Sha256: b637564af248703294b270e723d6b27d3dff2c1e6d28417c1441b4358b6311f9

Contents?: true

Size: 680 Bytes

Versions: 916

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

916 entries across 916 versions & 1 rubygems

Version Path
playbook_ui-13.0.0.pre.alpha.PLAY966collapsiblenav41126 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-13.0.0.pre.alpha.salesbookmismatchingdate1120 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-12.39.0.pre.alpha.salesbookmismatchingdate1117 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-13.0.0 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-12.39.0.pre.alpha.PLAY966collapsiblenav41115 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-12.39.0.pre.alpha.salesbookmismatchingdate1114 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-12.39.0 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-12.38.0.pre.alpha.PBNTR78selectkitmultipleprop1094 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-12.38.0.pre.alpha.PLAY932removemomentqp1088 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-12.38.0.pre.alpha.PLAY966collapsiblenav41086 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-12.38.0.pre.alpha.audiencesalpha1083 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-12.38.0.pre.alpha.PLAY966collapsiblenav41082 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-12.38.0.pre.alpha.PLAYaddingdatapropselectkit1080 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-12.37.0.pre.alpha.PLAY951collapsiblenav31078 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-12.38.0.pre.alpha.playbook123801077 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-12.37.0.pre.alpha.PLAY951collapsiblenav31074 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-12.37.0.pre.alpha.PLAY951collapsiblenav31073 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-12.37.0.pre.alpha.PLAYaddingdatapropselectkit1071 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-12.38.0 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts
playbook_ui-12.37.0.pre.alpha.svgiconmethods1064 app/pb_kits/playbook/pb_rich_text_editor/useFocus.ts