Sha256: b637564af248703294b270e723d6b27d3dff2c1e6d28417c1441b4358b6311f9

Contents?: true

Size: 680 Bytes

Versions: 919

Compression:

Stored size: 680 Bytes

Contents

const useFocus = () => {
  const allTrixEditors = document.querySelectorAll(
    '.focus-editor-targets trix-editor'
  )
  allTrixEditors.forEach((editorElement: any) => {
    const toolbarElement = editorElement.toolbarElement
    if (editorElement == document.activeElement) {
      editorElement.classList.add('focused-editor')
      toolbarElement.style.display = 'block'
    } else {
      // don't hide the toolbar if we've unfocused to focus on the link dialog.
      if (!toolbarElement.contains(document.activeElement)) {
        editorElement.classList.remove('focused-editor')
        toolbarElement.style.display = 'none'
      }
    }
  })
}

export default useFocus

Version data entries

919 entries across 919 versions & 1 rubygems

Version Path
playbook_ui-13.11.1.pre.alpha.play900startratingasinput1530 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-13.12.0 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-13.11.1 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-13.11.0 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-13.10.0.pre.alpha.PLAY1051removinghighchartsdependency1465 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-13.10.0.pre.alpha.webpackerregistercomponents1463 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-13.10.0.pre.alpha.dependabotnpmandyarnfortawesomefontawesomepro6421439 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-13.10.0.pre.alpha.play10561428 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-13.10.0.pre.alpha.play1054tableheadersortconsolidation1416 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-13.10.0.pre.alpha.play10561409 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-13.10.0.pre.alpha.dependabotnpmandyarntiptapextensionlink21121407 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-13.10.0.pre.alpha.PLAY1046multilevelsingleselectphase21365 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-13.10.0.pre.alpha.PLAY1046multilevelsingleselectphase21358 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-13.10.0.pre.alpha.play10481357 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-13.10.0.pre.alpha.play845addswiftkitspage1332 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-13.10.0.pre.alpha.PLAY978alphatesthighcharts41330 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-13.10.0.pre.alpha.PLAY1046multilevelsingleselectphase21328 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-13.10.0.pre.alpha.PLAY1046multilevelsingleselectphase21323 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-13.10.0.pre.alpha.play978makehighchartsadevdependencypoc1322 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-13.10.0 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts