carbon-react 158.6.1 → 158.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/components/note/note.component.js +1 -1
- package/esm/components/text-editor/__internal__/__nodes__/mention.node.d.ts +60 -0
- package/esm/components/text-editor/__internal__/__nodes__/mention.node.js +1 -0
- package/esm/components/text-editor/__internal__/__nodes__/styled-span.node.d.ts +105 -0
- package/esm/components/text-editor/__internal__/__nodes__/styled-span.node.js +1 -0
- package/esm/components/text-editor/__internal__/__plugins__/LinkMonitor/link-monitor.plugin.js +1 -0
- package/esm/components/text-editor/__internal__/__plugins__/StyledSpanEnter/index.d.ts +1 -0
- package/esm/components/text-editor/__internal__/__plugins__/StyledSpanEnter/index.js +1 -0
- package/esm/components/text-editor/__internal__/__plugins__/StyledSpanEnter/styled-span-enter.plugin.d.ts +2 -0
- package/esm/components/text-editor/__internal__/__plugins__/StyledSpanEnter/styled-span-enter.plugin.js +1 -0
- package/esm/components/text-editor/__internal__/__plugins__/index.d.ts +4 -0
- package/esm/components/text-editor/__internal__/__plugins__/index.js +1 -0
- package/esm/components/text-editor/__internal__/__ui__/CharacterCounter/character-counter.component.d.ts +4 -0
- package/esm/components/text-editor/__internal__/__ui__/CharacterCounter/character-counter.component.js +1 -0
- package/esm/components/text-editor/__internal__/{plugins → __ui__}/CharacterCounter/character-counter.style.d.ts +3 -1
- package/esm/components/text-editor/__internal__/__ui__/CharacterCounter/character-counter.style.js +1 -0
- package/esm/components/text-editor/__internal__/__ui__/ContentEditor/content-editor.component.d.ts +4 -0
- package/esm/components/text-editor/__internal__/__ui__/ContentEditor/content-editor.component.js +1 -0
- package/{lib/components/text-editor/__internal__/plugins → esm/components/text-editor/__internal__/__ui__}/ContentEditor/content-editor.style.d.ts +4 -2
- package/esm/components/text-editor/__internal__/__ui__/ContentEditor/content-editor.style.js +1 -0
- package/esm/components/text-editor/__internal__/__ui__/Mentions/constants.d.ts +15 -0
- package/esm/components/text-editor/__internal__/__ui__/Mentions/constants.js +1 -0
- package/esm/components/text-editor/__internal__/__ui__/Mentions/helpers.d.ts +3 -0
- package/esm/components/text-editor/__internal__/__ui__/Mentions/helpers.js +1 -0
- package/esm/components/text-editor/__internal__/__ui__/Mentions/index.d.ts +2 -0
- package/esm/components/text-editor/__internal__/__ui__/Mentions/index.js +1 -0
- package/esm/components/text-editor/__internal__/__ui__/Mentions/mention-typeahead-option.class.d.ts +11 -0
- package/esm/components/text-editor/__internal__/__ui__/Mentions/mention-typeahead-option.class.js +1 -0
- package/esm/components/text-editor/__internal__/__ui__/Mentions/mention.types.d.ts +14 -0
- package/esm/components/text-editor/__internal__/__ui__/Mentions/mentions-typeahead-menu-item.component.d.ts +12 -0
- package/esm/components/text-editor/__internal__/__ui__/Mentions/mentions-typeahead-menu-item.component.js +1 -0
- package/esm/components/text-editor/__internal__/__ui__/Mentions/mentions.component.d.ts +7 -0
- package/esm/components/text-editor/__internal__/__ui__/Mentions/mentions.component.js +1 -0
- package/esm/components/text-editor/__internal__/__ui__/Mentions/mentions.style.d.ts +3 -0
- package/esm/components/text-editor/__internal__/__ui__/Mentions/mentions.style.js +1 -0
- package/{lib/components/text-editor/__internal__/plugins → esm/components/text-editor/__internal__/__ui__}/Placeholder/placeholder.component.d.ts +1 -6
- package/esm/components/text-editor/__internal__/__ui__/Placeholder/placeholder.style.js +1 -0
- package/esm/components/text-editor/__internal__/__ui__/ReadOnlyEditor/read-only-rte.component.d.ts +6 -0
- package/esm/components/text-editor/__internal__/__ui__/ReadOnlyEditor/read-only-rte.component.js +1 -0
- package/esm/components/text-editor/__internal__/__ui__/Toolbar/button-group/button-group.component.d.ts +4 -0
- package/esm/components/text-editor/__internal__/__ui__/Toolbar/button-group/button-group.component.js +1 -0
- package/esm/components/text-editor/__internal__/__ui__/Toolbar/button-group/button-group.style.d.ts +2 -0
- package/esm/components/text-editor/__internal__/__ui__/Toolbar/button-group/button-group.style.js +1 -0
- package/esm/components/text-editor/__internal__/__ui__/Toolbar/buttons/bold.component.d.ts +4 -0
- package/esm/components/text-editor/__internal__/__ui__/Toolbar/buttons/bold.component.js +1 -0
- package/esm/components/text-editor/__internal__/__ui__/Toolbar/buttons/hyperlink.component.d.ts +6 -0
- package/esm/components/text-editor/__internal__/__ui__/Toolbar/buttons/hyperlink.component.js +1 -0
- package/esm/components/text-editor/__internal__/{plugins → __ui__}/Toolbar/buttons/index.d.ts +3 -0
- package/esm/components/text-editor/__internal__/__ui__/Toolbar/buttons/index.js +1 -0
- package/esm/components/text-editor/__internal__/__ui__/Toolbar/buttons/italic.component.d.ts +4 -0
- package/esm/components/text-editor/__internal__/__ui__/Toolbar/buttons/italic.component.js +1 -0
- package/esm/components/text-editor/__internal__/__ui__/Toolbar/buttons/list.component.d.ts +10 -0
- package/esm/components/text-editor/__internal__/__ui__/Toolbar/buttons/list.component.js +1 -0
- package/esm/components/text-editor/__internal__/__ui__/Toolbar/buttons/save.component.d.ts +4 -0
- package/esm/components/text-editor/__internal__/__ui__/Toolbar/buttons/save.component.js +1 -0
- package/esm/components/text-editor/__internal__/__ui__/Toolbar/buttons/typography-dropdown/dropdown.component.d.ts +21 -0
- package/esm/components/text-editor/__internal__/__ui__/Toolbar/buttons/typography-dropdown/dropdown.component.js +1 -0
- package/esm/components/text-editor/__internal__/__ui__/Toolbar/buttons/typography-dropdown/dropdown.style.d.ts +13 -0
- package/esm/components/text-editor/__internal__/__ui__/Toolbar/buttons/typography-dropdown/dropdown.style.js +1 -0
- package/esm/components/text-editor/__internal__/__ui__/Toolbar/buttons/typography.component.d.ts +20 -0
- package/esm/components/text-editor/__internal__/__ui__/Toolbar/buttons/typography.component.js +1 -0
- package/esm/components/text-editor/__internal__/__ui__/Toolbar/buttons/underline.component.d.ts +4 -0
- package/esm/components/text-editor/__internal__/__ui__/Toolbar/buttons/underline.component.js +1 -0
- package/esm/components/text-editor/__internal__/__ui__/Toolbar/toolbar.component.d.ts +4 -0
- package/esm/components/text-editor/__internal__/__ui__/Toolbar/toolbar.component.js +1 -0
- package/esm/components/text-editor/__internal__/{plugins → __ui__}/Toolbar/toolbar.style.d.ts +7 -3
- package/esm/components/text-editor/__internal__/__ui__/Toolbar/toolbar.style.js +1 -0
- package/esm/components/text-editor/__internal__/{plugins → __ui__}/index.d.ts +2 -3
- package/esm/components/text-editor/__internal__/__ui__/index.js +1 -0
- package/esm/components/text-editor/__internal__/{constants.d.ts → __utils__/constants.d.ts} +7 -6
- package/esm/components/text-editor/__internal__/__utils__/constants.js +1 -0
- package/{lib/components/text-editor/__internal__ → esm/components/text-editor/__internal__/__utils__}/helpers.d.ts +4 -1
- package/esm/components/text-editor/__internal__/__utils__/helpers.js +1 -0
- package/esm/components/text-editor/__internal__/__utils__/interfaces.types.d.ts +185 -0
- package/esm/components/text-editor/__internal__/__utils__/theme.d.ts +5 -0
- package/esm/components/text-editor/__internal__/__utils__/theme.js +1 -0
- package/esm/components/text-editor/__internal__/index.d.ts +1 -1
- package/esm/components/text-editor/__internal__/index.js +1 -1
- package/esm/components/text-editor/index.d.ts +4 -2
- package/esm/components/text-editor/index.js +1 -1
- package/esm/components/text-editor/text-editor.component.d.ts +1 -62
- package/esm/components/text-editor/text-editor.component.js +1 -1
- package/esm/components/text-editor/text-editor.style.d.ts +6 -3
- package/esm/components/text-editor/text-editor.style.js +1 -1
- package/esm/index.js +1 -1
- package/esm/locales/de-de.js +1 -1
- package/esm/locales/en-gb.js +1 -1
- package/esm/locales/es-es.js +1 -1
- package/esm/locales/fr-ca.js +1 -1
- package/esm/locales/fr-fr.js +1 -1
- package/esm/locales/locale.d.ts +22 -0
- package/lib/components/note/note.component.js +1 -1
- package/lib/components/text-editor/__internal__/__nodes__/mention.node.d.ts +60 -0
- package/lib/components/text-editor/__internal__/__nodes__/mention.node.js +1 -0
- package/lib/components/text-editor/__internal__/__nodes__/styled-span.node.d.ts +105 -0
- package/lib/components/text-editor/__internal__/__nodes__/styled-span.node.js +1 -0
- package/lib/components/text-editor/__internal__/__plugins__/AutoLinker/package.json +6 -0
- package/lib/components/text-editor/__internal__/__plugins__/EditorRef/package.json +6 -0
- package/lib/components/text-editor/__internal__/__plugins__/LinkMonitor/link-monitor.plugin.js +1 -0
- package/lib/components/text-editor/__internal__/__plugins__/LinkMonitor/package.json +6 -0
- package/lib/components/text-editor/__internal__/__plugins__/StyledSpanEnter/index.d.ts +1 -0
- package/lib/components/text-editor/__internal__/__plugins__/StyledSpanEnter/index.js +1 -0
- package/lib/components/text-editor/__internal__/__plugins__/StyledSpanEnter/package.json +6 -0
- package/lib/components/text-editor/__internal__/__plugins__/StyledSpanEnter/styled-span-enter.plugin.d.ts +2 -0
- package/lib/components/text-editor/__internal__/__plugins__/StyledSpanEnter/styled-span-enter.plugin.js +1 -0
- package/lib/components/text-editor/__internal__/__plugins__/index.d.ts +4 -0
- package/lib/components/text-editor/__internal__/__plugins__/index.js +1 -0
- package/lib/components/text-editor/__internal__/__plugins__/package.json +6 -0
- package/lib/components/text-editor/__internal__/__plugins__/useCursorAtEnd/package.json +6 -0
- package/lib/components/text-editor/__internal__/__ui__/CharacterCounter/character-counter.component.d.ts +4 -0
- package/lib/components/text-editor/__internal__/__ui__/CharacterCounter/character-counter.component.js +1 -0
- package/lib/components/text-editor/__internal__/{plugins → __ui__}/CharacterCounter/character-counter.style.d.ts +3 -1
- package/lib/components/text-editor/__internal__/__ui__/CharacterCounter/character-counter.style.js +1 -0
- package/lib/components/text-editor/__internal__/__ui__/CharacterCounter/package.json +6 -0
- package/lib/components/text-editor/__internal__/__ui__/ContentEditor/content-editor.component.d.ts +4 -0
- package/lib/components/text-editor/__internal__/__ui__/ContentEditor/content-editor.component.js +1 -0
- package/{esm/components/text-editor/__internal__/plugins → lib/components/text-editor/__internal__/__ui__}/ContentEditor/content-editor.style.d.ts +4 -2
- package/lib/components/text-editor/__internal__/__ui__/ContentEditor/content-editor.style.js +1 -0
- package/lib/components/text-editor/__internal__/__ui__/ContentEditor/package.json +6 -0
- package/lib/components/text-editor/__internal__/__ui__/LinkPreviewer/package.json +6 -0
- package/lib/components/text-editor/__internal__/__ui__/Mentions/constants.d.ts +15 -0
- package/lib/components/text-editor/__internal__/__ui__/Mentions/constants.js +1 -0
- package/lib/components/text-editor/__internal__/__ui__/Mentions/helpers.d.ts +3 -0
- package/lib/components/text-editor/__internal__/__ui__/Mentions/helpers.js +1 -0
- package/lib/components/text-editor/__internal__/__ui__/Mentions/index.d.ts +2 -0
- package/lib/components/text-editor/__internal__/__ui__/Mentions/index.js +1 -0
- package/lib/components/text-editor/__internal__/__ui__/Mentions/mention-typeahead-option.class.d.ts +11 -0
- package/lib/components/text-editor/__internal__/__ui__/Mentions/mention-typeahead-option.class.js +1 -0
- package/lib/components/text-editor/__internal__/__ui__/Mentions/mention.types.d.ts +14 -0
- package/lib/components/text-editor/__internal__/__ui__/Mentions/mentions-typeahead-menu-item.component.d.ts +12 -0
- package/lib/components/text-editor/__internal__/__ui__/Mentions/mentions-typeahead-menu-item.component.js +1 -0
- package/lib/components/text-editor/__internal__/__ui__/Mentions/mentions.component.d.ts +7 -0
- package/lib/components/text-editor/__internal__/__ui__/Mentions/mentions.component.js +1 -0
- package/lib/components/text-editor/__internal__/__ui__/Mentions/mentions.style.d.ts +3 -0
- package/lib/components/text-editor/__internal__/__ui__/Mentions/mentions.style.js +1 -0
- package/lib/components/text-editor/__internal__/__ui__/Mentions/package.json +6 -0
- package/lib/components/text-editor/__internal__/__ui__/Placeholder/package.json +6 -0
- package/{esm/components/text-editor/__internal__/plugins → lib/components/text-editor/__internal__/__ui__}/Placeholder/placeholder.component.d.ts +1 -6
- package/lib/components/text-editor/__internal__/{plugins → __ui__}/Placeholder/placeholder.style.js +1 -1
- package/lib/components/text-editor/__internal__/__ui__/ReadOnlyEditor/read-only-rte.component.d.ts +6 -0
- package/lib/components/text-editor/__internal__/__ui__/ReadOnlyEditor/read-only-rte.component.js +1 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/button-group/button-group.component.d.ts +4 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/button-group/button-group.component.js +1 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/button-group/button-group.style.d.ts +2 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/button-group/button-group.style.js +1 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/buttons/bold.component.d.ts +4 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/buttons/bold.component.js +1 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/buttons/hyperlink.component.d.ts +6 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/buttons/hyperlink.component.js +1 -0
- package/lib/components/text-editor/__internal__/{plugins → __ui__}/Toolbar/buttons/index.d.ts +3 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/buttons/index.js +1 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/buttons/italic.component.d.ts +4 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/buttons/italic.component.js +1 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/buttons/list.component.d.ts +10 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/buttons/list.component.js +1 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/buttons/package.json +6 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/buttons/save.component.d.ts +4 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/buttons/save.component.js +1 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/buttons/typography-dropdown/dropdown.component.d.ts +21 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/buttons/typography-dropdown/dropdown.component.js +1 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/buttons/typography-dropdown/dropdown.style.d.ts +13 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/buttons/typography-dropdown/dropdown.style.js +1 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/buttons/typography.component.d.ts +20 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/buttons/typography.component.js +1 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/buttons/underline.component.d.ts +4 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/buttons/underline.component.js +1 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/package.json +6 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/toolbar.component.d.ts +4 -0
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/toolbar.component.js +1 -0
- package/lib/components/text-editor/__internal__/{plugins → __ui__}/Toolbar/toolbar.style.d.ts +7 -3
- package/lib/components/text-editor/__internal__/__ui__/Toolbar/toolbar.style.js +1 -0
- package/lib/components/text-editor/__internal__/{plugins → __ui__}/index.d.ts +2 -3
- package/lib/components/text-editor/__internal__/__ui__/index.js +1 -0
- package/lib/components/text-editor/__internal__/__ui__/package.json +6 -0
- package/lib/components/text-editor/__internal__/{constants.d.ts → __utils__/constants.d.ts} +7 -6
- package/lib/components/text-editor/__internal__/__utils__/constants.js +1 -0
- package/{esm/components/text-editor/__internal__ → lib/components/text-editor/__internal__/__utils__}/helpers.d.ts +4 -1
- package/lib/components/text-editor/__internal__/__utils__/helpers.js +1 -0
- package/lib/components/text-editor/__internal__/__utils__/interfaces.types.d.ts +185 -0
- package/lib/components/text-editor/__internal__/__utils__/theme.d.ts +5 -0
- package/lib/components/text-editor/__internal__/__utils__/theme.js +1 -0
- package/lib/components/text-editor/__internal__/index.d.ts +1 -1
- package/lib/components/text-editor/__internal__/index.js +1 -1
- package/lib/components/text-editor/index.d.ts +4 -2
- package/lib/components/text-editor/index.js +1 -1
- package/lib/components/text-editor/text-editor.component.d.ts +1 -62
- package/lib/components/text-editor/text-editor.component.js +1 -1
- package/lib/components/text-editor/text-editor.style.d.ts +6 -3
- package/lib/components/text-editor/text-editor.style.js +1 -1
- package/lib/index.js +1 -1
- package/lib/locales/de-de.js +1 -1
- package/lib/locales/en-gb.js +1 -1
- package/lib/locales/es-es.js +1 -1
- package/lib/locales/fr-ca.js +1 -1
- package/lib/locales/fr-fr.js +1 -1
- package/lib/locales/locale.d.ts +22 -0
- package/package.json +1 -1
- package/esm/components/text-editor/__internal__/constants.js +0 -1
- package/esm/components/text-editor/__internal__/helpers.js +0 -1
- package/esm/components/text-editor/__internal__/plugins/CharacterCounter/__test__/character-counter.component.js +0 -1
- package/esm/components/text-editor/__internal__/plugins/CharacterCounter/character-counter.component.d.ts +0 -9
- package/esm/components/text-editor/__internal__/plugins/CharacterCounter/character-counter.component.js +0 -1
- package/esm/components/text-editor/__internal__/plugins/CharacterCounter/character-counter.style.js +0 -1
- package/esm/components/text-editor/__internal__/plugins/ContentEditor/content-editor.component.d.ts +0 -23
- package/esm/components/text-editor/__internal__/plugins/ContentEditor/content-editor.component.js +0 -1
- package/esm/components/text-editor/__internal__/plugins/ContentEditor/content-editor.style.js +0 -1
- package/esm/components/text-editor/__internal__/plugins/LinkMonitor/link-monitor.plugin.js +0 -1
- package/esm/components/text-editor/__internal__/plugins/Placeholder/placeholder.style.js +0 -1
- package/esm/components/text-editor/__internal__/plugins/Toolbar/buttons/bold.component.d.ts +0 -4
- package/esm/components/text-editor/__internal__/plugins/Toolbar/buttons/bold.component.js +0 -1
- package/esm/components/text-editor/__internal__/plugins/Toolbar/buttons/common.types.d.ts +0 -6
- package/esm/components/text-editor/__internal__/plugins/Toolbar/buttons/index.js +0 -1
- package/esm/components/text-editor/__internal__/plugins/Toolbar/buttons/italic.component.d.ts +0 -4
- package/esm/components/text-editor/__internal__/plugins/Toolbar/buttons/italic.component.js +0 -1
- package/esm/components/text-editor/__internal__/plugins/Toolbar/buttons/list.component.d.ts +0 -5
- package/esm/components/text-editor/__internal__/plugins/Toolbar/buttons/list.component.js +0 -1
- package/esm/components/text-editor/__internal__/plugins/Toolbar/buttons/save.component.d.ts +0 -34
- package/esm/components/text-editor/__internal__/plugins/Toolbar/buttons/save.component.js +0 -1
- package/esm/components/text-editor/__internal__/plugins/Toolbar/toolbar.component.d.ts +0 -15
- package/esm/components/text-editor/__internal__/plugins/Toolbar/toolbar.component.js +0 -1
- package/esm/components/text-editor/__internal__/plugins/Toolbar/toolbar.style.js +0 -1
- package/esm/components/text-editor/__internal__/plugins/index.js +0 -1
- package/esm/components/text-editor/__internal__/read-only-rte.component.d.ts +0 -4
- package/esm/components/text-editor/__internal__/read-only-rte.component.js +0 -1
- package/esm/components/text-editor/utils.d.ts +0 -4
- package/esm/components/text-editor/utils.js +0 -1
- package/lib/components/text-editor/__internal__/constants.js +0 -1
- package/lib/components/text-editor/__internal__/helpers.js +0 -1
- package/lib/components/text-editor/__internal__/plugins/AutoLinker/package.json +0 -6
- package/lib/components/text-editor/__internal__/plugins/CharacterCounter/__test__/character-counter.component.js +0 -1
- package/lib/components/text-editor/__internal__/plugins/CharacterCounter/character-counter.component.d.ts +0 -9
- package/lib/components/text-editor/__internal__/plugins/CharacterCounter/character-counter.component.js +0 -1
- package/lib/components/text-editor/__internal__/plugins/CharacterCounter/character-counter.style.js +0 -1
- package/lib/components/text-editor/__internal__/plugins/CharacterCounter/package.json +0 -6
- package/lib/components/text-editor/__internal__/plugins/ContentEditor/content-editor.component.d.ts +0 -23
- package/lib/components/text-editor/__internal__/plugins/ContentEditor/content-editor.component.js +0 -1
- package/lib/components/text-editor/__internal__/plugins/ContentEditor/content-editor.style.js +0 -1
- package/lib/components/text-editor/__internal__/plugins/ContentEditor/package.json +0 -6
- package/lib/components/text-editor/__internal__/plugins/EditorRef/package.json +0 -6
- package/lib/components/text-editor/__internal__/plugins/LinkMonitor/link-monitor.plugin.js +0 -1
- package/lib/components/text-editor/__internal__/plugins/LinkMonitor/package.json +0 -6
- package/lib/components/text-editor/__internal__/plugins/LinkPreviewer/package.json +0 -6
- package/lib/components/text-editor/__internal__/plugins/Placeholder/package.json +0 -6
- package/lib/components/text-editor/__internal__/plugins/Toolbar/buttons/bold.component.d.ts +0 -4
- package/lib/components/text-editor/__internal__/plugins/Toolbar/buttons/bold.component.js +0 -1
- package/lib/components/text-editor/__internal__/plugins/Toolbar/buttons/common.types.d.ts +0 -6
- package/lib/components/text-editor/__internal__/plugins/Toolbar/buttons/index.js +0 -1
- package/lib/components/text-editor/__internal__/plugins/Toolbar/buttons/italic.component.d.ts +0 -4
- package/lib/components/text-editor/__internal__/plugins/Toolbar/buttons/italic.component.js +0 -1
- package/lib/components/text-editor/__internal__/plugins/Toolbar/buttons/list.component.d.ts +0 -5
- package/lib/components/text-editor/__internal__/plugins/Toolbar/buttons/list.component.js +0 -1
- package/lib/components/text-editor/__internal__/plugins/Toolbar/buttons/package.json +0 -6
- package/lib/components/text-editor/__internal__/plugins/Toolbar/buttons/save.component.d.ts +0 -34
- package/lib/components/text-editor/__internal__/plugins/Toolbar/buttons/save.component.js +0 -1
- package/lib/components/text-editor/__internal__/plugins/Toolbar/package.json +0 -6
- package/lib/components/text-editor/__internal__/plugins/Toolbar/toolbar.component.d.ts +0 -15
- package/lib/components/text-editor/__internal__/plugins/Toolbar/toolbar.component.js +0 -1
- package/lib/components/text-editor/__internal__/plugins/Toolbar/toolbar.style.js +0 -1
- package/lib/components/text-editor/__internal__/plugins/index.js +0 -1
- package/lib/components/text-editor/__internal__/plugins/package.json +0 -6
- package/lib/components/text-editor/__internal__/plugins/useCursorAtEnd/package.json +0 -6
- package/lib/components/text-editor/__internal__/read-only-rte.component.d.ts +0 -4
- package/lib/components/text-editor/__internal__/read-only-rte.component.js +0 -1
- package/lib/components/text-editor/utils.d.ts +0 -4
- package/lib/components/text-editor/utils.js +0 -1
- /package/esm/components/text-editor/__internal__/{plugins → __plugins__}/AutoLinker/auto-link.component.d.ts +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __plugins__}/AutoLinker/auto-link.component.js +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __plugins__}/AutoLinker/index.d.ts +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __plugins__}/AutoLinker/index.js +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __plugins__}/EditorRef/editor-ref.plugin.d.ts +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __plugins__}/EditorRef/editor-ref.plugin.js +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __plugins__}/EditorRef/index.d.ts +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __plugins__}/EditorRef/index.js +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __plugins__}/LinkMonitor/index.d.ts +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __plugins__}/LinkMonitor/index.js +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __plugins__}/LinkMonitor/link-monitor.plugin.d.ts +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __plugins__}/useCursorAtEnd/index.d.ts +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __plugins__}/useCursorAtEnd/index.js +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __ui__}/CharacterCounter/index.d.ts +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __ui__}/CharacterCounter/index.js +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __ui__}/ContentEditor/index.d.ts +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __ui__}/ContentEditor/index.js +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __ui__}/LinkPreviewer/index.d.ts +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __ui__}/LinkPreviewer/index.js +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __ui__}/LinkPreviewer/link-previewer.component.d.ts +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __ui__}/LinkPreviewer/link-previewer.component.js +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __ui__}/LinkPreviewer/link-previewer.style.d.ts +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __ui__}/LinkPreviewer/link-previewer.style.js +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __ui__}/Placeholder/index.d.ts +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __ui__}/Placeholder/index.js +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __ui__}/Placeholder/placeholder.component.js +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __ui__}/Placeholder/placeholder.style.d.ts +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __ui__}/Toolbar/index.d.ts +0 -0
- /package/esm/components/text-editor/__internal__/{plugins → __ui__}/Toolbar/index.js +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __plugins__}/AutoLinker/auto-link.component.d.ts +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __plugins__}/AutoLinker/auto-link.component.js +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __plugins__}/AutoLinker/index.d.ts +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __plugins__}/AutoLinker/index.js +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __plugins__}/EditorRef/editor-ref.plugin.d.ts +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __plugins__}/EditorRef/editor-ref.plugin.js +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __plugins__}/EditorRef/index.d.ts +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __plugins__}/EditorRef/index.js +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __plugins__}/LinkMonitor/index.d.ts +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __plugins__}/LinkMonitor/index.js +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __plugins__}/LinkMonitor/link-monitor.plugin.d.ts +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __plugins__}/useCursorAtEnd/index.d.ts +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __plugins__}/useCursorAtEnd/index.js +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __ui__}/CharacterCounter/index.d.ts +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __ui__}/CharacterCounter/index.js +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __ui__}/ContentEditor/index.d.ts +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __ui__}/ContentEditor/index.js +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __ui__}/LinkPreviewer/index.d.ts +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __ui__}/LinkPreviewer/index.js +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __ui__}/LinkPreviewer/link-previewer.component.d.ts +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __ui__}/LinkPreviewer/link-previewer.component.js +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __ui__}/LinkPreviewer/link-previewer.style.d.ts +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __ui__}/LinkPreviewer/link-previewer.style.js +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __ui__}/Placeholder/index.d.ts +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __ui__}/Placeholder/index.js +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __ui__}/Placeholder/placeholder.component.js +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __ui__}/Placeholder/placeholder.style.d.ts +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __ui__}/Toolbar/index.d.ts +0 -0
- /package/lib/components/text-editor/__internal__/{plugins → __ui__}/Toolbar/index.js +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type ButtonProps = {
|
|
2
|
+
size: "small" | "medium" | "large";
|
|
3
|
+
menuOpen?: boolean;
|
|
4
|
+
};
|
|
5
|
+
type ListProps = {
|
|
6
|
+
size: "small" | "medium" | "large";
|
|
7
|
+
};
|
|
8
|
+
export declare const StyledButton: import("styled-components").StyledComponent<"button", any, ButtonProps, never>;
|
|
9
|
+
export declare const StyledMenu: import("styled-components").StyledComponent<"ul", any, ListProps, never>;
|
|
10
|
+
export declare const StyledMenuItem: import("styled-components").StyledComponent<"li", any, {
|
|
11
|
+
isFocused: boolean;
|
|
12
|
+
}, never>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import o,{css as e}from"styled-components";import t from"../../../../../../../style/utils/add-focus-styling.js";const r=o.button.withConfig({displayName:"dropdown.style__StyledButton",componentId:"sc-658dffa6-0"})(["width:100%;min-height:32px;display:flex;justify-content:space-between;align-items:center;border:none;background:transparent;border-radius:var(--borderRadius100);cursor:pointer;font-size:var(--fontSizes100);font-weight:var(--fontWeights500);height:",";"," &:focus{","}"],(({size:o})=>(o=>{switch(o){case"small":return"32px";case"large":return"48px";default:return"40px"}})(o)),(({menuOpen:o})=>o&&e(["",""],t())),t()),i=o.ul.withConfig({displayName:"dropdown.style__StyledMenu",componentId:"sc-658dffa6-1"})(["position:absolute;top:",";left:0;z-index:1;background:white;border:1px solid #ccc;border-radius:8px;box-shadow:0 2px 5px rgba(0,0,0,0.15);list-style:none;margin:0;padding:8px 0;width:100%;max-height:200px;overflow-y:auto;"],(({size:o})=>"small"===o?"38px":"large"===o?"54px":"46px")),n=o.li.withConfig({displayName:"dropdown.style__StyledMenuItem",componentId:"sc-658dffa6-2"})(["background:",";cursor:pointer;user-select:none;padding:8px 16px;color:var(--colorsUtilityYin055);&&{&:hover{background:#f0f0f0;color:var(--colorsUtilityYin100);}}&:focus-visible{box-shadow:inset 0px 0px 0px var(--borderWidth300) var(--colorsUtilityYin090);outline:none;background:white;&:hover{background-color:var(--colorsUtilityYang100);}}"],(o=>o.isFocused?"#f0f0f0":"white"));export{r as StyledButton,i as StyledMenu,n as StyledMenuItem};
|
package/esm/components/text-editor/__internal__/__ui__/Toolbar/buttons/typography.component.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RangeSelection } from "lexical";
|
|
2
|
+
import React, { RefObject } from "react";
|
|
3
|
+
import { StyledSpanNode } from "../../../__nodes__/styled-span.node";
|
|
4
|
+
export type TypographyKey = "paragraph" | "title" | "subtitle" | "sectionHeader" | "sectionSubheader";
|
|
5
|
+
export type TypographySelectorProps = {
|
|
6
|
+
/** Reference to the editor for the toolbar to consume */
|
|
7
|
+
contentEditorRef: RefObject<HTMLDivElement>;
|
|
8
|
+
/** The namespace of the editor that this dropdown belongs to */
|
|
9
|
+
namespace: string;
|
|
10
|
+
/** Whether the button is the first in a group of buttons */
|
|
11
|
+
isFirstButton?: boolean;
|
|
12
|
+
isOpen: boolean;
|
|
13
|
+
setIsOpen: (open: boolean) => void;
|
|
14
|
+
focusedIndex?: number;
|
|
15
|
+
setFocusedIndex?: (index: number) => void;
|
|
16
|
+
size?: "small" | "medium" | "large";
|
|
17
|
+
};
|
|
18
|
+
export declare function getStyledSpanFromSelection(selection: RangeSelection): StyledSpanNode | null;
|
|
19
|
+
declare const TypographySelector: ({ contentEditorRef, namespace, isFirstButton, isOpen, setIsOpen, focusedIndex, setFocusedIndex, size, }: TypographySelectorProps) => React.JSX.Element;
|
|
20
|
+
export default TypographySelector;
|
package/esm/components/text-editor/__internal__/__ui__/Toolbar/buttons/typography.component.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{SELECTION_CHANGE_COMMAND as o,$getSelection as n,$isRangeSelection as r,COMMAND_PRIORITY_LOW as s,TextNode as a,$getRoot as i,$isParagraphNode as p}from"lexical";import{useState as c,useEffect as d}from"react";import{Box as m}from"../../../../../box/box.component.js";import{StyledSpanNode as l}from"../../../__nodes__/styled-span.node.js";import f from"./typography-dropdown/dropdown.component.js";function u(e){let t=e.anchor.getNode();for(;t;){if(t instanceof l)return t;t=t.getParent()}return null}const g=({contentEditorRef:g,namespace:h,isFirstButton:x=!1,isOpen:C,setIsOpen:y,focusedIndex:F=-1,setFocusedIndex:I,size:O})=>{const[T]=t(),[b,j]=c("paragraph");d((()=>T.registerCommand(o,(()=>(setTimeout((()=>{T.getEditorState().read((()=>{const e=n();if(r(e)){const t=u(e);j(t?t.getTypographyKey():"paragraph")}}))}),0),!1)),s)),[T]);const v=e=>{const t=e;j(t),T.update((()=>{const e=n();if(r(e)){const o=e.getNodes(),n=e.anchor.offset,r=e.focus.offset;let s=null;o.forEach((e=>{if(e instanceof a||e instanceof l){let o;o="paragraph"===t?new a(e.getTextContent()):l.createFromOption(t,e.getTextContent()),e.replace(o),s||(s=o)}})),s&&s.select(n,r)}else{let e;e="paragraph"===t?new a(""):l.createFromOption(t,"");const o=i(),n=o.getLastChild();p(n)?n.append(e):o.append(e),e.select()}}),{discrete:!0}),setTimeout((()=>{var e;null==g||null===(e=g.current)||void 0===e||e.focus(),T.dispatchCommand(o,void 0)}),0)};return e(m,{minWidth:"150px",marginRight:"spacing05",children:e(f,{size:O,namespace:h,onChange:e=>{v(e)},value:b,isFirstButton:x,options:["title","subtitle","sectionHeader","sectionSubheader","paragraph"].map((e=>({id:e,key:e,onClick:()=>{v(e)}}))),isOpen:C,setIsOpen:y,focusedIndex:F,setFocusedIndex:I})})};export{g as default,u as getStyledSpanFromSelection};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{FORMAT_TEXT_COMMAND as r}from"lexical";import o from"react";import{FormattingButton as i}from"../toolbar.style.js";import a from"../../../../../../hooks/__internal__/useLocale/useLocale.js";import{TEXT_EDITOR_ACTION_TYPES as n}from"../../../__utils__/constants.js";const s=o.forwardRef((({isActive:o,isFirstButton:s=!1,namespace:l,size:m},c)=>{const[u]=t(),p=a();return e(i,{size:m,"aria-label":p.textEditor.underlineAria(),onClick:()=>{u.isEditable()&&u.dispatchCommand(r,n.Underline)},iconType:"underline",onMouseDown:e=>e.preventDefault(),buttonType:o?"primary":"tertiary",isActive:o,"aria-pressed":o,"data-role":`${l}-underline-button`,id:`${l}-underline-button`,tabIndex:s?0:-1,className:"toolbar-button",ref:c})}));export{s as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ToolbarProps } from "../../__utils__/interfaces.types";
|
|
3
|
+
declare const Toolbar: ({ contentEditorRef, namespace, hasHeader, onCancel, onSave, size, toolbarControls, }: ToolbarProps) => React.JSX.Element | null;
|
|
4
|
+
export default Toolbar;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import{useLexicalComposerContext as n}from"@lexical/react/LexicalComposerContext";import{mergeRegister as i}from"@lexical/utils";import{$getSelection as r,$isRangeSelection as l,$getRoot as a,$createTextNode as s,$createParagraphNode as d,$isParagraphNode as c}from"lexical";import{useRef as u,useState as m,useCallback as p,useEffect as b}from"react";import{StyledToolbarWrapper as f,StyledToolbar as h,CommandButtons as g}from"./toolbar.style.js";import v from"../../../../button/button.component.js";import y from"../../../../../hooks/__internal__/useLocale/useLocale.js";import x from"./buttons/bold.component.js";import k from"./buttons/hyperlink.component.js";import j from"./buttons/italic.component.js";import E from"./buttons/list.component.js";import F from"./buttons/save.component.js";import w from"./buttons/typography.component.js";import z from"./buttons/underline.component.js";import B from"./button-group/button-group.component.js";import{TEXT_EDITOR_ACTION_TYPES as C}from"../../__utils__/constants.js";import{Textbox as D}from"../../../../textbox/textbox.component.js";import{$createLinkNode as L}from"@lexical/link";import{Dialog as $}from"../../../../dialog/dialog.component.js";import{Form as A}from"../../../../form/form.component.js";import"../../../../form/required-fields-indicator/required-fields-indicator.component.js";const I=({contentEditorRef:I,namespace:S,hasHeader:_,onCancel:q,onSave:O,size:T="medium",toolbarControls:H=["typography","bold","italic","underline","unordered-list","ordered-list","link"]})=>{const[R]=n(),U=R.isEditable(),N=u(null),[K,G]=m(!1),[J,M]=m(!1),[P,Q]=m(!1),[V,W]=m(!1),[X,Y]=m(!1),[Z,ee]=m(-1),[te,oe]=m(""),[ne,ie]=m(""),re=y(),le=H.includes("typography"),ae=H.includes("bold")||H.includes("italic")||H.includes("underline"),se=H.includes("unordered-list")||H.includes("ordered-list"),de=H.includes("link"),ce=p((()=>{const e=r();l(e)&&(G(e.hasFormat(C.Bold)),M(e.hasFormat(C.Italic)),Q(e.hasFormat(C.Underline)))}),[]);b((()=>i(R.registerUpdateListener((({editorState:e})=>{e.read((()=>{R.isEditable()&&ce()}))})))),[ce,R]);const ue=()=>{oe(""),ie(""),W(!1)};if(!U)return null;const me=te.length&&ne.length;return e(f,{"data-role":`${S}-toolbar-wrapper`,hasHeader:_,id:`${S}-toolbar-wrapper`,size:T,children:[e(h,{role:"toolbar","aria-label":re.textEditor.toolbarAriaLabel(),"data-role":`${S}-toolbar`,id:`${S}-toolbar`,ref:N,onKeyDown:e=>{var t,o;if(0===H.length||!N.current)return;const n=Array.from(null===(t=N.current)||void 0===t?void 0:t.querySelectorAll("button.toolbar-button"));if(!n.length)return;const i=n.findIndex((e=>{var t;return e.id===(null===(t=document.activeElement)||void 0===t?void 0:t.id)}));let r=-1;switch(e.key){case"ArrowRight":e.preventDefault(),X||(r=i<n.length-1?i+1:0);break;case"ArrowLeft":e.preventDefault(),X||(r=i>0?i-1:n.length-1);break;case"Home":e.preventDefault(),r=0;break;case"End":e.preventDefault(),r=n.length-1;break;default:return}n.forEach(((e,t)=>{e.tabIndex=t===r?0:-1})),r>-1&&(null===(o=n[r])||void 0===o||o.focus())},tabIndex:-1,children:[e(o,{children:[le&&t(B,{name:"typography-formatting-buttons",namespace:S,showDivider:ae||se||de,children:t(w,{contentEditorRef:I,namespace:S,isFirstButton:!0,isOpen:X,setIsOpen:Y,focusedIndex:Z,setFocusedIndex:ee,size:T})}),ae&&e(B,{name:"text-formatting-buttons",namespace:S,showDivider:se||de,children:[H.includes("bold")&&t(x,{isActive:K,namespace:S,isFirstButton:!le,size:T}),H.includes("italic")&&t(j,{isActive:J,namespace:S,isFirstButton:!le&&!H.includes("bold"),size:T}),H.includes("underline")&&t(z,{isActive:P,namespace:S,isFirstButton:!le&&!H.includes("bold")&&!H.includes("italic"),size:T})]}),se&&t(B,{name:"list-formatting-buttons",namespace:S,showDivider:de,children:t(E,{namespace:S,olIsFirstButton:!le&&!ae&&!H.includes("unordered-list"),showOL:H.includes("ordered-list"),showUL:H.includes("unordered-list"),ulIsFirstButton:!le&&!ae,size:T})}),de&&t(B,{name:"hyperlink-formatting-buttons",namespace:S,showDivider:!1,children:t(k,{namespace:S,isFirstButton:!le&&!ae&&!se,setDialogOpen:W,size:T})})]}),t($,{open:V,onCancel:()=>{ue()},title:re.textEditor.hyperlink.dialogTitle(),"data-role":`${S}-hyperlink-dialog`,"aria-label":re.textEditor.hyperlink.dialogTitle(),size:"small",children:e(A,{leftSideButtons:t(v,{"data-role":`${S}-hyperlink-cancel-button`,onClick:()=>{ue()},children:"Cancel"}),saveButton:t(v,{buttonType:"primary",type:"submit",disabled:!me,"data-role":`${S}-hyperlink-save-button`,children:"Save"}),onSubmit:e=>{e.preventDefault(),R.isEditable()&&(R.update((()=>{const e=a(),t=e.getChildrenSize(),o=r(),n=L(ne);if(n.append(s(te)),0===t){const t=d();t.append(n),e.append(t),t.selectEnd()}else if(l(o))o.insertNodes([n]);else{const t=e.getLastChild();c(t)&&t.append(n)}})),ue())},children:[t(D,{label:re.textEditor.hyperlink.textFieldLabel(),name:"text",required:!0,"data-role":`${S}-hyperlink-text-field`,value:te,onChange:e=>oe(e.target.value)}),t(D,{label:re.textEditor.hyperlink.linkFieldLabel(),name:"link",required:!0,"data-role":`${S}-hyperlink-link-field`,value:ne,onChange:e=>ie(e.target.value)})]})})]}),e(g,{"data-role":`${S}-command-buttons`,children:[q&&t(v,{buttonType:"tertiary","data-role":`${S}-cancel-button`,"aria-label":re.textEditor.cancelButtonAria(),onClick:()=>null==q?void 0:q(R),size:T,className:"command-button",children:re.textEditor.cancelButton()}),O&&t(F,{namespace:S,onSave:O,size:T})]})]})};export{I as default};
|
package/esm/components/text-editor/__internal__/{plugins → __ui__}/Toolbar/toolbar.style.d.ts
RENAMED
|
@@ -2,11 +2,15 @@ import { ButtonProps } from "../../../../button";
|
|
|
2
2
|
interface FormattingButtonProps extends ButtonProps {
|
|
3
3
|
tabIndex?: number;
|
|
4
4
|
isActive?: boolean;
|
|
5
|
+
onMouseDown?: React.MouseEventHandler<HTMLButtonElement>;
|
|
6
|
+
size?: "small" | "medium" | "large";
|
|
5
7
|
}
|
|
6
|
-
declare const
|
|
8
|
+
export declare const getPaddingForSize: (size?: "small" | "medium" | "large") => "16px" | "12px" | "8px";
|
|
9
|
+
declare const StyledToolbarWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
7
10
|
hasHeader?: boolean;
|
|
11
|
+
size?: "small" | "medium" | "large";
|
|
8
12
|
}, never>;
|
|
9
|
-
declare const
|
|
13
|
+
declare const StyledToolbar: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
10
14
|
declare const CommandButtons: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
11
15
|
declare const FormattingButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLAnchorElement | HTMLButtonElement>>, any, FormattingButtonProps, never>;
|
|
12
|
-
export { StyledToolbar,
|
|
16
|
+
export { StyledToolbar, StyledToolbarWrapper, CommandButtons, FormattingButton, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r,{css as o}from"styled-components";import t from"../../../../button/button.component.js";const i=r=>{switch(r){case"small":return"8px";case"large":return"16px";default:return"12px"}},e=r.div.withConfig({displayName:"toolbar.style__StyledToolbarWrapper",componentId:"sc-524b490c-0"})(["display:flex;flex-direction:row;gap:8px;background-color:var(--colorsActionMajorYang100);padding:",";border-top-left-radius:",";border-top-right-radius:",";border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom:1px solid var(--colorsUtilityMajor200);align-items:center;flex-wrap:wrap;"],(r=>i(r.size)),(({hasHeader:r})=>r?"0":"var(--borderRadius100)"),(({hasHeader:r})=>r?"0":"var(--borderRadius100)")),a=r.div.withConfig({displayName:"toolbar.style__StyledToolbar",componentId:"sc-524b490c-1"})(["display:flex;flex-direction:row;gap:8px;background-color:var(--colorsActionMajorYang100);align-items:center;flex-wrap:wrap;"]),n=r.div.withConfig({displayName:"toolbar.style__CommandButtons",componentId:"sc-524b490c-2"})(["display:flex;flex-direction:row;gap:8px;"]),l=r(t).withConfig({displayName:"toolbar.style__FormattingButton",componentId:"sc-524b490c-3"})(["display:inline-flex;justify-content:center;align-items:center;padding:6px;border-radius:var(--borderRadius100);border:medium;cursor:pointer;&:hover{> span{color:var(--colorsUtilityYang100) !important;}}"," "," > span{","}"],(({size:r})=>{switch(r){case"large":return o(["min-width:48px;min-height:48px;"]);case"small":return o(["min-width:32px;min-height:32px;"]);default:return o(["min-width:40px;min-height:40px;"])}}),(({isActive:r})=>o(["background-color:",";"],r?"var(--colorsActionMajor600)":"transparent")),(({isActive:r})=>o(["color:"," !important;"],r?"var(--colorsUtilityYang100)":"var(--colorsUtilityYin100) ")));export{n as CommandButtons,l as FormattingButton,a as StyledToolbar,e as StyledToolbarWrapper,i as getPaddingForSize};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export { default as AutoLinkerPlugin } from "./AutoLinker";
|
|
2
1
|
export { default as CharacterCounterPlugin } from "./CharacterCounter";
|
|
3
2
|
export { default as ContentEditor } from "./ContentEditor";
|
|
4
|
-
export { default as LinkMonitorPlugin } from "./LinkMonitor";
|
|
5
3
|
export { default as LinkPreviewerPlugin } from "./LinkPreviewer";
|
|
4
|
+
export { default as Mentions } from "./Mentions";
|
|
6
5
|
export { default as Placeholder } from "./Placeholder";
|
|
7
6
|
export { default as ToolbarPlugin } from "./Toolbar";
|
|
8
|
-
export {
|
|
7
|
+
export type { Mention } from "./Mentions";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default as CharacterCounterPlugin}from"./CharacterCounter/character-counter.component.js";export{default as ContentEditor}from"./ContentEditor/content-editor.component.js";export{default as LinkPreviewerPlugin}from"./LinkPreviewer/link-previewer.component.js";export{MentionsPlugin as Mentions}from"./Mentions/mentions.component.js";export{default as Placeholder}from"./Placeholder/placeholder.component.js";export{default as ToolbarPlugin}from"./Toolbar/toolbar.component.js";
|
|
@@ -3,18 +3,19 @@ import { LinkNode } from "@lexical/link";
|
|
|
3
3
|
import { ListNode, ListItemNode, ListType } from "@lexical/list";
|
|
4
4
|
import { HorizontalRuleNode } from "@lexical/react/LexicalHorizontalRuleNode";
|
|
5
5
|
import { HeadingNode, QuoteNode } from "@lexical/rich-text";
|
|
6
|
-
import {
|
|
6
|
+
import { TextFormatType } from "lexical";
|
|
7
|
+
import { StyledSpanNode } from "../__nodes__/styled-span.node";
|
|
8
|
+
import { MentionNode } from "../__nodes__/mention.node";
|
|
7
9
|
/** The default prefix applied to the editor's internal class names, IDs, etc. */
|
|
8
10
|
declare const COMPONENT_PREFIX = "carbon-rte";
|
|
9
|
-
/** The theme overrides needed to correctly style the editor */
|
|
10
|
-
declare const theme: EditorThemeClasses;
|
|
11
11
|
/** The available actions that can be used in the editor */
|
|
12
|
-
declare const
|
|
12
|
+
declare const TEXT_EDITOR_ACTION_TYPES: {
|
|
13
13
|
Bold: TextFormatType;
|
|
14
14
|
Italic: TextFormatType;
|
|
15
|
+
Underline: TextFormatType;
|
|
15
16
|
OrderedList: ListType;
|
|
16
17
|
UnorderedList: ListType;
|
|
17
18
|
};
|
|
18
19
|
/** The nodes supported by markdown */
|
|
19
|
-
declare const
|
|
20
|
-
export { COMPONENT_PREFIX,
|
|
20
|
+
declare const MARKDOWN_NODES: (typeof StyledSpanNode | typeof MentionNode | typeof LinkNode | typeof CodeNode | typeof ListNode | typeof ListItemNode | typeof HeadingNode | typeof QuoteNode | typeof HorizontalRuleNode)[];
|
|
21
|
+
export { COMPONENT_PREFIX, MARKDOWN_NODES, TEXT_EDITOR_ACTION_TYPES };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CodeNode as e}from"@lexical/code";import{AutoLinkNode as o,LinkNode as r}from"@lexical/link";import{ListNode as i,ListItemNode as l}from"@lexical/list";import{HorizontalRuleNode as t}from"@lexical/react/LexicalHorizontalRuleNode";import{HeadingNode as n,QuoteNode as m}from"@lexical/rich-text";import{StyledSpanNode as d}from"../__nodes__/styled-span.node.js";import{MentionNode as c}from"../__nodes__/mention.node.js";const a="carbon-rte",s={Bold:"bold",Italic:"italic",Underline:"underline",OrderedList:"number",UnorderedList:"bullet"},p=[o,e,r,i,l,n,m,t,d,c];export{a as COMPONENT_PREFIX,p as MARKDOWN_NODES,s as TEXT_EDITOR_ACTION_TYPES};
|
|
@@ -17,4 +17,7 @@ declare const SerializeLexical: (editor: LexicalEditor) => {
|
|
|
17
17
|
declare const DeserializeHTML: (html: string) => string;
|
|
18
18
|
/** Function to validate a given URL */
|
|
19
19
|
declare function validateUrl(url: string): boolean;
|
|
20
|
-
|
|
20
|
+
declare const createFromHTML: (html: string) => string;
|
|
21
|
+
/** Creates and returns a string representation of an empty editor */
|
|
22
|
+
declare const createEmpty: () => string;
|
|
23
|
+
export { createEmpty, createFromHTML, DeserializeHTML, SerializeLexical, validateUrl, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createHeadlessEditor as t}from"@lexical/headless";import{$generateNodesFromDOM as e,$generateHtmlFromNodes as r}from"@lexical/html";import{$getRoot as o,$getSelection as n}from"lexical";import{MARKDOWN_NODES as i}from"./constants.js";import{getTheme as s}from"./theme.js";import l from"../../../../__internal__/utils/logger/index.js";const a=t=>{let e,o;return t.read((()=>{const n=t.getEditorState();o=n.toJSON(),e=r(t,null)})),{htmlString:e,json:o}},m=r=>{const a=t({namespace:"html-to-json",onError:t=>l.error(t.message),theme:s(),nodes:i});let m;if(a.update((()=>{const t=(new DOMParser).parseFromString(r,"text/html"),i=e(a,t);o().select();const s=n();if(s)try{s.insertNodes(i)}catch(t){m=t}}),{discrete:!0}),m)throw m;const c=a.getEditorState().toJSON();return JSON.stringify(c)},c=new RegExp(/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w]*))?)/);function p(t){return"https://"===t||c.test(t)}const d=t=>m(t),h=()=>'{"root":{"children":[{"children":[],"direction":null,"format":"","indent":0,"type":"paragraph","version":1}],"direction":null,"format":"","indent":0,"type":"root","version":1}}';export{m as DeserializeHTML,a as SerializeLexical,h as createEmpty,d as createFromHTML,p as validateUrl};
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { MarginProps } from "styled-system";
|
|
2
|
+
import { TagProps } from "../../../../__internal__/utils/helpers/tags";
|
|
3
|
+
import { LexicalEditor } from "lexical";
|
|
4
|
+
import { RefObject } from "react";
|
|
5
|
+
export interface TextEditorHandle {
|
|
6
|
+
/** Programmatically focus on the text editor. */
|
|
7
|
+
focus: () => void;
|
|
8
|
+
}
|
|
9
|
+
export interface TextEditorProps extends MarginProps, TagProps {
|
|
10
|
+
/** The maximum number of characters allowed in the editor */
|
|
11
|
+
characterLimit?: number;
|
|
12
|
+
/** The message to be shown when the editor is in an error state */
|
|
13
|
+
error?: string;
|
|
14
|
+
/** Custom footer content to be displayed below the editor */
|
|
15
|
+
footer?: React.ReactNode;
|
|
16
|
+
/** Custom header content to be displayed above the editor */
|
|
17
|
+
header?: React.ReactNode;
|
|
18
|
+
/** A hint string rendered before the editor but after the label. Intended to describe the purpose or content of the input. */
|
|
19
|
+
inputHint?: string;
|
|
20
|
+
/** The label to display above the editor */
|
|
21
|
+
labelText: string;
|
|
22
|
+
/** The identifier for the Text Editor. This allows for the using of multiple Text Editors on a screen */
|
|
23
|
+
namespace?: string;
|
|
24
|
+
/** Callback that is triggered when the editor loses focus. */
|
|
25
|
+
onBlur?: (ev: React.FocusEvent<HTMLElement>) => void;
|
|
26
|
+
/**
|
|
27
|
+
* [Legacy] Callback that is triggered when the editor's cancel button is activated. The cancel button is rendered when this function is provided.
|
|
28
|
+
* @deprecated Please ensure that `TextEditor` is used as a part of a `Form` component, which will handle the cancel functionality.
|
|
29
|
+
*/
|
|
30
|
+
onCancel?: () => void;
|
|
31
|
+
/** Callback that is triggered when the editor's text content is modified or styled. */
|
|
32
|
+
onChange?: (value: string, formattedValues: EditorFormattedValues) => void;
|
|
33
|
+
/** Callback that is triggered when the editor gains focus. */
|
|
34
|
+
onFocus?: (ev: React.FocusEvent<HTMLElement>) => void;
|
|
35
|
+
/** Callback that is triggered when a link is added in the editor's content. */
|
|
36
|
+
onLinkAdded?: (link: string, state: string) => void;
|
|
37
|
+
/**
|
|
38
|
+
* [Legacy] Callback that is triggered when the editor's save button is activated. The save button is rendered when this function is provided.
|
|
39
|
+
* @deprecated Please ensure that `TextEditor` is used as a part of a `Form` component, which will handle the save functionality.
|
|
40
|
+
*/
|
|
41
|
+
onSave?: (value: EditorFormattedValues) => void;
|
|
42
|
+
/** The placeholder to display when the editor is empty */
|
|
43
|
+
placeholder?: string;
|
|
44
|
+
/** An array of link preview nodes to render in the editor */
|
|
45
|
+
previews?: React.JSX.Element[];
|
|
46
|
+
/** Whether the editor is read-only */
|
|
47
|
+
readOnly?: boolean;
|
|
48
|
+
/** Whether the content of the editor is required to have a value */
|
|
49
|
+
required?: boolean;
|
|
50
|
+
/** Number greater than 2 multiplied to override the default min-height of the editor */
|
|
51
|
+
rows?: number;
|
|
52
|
+
/** The size of the toolbar */
|
|
53
|
+
size?: "small" | "medium" | "large";
|
|
54
|
+
/** The message to be shown when the editor is in an warning state */
|
|
55
|
+
warning?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Alias of `initialValue` prop.
|
|
58
|
+
* @deprecated Please use `initialValue` instead.
|
|
59
|
+
*/
|
|
60
|
+
value?: string | undefined;
|
|
61
|
+
/** The initial value of the editor, as a HTML string, or JSON */
|
|
62
|
+
initialValue?: string | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Allows the injection of one or more Lexical-compatible React components into the editor to extend its functionality.
|
|
65
|
+
* This prop is optional and supports a single plugin, multiple plugins (via fragments or arrays), or `null`.
|
|
66
|
+
*/
|
|
67
|
+
customPlugins?: React.ReactNode;
|
|
68
|
+
/** Render the ValidationMessage above the TextEditor */
|
|
69
|
+
validationMessagePositionTop?: boolean;
|
|
70
|
+
/** */
|
|
71
|
+
toolbarControls?: ToolbarControl[];
|
|
72
|
+
}
|
|
73
|
+
export interface PlaceholderProps {
|
|
74
|
+
/** The namespace of the editor that this placeholder belongs to */
|
|
75
|
+
namespace: string;
|
|
76
|
+
/** The text to display in the placeholder */
|
|
77
|
+
text: string | undefined;
|
|
78
|
+
}
|
|
79
|
+
export interface ContentEditorProps {
|
|
80
|
+
/** A hint string rendered before the editor but after the label. Intended to describe the purpose or content of the input. */
|
|
81
|
+
inputHint?: string;
|
|
82
|
+
/** Whether the content editor has focused */
|
|
83
|
+
isFocused?: boolean;
|
|
84
|
+
/** The namespace of the editor that this content editor belongs to */
|
|
85
|
+
namespace: string;
|
|
86
|
+
/** The link previews to render at the foot of the editor */
|
|
87
|
+
previews?: React.JSX.Element[];
|
|
88
|
+
/** The number of rows to render in the editor */
|
|
89
|
+
rows?: number;
|
|
90
|
+
/** Whether the editor is read-only */
|
|
91
|
+
readOnly?: boolean;
|
|
92
|
+
/** Whether the editor is required */
|
|
93
|
+
required?: boolean;
|
|
94
|
+
/** Editor has an error */
|
|
95
|
+
error?: boolean;
|
|
96
|
+
/** Editor has a warning */
|
|
97
|
+
warning?: boolean;
|
|
98
|
+
/** Render the ValidationMessage above the Editor */
|
|
99
|
+
validationMessagePositionTop?: boolean;
|
|
100
|
+
/** The size of the content editor */
|
|
101
|
+
size?: "small" | "medium" | "large";
|
|
102
|
+
}
|
|
103
|
+
export interface CharacterCounterPluginProps {
|
|
104
|
+
/** Whether the content editor has focused */
|
|
105
|
+
isFocused?: boolean;
|
|
106
|
+
/** The maximum number of characters to allow before showing the warning */
|
|
107
|
+
maxChars: number;
|
|
108
|
+
/** The namespace of the editor that this counter belongs to */
|
|
109
|
+
namespace: string;
|
|
110
|
+
/** The size of the content editor */
|
|
111
|
+
marginTop?: string;
|
|
112
|
+
}
|
|
113
|
+
export interface FocusCommandPayload {
|
|
114
|
+
defaultToEnd: boolean;
|
|
115
|
+
}
|
|
116
|
+
export interface ToolbarProps {
|
|
117
|
+
/** Reference to the editor for the toolbar to consume */
|
|
118
|
+
contentEditorRef: RefObject<HTMLDivElement>;
|
|
119
|
+
/** The namespace of the editor that this toolbar belongs to */
|
|
120
|
+
namespace: string;
|
|
121
|
+
/** Determines if the Text Editor has a header */
|
|
122
|
+
hasHeader?: boolean;
|
|
123
|
+
/** The callback to call when the cancel button is clicked */
|
|
124
|
+
onCancel?: (editor: LexicalEditor) => void;
|
|
125
|
+
/** The callback to call when the save button is clicked */
|
|
126
|
+
onSave?: (value: EditorFormattedValues) => void;
|
|
127
|
+
/** The size of the toolbar */
|
|
128
|
+
size?: "small" | "medium" | "large";
|
|
129
|
+
/** The list of enabled controls */
|
|
130
|
+
toolbarControls?: ToolbarControl[];
|
|
131
|
+
}
|
|
132
|
+
export type ButtonGroupProps = {
|
|
133
|
+
/** The children of the button group */
|
|
134
|
+
children?: React.ReactNode | React.ReactNode[];
|
|
135
|
+
/** The name of the button group */
|
|
136
|
+
name: string;
|
|
137
|
+
/** The namespace of the containing editor */
|
|
138
|
+
namespace?: string;
|
|
139
|
+
/** Determines if the button group should show a divider */
|
|
140
|
+
showDivider?: boolean;
|
|
141
|
+
};
|
|
142
|
+
export interface FormattingButtonProps {
|
|
143
|
+
/** Whether the button is active or not, relative to the text at the current cursor position */
|
|
144
|
+
isActive: boolean;
|
|
145
|
+
/** Whether the button is the first in a group of buttons */
|
|
146
|
+
isFirstButton?: boolean;
|
|
147
|
+
/** The namespace of the editor that this button belongs to */
|
|
148
|
+
namespace: string;
|
|
149
|
+
/** The size of the button */
|
|
150
|
+
size?: "small" | "medium" | "large";
|
|
151
|
+
}
|
|
152
|
+
export interface SaveObjectProps {
|
|
153
|
+
detail: number;
|
|
154
|
+
format: number;
|
|
155
|
+
mode: string;
|
|
156
|
+
style: string;
|
|
157
|
+
text: string;
|
|
158
|
+
type: string;
|
|
159
|
+
version: number;
|
|
160
|
+
}
|
|
161
|
+
export interface SaveProps {
|
|
162
|
+
children: SaveObjectProps[];
|
|
163
|
+
}
|
|
164
|
+
export interface EditorFormattedValues {
|
|
165
|
+
htmlString?: string;
|
|
166
|
+
json?: {
|
|
167
|
+
root: {
|
|
168
|
+
children: SaveProps[];
|
|
169
|
+
direction: string;
|
|
170
|
+
format: string;
|
|
171
|
+
indent: number;
|
|
172
|
+
type: string;
|
|
173
|
+
version: string;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
export interface SaveButtonProps {
|
|
178
|
+
/** The namespace of the editor that this button belongs to */
|
|
179
|
+
namespace: string;
|
|
180
|
+
/** The callback to call when the save button is clicked */
|
|
181
|
+
onSave: (value: EditorFormattedValues) => void;
|
|
182
|
+
/** The size of the button */
|
|
183
|
+
size?: "small" | "medium" | "large";
|
|
184
|
+
}
|
|
185
|
+
export type ToolbarControl = "typography" | "bold" | "italic" | "underline" | "unordered-list" | "ordered-list" | "link";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t={text:{bold:"textBold",italic:"textItalic",underline:"textUnderline"}},e=()=>t;export{t as THEME,e as getTheme};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from "./
|
|
1
|
+
export { default } from "./__ui__/Mentions/";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default}from"./
|
|
1
|
+
export{MentionsPlugin as default}from"./__ui__/Mentions/mentions.component.js";
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { default } from "./text-editor.component";
|
|
2
|
-
export { createEmpty, createFromHTML } from "./
|
|
3
|
-
export type { TextEditorHandle, TextEditorProps, EditorFormattedValues, } from "./
|
|
2
|
+
export { createEmpty, createFromHTML } from "./__internal__/__utils__/helpers";
|
|
3
|
+
export type { TextEditorHandle, TextEditorProps, EditorFormattedValues, } from "./__internal__/__utils__/interfaces.types";
|
|
4
|
+
export { default as MentionsPlugin } from "./__internal__/__ui__/Mentions/";
|
|
5
|
+
export type { Mention } from "./__internal__/__ui__/Mentions";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{TextEditor as default}from"./text-editor.component.js";export{createEmpty,createFromHTML}from"./
|
|
1
|
+
export{TextEditor as default}from"./text-editor.component.js";export{createEmpty,createFromHTML}from"./__internal__/__utils__/helpers.js";export{MentionsPlugin}from"./__internal__/__ui__/Mentions/mentions.component.js";
|
|
@@ -1,65 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { EditorFormattedValues as SaveCallbackProps } from "./__internal__/plugins/Toolbar/buttons/save.component";
|
|
4
|
-
import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
5
|
-
export interface TextEditorHandle {
|
|
6
|
-
/** Programmatically focus on the text editor. */
|
|
7
|
-
focus: () => void;
|
|
8
|
-
}
|
|
9
|
-
export type EditorFormattedValues = SaveCallbackProps;
|
|
10
|
-
export interface TextEditorProps extends MarginProps, TagProps {
|
|
11
|
-
/** The maximum number of characters allowed in the editor */
|
|
12
|
-
characterLimit?: number;
|
|
13
|
-
/** The message to be shown when the editor is in an error state */
|
|
14
|
-
error?: string;
|
|
15
|
-
/** Custom footer content to be displayed below the editor */
|
|
16
|
-
footer?: React.ReactNode;
|
|
17
|
-
/** Custom header content to be displayed above the editor */
|
|
18
|
-
header?: React.ReactNode;
|
|
19
|
-
/** A hint string rendered before the editor but after the label. Intended to describe the purpose or content of the input. */
|
|
20
|
-
inputHint?: string;
|
|
21
|
-
/** The label to display above the editor */
|
|
22
|
-
labelText: string;
|
|
23
|
-
/** The identifier for the Text Editor. This allows for the using of multiple Text Editors on a screen */
|
|
24
|
-
namespace?: string;
|
|
25
|
-
/** Callback that is triggered when the editor loses focus. */
|
|
26
|
-
onBlur?: (ev: React.FocusEvent<HTMLElement>) => void;
|
|
27
|
-
/** Callback that is triggered when the editor's cancel button is activated. The cancel button is rendered when this function is provided. */
|
|
28
|
-
onCancel?: () => void;
|
|
29
|
-
/** Callback that is triggered when the editor's text content is modified or styled. */
|
|
30
|
-
onChange?: (value: string, formattedValues: EditorFormattedValues) => void;
|
|
31
|
-
/** Callback that is triggered when the editor gains focus. */
|
|
32
|
-
onFocus?: (ev: React.FocusEvent<HTMLElement>) => void;
|
|
33
|
-
/** Callback that is triggered when a link is added in the editor's content. */
|
|
34
|
-
onLinkAdded?: (link: string, state: string) => void;
|
|
35
|
-
/** Callback that is triggered when the editor's save button is activated. The save button is rendered when this function is provided. */
|
|
36
|
-
onSave?: (value: SaveCallbackProps) => void;
|
|
37
|
-
/** The placeholder to display when the editor is empty */
|
|
38
|
-
placeholder?: string;
|
|
39
|
-
/** An array of link preview nodes to render in the editor */
|
|
40
|
-
previews?: React.JSX.Element[];
|
|
41
|
-
/** Whether the editor is read-only */
|
|
42
|
-
readOnly?: boolean;
|
|
43
|
-
/** Whether the content of the editor is required to have a value */
|
|
44
|
-
required?: boolean;
|
|
45
|
-
/** Number greater than 2 multiplied to override the default min-height of the editor */
|
|
46
|
-
rows?: number;
|
|
47
|
-
/** The message to be shown when the editor is in an warning state */
|
|
48
|
-
warning?: string;
|
|
49
|
-
/**
|
|
50
|
-
* Alias of `initialValue` prop.
|
|
51
|
-
* @deprecated Please use `initialValue` instead.
|
|
52
|
-
*/
|
|
53
|
-
value?: string | undefined;
|
|
54
|
-
/** The initial value of the editor, as a HTML string, or JSON */
|
|
55
|
-
initialValue?: string | undefined;
|
|
56
|
-
/**
|
|
57
|
-
* Allows the injection of one or more Lexical-compatible React components into the editor to extend its functionality.
|
|
58
|
-
* This prop is optional and supports a single plugin, multiple plugins (via fragments or arrays), or `null`.
|
|
59
|
-
*/
|
|
60
|
-
customPlugins?: React.ReactNode;
|
|
61
|
-
/** Render the ValidationMessage above the TextEditor */
|
|
62
|
-
validationMessagePositionTop?: boolean;
|
|
63
|
-
}
|
|
2
|
+
import { TextEditorHandle, TextEditorProps } from "./__internal__/__utils__/interfaces.types";
|
|
64
3
|
export declare const TextEditor: React.ForwardRefExoticComponent<TextEditorProps & React.RefAttributes<TextEditorHandle>>;
|
|
65
4
|
export default TextEditor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as r,Fragment as t}from"react/jsx-runtime";import{LexicalComposer as n}from"@lexical/react/LexicalComposer";import{ClickableLinkPlugin as o}from"@lexical/react/LexicalClickableLinkPlugin";import{LexicalErrorBoundary as i}from"@lexical/react/LexicalErrorBoundary";import{HistoryPlugin as a}from"@lexical/react/LexicalHistoryPlugin";import{MarkdownShortcutPlugin as l}from"@lexical/react/LexicalMarkdownShortcutPlugin";import{RichTextPlugin as s}from"@lexical/react/LexicalRichTextPlugin";import{LinkPlugin as c}from"@lexical/react/LexicalLinkPlugin";import{ListPlugin as p}from"@lexical/react/LexicalListPlugin";import{OnChangePlugin as d}from"@lexical/react/LexicalOnChangePlugin";import{$getRoot as
|
|
1
|
+
import{jsx as e,jsxs as r,Fragment as t}from"react/jsx-runtime";import{LexicalComposer as n}from"@lexical/react/LexicalComposer";import{ClickableLinkPlugin as o}from"@lexical/react/LexicalClickableLinkPlugin";import{LexicalErrorBoundary as i}from"@lexical/react/LexicalErrorBoundary";import{HistoryPlugin as a}from"@lexical/react/LexicalHistoryPlugin";import{MarkdownShortcutPlugin as l}from"@lexical/react/LexicalMarkdownShortcutPlugin";import{RichTextPlugin as s}from"@lexical/react/LexicalRichTextPlugin";import{LinkPlugin as c}from"@lexical/react/LexicalLinkPlugin";import{ListPlugin as p}from"@lexical/react/LexicalListPlugin";import{OnChangePlugin as d}from"@lexical/react/LexicalOnChangePlugin";import{$getRoot as _}from"lexical";import{forwardRef as u,useRef as m,useState as f,useImperativeHandle as g,useEffect as h,useMemo as v,useCallback as b}from"react";import x from"../../__internal__/label/label.component.js";import y from"../../hooks/__internal__/useLocale/useLocale.js";import j from"../../__internal__/utils/logger/index.js";import{COMPONENT_PREFIX as w,MARKDOWN_NODES as O}from"./__internal__/__utils__/constants.js";import P from"./__internal__/__plugins__/AutoLinker/auto-link.component.js";import L from"./__internal__/__plugins__/LinkMonitor/link-monitor.plugin.js";import E from"./__internal__/__plugins__/StyledSpanEnter/styled-span-enter.plugin.js";import"./__internal__/__plugins__/useCursorAtEnd/index.js";import C from"./text-editor.context.js";import{StyledTextEditorWrapper as T,StyledWrapper as k,StyledEditorToolbarWrapper as S,StyledHeaderWrapper as M,StyledTextEditor as $,StyledFooterWrapper as B}from"./text-editor.style.js";import{createEmpty as F,SerializeLexical as H,validateUrl as z}from"./__internal__/__utils__/helpers.js";import{HintText as A}from"../../__internal__/hint-text/hint-text.component.js";import q from"../../__internal__/validation-message/validation-message.component.js";import D from"../textbox/textbox.style.js";import"../../style/utils/filter-styled-system-padding-props.js";import I from"../../style/utils/filter-styled-system-margin-props.js";import R from"../../__internal__/utils/helpers/tags/tags.js";import V from"./__internal__/__ui__/ReadOnlyEditor/read-only-rte.component.js";import{getTheme as U}from"./__internal__/__utils__/theme.js";import G from"./__internal__/__ui__/CharacterCounter/character-counter.component.js";import J from"./__internal__/__ui__/ContentEditor/content-editor.component.js";import"./__internal__/__ui__/LinkPreviewer/link-previewer.style.js";import"@lexical/react/LexicalComposerContext";import"@lexical/react/LexicalTypeaheadMenuPlugin";import"react-dom";import"./__internal__/__ui__/Mentions/constants.js";import"./__internal__/__ui__/Mentions/mentions.style.js";import"../tooltip/tooltip.component.js";import"../portrait/portrait.style.js";import K from"./__internal__/__ui__/Placeholder/placeholder.component.js";import N from"./__internal__/__ui__/Toolbar/toolbar.component.js";function Q(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function W(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),n.forEach((function(r){Q(e,r,t[r])}))}return e}let X=!1,Y=!1,Z=!1;const ee=u(((u,Q)=>{var ee,re,te,{characterLimit:ne=3e3,error:oe,footer:ie,header:ae,inputHint:le,labelText:se,namespace:ce=w,onBlur:pe,onCancel:de,onChange:_e,onFocus:ue,onLinkAdded:me,onSave:fe,placeholder:ge,previews:he=[],readOnly:ve=!1,required:be=!1,rows:xe,size:ye="medium",warning:je,customPlugins:we,validationMessagePositionTop:Oe=!1,toolbarControls:Pe}=u,Le=function(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}(u,["characterLimit","error","footer","header","inputHint","labelText","namespace","onBlur","onCancel","onChange","onFocus","onLinkAdded","onSave","placeholder","previews","readOnly","required","rows","size","warning","customPlugins","validationMessagePositionTop","toolbarControls"]);!X&&Le.value&&(X=!0,j.deprecate("`value` is deprecated in TextEditor and support will soon be removed. Please use `initialValue` instead.")),!Y&&de&&(Y=!0,j.deprecate("`onCancel` is deprecated in TextEditor and support will soon be removed. Please ensure that `TextEditor` is used as a part of a `Form` component, which will handle the cancel functionality.")),!Z&&fe&&(Z=!0,j.deprecate("`onSave` is deprecated in TextEditor and support will soon be removed. Please ensure that `TextEditor` is used as a part of a `Form` component, which will handle the save functionality."));const Ee=m(null!==(te=null!==(re=Le.initialValue)&&void 0!==re?re:Le.value)&&void 0!==te?te:F()),Ce=y(),[Te,ke]=f(void 0),Se=m(null),[Me,$e]=f(!1);g(Q,(()=>({focus(){var e;null===(e=Se.current)||void 0===e||e.focus()}})),[]),h((()=>{const e=null==Se?void 0:Se.current,r=()=>{$e(!0)},t=()=>{$e(!1)};return null==e||e.addEventListener("focus",r),null==e||e.addEventListener("blur",t),()=>{null==e||e.removeEventListener("focus",r),null==e||e.removeEventListener("blur",t)}}),[Se]);const Be=v((()=>({namespace:ce,nodes:O,onError:e=>j.error(e.message),theme:U(),editorState:Ee.current,editable:!ve})),[ce,ve]),Fe=b(((e,r)=>{const t=e.read((()=>_().getChildren().map((e=>e.getTextContent())).join("\n\n")));if(_e){const e=H(r);null==_e||_e(t,e)}if(ne>0){const e=ne-t.length;ke(e<0?Ce.textEditor.characterLimit(Math.abs(e)):void 0)}}),[ne,Ce.textEditor,_e]),He=b((e=>{if(!e.isEditable())return;if(!de)return;const r=e.parseEditorState(Ee.current);e.setEditorState(r),de()}),[de]),ze=v((()=>({namespace:ce,onCancel:de?He:void 0,onSave:fe,toolbarControls:Pe})),[He,ce,de,fe,Pe]),Ae=je||Te,qe=()=>{switch(ye){case"large":return"var(--spacing150)";case"small":return"var(--spacing050)";default:return"var(--spacing100)"}};return e(T,(De=W({"data-role":`${ce}-editor-wrapper`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||null==pe||pe(e)},onFocus:e=>{e.currentTarget.contains(e.relatedTarget)||null==ue||ue(e)}},I(Le),R("text-editor",Le)),Ie=null!=(Ie={children:r(C.Provider,{value:{onLinkAdded:me},children:[e(x,{isRequired:be,labelId:`${ce}-label`,children:se}),le&&!ve&&e(A,{id:`${ce}-input-hint`,marginBottom:qe(),children:le}),e(n,{initialConfig:Be,children:r(k,{"data-role":`${ce}-wrapper`,children:[Oe&&r(t,{children:[e(q,{error:oe,warning:Ae,validationId:`${ce}-validation-message`,"data-role":`${ce}-validation-message`,validationMessagePositionTop:Oe}),(oe||Ae)&&e(D,{warning:!(oe||!Ae)})]}),r(S,{"data-role":`${ce}-editor-toolbar-wrapper`,error:!!oe,id:`${ce}-editor-toolbar-wrapper`,children:[ae&&e(M,{"data-role":`${ce}-header-wrapper`,children:ae}),ve?e(V,{initialValue:(null===(ee=Se.current)||void 0===ee?void 0:ee.innerHTML)||Ee.current,size:ye}):r(t,{children:[e(N,W({contentEditorRef:Se,hasHeader:Boolean(ae),size:ye},ze)),r($,{"data-role":`${ce}-editor`,error:!!oe,children:[e(s,{contentEditable:e(J,{ref:Se,inputHint:le,isFocused:Me,namespace:ce,previews:he,rows:xe,readOnly:ve,required:be,error:!!oe,warning:!!je||!!Te,validationMessagePositionTop:Oe,size:ye}),placeholder:e(K,{namespace:ce,text:ge}),ErrorBoundary:i}),e(p,{}),e(a,{}),e(l,{}),e(d,{onChange:Fe,ignoreHistoryMergeTagChange:!0,ignoreSelectionChange:!0}),e(c,{validateUrl:z}),e(o,{newTab:!0}),e(P,{}),e(E,{}),we]})]}),ie&&e(B,{"data-role":`${ce}-footer-wrapper`,size:ye,children:ie}),e(L,{})]}),!Oe&&r(t,{children:[e(q,{error:oe,warning:Ae,validationId:`${ce}-validation-message`,"data-role":`${ce}-validation-message`,validationMessagePositionTop:Oe}),(oe||Ae)&&e(D,{warning:!(oe||!Ae)})]}),ne>0&&!ve&&e(G,{isFocused:Me,maxChars:ne,namespace:ce,marginTop:qe()})]})})]})})?Ie:{},Object.getOwnPropertyDescriptors?Object.defineProperties(De,Object.getOwnPropertyDescriptors(Ie)):function(e){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r.push.apply(r,t)}return r}(Object(Ie)).forEach((function(e){Object.defineProperty(De,e,Object.getOwnPropertyDescriptor(Ie,e))})),De));var De,Ie}));export{ee as TextEditor,ee as default};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { MarginProps } from "styled-system";
|
|
2
2
|
type StyledTextEditorWrapperProps = MarginProps;
|
|
3
3
|
interface StyledEditorToolbarWrapperProps {
|
|
4
|
-
focused?: boolean;
|
|
5
4
|
error?: boolean;
|
|
6
5
|
}
|
|
7
|
-
export declare const StyledTextEditor: import("styled-components").StyledComponent<"div", any, {
|
|
6
|
+
export declare const StyledTextEditor: import("styled-components").StyledComponent<"div", any, {
|
|
7
|
+
error?: boolean;
|
|
8
|
+
}, never>;
|
|
8
9
|
export declare const StyledTextEditorWrapper: import("styled-components").StyledComponent<"div", any, StyledTextEditorWrapperProps, never>;
|
|
9
10
|
export declare const StyledWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
10
11
|
export declare const StyledEditorToolbarWrapper: import("styled-components").StyledComponent<"div", any, StyledEditorToolbarWrapperProps, never>;
|
|
11
12
|
export declare const StyledHeaderWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
12
|
-
export declare const StyledFooterWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
13
|
+
export declare const StyledFooterWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
14
|
+
size: "small" | "medium" | "large";
|
|
15
|
+
}, never>;
|
|
13
16
|
export default StyledTextEditor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import o,{css as t}from"styled-components";import{margin as
|
|
1
|
+
import o,{css as t}from"styled-components";import{margin as r}from"styled-system";const e=o.div.withConfig({displayName:"text-editor.style__StyledTextEditor",componentId:"sc-f35af111-0"})(["position:relative;box-sizing:border-box;",""],(({error:o})=>o&&t(["margin:-1px;"]))),i=o.div.withConfig({displayName:"text-editor.style__StyledTextEditorWrapper",componentId:"sc-f35af111-1"})(["margin-bottom:var(--fieldSpacing);"," min-width:288px;"],r),a=o.div.withConfig({displayName:"text-editor.style__StyledWrapper",componentId:"sc-f35af111-2"})(['position:relative;.textBold{font-weight:bold;}.textItalic{font-style:italic;}.textUnderline{text-decoration:underline;}a:not([data-component="link-preview"]){color:var(--colorsActionMajor500);cursor:pointer;&:hover{color:var(--colorsActionMajor600);}&:focus{outline:none;text-decoration:none;color:var(--colorsActionMajorYin090);background-color:var(--colorsSemanticFocus250);border-radius:var(--borderRadius025);box-shadow:0 var(--spacing050) 0 0 var(--colorsUtilityYin090);}}']),d=o.div.withConfig({displayName:"text-editor.style__StyledEditorToolbarWrapper",componentId:"sc-f35af111-3"})(["border-radius:var(--borderRadius100);",""],(({error:o})=>t(o?["border:1px solid var(--colorsUtilityMajor200);"]:["outline:1px solid var(--colorsUtilityMajor200);"]))),n=o.div.withConfig({displayName:"text-editor.style__StyledHeaderWrapper",componentId:"sc-f35af111-4"})(["padding:var(--spacing200);"]),l=o.div.withConfig({displayName:"text-editor.style__StyledFooterWrapper",componentId:"sc-f35af111-5"})(["border-top:1px solid var(--colorsUtilityMajor200);padding:",";"],(({size:o})=>{switch(o){case"large":return"var(--spacing200)";case"small":return"var(--spacing100)";default:return"var(--spacing150)"}}));export{d as StyledEditorToolbarWrapper,l as StyledFooterWrapper,n as StyledHeaderWrapper,e as StyledTextEditor,i as StyledTextEditorWrapper,a as StyledWrapper,e as default};
|