carbon-react 148.0.1 → 149.0.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/__internal__/label/label.component.js +4 -1
- package/esm/components/note/note.component.d.ts +1 -2
- package/esm/components/note/note.component.js +6 -9
- package/esm/components/text-editor/__internal__/constants.d.ts +21 -0
- package/esm/components/text-editor/__internal__/constants.js +29 -0
- package/esm/components/text-editor/__internal__/helpers.d.ts +20 -0
- package/esm/components/text-editor/__internal__/helpers.js +84 -0
- package/esm/components/text-editor/__internal__/index.d.ts +2 -0
- package/esm/components/text-editor/__internal__/index.js +2 -0
- package/esm/components/text-editor/__internal__/plugins/AutoLinker/auto-link.component.d.ts +3 -0
- package/esm/components/text-editor/__internal__/plugins/AutoLinker/auto-link.component.js +28 -0
- package/esm/components/text-editor/__internal__/plugins/AutoLinker/index.d.ts +1 -0
- package/esm/components/text-editor/__internal__/plugins/AutoLinker/index.js +1 -0
- package/esm/components/text-editor/__internal__/plugins/CharacterCounter/__test__/character-counter.component.d.ts +10 -0
- package/esm/components/text-editor/__internal__/plugins/CharacterCounter/__test__/character-counter.component.js +33 -0
- package/esm/components/text-editor/__internal__/plugins/CharacterCounter/character-counter.component.d.ts +9 -0
- package/esm/components/text-editor/__internal__/plugins/CharacterCounter/character-counter.component.js +59 -0
- package/esm/components/text-editor/__internal__/plugins/CharacterCounter/character-counter.style.d.ts +3 -0
- package/esm/components/text-editor/__internal__/plugins/CharacterCounter/character-counter.style.js +17 -0
- package/esm/components/text-editor/__internal__/plugins/CharacterCounter/index.d.ts +1 -0
- package/esm/components/text-editor/__internal__/plugins/CharacterCounter/index.js +1 -0
- package/esm/components/text-editor/__internal__/plugins/ContentEditor/content-editor.component.d.ts +17 -0
- package/esm/components/text-editor/__internal__/plugins/ContentEditor/content-editor.component.js +40 -0
- package/esm/components/text-editor/__internal__/plugins/ContentEditor/content-editor.style.d.ts +6 -0
- package/esm/components/text-editor/__internal__/plugins/ContentEditor/content-editor.style.js +34 -0
- package/esm/components/text-editor/__internal__/plugins/ContentEditor/index.d.ts +1 -0
- package/esm/components/text-editor/__internal__/plugins/ContentEditor/index.js +1 -0
- package/esm/components/text-editor/__internal__/plugins/LinkMonitor/index.d.ts +1 -0
- package/esm/components/text-editor/__internal__/plugins/LinkMonitor/index.js +1 -0
- package/esm/components/text-editor/__internal__/plugins/LinkMonitor/link-monitor.plugin.d.ts +2 -0
- package/esm/components/text-editor/__internal__/plugins/LinkMonitor/link-monitor.plugin.js +62 -0
- package/esm/components/text-editor/__internal__/plugins/LinkPreviewer/index.d.ts +1 -0
- package/esm/components/text-editor/__internal__/plugins/LinkPreviewer/index.js +1 -0
- package/esm/components/text-editor/__internal__/plugins/LinkPreviewer/link-previewer.component.d.ts +11 -0
- package/esm/components/text-editor/__internal__/plugins/LinkPreviewer/link-previewer.component.js +19 -0
- package/esm/components/text-editor/__internal__/plugins/LinkPreviewer/link-previewer.style.d.ts +6 -0
- package/esm/components/text-editor/__internal__/plugins/LinkPreviewer/link-previewer.style.js +29 -0
- package/esm/components/text-editor/__internal__/plugins/OnChange/index.d.ts +1 -0
- package/esm/components/text-editor/__internal__/plugins/OnChange/index.js +1 -0
- package/esm/components/text-editor/__internal__/plugins/OnChange/on-change.plugin.d.ts +5 -0
- package/esm/components/text-editor/__internal__/plugins/OnChange/on-change.plugin.js +25 -0
- package/esm/components/text-editor/__internal__/plugins/Placeholder/index.d.ts +1 -0
- package/esm/components/text-editor/__internal__/plugins/Placeholder/index.js +1 -0
- package/esm/components/text-editor/__internal__/plugins/Placeholder/placeholder.component.d.ts +14 -0
- package/esm/components/text-editor/__internal__/plugins/Placeholder/placeholder.component.js +17 -0
- package/esm/components/text-editor/__internal__/plugins/Placeholder/placeholder.style.d.ts +2 -0
- package/esm/components/text-editor/__internal__/plugins/Placeholder/placeholder.style.js +8 -0
- package/esm/components/text-editor/__internal__/plugins/Toolbar/buttons/bold.component.d.ts +4 -0
- package/esm/components/text-editor/__internal__/plugins/Toolbar/buttons/bold.component.js +41 -0
- package/esm/components/text-editor/__internal__/plugins/Toolbar/buttons/common.d.ts +6 -0
- package/esm/components/text-editor/__internal__/plugins/Toolbar/buttons/common.js +1 -0
- package/esm/components/text-editor/__internal__/plugins/Toolbar/buttons/index.d.ts +4 -0
- package/esm/components/text-editor/__internal__/plugins/Toolbar/buttons/index.js +4 -0
- package/esm/components/text-editor/__internal__/plugins/Toolbar/buttons/italic.component.d.ts +4 -0
- package/esm/components/text-editor/__internal__/plugins/Toolbar/buttons/italic.component.js +41 -0
- package/esm/components/text-editor/__internal__/plugins/Toolbar/buttons/list.component.d.ts +5 -0
- package/esm/components/text-editor/__internal__/plugins/Toolbar/buttons/list.component.js +317 -0
- package/esm/components/text-editor/__internal__/plugins/Toolbar/buttons/save.component.d.ts +34 -0
- package/esm/components/text-editor/__internal__/plugins/Toolbar/buttons/save.component.js +29 -0
- package/esm/components/text-editor/__internal__/plugins/Toolbar/index.d.ts +1 -0
- package/esm/components/text-editor/__internal__/plugins/Toolbar/toolbar.component.d.ts +12 -0
- package/esm/components/text-editor/__internal__/plugins/Toolbar/toolbar.component.js +111 -0
- package/esm/components/text-editor/__internal__/plugins/Toolbar/toolbar.style.d.ts +11 -0
- package/esm/components/text-editor/__internal__/plugins/Toolbar/toolbar.style.js +57 -0
- package/esm/components/text-editor/__internal__/plugins/index.d.ts +9 -0
- package/esm/components/text-editor/__internal__/plugins/index.js +9 -0
- package/esm/components/text-editor/__internal__/plugins/useCursorAtEnd/index.d.ts +2 -0
- package/esm/components/text-editor/__internal__/plugins/useCursorAtEnd/index.js +71 -0
- package/esm/components/text-editor/__internal__/read-only-rte.component.d.ts +4 -0
- package/esm/components/text-editor/__internal__/read-only-rte.component.js +62 -0
- package/esm/components/text-editor/__internal__/style.css +7 -0
- package/esm/components/text-editor/__internal__/utils.d.ts +4 -0
- package/esm/components/text-editor/__internal__/utils.js +14 -0
- package/esm/components/text-editor/index.d.ts +2 -1
- package/esm/components/text-editor/index.js +2 -1
- package/esm/components/text-editor/text-editor.component.d.ts +32 -28
- package/esm/components/text-editor/text-editor.component.js +139 -478
- package/esm/components/text-editor/text-editor.context.d.ts +6 -0
- package/esm/components/text-editor/text-editor.context.js +4 -0
- package/esm/components/text-editor/text-editor.style.d.ts +18 -11
- package/esm/components/text-editor/text-editor.style.js +55 -52
- package/esm/locales/de-de.js +0 -14
- package/esm/locales/en-gb.js +18 -14
- package/esm/locales/es-es.js +0 -14
- package/esm/locales/fr-ca.js +0 -14
- package/esm/locales/fr-fr.js +0 -14
- package/esm/locales/locale.d.ts +14 -14
- package/lib/__internal__/label/label.component.js +3 -0
- package/lib/components/note/note.component.d.ts +1 -2
- package/lib/components/note/note.component.js +6 -9
- package/lib/components/text-editor/__internal__/constants.d.ts +21 -0
- package/lib/components/text-editor/__internal__/constants.js +33 -0
- package/lib/components/text-editor/__internal__/helpers.d.ts +20 -0
- package/lib/components/text-editor/__internal__/helpers.js +91 -0
- package/lib/components/text-editor/__internal__/index.d.ts +2 -0
- package/lib/components/text-editor/__internal__/index.js +26 -0
- package/lib/components/text-editor/__internal__/package.json +6 -0
- package/lib/components/text-editor/__internal__/plugins/AutoLinker/auto-link.component.d.ts +3 -0
- package/lib/components/text-editor/__internal__/plugins/AutoLinker/auto-link.component.js +36 -0
- package/lib/components/text-editor/__internal__/plugins/AutoLinker/index.d.ts +1 -0
- package/lib/components/text-editor/__internal__/{editor-link → plugins/AutoLinker}/index.js +2 -2
- package/lib/components/text-editor/__internal__/{toolbar/toolbar-button → plugins/AutoLinker}/package.json +1 -1
- package/lib/components/text-editor/__internal__/plugins/CharacterCounter/__test__/character-counter.component.d.ts +10 -0
- package/lib/components/text-editor/__internal__/plugins/CharacterCounter/__test__/character-counter.component.js +42 -0
- package/lib/components/text-editor/__internal__/plugins/CharacterCounter/character-counter.component.d.ts +9 -0
- package/lib/components/text-editor/__internal__/plugins/CharacterCounter/character-counter.component.js +68 -0
- package/lib/components/text-editor/__internal__/plugins/CharacterCounter/character-counter.style.d.ts +3 -0
- package/lib/components/text-editor/__internal__/plugins/CharacterCounter/character-counter.style.js +24 -0
- package/lib/components/text-editor/__internal__/plugins/CharacterCounter/index.d.ts +1 -0
- package/lib/components/text-editor/__internal__/plugins/CharacterCounter/index.js +13 -0
- package/lib/components/text-editor/__internal__/plugins/CharacterCounter/package.json +6 -0
- package/lib/components/text-editor/__internal__/plugins/ContentEditor/content-editor.component.d.ts +17 -0
- package/lib/components/text-editor/__internal__/plugins/ContentEditor/content-editor.component.js +48 -0
- package/lib/components/text-editor/__internal__/plugins/ContentEditor/content-editor.style.d.ts +6 -0
- package/lib/components/text-editor/__internal__/plugins/ContentEditor/content-editor.style.js +42 -0
- package/lib/components/text-editor/__internal__/plugins/ContentEditor/index.d.ts +1 -0
- package/lib/components/text-editor/__internal__/{toolbar/toolbar-button → plugins/ContentEditor}/index.js +2 -2
- package/lib/components/text-editor/__internal__/plugins/ContentEditor/package.json +6 -0
- package/lib/components/text-editor/__internal__/plugins/LinkMonitor/index.d.ts +1 -0
- package/lib/components/text-editor/__internal__/{label-wrapper → plugins/LinkMonitor}/index.js +2 -2
- package/lib/components/text-editor/__internal__/plugins/LinkMonitor/link-monitor.plugin.d.ts +2 -0
- package/lib/components/text-editor/__internal__/plugins/LinkMonitor/link-monitor.plugin.js +70 -0
- package/lib/components/text-editor/__internal__/plugins/LinkMonitor/package.json +6 -0
- package/lib/components/text-editor/__internal__/plugins/LinkPreviewer/index.d.ts +1 -0
- package/lib/components/text-editor/__internal__/plugins/LinkPreviewer/index.js +13 -0
- package/lib/components/text-editor/__internal__/plugins/LinkPreviewer/link-previewer.component.d.ts +11 -0
- package/lib/components/text-editor/__internal__/plugins/LinkPreviewer/link-previewer.component.js +28 -0
- package/lib/components/text-editor/__internal__/plugins/LinkPreviewer/link-previewer.style.d.ts +6 -0
- package/lib/components/text-editor/__internal__/{toolbar/toolbar-button/toolbar-button.style.js → plugins/LinkPreviewer/link-previewer.style.js} +21 -31
- package/lib/components/text-editor/__internal__/plugins/LinkPreviewer/package.json +6 -0
- package/lib/components/text-editor/__internal__/plugins/OnChange/index.d.ts +1 -0
- package/lib/components/text-editor/__internal__/plugins/OnChange/index.js +13 -0
- package/lib/components/text-editor/__internal__/plugins/OnChange/on-change.plugin.d.ts +5 -0
- package/lib/components/text-editor/__internal__/plugins/OnChange/on-change.plugin.js +32 -0
- package/lib/components/text-editor/__internal__/plugins/OnChange/package.json +6 -0
- package/lib/components/text-editor/__internal__/plugins/Placeholder/index.d.ts +1 -0
- package/lib/components/text-editor/__internal__/plugins/Placeholder/index.js +13 -0
- package/lib/components/text-editor/__internal__/plugins/Placeholder/package.json +6 -0
- package/lib/components/text-editor/__internal__/plugins/Placeholder/placeholder.component.d.ts +14 -0
- package/lib/components/text-editor/__internal__/plugins/Placeholder/placeholder.component.js +25 -0
- package/lib/components/text-editor/__internal__/plugins/Placeholder/placeholder.style.d.ts +2 -0
- package/lib/components/text-editor/__internal__/plugins/Placeholder/placeholder.style.js +15 -0
- package/lib/components/text-editor/__internal__/plugins/Toolbar/buttons/bold.component.d.ts +4 -0
- package/lib/components/text-editor/__internal__/plugins/Toolbar/buttons/bold.component.js +48 -0
- package/lib/components/text-editor/__internal__/plugins/Toolbar/buttons/common.d.ts +6 -0
- package/lib/components/text-editor/__internal__/plugins/Toolbar/buttons/common.js +5 -0
- package/lib/components/text-editor/__internal__/plugins/Toolbar/buttons/index.d.ts +4 -0
- package/lib/components/text-editor/__internal__/plugins/Toolbar/buttons/index.js +34 -0
- package/lib/components/text-editor/__internal__/plugins/Toolbar/buttons/italic.component.d.ts +4 -0
- package/lib/components/text-editor/__internal__/plugins/Toolbar/buttons/italic.component.js +47 -0
- package/lib/components/text-editor/__internal__/plugins/Toolbar/buttons/list.component.d.ts +5 -0
- package/lib/components/text-editor/__internal__/plugins/Toolbar/buttons/list.component.js +325 -0
- package/lib/components/text-editor/__internal__/plugins/Toolbar/buttons/package.json +6 -0
- package/lib/components/text-editor/__internal__/plugins/Toolbar/buttons/save.component.d.ts +34 -0
- package/lib/components/text-editor/__internal__/plugins/Toolbar/buttons/save.component.js +36 -0
- package/lib/components/text-editor/__internal__/plugins/Toolbar/index.d.ts +1 -0
- package/lib/components/text-editor/__internal__/plugins/Toolbar/package.json +6 -0
- package/lib/components/text-editor/__internal__/plugins/Toolbar/toolbar.component.d.ts +12 -0
- package/lib/components/text-editor/__internal__/plugins/Toolbar/toolbar.component.js +120 -0
- package/lib/components/text-editor/__internal__/plugins/Toolbar/toolbar.style.d.ts +11 -0
- package/lib/components/text-editor/__internal__/plugins/Toolbar/toolbar.style.js +65 -0
- package/lib/components/text-editor/__internal__/plugins/index.d.ts +9 -0
- package/lib/components/text-editor/__internal__/plugins/index.js +69 -0
- package/lib/components/text-editor/__internal__/{toolbar → plugins}/package.json +1 -1
- package/lib/components/text-editor/__internal__/plugins/useCursorAtEnd/index.d.ts +2 -0
- package/lib/components/text-editor/__internal__/plugins/useCursorAtEnd/index.js +78 -0
- package/lib/components/text-editor/__internal__/plugins/useCursorAtEnd/package.json +6 -0
- package/lib/components/text-editor/__internal__/read-only-rte.component.d.ts +4 -0
- package/lib/components/text-editor/__internal__/read-only-rte.component.js +72 -0
- package/lib/components/text-editor/__internal__/style.css +7 -0
- package/lib/components/text-editor/__internal__/utils.d.ts +4 -0
- package/lib/components/text-editor/__internal__/utils.js +21 -0
- package/lib/components/text-editor/index.d.ts +2 -1
- package/lib/components/text-editor/index.js +7 -7
- package/lib/components/text-editor/text-editor.component.d.ts +32 -28
- package/lib/components/text-editor/text-editor.component.js +141 -477
- package/lib/components/text-editor/text-editor.context.d.ts +6 -0
- package/lib/components/text-editor/{__internal__/editor.context.js → text-editor.context.js} +1 -0
- package/lib/components/text-editor/text-editor.style.d.ts +18 -11
- package/lib/components/text-editor/text-editor.style.js +57 -53
- package/lib/locales/de-de.js +0 -14
- package/lib/locales/en-gb.js +18 -14
- package/lib/locales/es-es.js +0 -14
- package/lib/locales/fr-ca.js +0 -14
- package/lib/locales/fr-fr.js +0 -14
- package/lib/locales/locale.d.ts +14 -14
- package/package.json +7 -4
- package/esm/components/text-editor/__internal__/decorators/index.d.ts +0 -3
- package/esm/components/text-editor/__internal__/decorators/index.js +0 -3
- package/esm/components/text-editor/__internal__/decorators/link-decorator.d.ts +0 -8
- package/esm/components/text-editor/__internal__/decorators/link-decorator.js +0 -37
- package/esm/components/text-editor/__internal__/editor-link/editor-link.component.d.ts +0 -9
- package/esm/components/text-editor/__internal__/editor-link/editor-link.component.js +0 -36
- package/esm/components/text-editor/__internal__/editor-link/editor-link.style.d.ts +0 -3
- package/esm/components/text-editor/__internal__/editor-link/editor-link.style.js +0 -13
- package/esm/components/text-editor/__internal__/editor-link/index.d.ts +0 -2
- package/esm/components/text-editor/__internal__/editor-link/index.js +0 -1
- package/esm/components/text-editor/__internal__/editor-validation-wrapper/editor-validation-wrapper.component.d.ts +0 -11
- package/esm/components/text-editor/__internal__/editor-validation-wrapper/editor-validation-wrapper.component.js +0 -18
- package/esm/components/text-editor/__internal__/editor-validation-wrapper/editor-validation-wrapper.style.d.ts +0 -2
- package/esm/components/text-editor/__internal__/editor-validation-wrapper/editor-validation-wrapper.style.js +0 -11
- package/esm/components/text-editor/__internal__/editor-validation-wrapper/index.d.ts +0 -2
- package/esm/components/text-editor/__internal__/editor-validation-wrapper/index.js +0 -1
- package/esm/components/text-editor/__internal__/editor.context.d.ts +0 -6
- package/esm/components/text-editor/__internal__/editor.context.js +0 -2
- package/esm/components/text-editor/__internal__/label-wrapper/index.d.ts +0 -2
- package/esm/components/text-editor/__internal__/label-wrapper/index.js +0 -1
- package/esm/components/text-editor/__internal__/label-wrapper/label-wrapper.component.d.ts +0 -12
- package/esm/components/text-editor/__internal__/label-wrapper/label-wrapper.component.js +0 -18
- package/esm/components/text-editor/__internal__/toolbar/index.d.ts +0 -2
- package/esm/components/text-editor/__internal__/toolbar/toolbar-button/index.d.ts +0 -2
- package/esm/components/text-editor/__internal__/toolbar/toolbar-button/index.js +0 -1
- package/esm/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.component.d.ts +0 -25
- package/esm/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.component.js +0 -50
- package/esm/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.style.d.ts +0 -6
- package/esm/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.style.js +0 -38
- package/esm/components/text-editor/__internal__/toolbar/toolbar.component.d.ts +0 -16
- package/esm/components/text-editor/__internal__/toolbar/toolbar.component.js +0 -158
- package/esm/components/text-editor/__internal__/toolbar/toolbar.style.d.ts +0 -4
- package/esm/components/text-editor/__internal__/toolbar/toolbar.style.js +0 -28
- package/esm/components/text-editor/__internal__/utils/index.d.ts +0 -1
- package/esm/components/text-editor/__internal__/utils/index.js +0 -1
- package/esm/components/text-editor/__internal__/utils/utils.d.ts +0 -29
- package/esm/components/text-editor/__internal__/utils/utils.js +0 -174
- package/esm/components/text-editor/types.d.ts +0 -6
- package/esm/components/text-editor/types.js +0 -4
- package/lib/components/text-editor/__internal__/decorators/index.d.ts +0 -3
- package/lib/components/text-editor/__internal__/decorators/index.js +0 -10
- package/lib/components/text-editor/__internal__/decorators/link-decorator.d.ts +0 -8
- package/lib/components/text-editor/__internal__/decorators/link-decorator.js +0 -44
- package/lib/components/text-editor/__internal__/decorators/package.json +0 -6
- package/lib/components/text-editor/__internal__/editor-link/editor-link.component.d.ts +0 -9
- package/lib/components/text-editor/__internal__/editor-link/editor-link.component.js +0 -45
- package/lib/components/text-editor/__internal__/editor-link/editor-link.style.d.ts +0 -3
- package/lib/components/text-editor/__internal__/editor-link/editor-link.style.js +0 -20
- package/lib/components/text-editor/__internal__/editor-link/index.d.ts +0 -2
- package/lib/components/text-editor/__internal__/editor-link/package.json +0 -6
- package/lib/components/text-editor/__internal__/editor-validation-wrapper/editor-validation-wrapper.component.d.ts +0 -11
- package/lib/components/text-editor/__internal__/editor-validation-wrapper/editor-validation-wrapper.component.js +0 -25
- package/lib/components/text-editor/__internal__/editor-validation-wrapper/editor-validation-wrapper.style.d.ts +0 -2
- package/lib/components/text-editor/__internal__/editor-validation-wrapper/editor-validation-wrapper.style.js +0 -18
- package/lib/components/text-editor/__internal__/editor-validation-wrapper/index.d.ts +0 -2
- package/lib/components/text-editor/__internal__/editor-validation-wrapper/index.js +0 -13
- package/lib/components/text-editor/__internal__/editor-validation-wrapper/package.json +0 -6
- package/lib/components/text-editor/__internal__/editor.context.d.ts +0 -6
- package/lib/components/text-editor/__internal__/label-wrapper/index.d.ts +0 -2
- package/lib/components/text-editor/__internal__/label-wrapper/label-wrapper.component.d.ts +0 -12
- package/lib/components/text-editor/__internal__/label-wrapper/label-wrapper.component.js +0 -25
- package/lib/components/text-editor/__internal__/label-wrapper/package.json +0 -6
- package/lib/components/text-editor/__internal__/toolbar/index.d.ts +0 -2
- package/lib/components/text-editor/__internal__/toolbar/toolbar-button/index.d.ts +0 -2
- package/lib/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.component.d.ts +0 -25
- package/lib/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.component.js +0 -56
- package/lib/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.style.d.ts +0 -6
- package/lib/components/text-editor/__internal__/toolbar/toolbar.component.d.ts +0 -16
- package/lib/components/text-editor/__internal__/toolbar/toolbar.component.js +0 -167
- package/lib/components/text-editor/__internal__/toolbar/toolbar.style.d.ts +0 -4
- package/lib/components/text-editor/__internal__/toolbar/toolbar.style.js +0 -34
- package/lib/components/text-editor/__internal__/utils/index.d.ts +0 -1
- package/lib/components/text-editor/__internal__/utils/index.js +0 -90
- package/lib/components/text-editor/__internal__/utils/package.json +0 -6
- package/lib/components/text-editor/__internal__/utils/utils.d.ts +0 -29
- package/lib/components/text-editor/__internal__/utils/utils.js +0 -197
- package/lib/components/text-editor/types.d.ts +0 -6
- package/lib/components/text-editor/types.js +0 -10
- /package/esm/components/text-editor/__internal__/{toolbar → plugins/Toolbar}/index.js +0 -0
- /package/lib/components/text-editor/__internal__/{toolbar → plugins/Toolbar}/index.js +0 -0
package/lib/components/text-editor/{__internal__/editor.context.js → text-editor.context.js}
RENAMED
|
@@ -6,4 +6,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
// This is the context that is used to enable cross-component communication
|
|
9
10
|
var _default = exports.default = /*#__PURE__*/_react.default.createContext({});
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface StyledWrapperProps {
|
|
3
|
+
error?: string;
|
|
4
|
+
namespace: string;
|
|
5
|
+
warning?: string;
|
|
6
|
+
}
|
|
7
|
+
interface StyledValidationMessageProps {
|
|
8
|
+
error?: string;
|
|
9
|
+
}
|
|
10
|
+
interface StyledEditorToolbarWrapperProps {
|
|
11
|
+
focused?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const StyledTextEditor: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../box").BoxProps & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
|
|
14
|
+
export declare const StyledHintText: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
15
|
+
export declare const StyledWrapper: import("styled-components").StyledComponent<"div", any, StyledWrapperProps, never>;
|
|
16
|
+
export declare const StyledEditorToolbarWrapper: import("styled-components").StyledComponent<"div", any, StyledEditorToolbarWrapperProps, never>;
|
|
17
|
+
export declare const StyledValidationMessage: import("styled-components").StyledComponent<"div", any, StyledValidationMessageProps, never>;
|
|
18
|
+
export default StyledTextEditor;
|
|
@@ -3,76 +3,80 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.default = exports.StyledWrapper = exports.StyledValidationMessage = exports.StyledTextEditor = exports.StyledHintText = exports.StyledEditorToolbarWrapper = void 0;
|
|
7
7
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
|
-
var
|
|
9
|
-
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
10
|
-
var _browserTypeCheck = require("../../__internal__/utils/helpers/browser-type-check");
|
|
8
|
+
var _box = _interopRequireDefault(require("../box"));
|
|
11
9
|
var _addFocusStyling = _interopRequireDefault(require("../../style/utils/add-focus-styling"));
|
|
12
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
11
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
12
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
${_styledSystem.margin}
|
|
13
|
+
const StyledTextEditor = exports.StyledTextEditor = (0, _styledComponents.default)(_box.default)`
|
|
14
|
+
position: relative;
|
|
18
15
|
`;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
const StyledHintText = exports.StyledHintText = _styledComponents.default.div`
|
|
17
|
+
::after {
|
|
18
|
+
content: " ";
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
margin-top: var(--spacing000);
|
|
22
|
+
margin-bottom: var(--spacing150);
|
|
23
|
+
color: var(--colorsUtilityYin055);
|
|
24
|
+
font-size: 14px;
|
|
25
|
+
`;
|
|
26
|
+
const StyledWrapper = exports.StyledWrapper = _styledComponents.default.div`
|
|
23
27
|
${({
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
error,
|
|
29
|
+
namespace,
|
|
30
|
+
warning
|
|
27
31
|
}) => (0, _styledComponents.css)`
|
|
28
|
-
|
|
29
|
-
min-
|
|
30
|
-
position: relative;
|
|
32
|
+
min-height: 120px;
|
|
33
|
+
min-width: 300px;
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
${(error || warning) && (0, _styledComponents.css)`
|
|
36
|
+
padding-left: 8px;
|
|
37
|
+
border-left: 2px solid
|
|
38
|
+
var(
|
|
39
|
+
${error ? "--colorsSemanticNegative500" : "--colorsSemanticCaution500"}
|
|
40
|
+
);
|
|
37
41
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
#${namespace}-editor-toolbar-wrapper {
|
|
43
|
+
border-radius: var(--borderRadius100);
|
|
44
|
+
border: 2px solid
|
|
45
|
+
var(
|
|
46
|
+
${error ? "--colorsSemanticNegative500" : "--colorsSemanticCaution500"}
|
|
47
|
+
);
|
|
44
48
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
position: relative;
|
|
48
|
-
left: -4px;
|
|
49
|
-
padding-left: 4px;
|
|
49
|
+
.${namespace}-editable, #${namespace}-toolbar {
|
|
50
|
+
outline: none;
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
#${namespace}-toolbar {
|
|
54
|
+
border-top: 1px solid var(--colorsUtilityMajor200);
|
|
54
55
|
}
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
div.public-DraftEditor-content {
|
|
59
|
-
padding: 14px 8px;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
background-color: var(--colorsUtilityYang100);
|
|
63
|
-
outline: ${hasError ? "2px solid var(--colorsSemanticNegative500)" : "1px solid var(--colorsUtilityMajor200)"};
|
|
64
|
-
`}
|
|
56
|
+
}
|
|
57
|
+
`}
|
|
58
|
+
`};
|
|
65
59
|
`;
|
|
66
|
-
const
|
|
60
|
+
const StyledEditorToolbarWrapper = exports.StyledEditorToolbarWrapper = _styledComponents.default.div`
|
|
67
61
|
${({
|
|
68
|
-
|
|
69
|
-
hasError
|
|
62
|
+
focused
|
|
70
63
|
}) => (0, _styledComponents.css)`
|
|
71
|
-
border-radius: var(--
|
|
64
|
+
border-radius: var(--borderRadius100);
|
|
72
65
|
outline: none;
|
|
73
66
|
|
|
74
|
-
${
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
${focused && (0, _addFocusStyling.default)()}
|
|
68
|
+
`}
|
|
69
|
+
`;
|
|
70
|
+
const StyledValidationMessage = exports.StyledValidationMessage = _styledComponents.default.div`
|
|
71
|
+
${({
|
|
72
|
+
error
|
|
73
|
+
}) => (0, _styledComponents.css)`
|
|
74
|
+
color: var(
|
|
75
|
+
${error ? "--colorsSemanticNegative500" : "--colorsSemanticCaution600"}
|
|
76
|
+
);
|
|
77
|
+
font-weight: ${error ? 500 : "normal"};
|
|
78
|
+
margin-top: 0px;
|
|
79
|
+
margin-bottom: 8px;
|
|
77
80
|
`}
|
|
78
|
-
`;
|
|
81
|
+
`;
|
|
82
|
+
var _default = exports.default = StyledTextEditor;
|
package/lib/locales/de-de.js
CHANGED
|
@@ -182,20 +182,6 @@ const deDE = {
|
|
|
182
182
|
on: () => "EIN",
|
|
183
183
|
off: () => "AUS"
|
|
184
184
|
},
|
|
185
|
-
textEditor: {
|
|
186
|
-
tooltipMessages: {
|
|
187
|
-
bold: () => "Fett",
|
|
188
|
-
italic: () => "Kursiv",
|
|
189
|
-
bulletList: () => "Aufzählung mit Punkten",
|
|
190
|
-
numberList: () => "Nummerierte Liste"
|
|
191
|
-
},
|
|
192
|
-
ariaLabels: {
|
|
193
|
-
bold: () => "fett",
|
|
194
|
-
italic: () => "kursiv",
|
|
195
|
-
bulletList: () => "Aufzählung mit Punkten",
|
|
196
|
-
numberList: () => "Nummerierte Liste"
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
185
|
tileSelect: {
|
|
200
186
|
deselect: () => "Auswahl aufheben"
|
|
201
187
|
},
|
package/lib/locales/en-gb.js
CHANGED
|
@@ -158,6 +158,24 @@ const enGB = {
|
|
|
158
158
|
pod: {
|
|
159
159
|
undo: () => "Undo"
|
|
160
160
|
},
|
|
161
|
+
textEditor: {
|
|
162
|
+
boldAria: () => "Bold",
|
|
163
|
+
cancelButton: () => "Cancel",
|
|
164
|
+
cancelButtonAria: () => "Cancel",
|
|
165
|
+
characterCounter(count) {
|
|
166
|
+
return `${typeof count === "number" ? count.toString() : count} characters remaining`;
|
|
167
|
+
},
|
|
168
|
+
characterLimit(count) {
|
|
169
|
+
return `You are ${count} character(s) over the character limit`;
|
|
170
|
+
},
|
|
171
|
+
contentEditorAria: () => "Rich text content editor",
|
|
172
|
+
italicAria: () => "Italic",
|
|
173
|
+
orderedListAria: () => "Ordered list",
|
|
174
|
+
saveButton: () => "Save",
|
|
175
|
+
saveButtonAria: () => "Save",
|
|
176
|
+
toolbarAriaLabel: () => "Formatting",
|
|
177
|
+
unorderedListAria: () => "Unordered list"
|
|
178
|
+
},
|
|
161
179
|
search: {
|
|
162
180
|
searchButtonText: () => "Search"
|
|
163
181
|
},
|
|
@@ -186,20 +204,6 @@ const enGB = {
|
|
|
186
204
|
on: () => "ON",
|
|
187
205
|
off: () => "OFF"
|
|
188
206
|
},
|
|
189
|
-
textEditor: {
|
|
190
|
-
tooltipMessages: {
|
|
191
|
-
bold: () => "Bold",
|
|
192
|
-
italic: () => "Italic",
|
|
193
|
-
bulletList: () => "Bulleted List",
|
|
194
|
-
numberList: () => "Numbered List"
|
|
195
|
-
},
|
|
196
|
-
ariaLabels: {
|
|
197
|
-
bold: () => "bold",
|
|
198
|
-
italic: () => "italic",
|
|
199
|
-
bulletList: () => "bullet-list",
|
|
200
|
-
numberList: () => "number-list"
|
|
201
|
-
}
|
|
202
|
-
},
|
|
203
207
|
tileSelect: {
|
|
204
208
|
deselect: () => "Deselect"
|
|
205
209
|
},
|
package/lib/locales/es-es.js
CHANGED
|
@@ -183,20 +183,6 @@ const esES = {
|
|
|
183
183
|
on: () => "SÍ",
|
|
184
184
|
off: () => "NO"
|
|
185
185
|
},
|
|
186
|
-
textEditor: {
|
|
187
|
-
tooltipMessages: {
|
|
188
|
-
bold: () => "Negrita",
|
|
189
|
-
italic: () => "Cursiva",
|
|
190
|
-
bulletList: () => "Lista con viñetas",
|
|
191
|
-
numberList: () => "Lista numerada"
|
|
192
|
-
},
|
|
193
|
-
ariaLabels: {
|
|
194
|
-
bold: () => "negrita",
|
|
195
|
-
italic: () => "cursiva",
|
|
196
|
-
bulletList: () => "lista-con-viñetas",
|
|
197
|
-
numberList: () => "lista-numerada"
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
186
|
tileSelect: {
|
|
201
187
|
deselect: () => "Deseleccionar"
|
|
202
188
|
},
|
package/lib/locales/fr-ca.js
CHANGED
|
@@ -183,20 +183,6 @@ const frCA = {
|
|
|
183
183
|
on: () => "OUI",
|
|
184
184
|
off: () => "NON"
|
|
185
185
|
},
|
|
186
|
-
textEditor: {
|
|
187
|
-
tooltipMessages: {
|
|
188
|
-
bold: () => "Gras",
|
|
189
|
-
italic: () => "Italique",
|
|
190
|
-
bulletList: () => "Liste à puces",
|
|
191
|
-
numberList: () => "Liste numérotée"
|
|
192
|
-
},
|
|
193
|
-
ariaLabels: {
|
|
194
|
-
bold: () => "gras",
|
|
195
|
-
italic: () => "italique",
|
|
196
|
-
bulletList: () => "liste-à-puces",
|
|
197
|
-
numberList: () => "liste-numérotée"
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
186
|
tileSelect: {
|
|
201
187
|
deselect: () => "Désélectionner"
|
|
202
188
|
},
|
package/lib/locales/fr-fr.js
CHANGED
|
@@ -183,20 +183,6 @@ const frFR = {
|
|
|
183
183
|
on: () => "Oui",
|
|
184
184
|
off: () => "Désactiver"
|
|
185
185
|
},
|
|
186
|
-
textEditor: {
|
|
187
|
-
tooltipMessages: {
|
|
188
|
-
bold: () => "Gras",
|
|
189
|
-
italic: () => "Italique",
|
|
190
|
-
bulletList: () => "Liste à puces",
|
|
191
|
-
numberList: () => "Liste numérotée"
|
|
192
|
-
},
|
|
193
|
-
ariaLabels: {
|
|
194
|
-
bold: () => "gras",
|
|
195
|
-
italic: () => "italique",
|
|
196
|
-
bulletList: () => "liste à puces",
|
|
197
|
-
numberList: () => "liste numérotée"
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
186
|
tileSelect: {
|
|
201
187
|
deselect: () => "Désélectionner"
|
|
202
188
|
},
|
package/lib/locales/locale.d.ts
CHANGED
|
@@ -126,6 +126,20 @@ interface Locale {
|
|
|
126
126
|
pod: {
|
|
127
127
|
undo: () => string;
|
|
128
128
|
};
|
|
129
|
+
textEditor: {
|
|
130
|
+
boldAria: () => string;
|
|
131
|
+
cancelButton: () => string;
|
|
132
|
+
cancelButtonAria: () => string;
|
|
133
|
+
characterCounter: (count: number | string) => string;
|
|
134
|
+
characterLimit: (count: number) => string;
|
|
135
|
+
contentEditorAria: () => string;
|
|
136
|
+
italicAria: () => string;
|
|
137
|
+
orderedListAria: () => string;
|
|
138
|
+
saveButton: () => string;
|
|
139
|
+
saveButtonAria: () => string;
|
|
140
|
+
toolbarAriaLabel: () => string;
|
|
141
|
+
unorderedListAria: () => string;
|
|
142
|
+
};
|
|
129
143
|
search: {
|
|
130
144
|
searchButtonText: () => string;
|
|
131
145
|
};
|
|
@@ -154,20 +168,6 @@ interface Locale {
|
|
|
154
168
|
on: () => string;
|
|
155
169
|
off: () => string;
|
|
156
170
|
};
|
|
157
|
-
textEditor: {
|
|
158
|
-
tooltipMessages: {
|
|
159
|
-
bold: () => string;
|
|
160
|
-
italic: () => string;
|
|
161
|
-
bulletList: () => string;
|
|
162
|
-
numberList: () => string;
|
|
163
|
-
};
|
|
164
|
-
ariaLabels: {
|
|
165
|
-
bold: () => string;
|
|
166
|
-
italic: () => string;
|
|
167
|
-
bulletList: () => string;
|
|
168
|
-
numberList: () => string;
|
|
169
|
-
};
|
|
170
|
-
};
|
|
171
171
|
tileSelect: {
|
|
172
172
|
deselect: () => string;
|
|
173
173
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carbon-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "149.0.0",
|
|
4
4
|
"description": "A library of reusable React components for easily building user interfaces.",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
@@ -46,7 +46,6 @@
|
|
|
46
46
|
"homepage": "https://carbon.sage.com",
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@sage/design-tokens": "^4.17.0",
|
|
49
|
-
"draft-js": "^0.11.7",
|
|
50
49
|
"react": "^17.0.2 || ^18.0.0",
|
|
51
50
|
"react-dom": "^17.0.2 || ^18.0.0",
|
|
52
51
|
"styled-components": "^4.4.1"
|
|
@@ -92,7 +91,6 @@
|
|
|
92
91
|
"@testing-library/react": "^16.1.0",
|
|
93
92
|
"@testing-library/user-event": "^14.5.2",
|
|
94
93
|
"@types/crypto-js": "^4.2.1",
|
|
95
|
-
"@types/draft-js": "^0.11.10",
|
|
96
94
|
"@types/glob": "^8.1.0",
|
|
97
95
|
"@types/invariant": "^2.2.37",
|
|
98
96
|
"@types/jest": "^29.5.0",
|
|
@@ -120,7 +118,6 @@
|
|
|
120
118
|
"cz-conventional-changelog": "^3.3.0",
|
|
121
119
|
"date-fns-tz": "^1.3.8",
|
|
122
120
|
"dayjs": "^1.11.10",
|
|
123
|
-
"draft-js": "^0.11.7",
|
|
124
121
|
"eslint": "^8.55.0",
|
|
125
122
|
"eslint-config-airbnb": "^19.0.0",
|
|
126
123
|
"eslint-config-prettier": "^9.1.0",
|
|
@@ -172,6 +169,11 @@
|
|
|
172
169
|
"dependencies": {
|
|
173
170
|
"@floating-ui/dom": "~1.2.9",
|
|
174
171
|
"@floating-ui/react-dom": "~1.3.0",
|
|
172
|
+
"@lexical/headless": "^0.21.0",
|
|
173
|
+
"@lexical/link": "^0.21.0",
|
|
174
|
+
"@lexical/react": "^0.21.0",
|
|
175
|
+
"@lexical/selection": "^0.21.0",
|
|
176
|
+
"@octokit/rest": "^18.12.0",
|
|
175
177
|
"@styled-system/prop-types": "^5.1.5",
|
|
176
178
|
"@tanstack/react-virtual": "^3.11.2",
|
|
177
179
|
"@types/styled-system": "^5.1.22",
|
|
@@ -181,6 +183,7 @@
|
|
|
181
183
|
"date-fns": "^2.30.0",
|
|
182
184
|
"immutable": "~3.8.2",
|
|
183
185
|
"invariant": "^2.2.4",
|
|
186
|
+
"lexical": "^0.21.0",
|
|
184
187
|
"lodash": "^4.17.21",
|
|
185
188
|
"polished": "^4.2.2",
|
|
186
189
|
"prop-types": "^15.8.1",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { ContentBlock } from "draft-js";
|
|
3
|
-
declare type StrategyCallback = (start: number, end: number) => void;
|
|
4
|
-
declare const _default: {
|
|
5
|
-
strategy: (contentBlock: ContentBlock, callback: StrategyCallback) => void;
|
|
6
|
-
component: ({ children, contentState, entityKey, ...rest }: import("../editor-link").EditorLinkProps) => import("react").JSX.Element;
|
|
7
|
-
};
|
|
8
|
-
export default _default;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import EditorLink from "../editor-link";
|
|
2
|
-
function findWithRegex(regex, contentBlock, callback) {
|
|
3
|
-
const text = contentBlock.getText();
|
|
4
|
-
let matchArr;
|
|
5
|
-
let start = 0;
|
|
6
|
-
let candidates = [];
|
|
7
|
-
text.split(" ").forEach(chars => {
|
|
8
|
-
candidates = [...candidates, [...chars]];
|
|
9
|
-
});
|
|
10
|
-
candidates.forEach(candidate => {
|
|
11
|
-
// eslint-disable-next-line no-cond-assign
|
|
12
|
-
while ((matchArr = regex.exec(candidate.join(""))) !== null) {
|
|
13
|
-
start += matchArr.index;
|
|
14
|
-
callback(start, start + candidate.length);
|
|
15
|
-
}
|
|
16
|
-
start += candidate.length + 1;
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
const linkStrategy = (contentBlock, callback) => {
|
|
20
|
-
const combineRegex = (...regex) => new RegExp(regex.map(r => r.source).join(""), "g");
|
|
21
|
-
const urlRegex = combineRegex(/\b/, /(http:\/\/|https:\/\/|www\.)/,
|
|
22
|
-
// prefix
|
|
23
|
-
/([\w-]+:([\w-]+@))?/,
|
|
24
|
-
// userinfo
|
|
25
|
-
/([\w-]+\.)+\w+/,
|
|
26
|
-
// domain
|
|
27
|
-
/(:\d+)?/,
|
|
28
|
-
// port
|
|
29
|
-
/(\/[\w#!:.?+=&%@!-/]+)?/,
|
|
30
|
-
// paths, queries, fragments
|
|
31
|
-
/\b/);
|
|
32
|
-
findWithRegex(urlRegex, contentBlock, callback);
|
|
33
|
-
};
|
|
34
|
-
export default {
|
|
35
|
-
strategy: linkStrategy,
|
|
36
|
-
component: EditorLink
|
|
37
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { ContentState } from "draft-js";
|
|
3
|
-
export interface EditorLinkProps {
|
|
4
|
-
children: React.ReactElement[];
|
|
5
|
-
contentState?: ContentState;
|
|
6
|
-
entityKey?: string;
|
|
7
|
-
}
|
|
8
|
-
declare const EditorLink: ({ children, contentState, entityKey, ...rest }: EditorLinkProps) => React.JSX.Element;
|
|
9
|
-
export default EditorLink;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React, { useContext, useEffect } from "react";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
|
-
import StyledLink from "./editor-link.style";
|
|
5
|
-
import EditorContext from "../../__internal__/editor.context";
|
|
6
|
-
const EditorLink = ({
|
|
7
|
-
children,
|
|
8
|
-
contentState,
|
|
9
|
-
entityKey,
|
|
10
|
-
...rest
|
|
11
|
-
}) => {
|
|
12
|
-
const url = !!contentState && !!entityKey ? contentState.getEntity(entityKey).getData() : children[0].props.text;
|
|
13
|
-
const buildValidUrl = () => {
|
|
14
|
-
const candidateUrl = url.url || url;
|
|
15
|
-
const regex = /(http:\/\/|https:\/\/)+/g;
|
|
16
|
-
return regex.test(candidateUrl) ? candidateUrl : `https://${candidateUrl}`;
|
|
17
|
-
};
|
|
18
|
-
const validUrl = buildValidUrl();
|
|
19
|
-
const {
|
|
20
|
-
onLinkAdded,
|
|
21
|
-
editMode
|
|
22
|
-
} = useContext(EditorContext);
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
if (onLinkAdded) {
|
|
25
|
-
onLinkAdded(validUrl);
|
|
26
|
-
}
|
|
27
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
28
|
-
}, [validUrl]);
|
|
29
|
-
return /*#__PURE__*/React.createElement(StyledLink, _extends({
|
|
30
|
-
href: !editMode ? validUrl : undefined,
|
|
31
|
-
"aria-label": !editMode ? validUrl : undefined,
|
|
32
|
-
target: "_blank",
|
|
33
|
-
rel: "noopener noreferrer"
|
|
34
|
-
}, rest), children);
|
|
35
|
-
};
|
|
36
|
-
export default EditorLink;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
declare const StyledEditorLink: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../../../link").LinkProps & import("react").RefAttributes<HTMLAnchorElement | HTMLButtonElement>>, any, {}, never>;
|
|
3
|
-
export default StyledEditorLink;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
import Link from "../../../link";
|
|
3
|
-
const StyledEditorLink = styled(Link)`
|
|
4
|
-
max-width: 100%;
|
|
5
|
-
|
|
6
|
-
a {
|
|
7
|
-
max-width: 100% span span span {
|
|
8
|
-
font-weight: 500;
|
|
9
|
-
font-style: normal;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
`;
|
|
13
|
-
export default StyledEditorLink;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./editor-link.component";
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export interface EditorValidationWrapperProps {
|
|
3
|
-
/** Message to be displayed when there is an error */
|
|
4
|
-
error?: string;
|
|
5
|
-
/** Message to be displayed when there is a warning */
|
|
6
|
-
warning?: string;
|
|
7
|
-
/** Message to be displayed when there is an info */
|
|
8
|
-
info?: string;
|
|
9
|
-
}
|
|
10
|
-
declare const ValidationWrapper: ({ error, warning, info, }: EditorValidationWrapperProps) => React.JSX.Element;
|
|
11
|
-
export default ValidationWrapper;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import StyledValidationWrapper from "./editor-validation-wrapper.style";
|
|
4
|
-
import ValidationIcon from "../../../../__internal__/validations";
|
|
5
|
-
const ValidationWrapper = ({
|
|
6
|
-
error,
|
|
7
|
-
warning,
|
|
8
|
-
info
|
|
9
|
-
}) => /*#__PURE__*/React.createElement(StyledValidationWrapper, {
|
|
10
|
-
"data-component": "text-editor-validation-wrapper"
|
|
11
|
-
}, /*#__PURE__*/React.createElement(ValidationIcon, {
|
|
12
|
-
error: error,
|
|
13
|
-
warning: warning,
|
|
14
|
-
info: info,
|
|
15
|
-
tooltipPosition: "top",
|
|
16
|
-
tabIndex: 0
|
|
17
|
-
}));
|
|
18
|
-
export default ValidationWrapper;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
const StyledValidationWrapper = styled.div`
|
|
3
|
-
margin: var(--spacing200) var(--spacing200) var(--spacing000)
|
|
4
|
-
var(--spacing050);
|
|
5
|
-
min-width: var(--sizing500);
|
|
6
|
-
height: var(--sizing275);
|
|
7
|
-
display: flex;
|
|
8
|
-
float: right;
|
|
9
|
-
align-items: center;
|
|
10
|
-
`;
|
|
11
|
-
export default StyledValidationWrapper;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./editor-validation-wrapper.component";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./label-wrapper.component";
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
/**
|
|
3
|
-
* TextEditor component is composed with divs and spans.
|
|
4
|
-
* We have to manually trigger focus on TextEditor by clicking on label component.
|
|
5
|
-
* This wrapper allows us to trigger focus on TextEditor
|
|
6
|
-
*/
|
|
7
|
-
export interface LabelWrapperProps {
|
|
8
|
-
children: React.ReactNode;
|
|
9
|
-
onClick: (event: React.MouseEvent<HTMLSpanElement>) => void;
|
|
10
|
-
}
|
|
11
|
-
declare const LabelWrapper: ({ onClick, children }: LabelWrapperProps) => React.JSX.Element;
|
|
12
|
-
export default LabelWrapper;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
2
|
-
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
3
|
-
import React from "react";
|
|
4
|
-
/**
|
|
5
|
-
* TextEditor component is composed with divs and spans.
|
|
6
|
-
* We have to manually trigger focus on TextEditor by clicking on label component.
|
|
7
|
-
* This wrapper allows us to trigger focus on TextEditor
|
|
8
|
-
*/
|
|
9
|
-
import PropTypes from "prop-types";
|
|
10
|
-
const LabelWrapper = ({
|
|
11
|
-
onClick,
|
|
12
|
-
children
|
|
13
|
-
}) => {
|
|
14
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
15
|
-
onClick: onClick
|
|
16
|
-
}, " ", children, " ");
|
|
17
|
-
};
|
|
18
|
-
export default LabelWrapper;
|