@procore/text-editor 0.0.2 → 0.1.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +1 -22
  3. package/codemod/__fixtures__/procore.config.ternary.js +18 -0
  4. package/codemod/__fixtures__/src/components/MultilineFormRichText.tsx +2 -1
  5. package/codemod/text-editor-migrate.js +313 -105
  6. package/codemod/text-editor-migrate.test.js +28 -0
  7. package/dist/TextEditor/TextEditor.d.ts +1 -1
  8. package/dist/TextEditor/TextEditor.js +81 -36
  9. package/dist/TextEditor/TextEditor.js.map +1 -1
  10. package/dist/TextEditor/TextEditor.styles.js +1 -1
  11. package/dist/TextEditor/TextEditor.types.d.ts +32 -31
  12. package/dist/TextEditor/TextEditor.types.js.map +1 -1
  13. package/dist/TextEditor/TextEditorProvider.js +1 -1
  14. package/dist/TextEditor/TextEditorProvider.js.map +1 -1
  15. package/dist/TextEditor/plugins/TabSpacesPlugin/TabSpacesPlugin.js +2 -0
  16. package/dist/TextEditor/plugins/TabSpacesPlugin/TabSpacesPlugin.js.map +1 -1
  17. package/dist/TextEditor/textEditorTheming/textEditorTheming.styles.js +2 -1
  18. package/dist/TextEditor/textEditorTheming/textEditorTheming.styles.js.map +1 -1
  19. package/dist/TextEditor/useTabAsNavigation.js +2 -1
  20. package/dist/TextEditor/useTabAsNavigation.js.map +1 -1
  21. package/dist/TextEditor/utils/config.js +5 -3
  22. package/dist/TextEditor/utils/config.js.map +1 -1
  23. package/dist/TextEditor/utils/index.d.ts +0 -1
  24. package/dist/TextEditor/utils/index.js +0 -1
  25. package/dist/TextEditor/utils/index.js.map +1 -1
  26. package/dist/TextEditorOutput/TextEditorOutput.styles.js +1 -1
  27. package/dist/_typedoc/TextEditor/TextEditor.types.json +51 -51
  28. package/dist/_typedoc/TextEditor/TextEditorProvider.types.json +2 -2
  29. package/dist/_typedoc/TextEditorOutput/TextEditorOutput.types.json +3 -3
  30. package/dist/_typedoc/deprecations.json +1 -1
  31. package/package.json +13 -16
  32. package/dist/TextEditor/utils/plugins.d.ts +0 -7
  33. package/dist/TextEditor/utils/plugins.js +0 -184
  34. package/dist/TextEditor/utils/plugins.js.map +0 -1
@@ -1,11 +1,5 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["disabled", "error", "value", "initialValue", "onChange", "onInit", "onBlur", "onKeyDown", "config", "plugins", "locale", "onDirty"];
1
+ var _excluded = ["disabled", "error", "value", "initialValue", "onChange", "onInit", "onBlur", "onKeyDown", "locale", "onDirty"];
3
2
  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); }
4
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
7
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
8
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
3
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
10
4
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
5
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
@@ -24,7 +18,7 @@ import { TextEditorContext } from './TextEditorProvider';
24
18
  import { TextEditorTheme } from './textEditorTheming';
25
19
  import { useCKEditorCss } from './useCKEditorCss';
26
20
  import { useTabAsNavigation } from './useTabAsNavigation';
27
- import { addButtonDataAttributes, addPluginsFromStringArray, getDefaultConfig } from './utils';
21
+ import { addButtonDataAttributes, getDefaultConfig } from './utils';
28
22
 
29
23
  /**
30
24
  * To ensure your Jest tests work with the CKEditor implementation, wrap your Jest configuration with `textEditorJestConfig`:
@@ -67,20 +61,20 @@ import { addButtonDataAttributes, addPluginsFromStringArray, getDefaultConfig }
67
61
  * }),
68
62
  * })
69
63
  */
70
- export function TextEditor(_ref) {
71
- var disabled = _ref.disabled,
72
- error = _ref.error,
73
- value = _ref.value,
74
- initialValue = _ref.initialValue,
75
- onChange = _ref.onChange,
76
- onInit = _ref.onInit,
77
- onBlur = _ref.onBlur,
78
- onKeyDown = _ref.onKeyDown,
79
- externalConfig = _ref.config,
80
- stringPlugins = _ref.plugins,
81
- propLocale = _ref.locale,
82
- onDirty = _ref.onDirty,
83
- restProps = _objectWithoutProperties(_ref, _excluded);
64
+ export function TextEditor(props) {
65
+ var disabled = props.disabled,
66
+ error = props.error,
67
+ value = props.value,
68
+ initialValue = props.initialValue,
69
+ onChange = props.onChange,
70
+ onInit = props.onInit,
71
+ onBlur = props.onBlur,
72
+ onKeyDown = props.onKeyDown,
73
+ propLocale = props.locale,
74
+ onDirty = props.onDirty,
75
+ restProps = _objectWithoutProperties(props, _excluded);
76
+ var ariaLabel = props['aria-label'];
77
+ var ariaDescription = props['aria-description'];
84
78
  var _useCKEditorCss = useCKEditorCss(),
85
79
  cssLoading = _useCKEditorCss.isLoading;
86
80
  var editorRef = React.useRef(null);
@@ -113,6 +107,42 @@ export function TextEditor(_ref) {
113
107
  }
114
108
  };
115
109
  }, []);
110
+
111
+ // Update aria-label when ariaLabel prop changes
112
+ React.useEffect(function () {
113
+ if (!isEditorReady || !editorInstanceRef.current) {
114
+ return;
115
+ }
116
+ var editor = editorInstanceRef.current;
117
+ editor.editing.view.change(function (writer) {
118
+ var viewEditableRoot = editor.editing.view.document.getRoot();
119
+ if (viewEditableRoot) {
120
+ if (ariaLabel) {
121
+ writer.setAttribute('aria-label', ariaLabel, viewEditableRoot);
122
+ } else {
123
+ writer.removeAttribute('aria-label', viewEditableRoot);
124
+ }
125
+ }
126
+ });
127
+ }, [ariaLabel, isEditorReady]);
128
+
129
+ // Update aria-description when ariaDescription prop changes
130
+ React.useEffect(function () {
131
+ if (!isEditorReady || !editorInstanceRef.current) {
132
+ return;
133
+ }
134
+ var editor = editorInstanceRef.current;
135
+ editor.editing.view.change(function (writer) {
136
+ var viewEditableRoot = editor.editing.view.document.getRoot();
137
+ if (viewEditableRoot) {
138
+ if (ariaDescription) {
139
+ writer.setAttribute('aria-description', ariaDescription, viewEditableRoot);
140
+ } else {
141
+ writer.removeAttribute('aria-description', viewEditableRoot);
142
+ }
143
+ }
144
+ });
145
+ }, [ariaDescription, isEditorReady]);
116
146
  var _useZIndexContext = useZIndexContext(),
117
147
  zIndex = _useZIndexContext.value;
118
148
  var _React$useContext = React.useContext(TextEditorContext),
@@ -122,19 +152,14 @@ export function TextEditor(_ref) {
122
152
  var mergedConfig = React.useMemo(function () {
123
153
  var defaultConfig = getDefaultConfig(locale);
124
154
 
125
- // Handle string plugins for backward compatibility
126
- var configWithPlugins = stringPlugins !== null && stringPlugins !== void 0 && stringPlugins.length ? addPluginsFromStringArray(defaultConfig, stringPlugins) : defaultConfig;
127
-
128
- // Apply any external CKEditor config overrides provided by the consumer
129
- var externalResult = typeof externalConfig === 'function' ? externalConfig(configWithPlugins) : undefined;
130
- // Merge default config (with plugins) and consumer overrides
131
- var finalConfig = _objectSpread(_objectSpread({}, configWithPlugins), externalResult !== null && externalResult !== void 0 ? externalResult : {});
132
- return finalConfig;
133
- }, [externalConfig, locale, stringPlugins]);
134
- var bindKeyDownHandler = React.useCallback(function (editor) {
135
- if (!onKeyDown) {
136
- return;
155
+ // Set accessible label for the editable area if provided
156
+ // This is used by screen readers to announce the editor's purpose
157
+ if (ariaLabel) {
158
+ defaultConfig.label = ariaLabel;
137
159
  }
160
+ return defaultConfig;
161
+ }, [ariaLabel, locale]);
162
+ var bindKeyDownHandler = React.useCallback(function (editor) {
138
163
  var editorElement = editor.editing.view.document.getRoot();
139
164
  if (!editorElement) {
140
165
  return;
@@ -148,7 +173,12 @@ export function TextEditor(_ref) {
148
173
  // Create and store the new listener
149
174
  var keyDownListener = function keyDownListener(_event, data) {
150
175
  var domEvent = data.domEvent;
151
- onKeyDown(domEvent, editor);
176
+ // Prevent Enter from propagating to parent forms so the
177
+ // editor can handle newlines without accidentally submitting.
178
+ if (domEvent.key === 'Enter') {
179
+ domEvent.stopPropagation();
180
+ }
181
+ onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(domEvent, editor);
152
182
  };
153
183
  keyDownListenerRef.current = keyDownListener;
154
184
 
@@ -174,6 +204,20 @@ export function TextEditor(_ref) {
174
204
  editor.setData(initialValue);
175
205
  }
176
206
 
207
+ // Set aria-label and aria-description on the editable area if provided
208
+ // These provide accessible context to screen reader users
209
+ editor.editing.view.change(function (writer) {
210
+ var viewEditableRoot = editor.editing.view.document.getRoot();
211
+ if (viewEditableRoot) {
212
+ if (ariaLabel) {
213
+ writer.setAttribute('aria-label', ariaLabel, viewEditableRoot);
214
+ }
215
+ if (ariaDescription) {
216
+ writer.setAttribute('aria-description', ariaDescription, viewEditableRoot);
217
+ }
218
+ }
219
+ });
220
+
177
221
  // Bind keydown handler when editor is ready
178
222
  bindKeyDownHandler(editor);
179
223
  onInit === null || onInit === void 0 ? void 0 : onInit(editor);
@@ -200,7 +244,8 @@ export function TextEditor(_ref) {
200
244
  return /*#__PURE__*/React.createElement(StyledTextEditor, {
201
245
  ref: editorRef,
202
246
  key: editorKey,
203
- error: error
247
+ error: error,
248
+ "aria-invalid": error ? 'true' : 'false'
204
249
  }, /*#__PURE__*/React.createElement(GlobalEditorStyles, {
205
250
  zIndex: zIndex + 1
206
251
  }), /*#__PURE__*/React.createElement(TextEditorTheme, null), /*#__PURE__*/React.createElement(CKEditor, _extends({}, restProps, {
@@ -1 +1 @@
1
- {"version":3,"file":"TextEditor.js","names":["CKEditor","ClassicEditor","React","useI18nContext","useZIndexContext","useStickyToolbar","GlobalEditorStyles","StyledTextEditor","TextEditorContext","TextEditorTheme","useCKEditorCss","useTabAsNavigation","addButtonDataAttributes","addPluginsFromStringArray","getDefaultConfig","TextEditor","_ref","disabled","error","value","initialValue","onChange","onInit","onBlur","onKeyDown","externalConfig","config","stringPlugins","plugins","propLocale","locale","onDirty","restProps","_objectWithoutProperties","_excluded","_useCKEditorCss","cssLoading","isLoading","editorRef","useRef","editorInstanceRef","initialValueRef","keyDownListenerRef","_React$useState","useState","_React$useState2","_slicedToArray","isDirtyState","setIsDirtyState","_React$useState3","_React$useState4","isEditorReady","setIsEditorReady","_useI18nContext","contextLocale","useEffect","undefined","current","editing","view","document","off","_useZIndexContext","zIndex","_React$useContext","useContext","features","enableStickyToolbar","stickyToolbar","enableTabAsNavigation","tabAsNavigation","mergedConfig","useMemo","defaultConfig","configWithPlugins","length","externalResult","finalConfig","_objectSpread","bindKeyDownHandler","useCallback","editor","editorElement","getRoot","keyDownListener","_event","data","domEvent","on","handleChange","getData","isDirty","handleReady","setData","handleBlur","event","enabled","_useTabAsNavigation","editorKey","concat","createElement","ref","key","_extends","onReady"],"sources":["../../src/TextEditor/TextEditor.tsx"],"sourcesContent":["import { CKEditor } from '@ckeditor/ckeditor5-react'\nimport type { EditorConfig } from 'ckeditor5'\nimport { ClassicEditor, type EventInfo } from 'ckeditor5'\nimport React from 'react'\n\nimport { useI18nContext, useZIndexContext } from '@procore/core-react'\nimport { useStickyToolbar } from './StickyToolbar'\nimport { GlobalEditorStyles, StyledTextEditor } from './TextEditor.styles'\nimport type { KeyDownListener, TextEditorProps } from './TextEditor.types'\nimport { TextEditorContext } from './TextEditorProvider'\nimport { TextEditorTheme } from './textEditorTheming'\nimport { useCKEditorCss } from './useCKEditorCss'\nimport { useTabAsNavigation } from './useTabAsNavigation'\nimport {\n addButtonDataAttributes,\n addPluginsFromStringArray,\n getDefaultConfig,\n} from './utils'\n\n/**\n * To ensure your Jest tests work with the CKEditor implementation, wrap your Jest configuration with `textEditorJestConfig`:\n *\n * @example\n *\n * // Using Jest config file\n *\n * const { textEditorJestConfig } = require('@procore/text-editor/jestConfig')\n *\n * module.exports = textEditorJestConfig({\n * // Your existing Jest config\n * })\n *\n * @example\n *\n * // Using Hammer\n *\n * import { textEditorJestConfig } from '@procore/text-editor/jestConfig'\n *\n * export default {\n * testJest: (defaultConfig) =>\n * textEditorJestConfig({\n * ...defaultConfig,\n * // Your existing Jest config\n * }),\n * }\n *\n * @example\n *\n * // Using Core Scripts\n *\n * const { textEditorJestConfig } = require('@procore/text-editor/jestConfig')\n *\n * module.exports = () => ({\n * jestOverride: (defaultConfig) =>\n * textEditorJestConfig({\n * ...defaultConfig,\n * // Your existing Jest config\n * }),\n * })\n */\nexport function TextEditor({\n disabled,\n error,\n value,\n initialValue,\n onChange,\n onInit,\n onBlur,\n onKeyDown,\n config: externalConfig,\n plugins: stringPlugins,\n locale: propLocale,\n onDirty,\n ...restProps\n}: TextEditorProps) {\n const { isLoading: cssLoading } = useCKEditorCss()\n\n const editorRef = React.useRef<HTMLDivElement>(null)\n const editorInstanceRef = React.useRef<ClassicEditor | null>(null)\n const initialValueRef = React.useRef<string>(value || initialValue || '')\n const keyDownListenerRef = React.useRef<KeyDownListener | null>(null)\n const [isDirtyState, setIsDirtyState] = React.useState(false)\n const [isEditorReady, setIsEditorReady] = React.useState(false)\n const { locale: contextLocale } = useI18nContext()\n const locale = propLocale || contextLocale\n\n React.useEffect(() => {\n if (value !== undefined) {\n initialValueRef.current = value\n }\n }, [value])\n\n // Cleanup keydown listener on unmount\n React.useEffect(() => {\n return () => {\n if (keyDownListenerRef.current && editorInstanceRef.current) {\n editorInstanceRef.current.editing.view.document.off(\n 'keydown',\n keyDownListenerRef.current\n )\n keyDownListenerRef.current = null\n }\n }\n }, [])\n\n const { value: zIndex } = useZIndexContext()\n\n const { features } = React.useContext(TextEditorContext)\n const enableStickyToolbar = !!features?.stickyToolbar\n const enableTabAsNavigation = !!features?.tabAsNavigation\n\n const mergedConfig = React.useMemo(() => {\n const defaultConfig = getDefaultConfig(locale)\n\n // Handle string plugins for backward compatibility\n const configWithPlugins = stringPlugins?.length\n ? addPluginsFromStringArray(defaultConfig, stringPlugins)\n : defaultConfig\n\n // Apply any external CKEditor config overrides provided by the consumer\n const externalResult =\n typeof externalConfig === 'function'\n ? externalConfig(configWithPlugins)\n : undefined\n // Merge default config (with plugins) and consumer overrides\n let finalConfig: EditorConfig = {\n ...configWithPlugins,\n ...(externalResult ?? {}),\n }\n\n return finalConfig\n }, [externalConfig, locale, stringPlugins])\n\n const bindKeyDownHandler = React.useCallback(\n (editor: ClassicEditor) => {\n if (!onKeyDown) {\n return\n }\n\n const editorElement = editor.editing.view.document.getRoot()\n if (!editorElement) {\n return\n }\n\n // Remove existing keydown listener\n if (keyDownListenerRef.current) {\n editor.editing.view.document.off('keydown', keyDownListenerRef.current)\n }\n\n // Create and store the new listener\n const keyDownListener = (\n _event: EventInfo,\n data: { domEvent: Event }\n ) => {\n const domEvent = data.domEvent as KeyboardEvent\n onKeyDown(domEvent, editor)\n }\n\n keyDownListenerRef.current = keyDownListener\n\n // Add the keydown listener\n editor.editing.view.document.on('keydown', keyDownListener)\n },\n [onKeyDown]\n )\n\n const handleChange = (\n _event: EventInfo<string, unknown>,\n editor: ClassicEditor\n ) => {\n const data = editor.getData()\n const isDirty = data !== initialValueRef.current\n\n // Call onDirty only on first content modification\n if (isDirty && !isDirtyState) {\n setIsDirtyState(true)\n onDirty?.()\n }\n\n onChange?.(data, isDirty)\n }\n\n const handleReady = (editor: ClassicEditor) => {\n addButtonDataAttributes(editor)\n editorInstanceRef.current = editor\n setIsEditorReady(true)\n\n if (initialValue) {\n editor.setData(initialValue)\n }\n\n // Bind keydown handler when editor is ready\n bindKeyDownHandler(editor)\n\n onInit?.(editor)\n }\n\n const handleBlur = (\n event: EventInfo<string, unknown>,\n editor: ClassicEditor\n ) => {\n onBlur?.(event, editor)\n }\n\n useStickyToolbar({\n enabled: enableStickyToolbar,\n editor: isEditorReady ? editorInstanceRef.current : null,\n editorRef,\n cssLoading,\n })\n\n const { config } = useTabAsNavigation({\n config: mergedConfig,\n enabled: enableTabAsNavigation,\n editor: isEditorReady ? editorInstanceRef.current : null,\n })\n\n const editorKey = `${locale}-${enableTabAsNavigation}`\n\n if (cssLoading) {\n return null\n }\n\n return (\n <StyledTextEditor ref={editorRef} key={editorKey} error={error}>\n <GlobalEditorStyles zIndex={zIndex + 1} />\n <TextEditorTheme />\n <CKEditor\n {...restProps}\n editor={ClassicEditor}\n config={config}\n disabled={disabled}\n data={value}\n onChange={handleChange}\n onReady={handleReady}\n onBlur={handleBlur}\n />\n </Sty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eAC1C7D,KAAA,CAAAkG,aAAA,CAAC3F,eAAe,MAAE,CAAC,eACnBP,KAAA,CAAAkG,aAAA,CAACpG,QAAQ,EAAAuG,QAAA,KACHvE,SAAS;IACbiD,MAAM,EAAEhF,aAAc;IACtByB,MAAM,EAAEA,MAAO;IACfT,QAAQ,EAAEA,QAAS;IACnBqE,IAAI,EAAEnE,KAAM;IACZE,QAAQ,EAAEoE,YAAa;IACvBe,OAAO,EAAEZ,WAAY;IACrBrE,MAAM,EAAEuE;EAAW,EACpB,CACe,CAAC;AAEvB"}
1
+ {"version":3,"file":"TextEditor.js","names":["CKEditor","ClassicEditor","React","useI18nContext","useZIndexContext","useStickyToolbar","GlobalEditorStyles","StyledTextEditor","TextEditorContext","TextEditorTheme","useCKEditorCss","useTabAsNavigation","addButtonDataAttributes","getDefaultConfig","TextEditor","props","disabled","error","value","initialValue","onChange","onInit","onBlur","onKeyDown","propLocale","locale","onDirty","restProps","_objectWithoutProperties","_excluded","ariaLabel","ariaDescription","_useCKEditorCss","cssLoading","isLoading","editorRef","useRef","editorInstanceRef","initialValueRef","keyDownListenerRef","_React$useState","useState","_React$useState2","_slicedToArray","isDirtyState","setIsDirtyState","_React$useState3","_React$useState4","isEditorReady","setIsEditorReady","_useI18nContext","contextLocale","useEffect","undefined","current","editing","view","document","off","editor","change","writer","viewEditableRoot","getRoot","setAttribute","removeAttribute","_useZIndexContext","zIndex","_React$useContext","useContext","features","enableStickyToolbar","stickyToolbar","enableTabAsNavigation","tabAsNavigation","mergedConfig","useMemo","defaultConfig","label","bindKeyDownHandler","useCallback","editorElement","keyDownListener","_event","data","domEvent","key","stopPropagation","on","handleChange","getData","isDirty","handleReady","setData","handleBlur","event","enabled","_useTabAsNavigation","config","editorKey","concat","createElement","ref","_extends","onReady"],"sources":["../../src/TextEditor/TextEditor.tsx"],"sourcesContent":["import { CKEditor } from '@ckeditor/ckeditor5-react'\nimport { ClassicEditor, type EventInfo } from 'ckeditor5'\nimport React from 'react'\n\nimport { useI18nContext, useZIndexContext } from '@procore/core-react'\nimport { useStickyToolbar } from './StickyToolbar'\nimport { GlobalEditorStyles, StyledTextEditor } from './TextEditor.styles'\nimport type { KeyDownListener, TextEditorProps } from './TextEditor.types'\nimport { TextEditorContext } from './TextEditorProvider'\nimport { TextEditorTheme } from './textEditorTheming'\nimport { useCKEditorCss } from './useCKEditorCss'\nimport { useTabAsNavigation } from './useTabAsNavigation'\nimport { addButtonDataAttributes, getDefaultConfig } from './utils'\n\n/**\n * To ensure your Jest tests work with the CKEditor implementation, wrap your Jest configuration with `textEditorJestConfig`:\n *\n * @example\n *\n * // Using Jest config file\n *\n * const { textEditorJestConfig } = require('@procore/text-editor/jestConfig')\n *\n * module.exports = textEditorJestConfig({\n * // Your existing Jest config\n * })\n *\n * @example\n *\n * // Using Hammer\n *\n * import { textEditorJestConfig } from '@procore/text-editor/jestConfig'\n *\n * export default {\n * testJest: (defaultConfig) =>\n * textEditorJestConfig({\n * ...defaultConfig,\n * // Your existing Jest config\n * }),\n * }\n *\n * @example\n *\n * // Using Core Scripts\n *\n * const { textEditorJestConfig } = require('@procore/text-editor/jestConfig')\n *\n * module.exports = () => ({\n * jestOverride: (defaultConfig) =>\n * textEditorJestConfig({\n * ...defaultConfig,\n * // Your existing Jest config\n * }),\n * })\n */\nexport function TextEditor(props: Readonly<TextEditorProps>) {\n const {\n disabled,\n error,\n value,\n initialValue,\n onChange,\n onInit,\n onBlur,\n onKeyDown,\n locale: propLocale,\n onDirty,\n ...restProps\n } = props\n const ariaLabel = props['aria-label']\n const ariaDescription = props['aria-description']\n const { isLoading: cssLoading } = useCKEditorCss()\n\n const editorRef = React.useRef<HTMLDivElement>(null)\n const editorInstanceRef = React.useRef<ClassicEditor | null>(null)\n const initialValueRef = React.useRef<string>(value || initialValue || '')\n const keyDownListenerRef = React.useRef<KeyDownListener | null>(null)\n const [isDirtyState, setIsDirtyState] = React.useState(false)\n const [isEditorReady, setIsEditorReady] = React.useState(false)\n const { locale: contextLocale } = useI18nContext()\n const locale = propLocale || contextLocale\n\n React.useEffect(() => {\n if (value !== undefined) {\n initialValueRef.current = value\n }\n }, [value])\n\n // Cleanup keydown listener on unmount\n React.useEffect(() => {\n return () => {\n if (keyDownListenerRef.current && editorInstanceRef.current) {\n editorInstanceRef.current.editing.view.document.off(\n 'keydown',\n keyDownListenerRef.current\n )\n keyDownListenerRef.current = null\n }\n }\n }, [])\n\n // Update aria-label when ariaLabel prop changes\n React.useEffect(() => {\n if (!isEditorReady || !editorInstanceRef.current) {\n return\n }\n\n const editor = editorInstanceRef.current\n editor.editing.view.change((writer) => {\n const viewEditableRoot = editor.editing.view.document.getRoot()\n if (viewEditableRoot) {\n if (ariaLabel) {\n writer.setAttribute('aria-label', ariaLabel, viewEditableRoot)\n } else {\n writer.removeAttribute('aria-label', viewEditableRoot)\n }\n }\n })\n }, [ariaLabel, isEditorReady])\n\n // Update aria-description when ariaDescription prop changes\n React.useEffect(() => {\n if (!isEditorReady || !editorInstanceRef.current) {\n return\n }\n\n const editor = editorInstanceRef.current\n editor.editing.view.change((writer) => {\n const viewEditableRoot = editor.editing.view.document.getRoot()\n if (viewEditableRoot) {\n if (ariaDescription) {\n writer.setAttribute(\n 'aria-description',\n ariaDescription,\n viewEditableRoot\n )\n } else {\n writer.removeAttribute('aria-description', viewEditableRoot)\n }\n }\n })\n }, [ariaDescription, isEditorReady])\n\n const { value: zIndex } = useZIndexContext()\n\n const { features } = React.useContext(TextEditorContext)\n const enableStickyToolbar = !!features?.stickyToolbar\n const enableTabAsNavigation = !!features?.tabAsNavigation\n\n const mergedConfig = React.useMemo(() => {\n const defaultConfig = getDefaultConfig(locale)\n\n // Set accessible label for the editable area if provided\n // This is used by screen readers to announce the editor's purpose\n if (ariaLabel) {\n defaultConfig.label = ariaLabel\n }\n\n return defaultConfig\n }, [ariaLabel, locale])\n\n const bindKeyDownHandler = React.useCallback(\n (editor: ClassicEditor) => {\n const editorElement = editor.editing.view.document.getRoot()\n if (!editorElement) {\n return\n }\n\n // Remove existing keydown listener\n if (keyDownListenerRef.current) {\n editor.editing.view.document.off('keydown', keyDownListenerRef.current)\n }\n\n // Create and store the new listener\n const keyDownListener = (\n _event: EventInfo,\n data: { domEvent: Event }\n ) => {\n const domEvent = data.domEvent as KeyboardEvent\n // Prevent Enter from propagating to parent forms so the\n // editor can handle newlines without accidentally submitting.\n if (domEvent.key === 'Enter') {\n domEvent.stopPropagation()\n }\n\n onKeyDown?.(domEvent, editor)\n }\n\n keyDownListenerRef.current = keyDownListener\n\n // Add the keydown listener\n editor.editing.view.document.on('keydown', keyDownListener)\n },\n [onKeyDown]\n )\n\n const handleChange = (\n _event: EventInfo<string, unknown>,\n editor: ClassicEditor\n ) => {\n const data = editor.getData()\n const isDirty = data !== initialValueRef.current\n\n // Call onDirty only on first content modification\n if (isDirty && !isDirtyState) {\n setIsDirtyState(true)\n onDirty?.()\n }\n\n onChange?.(data, isDirty)\n }\n\n const handleReady = (editor: ClassicEditor) => {\n addButtonDataAttributes(editor)\n editorInstanceRef.current = editor\n setIsEditorReady(true)\n\n if (initialValue) {\n editor.setData(initialValue)\n }\n\n // Set aria-label and aria-description on the editable area if provided\n // These provide accessible context to screen reader users\n editor.editing.view.change((writer) => {\n const viewEditableRoot = editor.editing.view.document.getRoot()\n if (viewEditableRoot) {\n if (ariaLabel) {\n writer.setAttribute('aria-label', ariaLabel, viewEditableRoot)\n }\n if (ariaDescription) {\n writer.setAttribute(\n 'aria-description',\n ariaDescription,\n viewEditableRoot\n )\n }\n }\n })\n\n // Bind keydown handler when editor is ready\n bindKeyDownHandler(editor)\n\n onInit?.(editor)\n }\n\n const handleBlur = (\n event: EventInfo<string, unknown>,\n editor: ClassicEditor\n ) => {\n onBlur?.(event, editor)\n }\n\n useStickyToolbar({\n enabled: enableStickyToolbar,\n editor: isEditorReady ? editorInstanceRef.current : null,\n editorRef,\n cssLoading,\n })\n\n const { config } = useTabAsNavigation({\n config: mergedConfig,\n enabled: enableTabAsNavigation,\n editor: isEditorReady ? editorInstanceRef.current : null,\n })\n\n const editorKey = `${locale}-${enableTabAsNavigation}`\n\n if (cssLoading) {\n return null\n }\n\n return (\n <StyledTextEditor\n ref={editorRef}\n key={editorKey}\n error={error}\n aria-invalid={error ? 'true' : 'false'}\n >\n <GlobalEditorStyles zIndex={zIndex + 1} />\n <TextEditorTheme />\n <CKEditor\n {...restProps}\n editor={ClassicEditor}\n config={config}\n disabled={disabled}\n data={value}\n onChange={handleChange}\n onReady={handleReady}\n onBlur={handleBlur}\n />\n </StyledTextEditor>\n )\n}\n"],"mappings":";;;;;;;;;;AAAA,SAASA,QAAQ,QAAQ,2BAA2B;AACpD,SAASC,aAAa,QAAwB,WAAW;AACzD,OAAOC,KAAK,MAAM,OAAO;AAEzB,SAASC,cAAc,EAAEC,gBAAgB,QAAQ,qBAAqB;AACtE,SAASC,gBAAgB,QAAQ,iBAAiB;AAClD,SAASC,kBAAkB,EAAEC,gBAAgB,QAAQ,qBAAqB;AAE1E,SAASC,iBAAiB,QAAQ,sBAAsB;AACxD,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,uBAAuB,EAAEC,gBAAgB,QAAQ,SAAS;;AAEnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAACC,KAAgC,EAAE;EAC3D,IACEC,QAAQ,GAWND,KAAK,CAXPC,QAAQ;IACRC,KAAK,GAUHF,KAAK,CAVPE,KAAK;IACLC,KAAK,GASHH,KAAK,CATPG,KAAK;IACLC,YAAY,GAQVJ,KAAK,CARPI,YAAY;IACZC,QAAQ,GAONL,KAAK,CAPPK,QAAQ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,IAAAgE,mBAAA,GAAmBtF,kBAAkB,CAAC;MACpCuF,MAAM,EAAEvB,YAAY;MACpBqB,OAAO,EAAEvB,qBAAqB;MAC9Bd,MAAM,EAAEX,aAAa,GAAGX,iBAAiB,CAACiB,OAAO,GAAG;IACtD,CAAC,CAAC;IAJM4C,MAAM,GAAAD,mBAAA,CAANC,MAAM;EAMd,IAAMC,SAAS,MAAAC,MAAA,CAAM3E,MAAM,OAAA2E,MAAA,CAAI3B,qBAAqB,CAAE;EAEtD,IAAIxC,UAAU,EAAE;IACd,OAAO,IAAI;EACb;EAEA,oBACE/B,KAAA,CAAAmG,aAAA,CAAC9F,gBAAgB;IACf+F,GAAG,EAAEnE,SAAU;IACfmD,GAAG,EAAEa,SAAU;IACflF,KAAK,EAAEA,KAAM;IACb,gBAAcA,KAAK,GAAG,MAAM,GAAG;EAAQ,gBAEvCf,KAAA,CAAAmG,aAAA,CAAC/F,kBAAkB;IAAC6D,MAAM,EAAEA,MAAM,GAAG;EAAE,CAAE,CAAC,eAC1CjE,KAAA,CAAAmG,aAAA,CAAC5F,eAAe,MAAE,CAAC,eACnBP,KAAA,CAAAmG,aAAA,CAACrG,QAAQ,EAAAuG,QAAA,KACH5E,SAAS;IACbgC,MAAM,EAAE1D,aAAc;IACtBiG,MAAM,EAAEA,MAAO;IACflF,QAAQ,EAAEA,QAAS;IACnBoE,IAAI,EAAElE,KAAM;IACZE,QAAQ,EAAEqE,YAAa;IACvBe,OAAO,EAAEZ,WAAY;IACrBtE,MAAM,EAAEwE;EAAW,EACpB,CACe,CAAC;AAEvB"}
@@ -18,7 +18,7 @@ export var GlobalEditorStyles = /*#__PURE__*/createGlobalStyle([":root{--ck-z-de
18
18
  });
19
19
  export var StyledTextEditor = /*#__PURE__*/styled.div.withConfig({
20
20
  displayName: "StyledTextEditor",
21
- componentId: "text-editor-0_0_2__sc-iim79x-0"
21
+ componentId: "text-editor-0_1_0__sc-iim79x-0"
22
22
  })(["", ""], function (_ref6) {
23
23
  var error = _ref6.error;
24
24
  return error && "\n .ck-sticky-panel__content {\n border-top-color: ".concat(colors.red50, " !important;\n border-left-color: ").concat(colors.red50, " !important;\n border-right-color: ").concat(colors.red50, " !important;\n }\n\n .ck-editor__editable {\n border-left-color: ").concat(colors.red50, " !important;\n border-right-color: ").concat(colors.red50, " !important;\n border-bottom-color: ").concat(colors.red50, " !important;\n }\n ");
@@ -1,10 +1,10 @@
1
- import type { Locale } from '@procore/core-react';
2
- import type { ClassicEditor, EditorConfig, EventInfo } from 'ckeditor5';
1
+ import type { Locale } from '@procore/globalization-toolkit';
2
+ import type { ClassicEditor, EventInfo } from 'ckeditor5';
3
3
  export interface TextEditorProps {
4
4
  /**
5
5
  * Unique identifier for the editor
6
6
  *
7
- * @since 10.19.0
7
+ * @since 0.0.1
8
8
  */
9
9
  id?: string;
10
10
  /**
@@ -12,74 +12,75 @@ export interface TextEditorProps {
12
12
  *
13
13
  * @deprecated `initialValue` has been deprecated and will be removed in a future version.
14
14
  * Please use the `value` prop instead
15
- * @deprecatedSince 10.20.0
16
- * @since 10.19.0
15
+ * @deprecatedSince 0.0.1
16
+ * @since 0.0.1
17
17
  */
18
18
  initialValue?: string;
19
19
  /**
20
20
  * The current value of the editor
21
21
  *
22
- * @since 10.19.0
22
+ * @since 0.0.1
23
23
  */
24
24
  value?: string;
25
25
  /**
26
26
  * Indicates if the editor is disabled
27
27
  *
28
- * @since 10.19.0
28
+ * @since 0.0.1
29
29
  */
30
30
  disabled?: boolean;
31
31
  /**
32
32
  * Indicates if the editor is in an error state
33
33
  *
34
- * @since 10.19.0
34
+ * @since 0.0.1
35
35
  */
36
36
  error?: boolean;
37
37
  /**
38
- * Locale which will be used for localization. Can be passed directly or
39
- * set by wrapping components in I18n provider.
40
- * @since 10.19.0
38
+ * Accessible label for the editor's editable area. This text will be
39
+ * announced by screen readers when the user focuses the editor. It should
40
+ * match or include the visible label associated with this editor field.
41
+ * If not provided, screen readers will announce a generic "Rich Text Editor" message.
42
+ *
43
+ * @since 0.1.0
41
44
  */
42
- locale?: Locale;
45
+ 'aria-label'?: string;
43
46
  /**
44
- * Array of plugin names to add to the editor in addition to the defaults.
45
- * This provides backward compatibility with the deprecated TinyMCE version of the editor.
46
- * Supports plugin names like 'link', 'image', 'table', etc.
47
+ * Accessible description for the editor's editable area.
48
+ * This text provides additional context to screen reader users. It will be
49
+ * announced after the label when the user focuses the editor.
47
50
  *
48
- * @since 12.26.0
51
+ * @since 0.1.0
49
52
  */
50
- plugins?: string[];
53
+ 'aria-description'?: string;
51
54
  /**
52
- * Configuration function for customizing the editor
53
- *
54
- * @param defaultConfig - The default CKEditor configuration
55
- * @returns Customized configuration object
56
- * @since 12.26.0
55
+ * Locale which will be used for localization. Can be passed directly or
56
+ * set by wrapping components in I18n provider.
57
+ * @since 0.0.1
57
58
  */
58
- config?: (defaultConfig: EditorConfig) => EditorConfig;
59
+ locale?: Locale;
59
60
  /**
60
61
  * Callback fired when the editor content changes
61
62
  *
62
63
  * @param value - The current content of the editor
63
64
  * @param isDirty - Whether the content differs from the initial value
64
- * @since 10.19.0
65
+ * @since 0.0.1
65
66
  */
66
67
  onChange?: (value: string, isDirty?: boolean) => void;
67
68
  /**
68
69
  * Callback fired when the editor gains focus
69
70
  *
70
- * @since 10.19.0
71
+ * @since 0.0.1
71
72
  */
72
73
  onFocus?: (event: EventInfo, editor: ClassicEditor) => void;
73
74
  /**
74
75
  * Callback fired when the editor loses focus
75
76
  *
76
- * @since 10.19.0
77
+ * @since 0.0.1
77
78
  */
78
79
  onBlur?: (event: EventInfo, editor: ClassicEditor) => void;
79
80
  /**
80
81
  * Callback fired when an error occurs in the editor
81
82
  *
82
- * @since 10.19.0
83
+ * @since 0.0.1
83
84
  */
84
85
  onError?: (error: Error, details: {
85
86
  phase: 'initialization' | 'runtime';
@@ -88,19 +89,19 @@ export interface TextEditorProps {
88
89
  /**
89
90
  * Callback fired when the editor is ready
90
91
  *
91
- * @since 10.19.0
92
+ * @since 0.0.1
92
93
  */
93
94
  onInit?: (editor: ClassicEditor) => void;
94
95
  /**
95
96
  * Callback fired after the editor instance is destroyed
96
97
  *
97
- * @since 10.19.0
98
+ * @since 0.0.1
98
99
  */
99
100
  onAfterDestroy?: () => void;
100
101
  /**
101
102
  * Callback fired when the editor becomes dirty (content differs from initial value)
102
103
  *
103
- * @since 12.26.0
104
+ * @since 0.0.1
104
105
  */
105
106
  onDirty?: () => void;
106
107
  /**
@@ -108,7 +109,7 @@ export interface TextEditorProps {
108
109
  *
109
110
  * @param event - The keyboard event
110
111
  * @param editor - The CKEditor instance
111
- * @since 12.29.0
112
+ * @since 0.0.1
112
113
  */
113
114
  onKeyDown?: (event: KeyboardEvent, editor: ClassicEditor) => void;
114
115
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TextEditor.types.js","names":[],"sources":["../../src/TextEditor/TextEditor.types.ts"],"sourcesContent":["import type { Locale } from '@procore/core-react'\nimport type { ClassicEditor, EditorConfig, EventInfo } from 'ckeditor5'\n\nexport interface TextEditorProps {\n /**\n * Unique identifier for the editor\n *\n * @since 10.19.0\n */\n id?: string\n\n /**\n * Initial value of the editor\n *\n * @deprecated `initialValue` has been deprecated and will be removed in a future version.\n * Please use the `value` prop instead\n * @deprecatedSince 10.20.0\n * @since 10.19.0\n */\n initialValue?: string\n\n /**\n * The current value of the editor\n *\n * @since 10.19.0\n */\n value?: string\n\n /**\n * Indicates if the editor is disabled\n *\n * @since 10.19.0\n */\n disabled?: boolean\n\n /**\n * Indicates if the editor is in an error state\n *\n * @since 10.19.0\n */\n error?: boolean\n\n /**\n * Locale which will be used for localization. Can be passed directly or\n * set by wrapping components in I18n provider.\n * @since 10.19.0\n */\n locale?: Locale\n\n /**\n * Array of plugin names to add to the editor in addition to the defaults.\n * This provides backward compatibility with the deprecated TinyMCE version of the editor.\n * Supports plugin names like 'link', 'image', 'table', etc.\n *\n * @since 12.26.0\n */\n plugins?: string[]\n\n /**\n * Configuration function for customizing the editor\n *\n * @param defaultConfig - The default CKEditor configuration\n * @returns Customized configuration object\n * @since 12.26.0\n */\n config?: (defaultConfig: EditorConfig) => EditorConfig\n\n /**\n * Callback fired when the editor content changes\n *\n * @param value - The current content of the editor\n * @param isDirty - Whether the content differs from the initial value\n * @since 10.19.0\n */\n onChange?: (value: string, isDirty?: boolean) => void\n\n /**\n * Callback fired when the editor gains focus\n *\n * @since 10.19.0\n */\n onFocus?: (event: EventInfo, editor: ClassicEditor) => void\n\n /**\n * Callback fired when the editor loses focus\n *\n * @since 10.19.0\n */\n onBlur?: (event: EventInfo, editor: ClassicEditor) => void\n\n /**\n * Callback fired when an error occurs in the editor\n *\n * @since 10.19.0\n */\n onError?: (\n error: Error,\n details: {\n phase: 'initialization' | 'runtime'\n willEditorRestart?: boolean\n }\n ) => void\n\n /**\n * Callback fired when the editor is ready\n *\n * @since 10.19.0\n */\n onInit?: (editor: ClassicEditor) => void\n\n /**\n * Callback fired after the editor instance is destroyed\n *\n * @since 10.19.0\n */\n onAfterDestroy?: () => void\n\n /**\n * Callback fired when the editor becomes dirty (content differs from initial value)\n *\n * @since 12.26.0\n */\n onDirty?: () => void\n\n /**\n * Callback fired when a key is pressed in the editor\n *\n * @param event - The keyboard event\n * @param editor - The CKEditor instance\n * @since 12.29.0\n */\n onKeyDown?: (event: KeyboardEvent, editor: ClassicEditor) => void\n}\n\nexport type KeyDownListener = (\n event: EventInfo,\n data: { domEvent: Event }\n) => void\n"],"mappings":""}
1
+ {"version":3,"file":"TextEditor.types.js","names":[],"sources":["../../src/TextEditor/TextEditor.types.ts"],"sourcesContent":["import type { Locale } from '@procore/globalization-toolkit'\nimport type { ClassicEditor, EventInfo } from 'ckeditor5'\n\nexport interface TextEditorProps {\n /**\n * Unique identifier for the editor\n *\n * @since 0.0.1\n */\n id?: string\n\n /**\n * Initial value of the editor\n *\n * @deprecated `initialValue` has been deprecated and will be removed in a future version.\n * Please use the `value` prop instead\n * @deprecatedSince 0.0.1\n * @since 0.0.1\n */\n initialValue?: string\n\n /**\n * The current value of the editor\n *\n * @since 0.0.1\n */\n value?: string\n\n /**\n * Indicates if the editor is disabled\n *\n * @since 0.0.1\n */\n disabled?: boolean\n\n /**\n * Indicates if the editor is in an error state\n *\n * @since 0.0.1\n */\n error?: boolean\n\n /**\n * Accessible label for the editor's editable area. This text will be\n * announced by screen readers when the user focuses the editor. It should\n * match or include the visible label associated with this editor field.\n * If not provided, screen readers will announce a generic \"Rich Text Editor\" message.\n *\n * @since 0.1.0\n */\n 'aria-label'?: string\n\n /**\n * Accessible description for the editor's editable area.\n * This text provides additional context to screen reader users. It will be\n * announced after the label when the user focuses the editor.\n *\n * @since 0.1.0\n */\n 'aria-description'?: string\n\n /**\n * Locale which will be used for localization. Can be passed directly or\n * set by wrapping components in I18n provider.\n * @since 0.0.1\n */\n locale?: Locale\n\n /**\n * Callback fired when the editor content changes\n *\n * @param value - The current content of the editor\n * @param isDirty - Whether the content differs from the initial value\n * @since 0.0.1\n */\n onChange?: (value: string, isDirty?: boolean) => void\n\n /**\n * Callback fired when the editor gains focus\n *\n * @since 0.0.1\n */\n onFocus?: (event: EventInfo, editor: ClassicEditor) => void\n\n /**\n * Callback fired when the editor loses focus\n *\n * @since 0.0.1\n */\n onBlur?: (event: EventInfo, editor: ClassicEditor) => void\n\n /**\n * Callback fired when an error occurs in the editor\n *\n * @since 0.0.1\n */\n onError?: (\n error: Error,\n details: {\n phase: 'initialization' | 'runtime'\n willEditorRestart?: boolean\n }\n ) => void\n\n /**\n * Callback fired when the editor is ready\n *\n * @since 0.0.1\n */\n onInit?: (editor: ClassicEditor) => void\n\n /**\n * Callback fired after the editor instance is destroyed\n *\n * @since 0.0.1\n */\n onAfterDestroy?: () => void\n\n /**\n * Callback fired when the editor becomes dirty (content differs from initial value)\n *\n * @since 0.0.1\n */\n onDirty?: () => void\n\n /**\n * Callback fired when a key is pressed in the editor\n *\n * @param event - The keyboard event\n * @param editor - The CKEditor instance\n * @since 0.0.1\n */\n onKeyDown?: (event: KeyboardEvent, editor: ClassicEditor) => void\n}\n\nexport type KeyDownListener = (\n event: EventInfo,\n data: { domEvent: Event }\n) => void\n"],"mappings":""}
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  export var TextEditorContext = /*#__PURE__*/React.createContext({
3
3
  features: {
4
- tabAsNavigation: undefined,
4
+ tabAsNavigation: true,
5
5
  stickyToolbar: undefined
6
6
  }
7
7
  });
@@ -1 +1 @@
1
- {"version":3,"file":"TextEditorProvider.js","names":["React","TextEditorContext","createContext","features","tabAsNavigation","undefined","stickyToolbar","TextEditorProvider","_ref","children","createElement","Provider","value"],"sources":["../../src/TextEditor/TextEditorProvider.tsx"],"sourcesContent":["import React from 'react'\nimport type { TextEditorProviderProps } from './TextEditorProvider.types'\n\nexport const TextEditorContext = React.createContext<\n Omit<TextEditorProviderProps, 'children'>\n>({\n features: {\n tabAsNavigation: undefined,\n stickyToolbar: undefined,\n },\n})\n\nexport function TextEditorProvider({\n children,\n features,\n}: TextEditorProviderProps) {\n return (\n <TextEditorContext.Provider value={{ features }}>\n {children}\n </TextEditorContext.Provider>\n )\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAGzB,OAAO,IAAMC,iBAAiB,gBAAGD,KAAK,CAACE,aAAa,CAElD;EACAC,QAAQ,EAAE;IACRC,eAAe,EAAEC,SAAS;IAC1BC,aAAa,EAAED;EACjB;AACF,CAAC,CAAC;AAEF,OAAO,SAASE,kBAAkBA,CAAAC,IAAA,EAGN;EAAA,IAF1BC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRN,QAAQ,GAAAK,IAAA,CAARL,QAAQ;EAER,oBACEH,KAAA,CAAAU,aAAA,CAACT,iBAAiB,CAACU,QAAQ;IAACC,KAAK,EAAE;MAAET,QAAQ,EAARA;IAAS;EAAE,GAC7CM,QACyB,CAAC;AAEjC"}
1
+ {"version":3,"file":"TextEditorProvider.js","names":["React","TextEditorContext","createContext","features","tabAsNavigation","stickyToolbar","undefined","TextEditorProvider","_ref","children","createElement","Provider","value"],"sources":["../../src/TextEditor/TextEditorProvider.tsx"],"sourcesContent":["import React from 'react'\nimport type { TextEditorProviderProps } from './TextEditorProvider.types'\n\nexport const TextEditorContext = React.createContext<\n Omit<TextEditorProviderProps, 'children'>\n>({\n features: {\n tabAsNavigation: true,\n stickyToolbar: undefined,\n },\n})\n\nexport function TextEditorProvider({\n children,\n features,\n}: TextEditorProviderProps) {\n return (\n <TextEditorContext.Provider value={{ features }}>\n {children}\n </TextEditorContext.Provider>\n )\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAGzB,OAAO,IAAMC,iBAAiB,gBAAGD,KAAK,CAACE,aAAa,CAElD;EACAC,QAAQ,EAAE;IACRC,eAAe,EAAE,IAAI;IACrBC,aAAa,EAAEC;EACjB;AACF,CAAC,CAAC;AAEF,OAAO,SAASC,kBAAkBA,CAAAC,IAAA,EAGN;EAAA,IAF1BC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRN,QAAQ,GAAAK,IAAA,CAARL,QAAQ;EAER,oBACEH,KAAA,CAAAU,aAAA,CAACT,iBAAiB,CAACU,QAAQ;IAACC,KAAK,EAAE;MAAET,QAAQ,EAARA;IAAS;EAAE,GAC7CM,QACyB,CAAC;AAEjC"}
@@ -12,6 +12,8 @@ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? O
12
12
  function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
13
13
  function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
14
14
  import { Plugin, toWidget, viewToModelPositionOutsideModelElement, Widget } from 'ckeditor5';
15
+
16
+ // TODO - delete
15
17
  export var TabSpacesPlugin = /*#__PURE__*/function (_Plugin) {
16
18
  function TabSpacesPlugin() {
17
19
  _classCallCheck(this, TabSpacesPlugin);
@@ -1 +1 @@
1
- {"version":3,"file":"TabSpacesPlugin.js","names":["Plugin","toWidget","viewToModelPositionOutsideModelElement","Widget","TabSpacesPlugin","_Plugin","_classCallCheck","_callSuper","arguments","_inherits","_createClass","key","value","init","editor","model","doc","document","schema","register","allowWhere","isInline","isObject","editing","mapper","on","viewElement","hasClass","conversion","elementToElement","view","modelItem","_ref","viewWriter","writer","span","createContainerElement","contenteditable","insert","createPositionAt","createText","label","_ref2","name","classes","keystrokes","set","evtData","cancel","change","tab","createElement","insertContent","selection","get"],"sources":["../../../../src/TextEditor/plugins/TabSpacesPlugin/TabSpacesPlugin.ts"],"sourcesContent":["import type { Editor } from 'ckeditor5'\nimport {\n Plugin,\n toWidget,\n viewToModelPositionOutsideModelElement,\n Widget,\n} from 'ckeditor5'\n\nexport class TabSpacesPlugin extends Plugin {\n static get requires() {\n return [Widget]\n }\n\n static get pluginName() {\n return 'TabSpacesPlugin'\n }\n\n init(): void {\n const editor = this.editor as Editor\n const model = editor.model\n const doc = model.document\n\n model.schema.register('tab', {\n allowWhere: '$text',\n isInline: true,\n isObject: true,\n })\n\n editor.editing.mapper.on(\n 'viewToModelPosition',\n viewToModelPositionOutsideModelElement(model, (viewElement) =>\n viewElement.hasClass('ck-tab')\n )\n )\n\n editor.conversion.for('editingDowncast').elementToElement({\n model: 'tab',\n view: (modelItem, { writer: viewWriter }) => {\n const span = viewWriter.createContainerElement('span', {\n class: 'ck-tab',\n contenteditable: 'false',\n })\n viewWriter.insert(\n viewWriter.createPositionAt(span, 0),\n viewWriter.createText('\\u00A0\\u00A0\\u00A0')\n )\n\n return toWidget(span, viewWriter, { label: 'tab spaces' })\n },\n })\n\n editor.conversion.for('dataDowncast').elementToElement({\n model: 'tab',\n view: (modelItem, { writer: viewWriter }) => {\n const span = viewWriter.createContainerElement('span', {\n class: 'ck-tab',\n })\n viewWriter.insert(\n viewWriter.createPositionAt(span, 0),\n viewWriter.createText('\\u00A0\\u00A0\\u00A0')\n )\n return span\n },\n })\n\n editor.conversion.for('upcast').elementToElement({\n view: {\n name: 'span',\n classes: 'ck-tab',\n },\n model: 'tab',\n })\n\n editor.keystrokes.set('Tab', (evtData, cancel) => {\n model.change((writer) => {\n const tab = writer.createElement('tab')\n model.insertContent(tab, doc.selection)\n })\n cancel()\n })\n }\n}\n"],"mappings":";;;;;;;;;;;;;AACA,SACEA,MAAM,EACNC,QAAQ,EACRC,sCAAsC,EACtCC,MAAM,QACD,WAAW;AAElB,WAAaC,eAAe,0BAAAC,OAAA;EAAA,SAAAD,gBAAA;IAAAE,eAAA,OAAAF,eAAA;IAAA,OAAAG,UAAA,OAAAH,eAAA,EAAAI,SAAA;EAAA;EAAAC,SAAA,CAAAL,eAAA,EAAAC,OAAA;EAAA,OAAAK,YAAA,CAAAN,eAAA;IAAAO,GAAA;IAAAC,KAAA,EAS1B,SAAAC,IAAIA,CAAA,EAAS;MACX,IAAMC,MAAM,GAAG,IAAI,CAACA,MAAgB;MACpC,IAAMC,KAAK,GAAGD,MAAM,CAACC,KAAK;MAC1B,IAAMC,GAAG,GAAGD,KAAK,CAACE,QAAQ;MAE1BF,KAAK,CAACG,MAAM,CAACC,QAAQ,CAAC,KAAK,EAAE;QAC3BC,UAAU,EAAE,OAAO;QACnBC,QAAQ,EAAE,IAAI;QACdC,QAAQ,EAAE;MACZ,CAAC,CAAC;MAEFR,MAAM,CAACS,OAAO,CAACC,MAAM,CAACC,EAAE,CACtB,qBAAqB,EACrBvB,sCAAsC,CAACa,KAAK,EAAE,UAACW,WAAW;QAAA,OACxDA,WAAW,CAACC,QAAQ,CAAC,QAAQ,CAAC;MAAA,CAChC,CACF,CAAC;MAEDb,MAAM,CAACc,UAAU,OAAI,CAAC,iBAAiB,CAAC,CAACC,gBAAgB,CAAC;QACxDd,KAAK,EAAE,KAAK;QACZe,IAAI,EAAE,SAANA,IAAIA,CAAGC,SAA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M,EAAK;UACvB,IAAMgB,GAAG,GAAGhB,MAAM,CAACiB,aAAa,CAAC,KAAK,CAAC;UACvCpC,KAAK,CAACqC,aAAa,CAACF,GAAG,EAAElC,GAAG,CAACqC,SAAS,CAAC;QACzC,CAAC,CAAC;QACFL,MAAM,CAAC,CAAC;MACV,CAAC,CAAC;IACJ;EAAC;IAAArC,GAAA;IAAA2C,GAAA,EAvED,SAAAA,IAAA,EAAsB;MACpB,OAAO,CAACnD,MAAM,CAAC;IACjB;EAAC;IAAAQ,GAAA;IAAA2C,GAAA,EAED,SAAAA,IAAA,EAAwB;MACtB,OAAO,iBAAiB;IAC1B;EAAC;AAAA,EAPkCtD,MAAM"}
1
+ {"version":3,"file":"TabSpacesPlugin.js","names":["Plugin","toWidget","viewToModelPositionOutsideModelElement","Widget","TabSpacesPlugin","_Plugin","_classCallCheck","_callSuper","arguments","_inherits","_createClass","key","value","init","editor","model","doc","document","schema","register","allowWhere","isInline","isObject","editing","mapper","on","viewElement","hasClass","conversion","elementToElement","view","modelItem","_ref","viewWriter","writer","span","createContainerElement","contenteditable","insert","createPositionAt","createText","label","_ref2","name","classes","keystrokes","set","evtData","cancel","change","tab","createElement","insertContent","selection","get"],"sources":["../../../../src/TextEditor/plugins/TabSpacesPlugin/TabSpacesPlugin.ts"],"sourcesContent":["import type { Editor } from 'ckeditor5'\nimport {\n Plugin,\n toWidget,\n viewToModelPositionOutsideModelElement,\n Widget,\n} from 'ckeditor5'\n\n// TODO - delete\nexport class TabSpacesPlugin extends Plugin {\n static get requires() {\n return [Widget]\n }\n\n static get pluginName() {\n return 'TabSpacesPlugin'\n }\n\n init(): void {\n const editor = this.editor as Editor\n const model = editor.model\n const doc = model.document\n\n model.schema.register('tab', {\n allowWhere: '$text',\n isInline: true,\n isObject: true,\n })\n\n editor.editing.mapper.on(\n 'viewToModelPosition',\n viewToModelPositionOutsideModelElement(model, (viewElement) =>\n viewElement.hasClass('ck-tab')\n )\n )\n\n editor.conversion.for('editingDowncast').elementToElement({\n model: 'tab',\n view: (modelItem, { writer: viewWriter }) => {\n const span = viewWriter.createContainerElement('span', {\n class: 'ck-tab',\n contenteditable: 'false',\n })\n viewWriter.insert(\n viewWriter.createPositionAt(span, 0),\n viewWriter.createText('\\u00A0\\u00A0\\u00A0')\n )\n\n return toWidget(span, viewWriter, { label: 'tab spaces' })\n },\n })\n\n editor.conversion.for('dataDowncast').elementToElement({\n model: 'tab',\n view: (modelItem, { writer: viewWriter }) => {\n const span = viewWriter.createContainerElement('span', {\n class: 'ck-tab',\n })\n viewWriter.insert(\n viewWriter.createPositionAt(span, 0),\n viewWriter.createText('\\u00A0\\u00A0\\u00A0')\n )\n return span\n },\n })\n\n editor.conversion.for('upcast').elementToElement({\n view: {\n name: 'span',\n classes: 'ck-tab',\n },\n model: 'tab',\n })\n\n editor.keystrokes.set('Tab', (evtData, cancel) => {\n model.change((writer) => {\n const tab = writer.createElement('tab')\n model.insertContent(tab, doc.selection)\n })\n cancel()\n })\n }\n}\n"],"mappings":";;;;;;;;;;;;;AACA,SACEA,MAAM,EACNC,QAAQ,EACRC,sCAAsC,EACtCC,MAAM,QACD,WAAW;;AAElB;AACA,WAAaC,eAAe,0BAAAC,OAAA;EAAA,SAAAD,gBAAA;IAAAE,eAAA,OAAAF,eAAA;IAAA,OAAAG,UAAA,OAAAH,eAAA,EAAAI,SAAA;EAAA;EAAAC,SAAA,CAAAL,eAAA,EAAAC,OAAA;EAAA,OAAAK,YAAA,CAAAN,eAAA;IAAAO,GAAA;IAAAC,KAAA,EAS1B,SAAAC,IAAIA,CAAA,EAAS;MACX,IAAMC,MAAM,GAAG,IAAI,CAACA,MAAgB;MACpC,IAAMC,KAAK,GAAGD,MAAM,CAACC,KAAK;MAC1B,IAAMC,GAAG,GAAGD,KAAK,CAACE,QAAQ;MAE1BF,KAAK,CAACG,MAAM,CAACC,QAAQ,CAAC,KAAK,EAAE;QAC3BC,UAAU,EAAE,OAAO;QACnBC,QAAQ,EAAE,IAAI;QACdC,Q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;UACD,OAAOL,IAAI;QACb;MACF,CAAC,CAAC;MAEFrB,MAAM,CAACc,UAAU,OAAI,CAAC,QAAQ,CAAC,CAACC,gBAAgB,CAAC;QAC/CC,IAAI,EAAE;UACJa,IAAI,EAAE,MAAM;UACZC,OAAO,EAAE;QACX,CAAC;QACD7B,KAAK,EAAE;MACT,CAAC,CAAC;MAEFD,MAAM,CAAC+B,UAAU,CAACC,GAAG,CAAC,KAAK,EAAE,UAACC,OAAO,EAAEC,MAAM,EAAK;QAChDjC,KAAK,CAACkC,MAAM,CAAC,UAACf,MAAM,EAAK;UACvB,IAAMgB,GAAG,GAAGhB,MAAM,CAACiB,aAAa,CAAC,KAAK,CAAC;UACvCpC,KAAK,CAACqC,aAAa,CAACF,GAAG,EAAElC,GAAG,CAACqC,SAAS,CAAC;QACzC,CAAC,CAAC;QACFL,MAAM,CAAC,CAAC;MACV,CAAC,CAAC;IACJ;EAAC;IAAArC,GAAA;IAAA2C,GAAA,EAvED,SAAAA,IAAA,EAAsB;MACpB,OAAO,CAACnD,MAAM,CAAC;IACjB;EAAC;IAAAQ,GAAA;IAAA2C,GAAA,EAED,SAAAA,IAAA,EAAwB;MACtB,OAAO,iBAAiB;IAC1B;EAAC;AAAA,EAPkCtD,MAAM"}
@@ -1,3 +1,4 @@
1
+ import { colors, spacing } from '@procore/core-react';
1
2
  import { createGlobalStyle } from 'styled-components';
2
3
  import { alignCenterIcon, alignLeftIcon, alignRightIcon, bgColorIcon, boldIcon, checkmarkIcon, cutIcon, fontSizeIcon, imageIcon, indentIcon, italicIcon, linkIcon, orderedListIcon, outdentIcon, pasteAsTextIcon, pasteIcon, redoIcon, strikeThroughIcon, tableIcon, textColorIcon, underlineIcon, undoIcon, unorderedListIcon } from './icons';
3
4
  var getIconUrl = function getIconUrl(icon) {
@@ -6,5 +7,5 @@ var getIconUrl = function getIconUrl(icon) {
6
7
  }
7
8
  return "data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(icon));
8
9
  };
9
- export var TextEditorTheme = /*#__PURE__*/createGlobalStyle([".ck-button:first-child .ck-icon:first-child{background-size:24px;background-repeat:no-repeat;background-position:center;}[data-cke-command=\"bold\"],[data-cke-command=\"italic\"],[data-cke-command=\"underline\"],[data-cke-command=\"strikethrough\"],[data-cke-command=\"alignment:left\"],[data-cke-command=\"alignment:center\"],[data-cke-command=\"alignment:right\"],[data-cke-command=\"bulletedList\"],[data-cke-command=\"numberedList\"],[data-cke-command=\"outdent\"],[data-cke-command=\"indent\"],[data-cke-command=\"cut\"],[data-cke-command=\"paste\"],[data-cke-command=\"pasteAsText\"],[data-cke-command=\"fontSize\"],[data-cke-command=\"fontColor\"],[data-cke-command=\"fontBackgroundColor\"],[data-cke-command=\"link\"],[data-cke-command=\"insertTable\"],[data-cke-command=\"insertImageViaUrl\"],[data-cke-command=\"undo\"],[data-cke-command=\"redo\"]{> .ck-icon:first-child > *,> .ck-button:first-child > .ck-icon:first-child > *,> .ck-splitbutton > .ck-button:first-child > .ck-icon:first-child > *{display:none;}> .ck-icon:first-child,> .ck-splitbutton > .ck-button:first-child .ck-icon:first-child,> .ck-button > .ck-icon:first-child{width:24px !important;height:24px !important;}}[data-cke-command=\"bold\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"italic\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"underline\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"strikethrough\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"alignment:left\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"alignment:center\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"alignment:right\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"bulletedList\"] > .ck-splitbutton > .ck-button:first-child .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"numberedList\"] > .ck-splitbutton > .ck-button:first-child .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"outdent\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"indent\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"cut\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"paste\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"pasteAsText\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"fontSize\"] > .ck-button > .ck-icon:first-child{background-image:url('", "');background-size:19px;}[data-cke-command=\"fontColor\"] > .ck-button > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"fontBackgroundColor\"] > .ck-button > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"link\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"insertTable\"] > .ck-button > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"insertImageViaUrl\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"undo\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"redo\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"fontSize\"] .ck-dropdown__panel{max-width:130px !important;.ck-list__item{min-width:128px !important;}.ck-list{.ck-button{padding:4px 12px !important;font-size:14px !important;line-height:24px !important;.ck-button__label{font-size:14px !important;font-weight:normal !important;font-family:inherit !important;line-height:24px !important;}&[data-cke-tooltip-text]{font-size:14px !important;.ck-button__label{font-size:14px !important;}}&.ck-on{position:relative;padding-right:32px !important;&::after{content:\"\";position:absolute;right:8px;top:50%;transform:translateY(-50%);width:24px !important;height:24px !important;background-image:url('", "');background-size:24px 24px;background-repeat:no-repeat;background-position:center;line-height:1;}}}}.ck-list-item-button__check-holder{display:none !important;}}"], getIconUrl(boldIcon), getIconUrl(italicIcon), getIconUrl(underlineIcon), getIconUrl(strikeThroughIcon), getIconUrl(alignLeftIcon), getIconUrl(alignCenterIcon), getIconUrl(alignRightIcon), getIconUrl(unorderedListIcon), getIconUrl(orderedListIcon), getIconUrl(outdentIcon), getIconUrl(indentIcon), getIconUrl(cutIcon), getIconUrl(pasteIcon), getIconUrl(pasteAsTextIcon), getIconUrl(fontSizeIcon), getIconUrl(textColorIcon), getIconUrl(bgColorIcon), getIconUrl(linkIcon), getIconUrl(tableIcon), getIconUrl(imageIcon), getIconUrl(undoIcon), getIconUrl(redoIcon), getIconUrl(checkmarkIcon));
10
+ export var TextEditorTheme = /*#__PURE__*/createGlobalStyle([".ck-button:first-child .ck-icon:first-child{background-size:24px;background-repeat:no-repeat;background-position:center;}.ck-link-form .ck-button-action{font-size:13px !important;line-height:", " !important;background:", " !important;color:", " !important;border-radius:", " !important;font-family:inherit !important;font-weight:600 !important;height:", " !important;justify-content:center !important;align-items:center !important;cursor:pointer !important;&:hover{background:", " !important;}}[data-cke-command=\"bold\"],[data-cke-command=\"italic\"],[data-cke-command=\"underline\"],[data-cke-command=\"strikethrough\"],[data-cke-command=\"alignment:left\"],[data-cke-command=\"alignment:center\"],[data-cke-command=\"alignment:right\"],[data-cke-command=\"bulletedList\"],[data-cke-command=\"numberedList\"],[data-cke-command=\"outdent\"],[data-cke-command=\"indent\"],[data-cke-command=\"cut\"],[data-cke-command=\"paste\"],[data-cke-command=\"pasteAsText\"],[data-cke-command=\"fontSize\"],[data-cke-command=\"fontColor\"],[data-cke-command=\"fontBackgroundColor\"],[data-cke-command=\"link\"],[data-cke-command=\"insertTable\"],[data-cke-command=\"insertImageViaUrl\"],[data-cke-command=\"undo\"],[data-cke-command=\"redo\"]{> .ck-icon:first-child > *,> .ck-button:first-child > .ck-icon:first-child > *,> .ck-splitbutton > .ck-button:first-child > .ck-icon:first-child > *{display:none;}> .ck-icon:first-child,> .ck-splitbutton > .ck-button:first-child .ck-icon:first-child,> .ck-button > .ck-icon:first-child{width:24px !important;height:24px !important;}}[data-cke-command=\"bold\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"italic\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"underline\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"strikethrough\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"alignment:left\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"alignment:center\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"alignment:right\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"bulletedList\"] > .ck-splitbutton > .ck-button:first-child .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"numberedList\"] > .ck-splitbutton > .ck-button:first-child .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"outdent\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"indent\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"cut\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"paste\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"pasteAsText\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"fontSize\"] > .ck-button > .ck-icon:first-child{background-image:url('", "');background-size:19px;}[data-cke-command=\"fontColor\"] > .ck-button > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"fontBackgroundColor\"] > .ck-button > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"link\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"insertTable\"] > .ck-button > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"insertImageViaUrl\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"undo\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"redo\"] > .ck-icon:first-child{background-image:url('", "');}[data-cke-command=\"fontSize\"] .ck-dropdown__panel{max-width:130px !important;.ck-list__item{min-width:128px !important;}.ck-list{.ck-button{padding:4px 12px !important;font-size:14px !important;line-height:24px !important;.ck-button__label{font-size:14px !important;font-weight:normal !important;font-family:inherit !important;line-height:24px !important;}&[data-cke-tooltip-text]{font-size:14px !important;.ck-button__label{font-size:14px !important;}}&.ck-on{position:relative;padding-right:32px !important;&::after{content:\"\";position:absolute;right:8px;top:50%;transform:translateY(-50%);width:24px !important;height:24px !important;background-image:url('", "');background-size:24px 24px;background-repeat:no-repeat;background-position:center;line-height:1;}}}}.ck-list-item-button__check-holder{display:none !important;}}"], spacing.lg, colors.gray90, colors.gray15, spacing.xs, spacing.xl, colors.gray85, getIconUrl(boldIcon), getIconUrl(italicIcon), getIconUrl(underlineIcon), getIconUrl(strikeThroughIcon), getIconUrl(alignLeftIcon), getIconUrl(alignCenterIcon), getIconUrl(alignRightIcon), getIconUrl(unorderedListIcon), getIconUrl(orderedListIcon), getIconUrl(outdentIcon), getIconUrl(indentIcon), getIconUrl(cutIcon), getIconUrl(pasteIcon), getIconUrl(pasteAsTextIcon), getIconUrl(fontSizeIcon), getIconUrl(textColorIcon), getIconUrl(bgColorIcon), getIconUrl(linkIcon), getIconUrl(tableIcon), getIconUrl(imageIcon), getIconUrl(undoIcon), getIconUrl(redoIcon), getIconUrl(checkmarkIcon));
10
11
  //# sourceMappingURL=textEditorTheming.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"textEditorTheming.styles.js","names":["createGlobalStyle","alignCenterIcon","alignLeftIcon","alignRightIcon","bgColorIcon","boldIcon","checkmarkIcon","cutIcon","fontSizeIcon","imageIcon","indentIcon","italicIcon","linkIcon","orderedListIcon","outdentIcon","pasteAsTextIcon","pasteIcon","redoIcon","strikeThroughIcon","tableIcon","textColorIcon","underlineIcon","undoIcon","unorderedListIcon","getIconUrl","icon","startsWith","concat","encodeURIComponent","TextEditorTheme"],"sources":["../../../src/TextEditor/textEditorTheming/textEditorTheming.styles.ts"],"sourcesContent":["import { createGlobalStyle } from 'styled-components'\nimport {\n alignCenterIcon,\n alignLeftIcon,\n alignRightIcon,\n bgColorIcon,\n boldIcon,\n checkmarkIcon,\n cutIcon,\n fontSizeIcon,\n imageIcon,\n indentIcon,\n italicIcon,\n linkIcon,\n orderedListIcon,\n outdentIcon,\n pasteAsTextIcon,\n pasteIcon,\n redoIcon,\n strikeThroughIcon,\n tableIcon,\n textColorIcon,\n underlineIcon,\n undoIcon,\n unorderedListIcon,\n} from './icons'\n\nconst getIconUrl = (icon: string) => {\n if (icon.startsWith('data:')) {\n return icon\n }\n return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(icon)}`\n}\n\nexport const TextEditorTheme = createGlobalStyle`\n .ck-button:first-child .ck-icon:first-child {\n background-size: 24px;\n background-repeat: no-repeat;\n background-position: center;\n }\n\n [data-cke-command=\"bold\"],\n [data-cke-command=\"italic\"],\n [data-cke-command=\"underline\"],\n [data-cke-command=\"strikethrough\"],\n [data-cke-command=\"alignment:left\"],\n [data-cke-command=\"alignment:center\"],\n [data-cke-command=\"alignment:right\"],\n [data-cke-command=\"bulletedList\"],\n [data-cke-command=\"numberedList\"],\n [data-cke-command=\"outdent\"],\n [data-cke-command=\"indent\"],\n [data-cke-command=\"cut\"],\n [data-cke-command=\"paste\"],\n [data-cke-command=\"pasteAsText\"],\n [data-cke-command=\"fontSize\"],\n [data-cke-command=\"fontColor\"],\n [data-cke-command=\"fontBackgroundColor\"],\n [data-cke-command=\"link\"],\n [data-cke-command=\"insertTable\"],\n [data-cke-command=\"insertImageViaUrl\"],\n [data-cke-command=\"undo\"],\n [data-cke-command=\"redo\"] {\n > .ck-icon:first-child > *,\n > .ck-button:first-child > .ck-icon:first-child > *,\n > .ck-splitbutton > .ck-button:first-child > .ck-icon:first-child > * {\n display: none;\n }\n\n > .ck-icon:first-child,\n > .ck-splitbutton > .ck-button:first-child .ck-icon:first-child,\n > .ck-button > .ck-icon:first-child {\n width: 24px !important;\n height: 24px !important;\n }\n }\n\n [data-cke-command=\"bold\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(boldIcon)}');\n }\n\n [data-cke-command=\"italic\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(italicIcon)}');\n }\n\n [data-cke-command=\"underline\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(underlineIcon)}');\n }\n\n [data-cke-command=\"strikethrough\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(strikeThroughIcon)}');\n }\n\n [data-cke-command=\"alignment:left\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(alignLeftIcon)}');\n }\n\n [data-cke-command=\"alignment:center\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(alignCenterIcon)}');\n }\n\n [data-cke-command=\"alignment:right\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(alignRightIcon)}');\n }\n\n [data-cke-command=\"bulletedList\"] > .ck-splitbutton > .ck-button:first-child .ck-icon:first-child {\n background-image: url('${getIconUrl(unorderedListIcon)}');\n }\n\n [data-cke-command=\"numberedList\"] > .ck-splitbutton > .ck-button:first-child .ck-icon:first-child {\n background-image: url('${getIconUrl(orderedListIcon)}');\n }\n\n [data-cke-command=\"outdent\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(outdentIcon)}');\n }\n\n [data-cke-command=\"indent\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(indentIcon)}');\n }\n\n [data-cke-command=\"cut\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(cutIcon)}');\n }\n\n [data-cke-command=\"paste\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(pasteIcon)}');\n }\n\n [data-cke-command=\"pasteAsText\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(pasteAsTextIcon)}');\n }\n\n [data-cke-command=\"fontSize\"] > .ck-button > .ck-icon:first-child {\n background-image: url('${getIconUrl(fontSizeIcon)}');\n background-size: 19px;\n }\n\n [data-cke-command=\"fontColor\"] > .ck-button > .ck-icon:first-child {\n background-image: url('${getIconUrl(textColorIcon)}');\n }\n\n [data-cke-command=\"fontBackgroundColor\"] > .ck-button > .ck-icon:first-child {\n background-image: url('${getIconUrl(bgColorIcon)}');\n }\n [data-cke-command=\"link\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(linkIcon)}');\n }\n\n [data-cke-command=\"insertTable\"] > .ck-button > .ck-icon:first-child {\n background-image: url('${getIconUrl(tableIcon)}');\n }\n\n [data-cke-command=\"insertImageViaUrl\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(imageIcon)}');\n }\n\n [data-cke-command=\"undo\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(undoIcon)}');\n }\n\n [data-cke-command=\"redo\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(redoIcon)}');\n }\n\n [data-cke-command=\"fontSize\"] .ck-dropdown__panel {\n max-width: 130px !important;\n\n .ck-list__item {\n min-width: 128px !important;\n }\n\n .ck-list {\n .ck-button {\n padding: 4px 12px !important;\n font-size: 14px !important;\n line-height: 24px !important;\n\n .ck-button__label {\n font-size: 14px !important;\n font-weight: normal !important;\n font-family: inherit !important;\n line-height: 24px !important;\n }\n\n &[data-cke-tooltip-text] {\n font-size: 14px !important;\n\n .ck-button__label {\n font-size: 14px !important;\n }\n }\n\n &.ck-on {\n position: relative;\n padding-right: 32px !important;\n\n &::after {\n content: \"\";\n position: absolute;\n right: 8px;\n top: 50%;\n transform: translateY(-50%);\n width: 24px !important;\n height: 24px !important;\n background-image: url('${getIconUrl(checkmarkIcon)}');\n background-size: 24px 24px;\n background-repeat: no-repeat;\n background-position: center;\n line-height: 1;\n }\n }\n }\n }\n\n .ck-list-item-button__check-holder {\n display: none !important;\n }\n }\n`\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,mBAAmB;AACrD,SACEC,eAAe,EACfC,aAAa,EACbC,cAAc,EACdC,WAAW,EACXC,QAAQ,EACRC,aAAa,EACbC,OAAO,EACPC,YAAY,EACZC,SAAS,EACTC,UAAU,EACVC,UAAU,EACVC,QAAQ,EACRC,eAAe,EACfC,WAAW,EACXC,eAAe,EACfC,SAAS,EACTC,QAAQ,EACRC,iBAAiB,EACjBC,SAAS,EACTC,aAAa,EACbC,aAAa,EACbC,QAAQ,EACRC,iBAAiB,QACZ,SAAS;AAEhB,IAAMC,UAAU,GAAG,SAAbA,UAAUA,CAAIC,IAAY,EAAK;EACnC,IAAIA,IAAI,CAACC,UAAU,CAAC,OAAO,CAAC,EAAE;IAC5B,OAAOD,IAAI;EACb;EACA,2CAAAE,MAAA,CAA2CC,kBAAkB,CAACH,IAAI,CAAC;AACrE,CAAC;AAED,OAAO,IAAMI,eAAe,gBAAG7B,iBAAiB,s/HA4CnBwB,UAAU,CAACnB,QAAQ,CAAC,EAIpBmB,UAAU,CAACb,UAAU,CAAC,EAItBa,UAAU,CAACH,aAAa,CAAC,EAIzBG,UAAU,CAACN,iBAAiB,CAAC,EAI7BM,UAAU,CAACtB,aAAa,CAAC,EAIzBsB,UAAU,CAACvB,eAAe,CAAC,EAI3BuB,UAAU,CAACrB,cAAc,CAAC,EAI1BqB,UAAU,CAACD,iBAAiB,CAAC,EAI7BC,UAAU,CAACX,eAAe,CAAC,EAI3BW,UAAU,CAACV,WAAW,CAAC,EAIvBU,UAAU,CAACd,UAAU,CAAC,EAItBc,UAAU,CAACjB,OAAO,CAAC,EAInBiB,UAAU,CAACR,SAAS,CAAC,EAIrBQ,UAAU,CAACT,eAAe,CAAC,EAI3BS,UAAU,CAAChB,YAAY,CAAC,EAKxBgB,UAAU,CAACJ,aAAa,CAAC,EAIzBI,UAAU,CAACpB,WAAW,CAAC,EAGvBoB,UAAU,CAACZ,QAAQ,CAAC,EAIpBY,UAAU,CAACL,SAAS,CAAC,EAIrBK,UAAU,CAACf,SAAS,CAAC,EAIrBe,UAAU,CAACF,QAAQ,CAAC,EAIpBE,UAAU,CAACP,QAAQ,CAAC,EA2CZO,UAAU,CAAClB,aAAa,CAAC,CAc7D"}
1
+ {"version":3,"file":"textEditorTheming.styles.js","names":["colors","spacing","createGlobalStyle","alignCenterIcon","alignLeftIcon","alignRightIcon","bgColorIcon","boldIcon","checkmarkIcon","cutIcon","fontSizeIcon","imageIcon","indentIcon","italicIcon","linkIcon","orderedListIcon","outdentIcon","pasteAsTextIcon","pasteIcon","redoIcon","strikeThroughIcon","tableIcon","textColorIcon","underlineIcon","undoIcon","unorderedListIcon","getIconUrl","icon","startsWith","concat","encodeURIComponent","TextEditorTheme","lg","gray90","gray15","xs","xl","gray85"],"sources":["../../../src/TextEditor/textEditorTheming/textEditorTheming.styles.ts"],"sourcesContent":["import { colors, spacing } from '@procore/core-react'\nimport { createGlobalStyle } from 'styled-components'\nimport {\n alignCenterIcon,\n alignLeftIcon,\n alignRightIcon,\n bgColorIcon,\n boldIcon,\n checkmarkIcon,\n cutIcon,\n fontSizeIcon,\n imageIcon,\n indentIcon,\n italicIcon,\n linkIcon,\n orderedListIcon,\n outdentIcon,\n pasteAsTextIcon,\n pasteIcon,\n redoIcon,\n strikeThroughIcon,\n tableIcon,\n textColorIcon,\n underlineIcon,\n undoIcon,\n unorderedListIcon,\n} from './icons'\n\nconst getIconUrl = (icon: string) => {\n if (icon.startsWith('data:')) {\n return icon\n }\n return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(icon)}`\n}\n\nexport const TextEditorTheme = createGlobalStyle`\n .ck-button:first-child .ck-icon:first-child {\n background-size: 24px;\n background-repeat: no-repeat;\n background-position: center;\n }\n\n .ck-link-form .ck-button-action {\n font-size: 13px !important;\n line-height: ${spacing.lg} !important;\n background: ${colors.gray90} !important;\n color: ${colors.gray15} !important;\n border-radius: ${spacing.xs} !important;\n font-family: inherit !important;\n font-weight: 600 !important;\n height: ${spacing.xl} !important;\n justify-content: center !important;\n align-items: center !important;\n cursor: pointer !important;\n \n &:hover {\n background: ${colors.gray85} !important;\n }\n }\n \n [data-cke-command=\"bold\"],\n [data-cke-command=\"italic\"],\n [data-cke-command=\"underline\"],\n [data-cke-command=\"strikethrough\"],\n [data-cke-command=\"alignment:left\"],\n [data-cke-command=\"alignment:center\"],\n [data-cke-command=\"alignment:right\"],\n [data-cke-command=\"bulletedList\"],\n [data-cke-command=\"numberedList\"],\n [data-cke-command=\"outdent\"],\n [data-cke-command=\"indent\"],\n [data-cke-command=\"cut\"],\n [data-cke-command=\"paste\"],\n [data-cke-command=\"pasteAsText\"],\n [data-cke-command=\"fontSize\"],\n [data-cke-command=\"fontColor\"],\n [data-cke-command=\"fontBackgroundColor\"],\n [data-cke-command=\"link\"],\n [data-cke-command=\"insertTable\"],\n [data-cke-command=\"insertImageViaUrl\"],\n [data-cke-command=\"undo\"],\n [data-cke-command=\"redo\"] {\n > .ck-icon:first-child > *,\n > .ck-button:first-child > .ck-icon:first-child > *,\n > .ck-splitbutton > .ck-button:first-child > .ck-icon:first-child > * {\n display: none;\n }\n\n > .ck-icon:first-child,\n > .ck-splitbutton > .ck-button:first-child .ck-icon:first-child,\n > .ck-button > .ck-icon:first-child {\n width: 24px !important;\n height: 24px !important;\n }\n }\n\n [data-cke-command=\"bold\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(boldIcon)}');\n }\n\n [data-cke-command=\"italic\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(italicIcon)}');\n }\n\n [data-cke-command=\"underline\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(underlineIcon)}');\n }\n\n [data-cke-command=\"strikethrough\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(strikeThroughIcon)}');\n }\n\n [data-cke-command=\"alignment:left\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(alignLeftIcon)}');\n }\n\n [data-cke-command=\"alignment:center\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(alignCenterIcon)}');\n }\n\n [data-cke-command=\"alignment:right\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(alignRightIcon)}');\n }\n\n [data-cke-command=\"bulletedList\"] > .ck-splitbutton > .ck-button:first-child .ck-icon:first-child {\n background-image: url('${getIconUrl(unorderedListIcon)}');\n }\n\n [data-cke-command=\"numberedList\"] > .ck-splitbutton > .ck-button:first-child .ck-icon:first-child {\n background-image: url('${getIconUrl(orderedListIcon)}');\n }\n\n [data-cke-command=\"outdent\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(outdentIcon)}');\n }\n\n [data-cke-command=\"indent\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(indentIcon)}');\n }\n\n [data-cke-command=\"cut\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(cutIcon)}');\n }\n\n [data-cke-command=\"paste\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(pasteIcon)}');\n }\n\n [data-cke-command=\"pasteAsText\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(pasteAsTextIcon)}');\n }\n\n [data-cke-command=\"fontSize\"] > .ck-button > .ck-icon:first-child {\n background-image: url('${getIconUrl(fontSizeIcon)}');\n background-size: 19px;\n }\n\n [data-cke-command=\"fontColor\"] > .ck-button > .ck-icon:first-child {\n background-image: url('${getIconUrl(textColorIcon)}');\n }\n\n [data-cke-command=\"fontBackgroundColor\"] > .ck-button > .ck-icon:first-child {\n background-image: url('${getIconUrl(bgColorIcon)}');\n }\n [data-cke-command=\"link\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(linkIcon)}');\n }\n\n [data-cke-command=\"insertTable\"] > .ck-button > .ck-icon:first-child {\n background-image: url('${getIconUrl(tableIcon)}');\n }\n\n [data-cke-command=\"insertImageViaUrl\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(imageIcon)}');\n }\n\n [data-cke-command=\"undo\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(undoIcon)}');\n }\n\n [data-cke-command=\"redo\"] > .ck-icon:first-child {\n background-image: url('${getIconUrl(redoIcon)}');\n }\n\n [data-cke-command=\"fontSize\"] .ck-dropdown__panel {\n max-width: 130px !important;\n\n .ck-list__item {\n min-width: 128px !important;\n }\n\n .ck-list {\n .ck-button {\n padding: 4px 12px !important;\n font-size: 14px !important;\n line-height: 24px !important;\n\n .ck-button__label {\n font-size: 14px !important;\n font-weight: normal !important;\n font-family: inherit !important;\n line-height: 24px !important;\n }\n\n &[data-cke-tooltip-text] {\n font-size: 14px !important;\n\n .ck-button__label {\n font-size: 14px !important;\n }\n }\n\n &.ck-on {\n position: relative;\n padding-right: 32px !important;\n\n &::after {\n content: \"\";\n position: absolute;\n right: 8px;\n top: 50%;\n transform: translateY(-50%);\n width: 24px !important;\n height: 24px !important;\n background-image: url('${getIconUrl(checkmarkIcon)}');\n background-size: 24px 24px;\n background-repeat: no-repeat;\n background-position: center;\n line-height: 1;\n }\n }\n }\n }\n\n .ck-list-item-button__check-holder {\n display: none !important;\n }\n }\n`\n"],"mappings":"AAAA,SAASA,MAAM,EAAEC,OAAO,QAAQ,qBAAqB;AACrD,SAASC,iBAAiB,QAAQ,mBAAmB;AACrD,SACEC,eAAe,EACfC,aAAa,EACbC,cAAc,EACdC,WAAW,EACXC,QAAQ,EACRC,aAAa,EACbC,OAAO,EACPC,YAAY,EACZC,SAAS,EACTC,UAAU,EACVC,UAAU,EACVC,QAAQ,EACRC,eAAe,EACfC,WAAW,EACXC,eAAe,EACfC,SAAS,EACTC,QAAQ,EACRC,iBAAiB,EACjBC,SAAS,EACTC,aAAa,EACbC,aAAa,EACbC,QAAQ,EACRC,iBAAiB,QACZ,SAAS;AAEhB,IAAMC,UAAU,GAAG,SAAbA,UAAUA,CAAIC,IAAY,EAAK;EACnC,IAAIA,IAAI,CAACC,UAAU,CAAC,OAAO,CAAC,EAAE;IAC5B,OAAOD,IAAI;EACb;EACA,2CAAAE,MAAA,CAA2CC,kBAAkB,CAACH,IAAI,CAAC;AACrE,CAAC;AAED,OAAO,IAAMI,eAAe,gBAAG7B,iBAAiB,22IAS3BD,OAAO,CAAC+B,EAAE,EACXhC,MAAM,CAACiC,MAAM,EAClBjC,MAAM,CAACkC,MAAM,EACLjC,OAAO,CAACkC,EAAE,EAGjBlC,OAAO,CAACmC,EAAE,EAMFpC,MAAM,CAACqC,MAAM,EAyCRX,UAAU,CAACnB,QAAQ,CAAC,EAIpBmB,UAAU,CAACb,UAAU,CAAC,EAItBa,UAAU,CAACH,aAAa,CAAC,EAIzBG,UAAU,CAACN,iBAAiB,CAAC,EAI7BM,UAAU,CAACtB,aAAa,CAAC,EAIzBsB,UAAU,CAACvB,eAAe,CAAC,EAI3BuB,UAAU,CAACrB,cAAc,CAAC,EAI1BqB,UAAU,CAACD,iBAAiB,CAAC,EAI7BC,UAAU,CAACX,eAAe,CAAC,EAI3BW,UAAU,CAACV,WAAW,CAAC,EAIvBU,UAAU,CAACd,UAAU,CAAC,EAItBc,UAAU,CAACjB,OAAO,CAAC,EAInBiB,UAAU,CAACR,SAAS,CAAC,EAIrBQ,UAAU,CAACT,eAAe,CAAC,EAI3BS,UAAU,CAAChB,YAAY,CAAC,EAKxBgB,UAAU,CAACJ,aAAa,CAAC,EAIzBI,UAAU,CAACpB,WAAW,CAAC,EAGvBoB,UAAU,CAACZ,QAAQ,CAAC,EAIpBY,UAAU,CAACL,SAAS,CAAC,EAIrBK,UAAU,CAACf,SAAS,CAAC,EAIrBe,UAAU,CAACF,QAAQ,CAAC,EAIpBE,UAAU,CAACP,QAAQ,CAAC,EA2CZO,UAAU,CAAClB,aAAa,CAAC,CAc7D"}
@@ -5,6 +5,7 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
6
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
7
  import React from 'react';
8
+ // TODO - delete
8
9
  export var useTabAsNavigation = function useTabAsNavigation(_ref) {
9
10
  var enabled = _ref.enabled,
10
11
  config = _ref.config,
@@ -16,7 +17,7 @@ export var useTabAsNavigation = function useTabAsNavigation(_ref) {
16
17
 
17
18
  // Remove TabSpacesPlugin when tabAsNavigation is enabled
18
19
  var filteredPlugins = config.plugins.filter(function (plugin) {
19
- return typeof plugin === 'string' ? plugin !== 'TabSpacesPlugin' : plugin.pluginName !== 'TabSpacesPlugin';
20
+ return typeof plugin === 'string' ? plugin !== 'TabSpacesPlugin' : (plugin === null || plugin === void 0 ? void 0 : plugin.pluginName) !== 'TabSpacesPlugin';
20
21
  });
21
22
  return _objectSpread(_objectSpread({}, config), {}, {
22
23
  plugins: filteredPlugins
@@ -1 +1 @@
1
- {"version":3,"file":"useTabAsNavigation.js","names":["React","useTabAsNavigation","_ref","enabled","config","editor","enhancedConfig","useMemo","plugins","filteredPlugins","filter","plugin","pluginName","_objectSpread"],"sources":["../../src/TextEditor/useTabAsNavigation.ts"],"sourcesContent":["import type { ClassicEditor, EditorConfig } from 'ckeditor5'\nimport React from 'react'\n\ninterface UseTabAsNavigationProps {\n enabled: boolean\n config: EditorConfig\n editor: ClassicEditor | null\n}\n\ninterface UseTabAsNavigationReturn {\n config: EditorConfig\n}\n\nexport const useTabAsNavigation = ({\n enabled,\n config,\n editor,\n}: UseTabAsNavigationProps): UseTabAsNavigationReturn => {\n const enhancedConfig = React.useMemo(() => {\n if (!enabled || !config.plugins) {\n return config\n }\n\n // Remove TabSpacesPlugin when tabAsNavigation is enabled\n const filteredPlugins = config.plugins.filter((plugin) => {\n return typeof plugin === 'string'\n ? plugin !== 'TabSpacesPlugin'\n : plugin.pluginName !== 'TabSpacesPlugin'\n })\n\n return {\n ...config,\n plugins: filteredPlugins,\n }\n }, [enabled, config])\n\n return { config: enhancedConfig }\n}\n"],"mappings":";;;;;;AACA,OAAOA,KAAK,MAAM,OAAO;AAYzB,OAAO,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,IAAA,EAI0B;EAAA,IAHvDC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IACPC,MAAM,GAAAF,IAAA,CAANE,MAAM;IACNC,MAAM,GAAAH,IAAA,CAANG,MAAM;EAEN,IAAMC,cAAc,GAAGN,KAAK,CAACO,OAAO,CAAC,YAAM;IACzC,IAAI,CAACJ,OAAO,IAAI,CAACC,MAAM,CAACI,OAAO,EAAE;MAC/B,OAAOJ,MAAM;IACf;;IAEA;IACA,IAAMK,eAAe,GAAGL,MAAM,CAACI,OAAO,CAACE,MAAM,CAAC,UAACC,MAAM,EAAK;MACxD,OAAO,OAAOA,MAAM,KAAK,QAAQ,GAC7BA,MAAM,KAAK,iBAAiB,GAC5BA,MAAM,CAACC,UAAU,KAAK,iBAAiB;IAC7C,CAAC,CAAC;IAEF,OAAAC,aAAA,CAAAA,aAAA,KACKT,MAAM;MACTI,OAAO,EAAEC;IAAe;EAE5B,CAAC,EAAE,CAACN,OAAO,EAAEC,MAAM,CAAC,CAAC;EAErB,OAAO;IAAEA,MAAM,EAAEE;EAAe,CAAC;AACnC,CAAC"}
1
+ {"version":3,"file":"useTabAsNavigation.js","names":["React","useTabAsNavigation","_ref","enabled","config","editor","enhancedConfig","useMemo","plugins","filteredPlugins","filter","plugin","pluginName","_objectSpread"],"sources":["../../src/TextEditor/useTabAsNavigation.ts"],"sourcesContent":["import type { ClassicEditor, EditorConfig } from 'ckeditor5'\nimport React from 'react'\n\ninterface UseTabAsNavigationProps {\n enabled: boolean\n config: EditorConfig\n editor: ClassicEditor | null\n}\n\ninterface UseTabAsNavigationReturn {\n config: EditorConfig\n}\n\n// TODO - delete\nexport const useTabAsNavigation = ({\n enabled,\n config,\n editor,\n}: UseTabAsNavigationProps): UseTabAsNavigationReturn => {\n const enhancedConfig = React.useMemo(() => {\n if (!enabled || !config.plugins) {\n return config\n }\n\n // Remove TabSpacesPlugin when tabAsNavigation is enabled\n const filteredPlugins = config.plugins.filter((plugin) => {\n return typeof plugin === 'string'\n ? plugin !== 'TabSpacesPlugin'\n : plugin?.pluginName !== 'TabSpacesPlugin'\n })\n\n return {\n ...config,\n plugins: filteredPlugins,\n }\n }, [enabled, config])\n\n return { config: enhancedConfig }\n}\n"],"mappings":";;;;;;AACA,OAAOA,KAAK,MAAM,OAAO;AAYzB;AACA,OAAO,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,IAAA,EAI0B;EAAA,IAHvDC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IACPC,MAAM,GAAAF,IAAA,CAANE,MAAM;IACNC,MAAM,GAAAH,IAAA,CAANG,MAAM;EAEN,IAAMC,cAAc,GAAGN,KAAK,CAACO,OAAO,CAAC,YAAM;IACzC,IAAI,CAACJ,OAAO,IAAI,CAACC,MAAM,CAACI,OAAO,EAAE;MAC/B,OAAOJ,MAAM;IACf;;IAEA;IACA,IAAMK,eAAe,GAAGL,MAAM,CAACI,OAAO,CAACE,MAAM,CAAC,UAACC,MAAM,EAAK;MACxD,OAAO,OAAOA,MAAM,KAAK,QAAQ,GAC7BA,MAAM,KAAK,iBAAiB,GAC5B,CAAAA,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEC,UAAU,MAAK,iBAAiB;IAC9C,CAAC,CAAC;IAEF,OAAAC,aAAA,CAAAA,aAAA,KACKT,MAAM;MACTI,OAAO,EAAEC;IAAe;EAE5B,CAAC,EAAE,CAACN,OAAO,EAAEC,MAAM,CAAC,CAAC;EAErB,OAAO;IAAEA,MAAM,EAAEE;EAAe,CAAC;AACnC,CAAC"}