@procore/text-editor 1.0.0 → 1.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.
- package/.jest/ckeditorMock.js +2 -0
- package/.jest/ckeditorUtilsMock.js +14 -0
- package/CHANGELOG.md +30 -0
- package/dist/DebouncedTextEditor/DebouncedTextEditor.js +1 -1
- package/dist/DebouncedTextEditor/DebouncedTextEditor.js.map +1 -1
- package/dist/DebouncedTextEditor/index.js.map +1 -1
- package/dist/TextEditor/CKTextEditor.js +15 -9
- package/dist/TextEditor/CKTextEditor.js.map +1 -1
- package/dist/TextEditor/EditorError.js.map +1 -1
- package/dist/TextEditor/Providers/FeatureFlagProvider.js.map +1 -1
- package/dist/TextEditor/StickyToolbar/index.js.map +1 -1
- package/dist/TextEditor/StickyToolbar/useStickyToolbar.js.map +1 -1
- package/dist/TextEditor/StickyToolbar/useStickyToolbar.types.js.map +1 -1
- package/dist/TextEditor/TextEditor.js.map +1 -1
- package/dist/TextEditor/TextEditor.styles.d.ts +7 -8
- package/dist/TextEditor/TextEditor.styles.js +5 -5
- package/dist/TextEditor/TextEditor.styles.js.map +1 -1
- package/dist/TextEditor/TextEditor.types.d.ts +1 -1
- package/dist/TextEditor/TextEditor.types.js.map +1 -1
- package/dist/TextEditor/TextEditorI18nProvider.js.map +1 -1
- package/dist/TextEditor/TextEditorProvider.js.map +1 -1
- package/dist/TextEditor/TextEditorProvider.types.d.ts +1 -1
- package/dist/TextEditor/TextEditorProvider.types.js.map +1 -1
- package/dist/TextEditor/TinyMCETextEditor.js.map +1 -1
- package/dist/TextEditor/index.d.ts +1 -1
- package/dist/TextEditor/index.js +0 -1
- package/dist/TextEditor/index.js.map +1 -1
- package/dist/TextEditor/license_key.js.map +1 -1
- package/dist/TextEditor/plugins/CutPlugin/CutCommand.js +21 -29
- package/dist/TextEditor/plugins/CutPlugin/CutCommand.js.map +1 -1
- package/dist/TextEditor/plugins/CutPlugin/CutPlugin.js +2 -2
- package/dist/TextEditor/plugins/CutPlugin/CutPlugin.js.map +1 -1
- package/dist/TextEditor/plugins/CutPlugin/index.js.map +1 -1
- package/dist/TextEditor/plugins/IndentPaddingToMarginPlugin/IndentPaddingToMarginPlugin.js.map +1 -1
- package/dist/TextEditor/plugins/IndentPaddingToMarginPlugin/index.js.map +1 -1
- package/dist/TextEditor/plugins/NormalizeTableWidthPlugin/NormalizeTableWidthPlugin.js.map +1 -1
- package/dist/TextEditor/plugins/NormalizeTableWidthPlugin/index.js.map +1 -1
- package/dist/TextEditor/plugins/PasteAsTextPlugin/PasteAsTextCommand.js +20 -28
- package/dist/TextEditor/plugins/PasteAsTextPlugin/PasteAsTextCommand.js.map +1 -1
- package/dist/TextEditor/plugins/PasteAsTextPlugin/PasteAsTextPlugin.js +2 -2
- package/dist/TextEditor/plugins/PasteAsTextPlugin/PasteAsTextPlugin.js.map +1 -1
- package/dist/TextEditor/plugins/PasteAsTextPlugin/index.js.map +1 -1
- package/dist/TextEditor/plugins/PastePlugin/PasteCommand.js +54 -62
- package/dist/TextEditor/plugins/PastePlugin/PasteCommand.js.map +1 -1
- package/dist/TextEditor/plugins/PastePlugin/PastePlugin.js +2 -2
- package/dist/TextEditor/plugins/PastePlugin/PastePlugin.js.map +1 -1
- package/dist/TextEditor/plugins/PastePlugin/index.js.map +1 -1
- package/dist/TextEditor/plugins/ProcoreImageUploadPlugin/ProcoreImageUploadPlugin.d.ts +1 -1
- package/dist/TextEditor/plugins/ProcoreImageUploadPlugin/ProcoreImageUploadPlugin.js +50 -59
- package/dist/TextEditor/plugins/ProcoreImageUploadPlugin/ProcoreImageUploadPlugin.js.map +1 -1
- package/dist/TextEditor/plugins/ProcoreImageUploadPlugin/index.js.map +1 -1
- package/dist/TextEditor/plugins/TabSpacesPlugin/TabSpacesPlugin.js.map +1 -1
- package/dist/TextEditor/plugins/TabSpacesPlugin/index.js.map +1 -1
- package/dist/TextEditor/textEditorTheming/icons.js.map +1 -1
- package/dist/TextEditor/textEditorTheming/index.js.map +1 -1
- package/dist/TextEditor/textEditorTheming/textEditorTheming.styles.d.ts +0 -1
- package/dist/TextEditor/textEditorTheming/textEditorTheming.styles.js.map +1 -1
- package/dist/TextEditor/useCKEditorCss.js.map +1 -1
- package/dist/TextEditor/useCKEditorFocusScope.js.map +1 -1
- package/dist/TextEditor/useTabAsNavigation.js.map +1 -1
- package/dist/TextEditor/utils/config.js +29 -4
- package/dist/TextEditor/utils/config.js.map +1 -1
- package/dist/TextEditor/utils/imageAttributes.js.map +1 -1
- package/dist/TextEditor/utils/imageUrls.js.map +1 -1
- package/dist/TextEditor/utils/index.js.map +1 -1
- package/dist/TextEditor/utils/locale.js +12 -1
- package/dist/TextEditor/utils/locale.js.map +1 -1
- package/dist/TextEditor/utils/richTextEditorHandlers.d.ts +2 -2
- package/dist/TextEditor/utils/richTextEditorHandlers.js +62 -81
- package/dist/TextEditor/utils/richTextEditorHandlers.js.map +1 -1
- package/dist/TextEditorOutput/TextEditorOutput.js.map +1 -1
- package/dist/TextEditorOutput/TextEditorOutput.styles.d.ts +0 -1
- package/dist/TextEditorOutput/TextEditorOutput.styles.js +2 -2
- package/dist/TextEditorOutput/TextEditorOutput.styles.js.map +1 -1
- package/dist/TextEditorOutput/TextEditorOutput.types.d.ts +0 -1
- package/dist/TextEditorOutput/TextEditorOutput.types.js.map +1 -1
- package/dist/TextEditorOutput/TextEditorOutput.utils.js +12 -4
- package/dist/TextEditorOutput/TextEditorOutput.utils.js.map +1 -1
- package/dist/TextEditorOutput/index.js.map +1 -1
- package/dist/_storyHelpers/constants.js.map +1 -1
- package/dist/_typedoc/TextEditor/TextEditor.types.json +153 -153
- package/dist/_typedoc/TextEditor/TextEditorProvider.types.json +4 -4
- package/dist/_typedoc/TextEditorOutput/TextEditorOutput.types.json +9 -9
- package/dist/_utils/propsTypedoc.d.ts +3 -3
- package/dist/_utils/propsTypedoc.js +1 -3
- package/dist/_utils/propsTypedoc.js.map +1 -1
- package/dist/ckeditor5-premium-features.d.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/locales/de-DE.json +17 -0
- package/dist/locales/en-AU.json +17 -0
- package/dist/locales/en-CA.json +17 -0
- package/dist/locales/en-GB.json +17 -0
- package/dist/locales/es-ES.json +17 -0
- package/dist/locales/es.json +17 -0
- package/dist/locales/fr-CA.json +17 -0
- package/dist/locales/fr-FR.json +17 -0
- package/dist/locales/is-IS.json +17 -0
- package/dist/locales/it-IT.json +17 -0
- package/dist/locales/ja-JP.json +17 -0
- package/dist/locales/nb-NO.json +17 -0
- package/dist/locales/pl-PL.json +17 -0
- package/dist/locales/pt-BR.json +17 -0
- package/dist/locales/pt-PT.json +17 -0
- package/dist/locales/th-TH.json +17 -0
- package/dist/locales/zh-SG.json +17 -0
- package/dist/locales/zh-TW.json +17 -0
- package/dist/stories/util.js.map +1 -1
- package/dist/utils/debounce.js +1 -1
- package/dist/utils/debounce.js.map +1 -1
- package/jestConfig.js +0 -2
- package/package.json +44 -42
- package/.jest/translationMock.js +0 -12
package/.jest/ckeditorMock.js
CHANGED
|
@@ -27,6 +27,7 @@ MockCKEditor.displayName = 'CKEditor'
|
|
|
27
27
|
module.exports = {
|
|
28
28
|
CKEditor: MockCKEditor,
|
|
29
29
|
Command: MockCommand,
|
|
30
|
+
add: () => {},
|
|
30
31
|
Plugin: class extends MockPlugin {},
|
|
31
32
|
Alignment: class extends MockPlugin {},
|
|
32
33
|
Autoformat: class extends MockPlugin {},
|
|
@@ -63,6 +64,7 @@ module.exports = {
|
|
|
63
64
|
MultiLevelList: class extends MockPlugin {},
|
|
64
65
|
PageBreak: class extends MockPlugin {},
|
|
65
66
|
Paragraph: class extends MockPlugin {},
|
|
67
|
+
PasteFromOffice: class extends MockPlugin {},
|
|
66
68
|
RemoveFormat: class extends MockPlugin {},
|
|
67
69
|
SpecialCharacters: class extends MockPlugin {},
|
|
68
70
|
SpecialCharactersEssentials: class extends MockPlugin {},
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Mock for `@ckeditor/ckeditor5-utils`.
|
|
3
|
+
*
|
|
4
|
+
* Keeps every real export and only stubs `add` (the sole symbol we import from
|
|
5
|
+
* the package root, in TextEditor/utils/locale.ts). `add` registers translation
|
|
6
|
+
* strings on the global `window.CKEDITOR_TRANSLATIONS` store as a side effect at
|
|
7
|
+
* import time, which is unnecessary under Jest.
|
|
8
|
+
*/
|
|
9
|
+
const actual = jest.requireActual('@ckeditor/ckeditor5-utils')
|
|
10
|
+
|
|
11
|
+
module.exports = {
|
|
12
|
+
...actual,
|
|
13
|
+
add: jest.fn(),
|
|
14
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @procore/text-editor
|
|
2
2
|
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- a78988d: Add an "Open in a new tab" option to CKEditor links. When enabled in the link "Link properties" panel, the link is saved with `target="_blank"` and `rel="noopener noreferrer"`. Also set a default `https://` protocol so links typed without a scheme (for example `www.example.com`) are not treated as relative URLs.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 9dcbd9d: Add PasteFromOffice plugin to CKEditor config
|
|
12
|
+
- 6e916ea: Import `add` from `ckeditor5` instead of `@ckeditor/ckeditor5-utils` which not a declared dependency — it only worked through hoisting and could cause duplicate CKEditor modules.
|
|
13
|
+
- e4fb2ba: Mock `@ckeditor/ckeditor5-utils` in the package's Jest setup to avoid the `ckeditor-duplicated-modules` error.
|
|
14
|
+
- `locale.ts` imports `add` from `@ckeditor/ckeditor5-utils` to register the custom Cut/Paste/Paste-as-Text command labels on the global `window.CKEDITOR_TRANSLATIONS` store. Under Jest, the unmocked root import loaded ckeditor5-utils' version guard as a separate instance and threw `ckeditor-duplicated-modules`.
|
|
15
|
+
- The package's Jest config now maps `^@ckeditor/ckeditor5-utils # @procore/text-editor` to a local mock that keeps every real export and only stubs `add` (whose sole purpose at import time is a translation side effect that isn't needed under test). Runtime behavior is unchanged.
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
18
|
+
## 1.0.1
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- 0553e49: Fix rich-text table rendering and align write mode and read mode:
|
|
23
|
+
- Oversized tables now scroll the editor horizontally instead of stretching the page.
|
|
24
|
+
- Output tables match the editor's content width and centered alignment (the `table` figure class is preserved through sanitization).
|
|
25
|
+
- Long cell content wraps instead of forcing the table wider.
|
|
26
|
+
- Sanitize the editor value on input in write mode, mirroring the existing output sanitization.
|
|
27
|
+
- Updated dependencies [a0ab8c9]
|
|
28
|
+
- Updated dependencies [8fb364a]
|
|
29
|
+
- Updated dependencies [d8940ff]
|
|
30
|
+
- Updated dependencies [651f78c]
|
|
31
|
+
- Updated dependencies [7e53f92]
|
|
32
|
+
|
|
3
33
|
## 1.0.0
|
|
4
34
|
|
|
5
35
|
### Major Changes
|
|
@@ -57,7 +57,7 @@ export var DebouncedTextEditor = function DebouncedTextEditor(_ref) {
|
|
|
57
57
|
internalValue = _useState2[0],
|
|
58
58
|
setInternalValue = _useState2[1];
|
|
59
59
|
var debouncedOnChange = useCallback(debounce(function (newValue) {
|
|
60
|
-
onChange === null || onChange === void 0
|
|
60
|
+
onChange === null || onChange === void 0 || onChange(newValue);
|
|
61
61
|
}, DEBOUNCE_MS), []);
|
|
62
62
|
function handleChange(newValue) {
|
|
63
63
|
setInternalValue(newValue);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DebouncedTextEditor.js","names":["React","useCallback","useEffect","useState","TextEditor","debounce","DEBOUNCE_MS","DebouncedTextEditor","_ref","onChange","value","rest","_objectWithoutProperties","_excluded","_useState","_useState2","_slicedToArray","internalValue","setInternalValue","debouncedOnChange","newValue","handleChange","createElement","_extends"],"sources":["../../src/DebouncedTextEditor/DebouncedTextEditor.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useState } from 'react'\nimport type { TextEditorProps } from '../TextEditor'\nimport { TextEditor } from '../TextEditor'\nimport { debounce } from '../utils/debounce'\n\nconst DEBOUNCE_MS = 300\n\n/**\n * @deprecated `DebouncedTextEditor` is deprecated and will be removed in a future version.\n * Use `TextEditor` directly instead — it now debounces `getData()` internally.\n *\n * A performance-optimized version of `TextEditor` with built-in debounce on the `onChange` callback.\n *\n * ## When to use `DebouncedTextEditor`\n *\n * Use this component when:\n * - The `onChange` handler triggers expensive operations (API calls, complex state updates, re-renders)\n * - You want to reduce the frequency of updates while the user is actively typing\n * - Performance is a concern in forms with multiple rich text editors\n *\n * ## How it works\n *\n * The component waits 300ms after the user stops typing before calling `onChange`.\n * If the user continues typing, the timer resets. This reduces unnecessary updates\n * while maintaining a responsive editing experience.\n *\n * @example\n * ```tsx\n * import { DebouncedTextEditor } from '@procore/text-editor'\n *\n * function MyComponent() {\n * const [value, setValue] = React.useState('')\n *\n * return (\n * <DebouncedTextEditor\n * value={value}\n * onChange={(newValue) => setValue(newValue)}\n * />\n * )\n * }\n * ```\n */\nexport const DebouncedTextEditor = ({\n onChange,\n value,\n ...rest\n}: TextEditorProps) => {\n const [internalValue, setInternalValue] = useState(value ?? '')\n\n const debouncedOnChange = useCallback(\n debounce((newValue: string) => {\n onChange?.(newValue)\n }, DEBOUNCE_MS),\n []\n )\n\n function handleChange(newValue: string) {\n setInternalValue(newValue)\n debouncedOnChange(newValue)\n }\n\n useEffect(() => {\n setInternalValue(value ?? '')\n }, [value])\n\n return <TextEditor {...rest} value={internalValue} onChange={handleChange} />\n}\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAE/D,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,QAAQ,QAAQ,mBAAmB;AAE5C,IAAMC,WAAW,GAAG,GAAG;;AAEvB;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,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAAC,IAAA,EAIT;EAAA,IAHrBC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACFC,IAAI,GAAAC,wBAAA,CAAAJ,IAAA,EAAAK,SAAA;EAEP,IAAAC,SAAA,GAA0CX,QAAQ,CAACO,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAE,CAAC;IAAAK,UAAA,GAAAC,cAAA,CAAAF,SAAA;IAAxDG,aAAa,GAAAF,UAAA;IAAEG,gBAAgB,GAAAH,UAAA;EAEtC,IAAMI,iBAAiB,GAAGlB,WAAW,CACnCI,QAAQ,CAAC,UAACe,QAAgB,EAAK;IAC7BX,QAAQ,aAARA,QAAQ,
|
|
1
|
+
{"version":3,"file":"DebouncedTextEditor.js","names":["React","useCallback","useEffect","useState","TextEditor","debounce","DEBOUNCE_MS","DebouncedTextEditor","_ref","onChange","value","rest","_objectWithoutProperties","_excluded","_useState","_useState2","_slicedToArray","internalValue","setInternalValue","debouncedOnChange","newValue","handleChange","createElement","_extends"],"sources":["../../src/DebouncedTextEditor/DebouncedTextEditor.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useState } from 'react'\nimport type { TextEditorProps } from '../TextEditor'\nimport { TextEditor } from '../TextEditor'\nimport { debounce } from '../utils/debounce'\n\nconst DEBOUNCE_MS = 300\n\n/**\n * @deprecated `DebouncedTextEditor` is deprecated and will be removed in a future version.\n * Use `TextEditor` directly instead — it now debounces `getData()` internally.\n *\n * A performance-optimized version of `TextEditor` with built-in debounce on the `onChange` callback.\n *\n * ## When to use `DebouncedTextEditor`\n *\n * Use this component when:\n * - The `onChange` handler triggers expensive operations (API calls, complex state updates, re-renders)\n * - You want to reduce the frequency of updates while the user is actively typing\n * - Performance is a concern in forms with multiple rich text editors\n *\n * ## How it works\n *\n * The component waits 300ms after the user stops typing before calling `onChange`.\n * If the user continues typing, the timer resets. This reduces unnecessary updates\n * while maintaining a responsive editing experience.\n *\n * @example\n * ```tsx\n * import { DebouncedTextEditor } from '@procore/text-editor'\n *\n * function MyComponent() {\n * const [value, setValue] = React.useState('')\n *\n * return (\n * <DebouncedTextEditor\n * value={value}\n * onChange={(newValue) => setValue(newValue)}\n * />\n * )\n * }\n * ```\n */\nexport const DebouncedTextEditor = ({\n onChange,\n value,\n ...rest\n}: TextEditorProps) => {\n const [internalValue, setInternalValue] = useState(value ?? '')\n\n const debouncedOnChange = useCallback(\n debounce((newValue: string) => {\n onChange?.(newValue)\n }, DEBOUNCE_MS),\n []\n )\n\n function handleChange(newValue: string) {\n setInternalValue(newValue)\n debouncedOnChange(newValue)\n }\n\n useEffect(() => {\n setInternalValue(value ?? '')\n }, [value])\n\n return <TextEditor {...rest} value={internalValue} onChange={handleChange} />\n}\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAE/D,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,QAAQ,QAAQ,mBAAmB;AAE5C,IAAMC,WAAW,GAAG,GAAG;;AAEvB;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,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAAC,IAAA,EAIT;EAAA,IAHrBC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACFC,IAAI,GAAAC,wBAAA,CAAAJ,IAAA,EAAAK,SAAA;EAEP,IAAAC,SAAA,GAA0CX,QAAQ,CAACO,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAE,CAAC;IAAAK,UAAA,GAAAC,cAAA,CAAAF,SAAA;IAAxDG,aAAa,GAAAF,UAAA;IAAEG,gBAAgB,GAAAH,UAAA;EAEtC,IAAMI,iBAAiB,GAAGlB,WAAW,CACnCI,QAAQ,CAAC,UAACe,QAAgB,EAAK;IAC7BX,QAAQ,aAARA,QAAQ,eAARA,QAAQ,CAAGW,QAAQ,CAAC;EACtB,CAAC,EAAEd,WAAW,CAAC,EACf,EACF,CAAC;EAED,SAASe,YAAYA,CAACD,QAAgB,EAAE;IACtCF,gBAAgB,CAACE,QAAQ,CAAC;IAC1BD,iBAAiB,CAACC,QAAQ,CAAC;EAC7B;EAEAlB,SAAS,CAAC,YAAM;IACdgB,gBAAgB,CAACR,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAE,CAAC;EAC/B,CAAC,EAAE,CAACA,KAAK,CAAC,CAAC;EAEX,oBAAOV,KAAA,CAAAsB,aAAA,CAAClB,UAAU,EAAAmB,QAAA,KAAKZ,IAAI;IAAED,KAAK,EAAEO,aAAc;IAACR,QAAQ,EAAEY;EAAa,EAAE,CAAC;AAC/E,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["DebouncedTextEditor"],"sources":["../../src/DebouncedTextEditor/index.ts"],"sourcesContent":["export { DebouncedTextEditor } from './DebouncedTextEditor'\n"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,uBAAuB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["DebouncedTextEditor"],"sources":["../../src/DebouncedTextEditor/index.ts"],"sourcesContent":["export { DebouncedTextEditor } from './DebouncedTextEditor'\n"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,uBAAuB","ignoreList":[]}
|
|
@@ -20,6 +20,7 @@ import { ClassicEditor, FileRepository } from 'ckeditor5';
|
|
|
20
20
|
import React from 'react';
|
|
21
21
|
import { Toast, useI18nContext, useZIndexContext } from '@procore/core-react';
|
|
22
22
|
import { TextEditorOutput } from '../TextEditorOutput';
|
|
23
|
+
import { sanitizeTextEditorHtml } from '../TextEditorOutput/TextEditorOutput.utils';
|
|
23
24
|
import { debounce } from '../utils/debounce';
|
|
24
25
|
import { useStickyToolbar } from './StickyToolbar';
|
|
25
26
|
import { GlobalEditorStyles, StyledImageUploadWarningToast, StyledImageUploadWarningToastIcon, StyledTextEditor } from './TextEditor.styles';
|
|
@@ -56,8 +57,8 @@ export var CKTextEditor = function CKTextEditor(props) {
|
|
|
56
57
|
useCKEditorFocusScope();
|
|
57
58
|
var editorRef = React.useRef(null);
|
|
58
59
|
var editorInstanceRef = React.useRef(null);
|
|
59
|
-
var initialValueRef = React.useRef(value || initialValue || '');
|
|
60
|
-
var lastExternalValueRef = React.useRef(value || initialValue || '');
|
|
60
|
+
var initialValueRef = React.useRef(sanitizeTextEditorHtml(value || initialValue || ''));
|
|
61
|
+
var lastExternalValueRef = React.useRef(sanitizeTextEditorHtml(value || initialValue || ''));
|
|
61
62
|
var keyDownListenerRef = React.useRef(null);
|
|
62
63
|
var _React$useState = React.useState(false),
|
|
63
64
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -87,7 +88,7 @@ export var CKTextEditor = function CKTextEditor(props) {
|
|
|
87
88
|
}, [i18n, showToast]);
|
|
88
89
|
React.useEffect(function () {
|
|
89
90
|
if (value !== undefined) {
|
|
90
|
-
lastExternalValueRef.current = value;
|
|
91
|
+
lastExternalValueRef.current = sanitizeTextEditorHtml(value);
|
|
91
92
|
}
|
|
92
93
|
}, [value]);
|
|
93
94
|
React.useEffect(function () {
|
|
@@ -95,7 +96,7 @@ export var CKTextEditor = function CKTextEditor(props) {
|
|
|
95
96
|
if (!isEditorReady || !editor || value === undefined) return;
|
|
96
97
|
if (editor.editing.view.document.isFocused) return;
|
|
97
98
|
if (value === editor.getData()) return;
|
|
98
|
-
editor.data.set(value);
|
|
99
|
+
editor.data.set(sanitizeTextEditorHtml(value));
|
|
99
100
|
}, [value, isEditorReady]);
|
|
100
101
|
|
|
101
102
|
// Cleanup keydown listener on unmount
|
|
@@ -202,7 +203,7 @@ export var CKTextEditor = function CKTextEditor(props) {
|
|
|
202
203
|
if (domEvent.key === 'Enter') {
|
|
203
204
|
domEvent.stopPropagation();
|
|
204
205
|
}
|
|
205
|
-
onKeyDown === null || onKeyDown === void 0
|
|
206
|
+
onKeyDown === null || onKeyDown === void 0 || onKeyDown(domEvent, editor);
|
|
206
207
|
};
|
|
207
208
|
keyDownListenerRef.current = keyDownListener;
|
|
208
209
|
|
|
@@ -215,18 +216,23 @@ export var CKTextEditor = function CKTextEditor(props) {
|
|
|
215
216
|
var hasPendingUploads = hasPendingImageUploads(editor);
|
|
216
217
|
if (isDirty && !isDirtyState) {
|
|
217
218
|
setIsDirtyState(true);
|
|
218
|
-
onDirty === null || onDirty === void 0
|
|
219
|
+
onDirty === null || onDirty === void 0 || onDirty();
|
|
219
220
|
}
|
|
220
221
|
if (hasPendingUploads) {
|
|
221
222
|
return;
|
|
222
223
|
}
|
|
223
|
-
onChange === null || onChange === void 0
|
|
224
|
+
onChange === null || onChange === void 0 || onChange(data, isDirty);
|
|
224
225
|
}, DEBOUNCE_MS)).current;
|
|
225
226
|
var handleChange = debouncedChange;
|
|
226
227
|
var handleReady = function handleReady(editor) {
|
|
228
|
+
var _ref2;
|
|
227
229
|
addButtonDataAttributes(editor);
|
|
228
230
|
editorInstanceRef.current = editor;
|
|
229
231
|
setIsEditorReady(true);
|
|
232
|
+
var sanitizedValue = sanitizeTextEditorHtml((_ref2 = value !== null && value !== void 0 ? value : initialValue) !== null && _ref2 !== void 0 ? _ref2 : '');
|
|
233
|
+
if (sanitizedValue !== editor.getData()) {
|
|
234
|
+
editor.data.set(sanitizedValue);
|
|
235
|
+
}
|
|
230
236
|
|
|
231
237
|
// Set aria-label and aria-description on the editable area if provided
|
|
232
238
|
// These provide accessible context to screen reader users
|
|
@@ -251,11 +257,11 @@ export var CKTextEditor = function CKTextEditor(props) {
|
|
|
251
257
|
|
|
252
258
|
// Bind keydown handler when editor is ready
|
|
253
259
|
bindKeyDownHandler(editor);
|
|
254
|
-
onInit === null || onInit === void 0
|
|
260
|
+
onInit === null || onInit === void 0 || onInit(editor);
|
|
255
261
|
};
|
|
256
262
|
var handleBlur = function handleBlur(event, editor) {
|
|
257
263
|
debouncedChange.flush();
|
|
258
|
-
onBlur === null || onBlur === void 0
|
|
264
|
+
onBlur === null || onBlur === void 0 || onBlur(event, editor);
|
|
259
265
|
};
|
|
260
266
|
useStickyToolbar({
|
|
261
267
|
enabled: enableStickyToolbar,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CKTextEditor.js","names":["CKEditor","useToastAlertContext","ClassicEditor","FileRepository","React","Toast","useI18nContext","useZIndexContext","TextEditorOutput","debounce","useStickyToolbar","GlobalEditorStyles","StyledImageUploadWarningToast","StyledImageUploadWarningToastIcon","StyledTextEditor","TextEditorContext","TextEditorTheme","useCKEditorCss","useCKEditorFocusScope","useTabAsNavigation","addButtonDataAttributes","getDefaultConfig","richTextEditorUploadHandler","DEBOUNCE_MS","CKTextEditor","props","disabled","error","readonly","value","initialValue","onChange","onInit","onBlur","onKeyDown","propLocale","locale","onDirty","companyId","projectId","toolName","placeholder","rows","restProps","_objectWithoutProperties","_excluded","ariaLabel","ariaDescription","_useCKEditorCss","cssLoading","isLoading","editorRef","useRef","editorInstanceRef","initialValueRef","lastExternalValueRef","keyDownListenerRef","_React$useState","useState","_React$useState2","_slicedToArray","isDirtyState","setIsDirtyState","_React$useState3","_React$useState4","isEditorReady","setIsEditorReady","i18n","_useToastAlertContext","showToast","contextLocale","showImageUploadWarning","useCallback","message","custom","_ref","toastDismissProps","createElement","alignItems","padding","size","Text","Dismiss","_extends","t","useEffect","undefined","current","editor","editing","view","document","isFocused","getData","data","set","off","change","writer","viewEditableRoot","getRoot","setAttribute","removeAttribute","_useZIndexContext","zIndex","_React$useContext","useContext","features","enableStickyToolbar","stickyToolbar","enableTabAsNavigation","tabAsNavigation","imageUploadHandlers","useMemo","handlerOptions","upload","onError","onWarning","mergedConfig","defaultConfig","imageUpload","label","root","_objectSpread","bindKeyDownHandler","editorElement","keyDownListener","_event","domEvent","key","stopPropagation","on","debouncedChange","isDirty","trim","hasPendingUploads","hasPendingImageUploads","handleChange","handleReady","baseHeight","rowHeight","editorHeight","setStyle","concat","handleBlur","event","flush","enabled","_useTabAsNavigation","config","editorKey","ref","$ready","onReady","_fileRepository$loade","fileRepository","plugins","get","Array","from","loaders","some","loader","includes","String","status","_error"],"sources":["../../src/TextEditor/CKTextEditor.tsx"],"sourcesContent":["import { CKEditor } from '@ckeditor/ckeditor5-react'\nimport { useToastAlertContext } from '@procore/toast-alert'\nimport { ClassicEditor, FileRepository, type EventInfo } from 'ckeditor5'\nimport React from 'react'\n\nimport { Toast, useI18nContext, useZIndexContext } from '@procore/core-react'\nimport { TextEditorOutput } from '../TextEditorOutput'\nimport { debounce } from '../utils/debounce'\nimport { useStickyToolbar } from './StickyToolbar'\nimport {\n GlobalEditorStyles,\n StyledImageUploadWarningToast,\n StyledImageUploadWarningToastIcon,\n StyledTextEditor,\n} from './TextEditor.styles'\nimport type { KeyDownListener, TextEditorProps } from './TextEditor.types'\nimport { TextEditorContext } from './TextEditorProvider'\nimport { TextEditorTheme } from './textEditorTheming'\nimport { useCKEditorCss } from './useCKEditorCss'\nimport { useCKEditorFocusScope } from './useCKEditorFocusScope'\nimport { useTabAsNavigation } from './useTabAsNavigation'\nimport { addButtonDataAttributes, getDefaultConfig } from './utils'\nimport { richTextEditorUploadHandler } from './utils/richTextEditorHandlers'\n\nconst DEBOUNCE_MS = 300\n\nexport const CKTextEditor = (props: Readonly<TextEditorProps>) => {\n const {\n disabled,\n error,\n readonly,\n value,\n initialValue,\n onChange,\n onInit,\n onBlur,\n onKeyDown,\n locale: propLocale,\n onDirty,\n companyId,\n projectId,\n toolName,\n placeholder,\n rows,\n ...restProps\n } = props\n const ariaLabel = props['aria-label']\n const ariaDescription = props['aria-description']\n const { isLoading: cssLoading } = useCKEditorCss()\n useCKEditorFocusScope()\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 lastExternalValueRef = 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 i18n = useI18nContext()\n const { showToast } = useToastAlertContext()\n const { locale: contextLocale } = i18n\n const locale = propLocale || contextLocale\n\n const showImageUploadWarning = React.useCallback(\n (message: string) => {\n showToast.custom(({ toastDismissProps }) => (\n <StyledImageUploadWarningToast alignItems=\"center\" padding=\"md xl\">\n <StyledImageUploadWarningToastIcon size=\"lg\" />\n <Toast.Text>{message}</Toast.Text>\n <Toast.Dismiss\n aria-label={i18n.t('textEditor.imageUpload.dismissWarning')}\n {...toastDismissProps}\n />\n </StyledImageUploadWarningToast>\n ))\n },\n [i18n, showToast]\n )\n\n React.useEffect(() => {\n if (value !== undefined) {\n lastExternalValueRef.current = value\n }\n }, [value])\n\n React.useEffect(() => {\n const editor = editorInstanceRef.current\n if (!isEditorReady || !editor || value === undefined) return\n if (editor.editing.view.document.isFocused) return\n if (value === editor.getData()) return\n\n editor.data.set(value)\n }, [value, isEditorReady])\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 imageUploadHandlers = React.useMemo(() => {\n if (companyId === undefined || toolName === undefined) {\n return undefined\n }\n\n const handlerOptions = {\n companyId,\n projectId,\n toolName,\n }\n\n const upload = richTextEditorUploadHandler(handlerOptions)\n\n return {\n upload,\n i18n,\n onError: showToast.error,\n onWarning: showImageUploadWarning,\n }\n }, [\n companyId,\n i18n,\n projectId,\n showImageUploadWarning,\n showToast.error,\n toolName,\n ])\n\n const mergedConfig = React.useMemo(() => {\n const defaultConfig = getDefaultConfig(locale, {\n imageUpload: imageUploadHandlers,\n })\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 if (placeholder) {\n defaultConfig.root = { ...defaultConfig.root, placeholder }\n }\n\n return defaultConfig\n }, [ariaLabel, imageUploadHandlers, locale, placeholder])\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 debouncedChange = React.useRef(\n debounce((_event: EventInfo<string, unknown>, editor: ClassicEditor) => {\n const data = editor.getData()\n const isDirty = data !== lastExternalValueRef.current.trim()\n const hasPendingUploads = hasPendingImageUploads(editor)\n\n if (isDirty && !isDirtyState) {\n setIsDirtyState(true)\n onDirty?.()\n }\n\n if (hasPendingUploads) {\n return\n }\n\n onChange?.(data, isDirty)\n }, DEBOUNCE_MS)\n ).current\n\n const handleChange = debouncedChange\n\n const handleReady = (editor: ClassicEditor) => {\n addButtonDataAttributes(editor)\n editorInstanceRef.current = editor\n setIsEditorReady(true)\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 if (rows !== undefined) {\n const baseHeight = 35\n const rowHeight = 22\n const editorHeight = rows * rowHeight + baseHeight\n writer.setStyle('min-height', `${editorHeight}px`, viewEditableRoot)\n writer.setStyle('max-height', `${editorHeight}px`, viewEditableRoot)\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 debouncedChange.flush()\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 if (readonly) {\n return (\n <TextEditorOutput\n value={value}\n aria-label={ariaLabel}\n aria-description={ariaDescription}\n />\n )\n }\n\n return (\n <StyledTextEditor\n ref={editorRef}\n key={editorKey}\n error={error}\n $ready={isEditorReady}\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={initialValueRef.current}\n onChange={handleChange}\n onReady={handleReady}\n onBlur={handleBlur}\n />\n </StyledTextEditor>\n )\n}\n\nfunction hasPendingImageUploads(editor: ClassicEditor) {\n try {\n const fileRepository = editor.plugins.get(FileRepository) as {\n loaders?: Iterable<{ status?: string }>\n }\n\n return Array.from(fileRepository.loaders ?? []).some((loader) =>\n ['reading', 'uploading'].includes(String(loader.status))\n )\n } catch (_error) {\n return false\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAASA,QAAQ,QAAQ,2BAA2B;AACpD,SAASC,oBAAoB,QAAQ,sBAAsB;AAC3D,SAASC,aAAa,EAAEC,cAAc,QAAwB,WAAW;AACzE,OAAOC,KAAK,MAAM,OAAO;AAEzB,SAASC,KAAK,EAAEC,cAAc,EAAEC,gBAAgB,QAAQ,qBAAqB;AAC7E,SAASC,gBAAgB,QAAQ,qBAAqB;AACtD,SAASC,QAAQ,QAAQ,mBAAmB;AAC5C,SAASC,gBAAgB,QAAQ,iBAAiB;AAClD,SACEC,kBAAkB,EAClBC,6BAA6B,EAC7BC,iCAAiC,EAC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qBAAA,cAAAA,qBAAA,GAAI,EAAE,CAAC,CAACO,IAAI,CAAC,UAACC,MAAM;MAAA,OAC1D,CAAC,SAAS,EAAE,WAAW,CAAC,CAACC,QAAQ,CAACC,MAAM,CAACF,MAAM,CAACG,MAAM,CAAC,CAAC;IAAA,CAC1D,CAAC;EACH,CAAC,CAAC,OAAOC,MAAM,EAAE;IACf,OAAO,KAAK;EACd;AACF"}
|
|
1
|
+
{"version":3,"file":"CKTextEditor.js","names":["CKEditor","useToastAlertContext","ClassicEditor","FileRepository","React","Toast","useI18nContext","useZIndexContext","TextEditorOutput","sanitizeTextEditorHtml","debounce","useStickyToolbar","GlobalEditorStyles","StyledImageUploadWarningToast","StyledImageUploadWarningToastIcon","StyledTextEditor","TextEditorContext","TextEditorTheme","useCKEditorCss","useCKEditorFocusScope","useTabAsNavigation","addButtonDataAttributes","getDefaultConfig","richTextEditorUploadHandler","DEBOUNCE_MS","CKTextEditor","props","disabled","error","readonly","value","initialValue","onChange","onInit","onBlur","onKeyDown","propLocale","locale","onDirty","companyId","projectId","toolName","placeholder","rows","restProps","_objectWithoutProperties","_excluded","ariaLabel","ariaDescription","_useCKEditorCss","cssLoading","isLoading","editorRef","useRef","editorInstanceRef","initialValueRef","lastExternalValueRef","keyDownListenerRef","_React$useState","useState","_React$useState2","_slicedToArray","isDirtyState","setIsDirtyState","_React$useState3","_React$useState4","isEditorReady","setIsEditorReady","i18n","_useToastAlertContext","showToast","contextLocale","showImageUploadWarning","useCallback","message","custom","_ref","toastDismissProps","createElement","alignItems","padding","size","Text","Dismiss","_extends","t","useEffect","undefined","current","editor","editing","view","document","isFocused","getData","data","set","off","change","writer","viewEditableRoot","getRoot","setAttribute","removeAttribute","_useZIndexContext","zIndex","_React$useContext","useContext","features","enableStickyToolbar","stickyToolbar","enableTabAsNavigation","tabAsNavigation","imageUploadHandlers","useMemo","handlerOptions","upload","onError","onWarning","mergedConfig","defaultConfig","imageUpload","label","root","_objectSpread","bindKeyDownHandler","editorElement","keyDownListener","_event","domEvent","key","stopPropagation","on","debouncedChange","isDirty","trim","hasPendingUploads","hasPendingImageUploads","handleChange","handleReady","_ref2","sanitizedValue","baseHeight","rowHeight","editorHeight","setStyle","concat","handleBlur","event","flush","enabled","_useTabAsNavigation","config","editorKey","ref","$ready","onReady","_fileRepository$loade","fileRepository","plugins","get","Array","from","loaders","some","loader","includes","String","status","_error"],"sources":["../../src/TextEditor/CKTextEditor.tsx"],"sourcesContent":["import { CKEditor } from '@ckeditor/ckeditor5-react'\nimport { useToastAlertContext } from '@procore/toast-alert'\nimport { ClassicEditor, FileRepository, type EventInfo } from 'ckeditor5'\nimport React from 'react'\n\nimport { Toast, useI18nContext, useZIndexContext } from '@procore/core-react'\nimport { TextEditorOutput } from '../TextEditorOutput'\nimport { sanitizeTextEditorHtml } from '../TextEditorOutput/TextEditorOutput.utils'\nimport { debounce } from '../utils/debounce'\nimport { useStickyToolbar } from './StickyToolbar'\nimport {\n GlobalEditorStyles,\n StyledImageUploadWarningToast,\n StyledImageUploadWarningToastIcon,\n StyledTextEditor,\n} from './TextEditor.styles'\nimport type { KeyDownListener, TextEditorProps } from './TextEditor.types'\nimport { TextEditorContext } from './TextEditorProvider'\nimport { TextEditorTheme } from './textEditorTheming'\nimport { useCKEditorCss } from './useCKEditorCss'\nimport { useCKEditorFocusScope } from './useCKEditorFocusScope'\nimport { useTabAsNavigation } from './useTabAsNavigation'\nimport { addButtonDataAttributes, getDefaultConfig } from './utils'\nimport { richTextEditorUploadHandler } from './utils/richTextEditorHandlers'\n\nconst DEBOUNCE_MS = 300\n\nexport const CKTextEditor = (props: Readonly<TextEditorProps>) => {\n const {\n disabled,\n error,\n readonly,\n value,\n initialValue,\n onChange,\n onInit,\n onBlur,\n onKeyDown,\n locale: propLocale,\n onDirty,\n companyId,\n projectId,\n toolName,\n placeholder,\n rows,\n ...restProps\n } = props\n const ariaLabel = props['aria-label']\n const ariaDescription = props['aria-description']\n const { isLoading: cssLoading } = useCKEditorCss()\n useCKEditorFocusScope()\n\n const editorRef = React.useRef<HTMLDivElement>(null)\n const editorInstanceRef = React.useRef<ClassicEditor | null>(null)\n const initialValueRef = React.useRef<string>(\n sanitizeTextEditorHtml(value || initialValue || '')\n )\n const lastExternalValueRef = React.useRef<string>(\n sanitizeTextEditorHtml(value || initialValue || '')\n )\n const keyDownListenerRef = React.useRef<KeyDownListener | null>(null)\n const [isDirtyState, setIsDirtyState] = React.useState(false)\n const [isEditorReady, setIsEditorReady] = React.useState(false)\n const i18n = useI18nContext()\n const { showToast } = useToastAlertContext()\n const { locale: contextLocale } = i18n\n const locale = propLocale || contextLocale\n\n const showImageUploadWarning = React.useCallback(\n (message: string) => {\n showToast.custom(({ toastDismissProps }) => (\n <StyledImageUploadWarningToast alignItems=\"center\" padding=\"md xl\">\n <StyledImageUploadWarningToastIcon size=\"lg\" />\n <Toast.Text>{message}</Toast.Text>\n <Toast.Dismiss\n aria-label={i18n.t('textEditor.imageUpload.dismissWarning')}\n {...toastDismissProps}\n />\n </StyledImageUploadWarningToast>\n ))\n },\n [i18n, showToast]\n )\n\n React.useEffect(() => {\n if (value !== undefined) {\n lastExternalValueRef.current = sanitizeTextEditorHtml(value)\n }\n }, [value])\n\n React.useEffect(() => {\n const editor = editorInstanceRef.current\n if (!isEditorReady || !editor || value === undefined) return\n if (editor.editing.view.document.isFocused) return\n if (value === editor.getData()) return\n\n editor.data.set(sanitizeTextEditorHtml(value))\n }, [value, isEditorReady])\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 imageUploadHandlers = React.useMemo(() => {\n if (companyId === undefined || toolName === undefined) {\n return undefined\n }\n\n const handlerOptions = {\n companyId,\n projectId,\n toolName,\n }\n\n const upload = richTextEditorUploadHandler(handlerOptions)\n\n return {\n upload,\n i18n,\n onError: showToast.error,\n onWarning: showImageUploadWarning,\n }\n }, [\n companyId,\n i18n,\n projectId,\n showImageUploadWarning,\n showToast.error,\n toolName,\n ])\n\n const mergedConfig = React.useMemo(() => {\n const defaultConfig = getDefaultConfig(locale, {\n imageUpload: imageUploadHandlers,\n })\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 if (placeholder) {\n defaultConfig.root = { ...defaultConfig.root, placeholder }\n }\n\n return defaultConfig\n }, [ariaLabel, imageUploadHandlers, locale, placeholder])\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 debouncedChange = React.useRef(\n debounce((_event: EventInfo<string, unknown>, editor: ClassicEditor) => {\n const data = editor.getData()\n const isDirty = data !== lastExternalValueRef.current.trim()\n const hasPendingUploads = hasPendingImageUploads(editor)\n\n if (isDirty && !isDirtyState) {\n setIsDirtyState(true)\n onDirty?.()\n }\n\n if (hasPendingUploads) {\n return\n }\n\n onChange?.(data, isDirty)\n }, DEBOUNCE_MS)\n ).current\n\n const handleChange = debouncedChange\n\n const handleReady = (editor: ClassicEditor) => {\n addButtonDataAttributes(editor)\n editorInstanceRef.current = editor\n setIsEditorReady(true)\n const sanitizedValue = sanitizeTextEditorHtml(value ?? initialValue ?? '')\n if (sanitizedValue !== editor.getData()) {\n editor.data.set(sanitizedValue)\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 if (rows !== undefined) {\n const baseHeight = 35\n const rowHeight = 22\n const editorHeight = rows * rowHeight + baseHeight\n writer.setStyle('min-height', `${editorHeight}px`, viewEditableRoot)\n writer.setStyle('max-height', `${editorHeight}px`, viewEditableRoot)\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 debouncedChange.flush()\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 if (readonly) {\n return (\n <TextEditorOutput\n value={value}\n aria-label={ariaLabel}\n aria-description={ariaDescription}\n />\n )\n }\n\n return (\n <StyledTextEditor\n ref={editorRef}\n key={editorKey}\n error={error}\n $ready={isEditorReady}\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={initialValueRef.current}\n onChange={handleChange}\n onReady={handleReady}\n onBlur={handleBlur}\n />\n </StyledTextEditor>\n )\n}\n\nfunction hasPendingImageUploads(editor: ClassicEditor) {\n try {\n const fileRepository = editor.plugins.get(FileRepository) as {\n loaders?: Iterable<{ status?: string }>\n }\n\n return Array.from(fileRepository.loaders ?? []).some((loader) =>\n ['reading', 'uploading'].includes(String(loader.status))\n )\n } catch (_error) {\n return false\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAASA,QAAQ,QAAQ,2BAA2B;AACpD,SAASC,oBAAoB,QAAQ,sBAAsB;AAC3D,SAASC,aAAa,EAAEC,cAAc,QAAwB,WAAW;AACzE,OAAOC,KAAK,MAAM,OAAO;AAEzB,SAASC,KAAK,EAAEC,cAAc,EAAEC,gBAAgB,QAAQ,qBAAqB;AAC7E,SAASC,gBAAgB,QAAQ,qBAAqB;AACtD,SAASC,sBAAsB,QAAQ,4CAA4C;AACnF,S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F,QAAA,KACHxC,SAAS;IACb6C,MAAM,EAAEvF,aAAc;IACtBsJ,MAAM,EAAEA,MAAO;IACf7H,QAAQ,EAAEA,QAAS;IACnBoE,IAAI,EAAExC,eAAe,CAACiC,OAAQ;IAC9BxD,QAAQ,EAAE0G,YAAa;IACvBkB,OAAO,EAAEjB,WAAY;IACrBzG,MAAM,EAAEiH;EAAW,EACpB,CACe,CAAC;AAEvB,CAAC;AAED,SAASV,sBAAsBA,CAAChD,MAAqB,EAAE;EACrD,IAAI;IAAA,IAAAoE,qBAAA;IACF,IAAMC,cAAc,GAAGrE,MAAM,CAACsE,OAAO,CAACC,GAAG,CAAC7J,cAAc,CAEvD;IAED,OAAO8J,KAAK,CAACC,IAAI,EAAAL,qBAAA,GAACC,cAAc,CAACK,OAAO,cAAAN,qBAAA,cAAAA,qBAAA,GAAI,EAAE,CAAC,CAACO,IAAI,CAAC,UAACC,MAAM;MAAA,OAC1D,CAAC,SAAS,EAAE,WAAW,CAAC,CAACC,QAAQ,CAACC,MAAM,CAACF,MAAM,CAACG,MAAM,CAAC,CAAC;IAAA,CAC1D,CAAC;EACH,CAAC,CAAC,OAAOC,MAAM,EAAE;IACf,OAAO,KAAK;EACd;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorError.js","names":["Banner","React","EditorError","_ref","children","createElement","variant","Content","Body"],"sources":["../../src/TextEditor/EditorError.tsx"],"sourcesContent":["import { Banner } from '@procore/core-react'\nimport React, { type PropsWithChildren } from 'react'\n\nexport const EditorError = ({ children }: PropsWithChildren<{}>) => {\n return (\n <Banner variant=\"error\">\n <Banner.Content>\n <Banner.Body>{children}</Banner.Body>\n </Banner.Content>\n </Banner>\n )\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,qBAAqB;AAC5C,OAAOC,KAAK,MAAkC,OAAO;AAErD,OAAO,IAAMC,WAAW,GAAG,SAAdA,WAAWA,CAAAC,IAAA,EAA4C;EAAA,IAAtCC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;EACpC,oBACEH,KAAA,CAAAI,aAAA,CAACL,MAAM;IAACM,OAAO,EAAC;EAAO,gBACrBL,KAAA,CAAAI,aAAA,CAACL,MAAM,CAACO,OAAO,qBACbN,KAAA,CAAAI,aAAA,CAACL,MAAM,CAACQ,IAAI,QAAEJ,QAAsB,CACtB,CACV,CAAC;AAEb,CAAC"}
|
|
1
|
+
{"version":3,"file":"EditorError.js","names":["Banner","React","EditorError","_ref","children","createElement","variant","Content","Body"],"sources":["../../src/TextEditor/EditorError.tsx"],"sourcesContent":["import { Banner } from '@procore/core-react'\nimport React, { type PropsWithChildren } from 'react'\n\nexport const EditorError = ({ children }: PropsWithChildren<{}>) => {\n return (\n <Banner variant=\"error\">\n <Banner.Content>\n <Banner.Body>{children}</Banner.Body>\n </Banner.Content>\n </Banner>\n )\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,qBAAqB;AAC5C,OAAOC,KAAK,MAAkC,OAAO;AAErD,OAAO,IAAMC,WAAW,GAAG,SAAdA,WAAWA,CAAAC,IAAA,EAA4C;EAAA,IAAtCC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;EACpC,oBACEH,KAAA,CAAAI,aAAA,CAACL,MAAM;IAACM,OAAO,EAAC;EAAO,gBACrBL,KAAA,CAAAI,aAAA,CAACL,MAAM,CAACO,OAAO,qBACbN,KAAA,CAAAI,aAAA,CAACL,MAAM,CAACQ,IAAI,QAAEJ,QAAsB,CACtB,CACV,CAAC;AAEb,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureFlagProvider.js","names":["getProcoreZone","getProviderParams","FeatureToggleProvider","React","useId","useMemo","useRef","LAUNCH_DARKLY_KEYS","development","staging","production","getEnvironment","_getProcoreZone","globalThis","location","hostname","environment","FeatureFlagProvider","_ref","children","_getProviderParams","companyId","projectId","idRef","context","user","email","current","createElement","apiKey"],"sources":["../../../src/TextEditor/Providers/FeatureFlagProvider.tsx"],"sourcesContent":["import { getProcoreZone, getProviderParams } from '@procore/web-sdk-env-utils'\nimport { FeatureToggleProvider } from '@procore/web-sdk-feature-toggle'\nimport type { ReactElement } from 'react'\nimport React, { useId, useMemo, useRef } from 'react'\n\nconst LAUNCH_DARKLY_KEYS: Record<string, string> = {\n development: '570f37b4eee8b907140070c5',\n staging: '570f2f6e348a2806d7006b6f',\n production: '570e9423348a2806d7004354',\n}\n\nconst getEnvironment = () =>\n getProcoreZone(globalThis.location.hostname)?.environment\n\nexport function FeatureFlagProvider({\n children,\n}: Readonly<{ children: ReactElement }>) {\n const { companyId, projectId } = getProviderParams()\n const environment = getEnvironment()\n const idRef = useRef(useId())\n\n const context = useMemo(\n () => ({ user: { email: idRef.current, projectId, companyId } }),\n [projectId, companyId]\n )\n\n return (\n <FeatureToggleProvider\n apiKey={LAUNCH_DARKLY_KEYS[environment]}\n context={context}\n >\n {children}\n </FeatureToggleProvider>\n )\n}\n"],"mappings":"AAAA,SAASA,cAAc,EAAEC,iBAAiB,QAAQ,4BAA4B;AAC9E,SAASC,qBAAqB,QAAQ,iCAAiC;AAEvE,OAAOC,KAAK,IAAIC,KAAK,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAErD,IAAMC,kBAA0C,GAAG;EACjDC,WAAW,EAAE,0BAA0B;EACvCC,OAAO,EAAE,0BAA0B;EACnCC,UAAU,EAAE;AACd,CAAC;AAED,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAA;EAAA,IAAAC,eAAA;EAAA,QAAAA,eAAA,GAClBZ,cAAc,CAACa,UAAU,CAACC,QAAQ,CAACC,QAAQ,CAAC,cAAAH,eAAA,uBAA5CA,eAAA,CAA8CI,WAAW;AAAA;AAE3D,OAAO,SAASC,mBAAmBA,CAAAC,IAAA,EAEM;EAAA,IADvCC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;EAER,IAAAC,kBAAA,GAAiCnB,iBAAiB,CAAC,CAAC;IAA5CoB,SAAS,GAAAD,kBAAA,CAATC,SAAS;IAAEC,SAAS,GAAAF,kBAAA,CAATE,SAAS;EAC5B,IAAMN,WAAW,GAAGL,cAAc,CAAC,CAAC;EACpC,IAAMY,KAAK,GAAGjB,MAAM,CAACF,KAAK,CAAC,CAAC,CAAC;EAE7B,IAAMoB,OAAO,GAAGnB,OAAO,CACrB;IAAA,OAAO;MAAEoB,IAAI,EAAE;QAAEC,KAAK,EAAEH,KAAK,CAACI,OAAO;QAAEL,SAAS,EAATA,SAAS;QAAED,SAAS,EAATA;MAAU;IAAE,CAAC;EAAA,CAAC,EAChE,CAACC,SAAS,EAAED,SAAS,CACvB,CAAC;EAED,oBACElB,KAAA,CAAAyB,aAAA,CAAC1B,qBAAqB;IACpB2B,MAAM,EAAEtB,kBAAkB,CAACS,WAAW,CAAE;IACxCQ,OAAO,EAAEA;EAAQ,GAEhBL,QACoB,CAAC;AAE5B"}
|
|
1
|
+
{"version":3,"file":"FeatureFlagProvider.js","names":["getProcoreZone","getProviderParams","FeatureToggleProvider","React","useId","useMemo","useRef","LAUNCH_DARKLY_KEYS","development","staging","production","getEnvironment","_getProcoreZone","globalThis","location","hostname","environment","FeatureFlagProvider","_ref","children","_getProviderParams","companyId","projectId","idRef","context","user","email","current","createElement","apiKey"],"sources":["../../../src/TextEditor/Providers/FeatureFlagProvider.tsx"],"sourcesContent":["import { getProcoreZone, getProviderParams } from '@procore/web-sdk-env-utils'\nimport { FeatureToggleProvider } from '@procore/web-sdk-feature-toggle'\nimport type { ReactElement } from 'react'\nimport React, { useId, useMemo, useRef } from 'react'\n\nconst LAUNCH_DARKLY_KEYS: Record<string, string> = {\n development: '570f37b4eee8b907140070c5',\n staging: '570f2f6e348a2806d7006b6f',\n production: '570e9423348a2806d7004354',\n}\n\nconst getEnvironment = () =>\n getProcoreZone(globalThis.location.hostname)?.environment\n\nexport function FeatureFlagProvider({\n children,\n}: Readonly<{ children: ReactElement }>) {\n const { companyId, projectId } = getProviderParams()\n const environment = getEnvironment()\n const idRef = useRef(useId())\n\n const context = useMemo(\n () => ({ user: { email: idRef.current, projectId, companyId } }),\n [projectId, companyId]\n )\n\n return (\n <FeatureToggleProvider\n apiKey={LAUNCH_DARKLY_KEYS[environment]}\n context={context}\n >\n {children}\n </FeatureToggleProvider>\n )\n}\n"],"mappings":"AAAA,SAASA,cAAc,EAAEC,iBAAiB,QAAQ,4BAA4B;AAC9E,SAASC,qBAAqB,QAAQ,iCAAiC;AAEvE,OAAOC,KAAK,IAAIC,KAAK,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAErD,IAAMC,kBAA0C,GAAG;EACjDC,WAAW,EAAE,0BAA0B;EACvCC,OAAO,EAAE,0BAA0B;EACnCC,UAAU,EAAE;AACd,CAAC;AAED,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAA;EAAA,IAAAC,eAAA;EAAA,QAAAA,eAAA,GAClBZ,cAAc,CAACa,UAAU,CAACC,QAAQ,CAACC,QAAQ,CAAC,cAAAH,eAAA,uBAA5CA,eAAA,CAA8CI,WAAW;AAAA;AAE3D,OAAO,SAASC,mBAAmBA,CAAAC,IAAA,EAEM;EAAA,IADvCC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;EAER,IAAAC,kBAAA,GAAiCnB,iBAAiB,CAAC,CAAC;IAA5CoB,SAAS,GAAAD,kBAAA,CAATC,SAAS;IAAEC,SAAS,GAAAF,kBAAA,CAATE,SAAS;EAC5B,IAAMN,WAAW,GAAGL,cAAc,CAAC,CAAC;EACpC,IAAMY,KAAK,GAAGjB,MAAM,CAACF,KAAK,CAAC,CAAC,CAAC;EAE7B,IAAMoB,OAAO,GAAGnB,OAAO,CACrB;IAAA,OAAO;MAAEoB,IAAI,EAAE;QAAEC,KAAK,EAAEH,KAAK,CAACI,OAAO;QAAEL,SAAS,EAATA,SAAS;QAAED,SAAS,EAATA;MAAU;IAAE,CAAC;EAAA,CAAC,EAChE,CAACC,SAAS,EAAED,SAAS,CACvB,CAAC;EAED,oBACElB,KAAA,CAAAyB,aAAA,CAAC1B,qBAAqB;IACpB2B,MAAM,EAAEtB,kBAAkB,CAACS,WAAW,CAAE;IACxCQ,OAAO,EAAEA;EAAQ,GAEhBL,QACoB,CAAC;AAE5B","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useStickyToolbar"],"sources":["../../../src/TextEditor/StickyToolbar/index.ts"],"sourcesContent":["export { useStickyToolbar } from './useStickyToolbar'\nexport type { UseStickyToolbarProps } from './useStickyToolbar.types'\n"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,oBAAoB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["useStickyToolbar"],"sources":["../../../src/TextEditor/StickyToolbar/index.ts"],"sourcesContent":["export { useStickyToolbar } from './useStickyToolbar'\nexport type { UseStickyToolbarProps } from './useStickyToolbar.types'\n"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,oBAAoB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStickyToolbar.js","names":["useEffect","useRef","useStickyToolbar","_ref","enabled","editor","editorRef","cssLoading","originalLimiterElementRef","current","modal","closest","modalHeader","querySelector","resizeObserver","ResizeObserver","entries","_iterator","_createForOfIteratorHelper","_step","s","n","done","entry","value","_getComputedStyle","getComputedStyle","target","height","heightValue","parseInt","setAttribute","concat","err","e","f","observe","disconnect","ui","view","stickyPanel","limiterElement"],"sources":["../../../src/TextEditor/StickyToolbar/useStickyToolbar.ts"],"sourcesContent":["import { useEffect, useRef } from 'react'\n\nimport type { UseStickyToolbarProps } from './useStickyToolbar.types'\n\nexport function useStickyToolbar({\n enabled,\n editor,\n editorRef,\n cssLoading,\n}: UseStickyToolbarProps) {\n const originalLimiterElementRef = useRef<HTMLElement | null>(null)\n\n useEffect(() => {\n if (!editorRef.current || !editor) {\n return\n }\n\n const modal = editorRef.current.closest('[data-id=\"modal\"]')\n if (!modal) {\n return\n }\n\n const modalHeader = modal.querySelector('[data-id=\"modal-header\"]')\n if (!modalHeader) {\n return\n }\n\n const resizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n const { height } = getComputedStyle(entry.target)\n const heightValue = parseInt(height, 10) - 1\n modal.setAttribute('style', `--modal-header-height: ${heightValue}px`)\n }\n })\n\n resizeObserver.observe(modalHeader)\n return () => resizeObserver.disconnect()\n }, [editorRef, editor])\n\n useEffect(() => {\n if (!editorRef.current || cssLoading || !editor?.ui.view.stickyPanel) {\n return\n }\n\n const stickyPanel = editor.ui.view.stickyPanel\n\n if (!enabled) {\n originalLimiterElementRef.current = stickyPanel.limiterElement\n stickyPanel.limiterElement = null\n } else if (originalLimiterElementRef.current) {\n stickyPanel.limiterElement = originalLimiterElementRef.current\n originalLimiterElementRef.current = null\n }\n }, [enabled, editorRef, editor, cssLoading])\n}\n"],"mappings":";;;AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAIzC,OAAO,SAASC,gBAAgBA,CAAAC,IAAA,EAKN;EAAA,IAJxBC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IACPC,MAAM,GAAAF,IAAA,CAANE,MAAM;IACNC,SAAS,GAAAH,IAAA,CAATG,SAAS;IACTC,UAAU,GAAAJ,IAAA,CAAVI,UAAU;EAEV,IAAMC,yBAAyB,GAAGP,MAAM,CAAqB,IAAI,CAAC;EAElED,SAAS,CAAC,YAAM;IACd,IAAI,CAACM,SAAS,CAACG,OAAO,IAAI,CAACJ,MAAM,EAAE;MACjC;IACF;IAEA,IAAMK,KAAK,GAAGJ,SAAS,CAACG,OAAO,CAACE,OAAO,CAAC,mBAAmB,CAAC;IAC5D,IAAI,CAACD,KAAK,EAAE;MACV;IACF;IAEA,IAAME,WAAW,GAAGF,KAAK,CAACG,aAAa,CAAC,0BAA0B,CAAC;IACnE,IAAI,CAACD,WAAW,EAAE;MAChB;IACF;IAEA,IAAME,cAAc,GAAG,IAAIC,cAAc,CAAC,UAACC,OAAO,EAAK;MAA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AO;MAC9DD,yBAAyB,CAACC,OAAO,GAAG,IAAI;IAC1C;EACF,CAAC,EAAE,CAACL,OAAO,EAAEE,SAAS,EAAED,MAAM,EAAEE,UAAU,CAAC,CAAC;AAC9C"}
|
|
1
|
+
{"version":3,"file":"useStickyToolbar.js","names":["useEffect","useRef","useStickyToolbar","_ref","enabled","editor","editorRef","cssLoading","originalLimiterElementRef","current","modal","closest","modalHeader","querySelector","resizeObserver","ResizeObserver","entries","_iterator","_createForOfIteratorHelper","_step","s","n","done","entry","value","_getComputedStyle","getComputedStyle","target","height","heightValue","parseInt","setAttribute","concat","err","e","f","observe","disconnect","ui","view","stickyPanel","limiterElement"],"sources":["../../../src/TextEditor/StickyToolbar/useStickyToolbar.ts"],"sourcesContent":["import { useEffect, useRef } from 'react'\n\nimport type { UseStickyToolbarProps } from './useStickyToolbar.types'\n\nexport function useStickyToolbar({\n enabled,\n editor,\n editorRef,\n cssLoading,\n}: UseStickyToolbarProps) {\n const originalLimiterElementRef = useRef<HTMLElement | null>(null)\n\n useEffect(() => {\n if (!editorRef.current || !editor) {\n return\n }\n\n const modal = editorRef.current.closest('[data-id=\"modal\"]')\n if (!modal) {\n return\n }\n\n const modalHeader = modal.querySelector('[data-id=\"modal-header\"]')\n if (!modalHeader) {\n return\n }\n\n const resizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n const { height } = getComputedStyle(entry.target)\n const heightValue = parseInt(height, 10) - 1\n modal.setAttribute('style', `--modal-header-height: ${heightValue}px`)\n }\n })\n\n resizeObserver.observe(modalHeader)\n return () => resizeObserver.disconnect()\n }, [editorRef, editor])\n\n useEffect(() => {\n if (!editorRef.current || cssLoading || !editor?.ui.view.stickyPanel) {\n return\n }\n\n const stickyPanel = editor.ui.view.stickyPanel\n\n if (!enabled) {\n originalLimiterElementRef.current = stickyPanel.limiterElement\n stickyPanel.limiterElement = null\n } else if (originalLimiterElementRef.current) {\n stickyPanel.limiterElement = originalLimiterElementRef.current\n originalLimiterElementRef.current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AAA;QAAAhB,SAAA,CAAAiB,CAAA,CAAAD,GAAA;MAAA;QAAAhB,SAAA,CAAAkB,CAAA;MAAA;IACH,CAAC,CAAC;IAEFrB,cAAc,CAACsB,OAAO,CAACxB,WAAW,CAAC;IACnC,OAAO;MAAA,OAAME,cAAc,CAACuB,UAAU,CAAC,CAAC;IAAA;EAC1C,CAAC,EAAE,CAAC/B,SAAS,EAAED,MAAM,CAAC,CAAC;EAEvBL,SAAS,CAAC,YAAM;IACd,IAAI,CAACM,SAAS,CAACG,OAAO,IAAIF,UAAU,IAAI,EAACF,MAAM,aAANA,MAAM,eAANA,MAAM,CAAEiC,EAAE,CAACC,IAAI,CAACC,WAAW,GAAE;MACpE;IACF;IAEA,IAAMA,WAAW,GAAGnC,MAAM,CAACiC,EAAE,CAACC,IAAI,CAACC,WAAW;IAE9C,IAAI,CAACpC,OAAO,EAAE;MACZI,yBAAyB,CAACC,OAAO,GAAG+B,WAAW,CAACC,cAAc;MAC9DD,WAAW,CAACC,cAAc,GAAG,IAAI;IACnC,CAAC,MAAM,IAAIjC,yBAAyB,CAACC,OAAO,EAAE;MAC5C+B,WAAW,CAACC,cAAc,GAAGjC,yBAAyB,CAACC,OAAO;MAC9DD,yBAAyB,CAACC,OAAO,GAAG,IAAI;IAC1C;EACF,CAAC,EAAE,CAACL,OAAO,EAAEE,SAAS,EAAED,MAAM,EAAEE,UAAU,CAAC,CAAC;AAC9C","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStickyToolbar.types.js","names":[],"sources":["../../../src/TextEditor/StickyToolbar/useStickyToolbar.types.ts"],"sourcesContent":["import type { ClassicEditor } from 'ckeditor5'\nimport type { RefObject } from 'react'\n\nexport interface UseStickyToolbarProps {\n enabled: boolean\n editorRef: RefObject<HTMLDivElement>\n editor?: ClassicEditor | null\n cssLoading?: boolean\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"useStickyToolbar.types.js","names":[],"sources":["../../../src/TextEditor/StickyToolbar/useStickyToolbar.types.ts"],"sourcesContent":["import type { ClassicEditor } from 'ckeditor5'\nimport type { RefObject } from 'react'\n\nexport interface UseStickyToolbarProps {\n enabled: boolean\n editorRef: RefObject<HTMLDivElement>\n editor?: ClassicEditor | null\n cssLoading?: boolean\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditor.js","names":["ToastAlertProvider","useFeatureFlag","React","CKTextEditor","FeatureFlagProvider","TextEditorI18nProvider","TinyMCETextEditor","FLAG_NAME","TextEditor","props","createElement","TextEditorInner","enforceCKEditor","editorProps","_objectWithoutProperties","_excluded","flagValue","isCKEditorEnabled"],"sources":["../../src/TextEditor/TextEditor.tsx"],"sourcesContent":["import { ToastAlertProvider } from '@procore/toast-alert'\nimport { useFeatureFlag } from '@procore/web-sdk-feature-toggle'\nimport React from 'react'\n\nimport { CKTextEditor } from './CKTextEditor'\nimport { FeatureFlagProvider } from './Providers/FeatureFlagProvider'\nimport type { TextEditorProps } from './TextEditor.types'\nimport { TextEditorI18nProvider } from './TextEditorI18nProvider'\nimport { TinyMCETextEditor } from './TinyMCETextEditor'\n\nconst FLAG_NAME = 'pmqs-ck-editor-enabled'\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 return (\n <TextEditorI18nProvider>\n <ToastAlertProvider>\n <FeatureFlagProvider>\n <TextEditorInner {...props} />\n </FeatureFlagProvider>\n </ToastAlertProvider>\n </TextEditorI18nProvider>\n )\n}\n\nfunction TextEditorInner(props: Readonly<TextEditorProps>) {\n const { enforceCKEditor, ...editorProps } = props\n const flagValue = useFeatureFlag<boolean>(FLAG_NAME, false)\n const isCKEditorEnabled = enforceCKEditor ?? flagValue\n\n return isCKEditorEnabled ? (\n <CKTextEditor {...editorProps} />\n ) : (\n <TinyMCETextEditor {...editorProps} />\n )\n}\n"],"mappings":";;;AAAA,SAASA,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,cAAc,QAAQ,iCAAiC;AAChE,OAAOC,KAAK,MAAM,OAAO;AAEzB,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,mBAAmB,QAAQ,iCAAiC;AAErE,SAASC,sBAAsB,QAAQ,0BAA0B;AACjE,SAASC,iBAAiB,QAAQ,qBAAqB;AAEvD,IAAMC,SAAS,GAAG,wBAAwB;;AAE1C;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,oBACEP,KAAA,CAAAQ,aAAA,CAACL,sBAAsB,qBACrBH,KAAA,CAAAQ,aAAA,CAACV,kBAAkB,qBACjBE,KAAA,CAAAQ,aAAA,CAACN,mBAAmB,qBAClBF,KAAA,CAAAQ,aAAA,CAACC,eAAe,EAAKF,KAAQ,CACV,CACH,CACE,CAAC;AAE7B;AAEA,SAASE,eAAeA,CAACF,KAAgC,EAAE;EACzD,IAAQG,eAAe,GAAqBH,KAAK,CAAzCG,eAAe;IAAKC,WAAW,GAAAC,wBAAA,CAAKL,KAAK,EAAAM,SAAA;EACjD,IAAMC,SAAS,GAAGf,cAAc,CAAUM,SAAS,EAAE,KAAK,CAAC;EAC3D,IAAMU,iBAAiB,GAAGL,eAAe,aAAfA,eAAe,cAAfA,eAAe,GAAII,SAAS;EAEtD,OAAOC,iBAAiB,gBACtBf,KAAA,CAAAQ,aAAA,CAACP,YAAY,EAAKU,WAAc,CAAC,gBAEjCX,KAAA,CAAAQ,aAAA,CAACJ,iBAAiB,EAAKO,WAAc,CACtC;AACH"}
|
|
1
|
+
{"version":3,"file":"TextEditor.js","names":["ToastAlertProvider","useFeatureFlag","React","CKTextEditor","FeatureFlagProvider","TextEditorI18nProvider","TinyMCETextEditor","FLAG_NAME","TextEditor","props","createElement","TextEditorInner","enforceCKEditor","editorProps","_objectWithoutProperties","_excluded","flagValue","isCKEditorEnabled"],"sources":["../../src/TextEditor/TextEditor.tsx"],"sourcesContent":["import { ToastAlertProvider } from '@procore/toast-alert'\nimport { useFeatureFlag } from '@procore/web-sdk-feature-toggle'\nimport React from 'react'\n\nimport { CKTextEditor } from './CKTextEditor'\nimport { FeatureFlagProvider } from './Providers/FeatureFlagProvider'\nimport type { TextEditorProps } from './TextEditor.types'\nimport { TextEditorI18nProvider } from './TextEditorI18nProvider'\nimport { TinyMCETextEditor } from './TinyMCETextEditor'\n\nconst FLAG_NAME = 'pmqs-ck-editor-enabled'\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 return (\n <TextEditorI18nProvider>\n <ToastAlertProvider>\n <FeatureFlagProvider>\n <TextEditorInner {...props} />\n </FeatureFlagProvider>\n </ToastAlertProvider>\n </TextEditorI18nProvider>\n )\n}\n\nfunction TextEditorInner(props: Readonly<TextEditorProps>) {\n const { enforceCKEditor, ...editorProps } = props\n const flagValue = useFeatureFlag<boolean>(FLAG_NAME, false)\n const isCKEditorEnabled = enforceCKEditor ?? flagValue\n\n return isCKEditorEnabled ? (\n <CKTextEditor {...editorProps} />\n ) : (\n <TinyMCETextEditor {...editorProps} />\n )\n}\n"],"mappings":";;;AAAA,SAASA,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,cAAc,QAAQ,iCAAiC;AAChE,OAAOC,KAAK,MAAM,OAAO;AAEzB,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,mBAAmB,QAAQ,iCAAiC;AAErE,SAASC,sBAAsB,QAAQ,0BAA0B;AACjE,SAASC,iBAAiB,QAAQ,qBAAqB;AAEvD,IAAMC,SAAS,GAAG,wBAAwB;;AAE1C;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,oBACEP,KAAA,CAAAQ,aAAA,CAACL,sBAAsB,qBACrBH,KAAA,CAAAQ,aAAA,CAACV,kBAAkB,qBACjBE,KAAA,CAAAQ,aAAA,CAACN,mBAAmB,qBAClBF,KAAA,CAAAQ,aAAA,CAACC,eAAe,EAAKF,KAAQ,CACV,CACH,CACE,CAAC;AAE7B;AAEA,SAASE,eAAeA,CAACF,KAAgC,EAAE;EACzD,IAAQG,eAAe,GAAqBH,KAAK,CAAzCG,eAAe;IAAKC,WAAW,GAAAC,wBAAA,CAAKL,KAAK,EAAAM,SAAA;EACjD,IAAMC,SAAS,GAAGf,cAAc,CAAUM,SAAS,EAAE,KAAK,CAAC;EAC3D,IAAMU,iBAAiB,GAAGL,eAAe,aAAfA,eAAe,cAAfA,eAAe,GAAII,SAAS;EAEtD,OAAOC,iBAAiB,gBACtBf,KAAA,CAAAQ,aAAA,CAACP,YAAY,EAAKU,WAAc,CAAC,gBAEjCX,KAAA,CAAAQ,aAAA,CAACJ,iBAAiB,EAAKO,WAAc,CACtC;AACH","ignoreList":[]}
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export declare const GlobalEditorStyles: import("react").NamedExoticComponent<import("styled-components").ExecutionProps & {
|
|
3
2
|
zIndex: number;
|
|
4
3
|
}>;
|
|
5
4
|
export declare const StyledTextEditor: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
6
|
-
error?: boolean
|
|
7
|
-
$ready?: boolean
|
|
5
|
+
error?: boolean;
|
|
6
|
+
$ready?: boolean;
|
|
8
7
|
}>> & string;
|
|
9
8
|
export declare const StyledImageUploadWarningToast: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("react").HTMLAttributes<HTMLDivElement> & import("@procore/core-react").FlexProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
|
|
10
|
-
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
9
|
+
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
11
10
|
}, never>> & string & Omit<import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLDivElement> & import("@procore/core-react").FlexProps & import("react").RefAttributes<HTMLDivElement>>, keyof import("react").Component<any, {}, any>>;
|
|
12
11
|
export declare const StyledImageUploadWarningToastIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<{
|
|
13
|
-
size?: import("@procore/core-icons/dist/Icon").IconSize
|
|
12
|
+
size?: import("@procore/core-icons/dist/Icon").IconSize;
|
|
14
13
|
} & import("react").SVGAttributes<SVGElement> & import("react").RefAttributes<SVGSVGElement>, "ref"> & {
|
|
15
|
-
ref?: ((instance: SVGSVGElement | null) => void) | import("react").RefObject<SVGSVGElement> | null | undefined;
|
|
14
|
+
ref?: ((instance: SVGSVGElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<SVGSVGElement> | null | undefined;
|
|
16
15
|
}, never>> & string & Omit<import("react").ForwardRefExoticComponent<{
|
|
17
|
-
size?: import("@procore/core-icons/dist/Icon").IconSize
|
|
16
|
+
size?: import("@procore/core-icons/dist/Icon").IconSize;
|
|
18
17
|
} & import("react").SVGAttributes<SVGElement> & import("react").RefAttributes<SVGSVGElement>>, keyof import("react").Component<any, {}, any>>;
|
|
19
18
|
export declare const StyledReadOnlyValue: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("react").HTMLAttributes<HTMLSpanElement> & import("@procore/core-react").TypographyProps & import("react").RefAttributes<HTMLSpanElement>, "ref"> & {
|
|
20
|
-
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
19
|
+
ref?: ((instance: HTMLSpanElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
21
20
|
}, never>> & string & Omit<import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLSpanElement> & import("@procore/core-react").TypographyProps & import("react").RefAttributes<HTMLSpanElement>>, keyof import("react").Component<any, {}, any>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Info } from '@procore/core-icons';
|
|
2
2
|
import { borderRadius, colors, Flex, Typography } from '@procore/core-react';
|
|
3
3
|
import styled, { createGlobalStyle } from 'styled-components';
|
|
4
|
-
export var GlobalEditorStyles = /*#__PURE__*/createGlobalStyle([":root{--ck-z-default:", ";--ck-z-modal:", ";--ck-z-dialog:", ";}.ck-body-wrapper{--ck-z-default:", ";--ck-z-modal:", ";--ck-z-dialog:", ";}.ck-balloon-panel{z-index:", " !important;}.ck-dropdown__panel{z-index:", " !important;}.ck.ck-toolbar_grouping{container-type:inline-size;}.ck.ck-toolbar__grouped-dropdown > .ck-dropdown__panel{max-width:100cqw !important;z-index:", " !important;}.ck.ck-toolbar__grouped-dropdown > .ck-dropdown__panel .ck-toolbar__items{flex-wrap:wrap !important;}.ck-content{padding:16px 28px !important;--ck-content-font-family:Inter,'Noto Sans JP','Noto Sans KR','Noto Sans SC','Noto Sans TC',sans-serif;--ck-content-font-size:14px;--ck-content-word-break:break-word;--ck-content-overflow-wrap:break-word;--ck-content-line-height:1.4;p{margin-top:0 !important;margin-bottom:0 !important;}img{max-width:100%;height:auto;}}[data-id=\"modal\"] .ck-sticky-panel__content_sticky{top:var(--modal-header-height,84px) !important;}"], function (_ref) {
|
|
4
|
+
export var GlobalEditorStyles = /*#__PURE__*/createGlobalStyle([":root{--ck-z-default:", ";--ck-z-modal:", ";--ck-z-dialog:", ";}.ck-body-wrapper{--ck-z-default:", ";--ck-z-modal:", ";--ck-z-dialog:", ";}.ck-balloon-panel{z-index:", " !important;}.ck-dropdown__panel{z-index:", " !important;}.ck.ck-toolbar_grouping{container-type:inline-size;}.ck.ck-toolbar__grouped-dropdown > .ck-dropdown__panel{max-width:100cqw !important;z-index:", " !important;}.ck.ck-toolbar__grouped-dropdown > .ck-dropdown__panel .ck-toolbar__items{flex-wrap:wrap !important;}.ck-content{padding:16px 28px !important;--ck-content-font-family:Inter,'Noto Sans JP','Noto Sans KR','Noto Sans SC','Noto Sans TC',sans-serif;--ck-content-font-size:14px;--ck-content-word-break:break-word;--ck-content-overflow-wrap:break-word;--ck-content-line-height:1.4;overflow-x:auto;p{margin-top:0 !important;margin-bottom:0 !important;}img{max-width:100%;height:auto;}}[data-id=\"modal\"] .ck-sticky-panel__content_sticky{top:var(--modal-header-height,84px) !important;}"], function (_ref) {
|
|
5
5
|
var zIndex = _ref.zIndex;
|
|
6
6
|
return zIndex;
|
|
7
7
|
}, function (_ref2) {
|
|
@@ -31,7 +31,7 @@ export var GlobalEditorStyles = /*#__PURE__*/createGlobalStyle([":root{--ck-z-de
|
|
|
31
31
|
});
|
|
32
32
|
export var StyledTextEditor = /*#__PURE__*/styled.div.withConfig({
|
|
33
33
|
displayName: "StyledTextEditor",
|
|
34
|
-
componentId: "text-editor-
|
|
34
|
+
componentId: "text-editor-1_1_0__sc-iim79x-0"
|
|
35
35
|
})([".ck.ck-editor{opacity:", ";}", ""], function (_ref0) {
|
|
36
36
|
var $ready = _ref0.$ready;
|
|
37
37
|
return $ready ? 1 : 0;
|
|
@@ -41,14 +41,14 @@ export var StyledTextEditor = /*#__PURE__*/styled.div.withConfig({
|
|
|
41
41
|
});
|
|
42
42
|
export var StyledImageUploadWarningToast = /*#__PURE__*/styled(Flex).withConfig({
|
|
43
43
|
displayName: "StyledImageUploadWarningToast",
|
|
44
|
-
componentId: "text-editor-
|
|
44
|
+
componentId: "text-editor-1_1_0__sc-iim79x-1"
|
|
45
45
|
})(["background-color:", ";border-radius:", "px;box-shadow:0px 8px 32px -4px hsla(200,10%,15%,0.64);color:", ";min-height:48px;width:550px;"], colors.blue40, borderRadius.md, colors.white);
|
|
46
46
|
export var StyledImageUploadWarningToastIcon = /*#__PURE__*/styled(Info).withConfig({
|
|
47
47
|
displayName: "StyledImageUploadWarningToastIcon",
|
|
48
|
-
componentId: "text-editor-
|
|
48
|
+
componentId: "text-editor-1_1_0__sc-iim79x-2"
|
|
49
49
|
})(["color:", ";"], colors.white);
|
|
50
50
|
export var StyledReadOnlyValue = /*#__PURE__*/styled(Typography).withConfig({
|
|
51
51
|
displayName: "StyledReadOnlyValue",
|
|
52
|
-
componentId: "text-editor-
|
|
52
|
+
componentId: "text-editor-1_1_0__sc-iim79x-3"
|
|
53
53
|
})(["overflow-wrap:anywhere;margin-block-start:0 !important;user-select:text;table{border-width:revert-layer;border-style:solid;border-color:", ";overflow-wrap:break-word;}td,tr,th,tbody{border-width:revert-layer;border-style:inherit;border-color:inherit;}p{line-height:normal;}"], colors.gray60);
|
|
54
54
|
//# sourceMappingURL=TextEditor.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditor.styles.js","names":["Info","borderRadius","colors","Flex","Typography","styled","createGlobalStyle","GlobalEditorStyles","_ref","zIndex","_ref2","_ref3","_ref4","_ref5","_ref6","_ref7","_ref8","_ref9","StyledTextEditor","div","withConfig","displayName","componentId","_ref0","$ready","_ref1","error","concat","red50","StyledImageUploadWarningToast","blue40","md","white","StyledImageUploadWarningToastIcon","StyledReadOnlyValue","gray60"],"sources":["../../src/TextEditor/TextEditor.styles.ts"],"sourcesContent":["import { Info } from '@procore/core-icons'\nimport { borderRadius, colors, Flex, Typography } from '@procore/core-react'\nimport styled, { createGlobalStyle } from 'styled-components'\n\nexport const GlobalEditorStyles = createGlobalStyle<{\n zIndex: number\n}>`\n :root {\n --ck-z-default: ${({ zIndex }) => zIndex};\n --ck-z-modal: ${({ zIndex }) => zIndex + 999};\n --ck-z-dialog: ${({ zIndex }) => zIndex + 1000};\n }\n \n .ck-body-wrapper {\n --ck-z-default: ${({ zIndex }) => zIndex};\n --ck-z-modal: ${({ zIndex }) => zIndex + 999};\n --ck-z-dialog: ${({ zIndex }) => zIndex + 1000};\n }\n \n .ck-balloon-panel {\n z-index: ${({ zIndex }) => zIndex + 1000} !important;\n }\n\n .ck-dropdown__panel {\n z-index: ${({ zIndex }) => zIndex + 1000} !important;\n }\n\n .ck.ck-toolbar_grouping {\n container-type: inline-size;\n }\n\n .ck.ck-toolbar__grouped-dropdown > .ck-dropdown__panel {\n max-width: 100cqw !important;\n z-index: ${({ zIndex }) => zIndex + 1000} !important;\n }\n\n .ck.ck-toolbar__grouped-dropdown > .ck-dropdown__panel .ck-toolbar__items {\n flex-wrap: wrap !important;\n }\n\n .ck-content {\n padding: 16px 28px !important;\n --ck-content-font-family: Inter, 'Noto Sans JP', 'Noto Sans KR', 'Noto Sans SC', 'Noto Sans TC', sans-serif;\n --ck-content-font-size: 14px;\n --ck-content-word-break: break-word;\n --ck-content-overflow-wrap: break-word;\n --ck-content-line-height: 1.4;\n\n p {\n margin-top: 0 !important;\n margin-bottom: 0 !important;\n }\n\n img {\n max-width: 100%;\n height: auto;\n }\n }\n\n [data-id=\"modal\"] .ck-sticky-panel__content_sticky {\n top: var(--modal-header-height, 84px) !important;\n }\n`\n\nexport const StyledTextEditor = styled.div<{\n error?: boolean\n $ready?: boolean\n}>`\n .ck.ck-editor {\n opacity: ${({ $ready }) => ($ready ? 1 : 0)};\n }\n\n ${({ error }) =>\n error &&\n `\n .ck-sticky-panel__content {\n border-top-color: ${colors.red50} !important;\n border-left-color: ${colors.red50} !important;\n border-right-color: ${colors.red50} !important;\n }\n\n .ck-editor__editable {\n border-left-color: ${colors.red50} !important;\n border-right-color: ${colors.red50} !important;\n border-bottom-color: ${colors.red50} !important;\n }\n `}\n`\n\nexport const StyledImageUploadWarningToast = styled(Flex)`\n background-color: ${colors.blue40};\n border-radius: ${borderRadius.md}px;\n box-shadow: 0px 8px 32px -4px hsla(200, 10%, 15%, 0.64);\n color: ${colors.white};\n min-height: 48px;\n width: 550px;\n`\n\nexport const StyledImageUploadWarningToastIcon = styled(Info)`\n color: ${colors.white};\n`\n\nexport const StyledReadOnlyValue = styled(Typography)`\n overflow-wrap: anywhere;\n margin-block-start: 0 !important;\n user-select: text;\n\n table {\n border-width: revert-layer;\n border-style: solid;\n border-color: ${colors.gray60};\n overflow-wrap: break-word;\n }\n\n td,\n tr,\n th,\n tbody {\n border-width: revert-layer;\n border-style: inherit;\n border-color: inherit;\n }\n\n p {\n line-height: normal;\n }\n`\n"],"mappings":"AAAA,SAASA,IAAI,QAAQ,qBAAqB;AAC1C,SAASC,YAAY,EAAEC,MAAM,EAAEC,IAAI,EAAEC,UAAU,QAAQ,qBAAqB;AAC5E,OAAOC,MAAM,IAAIC,iBAAiB,QAAQ,mBAAmB;AAE7D,OAAO,IAAMC,kBAAkB,gBAAGD,iBAAiB,
|
|
1
|
+
{"version":3,"file":"TextEditor.styles.js","names":["Info","borderRadius","colors","Flex","Typography","styled","createGlobalStyle","GlobalEditorStyles","_ref","zIndex","_ref2","_ref3","_ref4","_ref5","_ref6","_ref7","_ref8","_ref9","StyledTextEditor","div","withConfig","displayName","componentId","_ref0","$ready","_ref1","error","concat","red50","StyledImageUploadWarningToast","blue40","md","white","StyledImageUploadWarningToastIcon","StyledReadOnlyValue","gray60"],"sources":["../../src/TextEditor/TextEditor.styles.ts"],"sourcesContent":["import { Info } from '@procore/core-icons'\nimport { borderRadius, colors, Flex, Typography } from '@procore/core-react'\nimport styled, { createGlobalStyle } from 'styled-components'\n\nexport const GlobalEditorStyles = createGlobalStyle<{\n zIndex: number\n}>`\n :root {\n --ck-z-default: ${({ zIndex }) => zIndex};\n --ck-z-modal: ${({ zIndex }) => zIndex + 999};\n --ck-z-dialog: ${({ zIndex }) => zIndex + 1000};\n }\n \n .ck-body-wrapper {\n --ck-z-default: ${({ zIndex }) => zIndex};\n --ck-z-modal: ${({ zIndex }) => zIndex + 999};\n --ck-z-dialog: ${({ zIndex }) => zIndex + 1000};\n }\n \n .ck-balloon-panel {\n z-index: ${({ zIndex }) => zIndex + 1000} !important;\n }\n\n .ck-dropdown__panel {\n z-index: ${({ zIndex }) => zIndex + 1000} !important;\n }\n\n .ck.ck-toolbar_grouping {\n container-type: inline-size;\n }\n\n .ck.ck-toolbar__grouped-dropdown > .ck-dropdown__panel {\n max-width: 100cqw !important;\n z-index: ${({ zIndex }) => zIndex + 1000} !important;\n }\n\n .ck.ck-toolbar__grouped-dropdown > .ck-dropdown__panel .ck-toolbar__items {\n flex-wrap: wrap !important;\n }\n\n .ck-content {\n padding: 16px 28px !important;\n --ck-content-font-family: Inter, 'Noto Sans JP', 'Noto Sans KR', 'Noto Sans SC', 'Noto Sans TC', sans-serif;\n --ck-content-font-size: 14px;\n --ck-content-word-break: break-word;\n --ck-content-overflow-wrap: break-word;\n --ck-content-line-height: 1.4;\n overflow-x: auto;\n\n p {\n margin-top: 0 !important;\n margin-bottom: 0 !important;\n }\n\n img {\n max-width: 100%;\n height: auto;\n }\n }\n\n [data-id=\"modal\"] .ck-sticky-panel__content_sticky {\n top: var(--modal-header-height, 84px) !important;\n }\n`\n\nexport const StyledTextEditor = styled.div<{\n error?: boolean\n $ready?: boolean\n}>`\n .ck.ck-editor {\n opacity: ${({ $ready }) => ($ready ? 1 : 0)};\n }\n\n ${({ error }) =>\n error &&\n `\n .ck-sticky-panel__content {\n border-top-color: ${colors.red50} !important;\n border-left-color: ${colors.red50} !important;\n border-right-color: ${colors.red50} !important;\n }\n\n .ck-editor__editable {\n border-left-color: ${colors.red50} !important;\n border-right-color: ${colors.red50} !important;\n border-bottom-color: ${colors.red50} !important;\n }\n `}\n`\n\nexport const StyledImageUploadWarningToast = styled(Flex)`\n background-color: ${colors.blue40};\n border-radius: ${borderRadius.md}px;\n box-shadow: 0px 8px 32px -4px hsla(200, 10%, 15%, 0.64);\n color: ${colors.white};\n min-height: 48px;\n width: 550px;\n`\n\nexport const StyledImageUploadWarningToastIcon = styled(Info)`\n color: ${colors.white};\n`\n\nexport const StyledReadOnlyValue = styled(Typography)`\n overflow-wrap: anywhere;\n margin-block-start: 0 !important;\n user-select: text;\n\n table {\n border-width: revert-layer;\n border-style: solid;\n border-color: ${colors.gray60};\n overflow-wrap: break-word;\n }\n\n td,\n tr,\n th,\n tbody {\n border-width: revert-layer;\n border-style: inherit;\n border-color: inherit;\n }\n\n p {\n line-height: normal;\n }\n`\n"],"mappings":"AAAA,SAASA,IAAI,QAAQ,qBAAqB;AAC1C,SAASC,YAAY,EAAEC,MAAM,EAAEC,IAAI,EAAEC,UAAU,QAAQ,qBAAqB;AAC5E,OAAOC,MAAM,IAAIC,iBAAiB,QAAQ,mBAAmB;AAE7D,OAAO,IAAMC,kBAAkB,gBAAGD,iBAAiB,48BAI7B,UAAAE,IAAA;EAAA,IAAGC,MAAM,GAAAD,IAAA,CAANC,MAAM;EAAA,OAAOA,MAAM;AAAA,GACxB,UAAAC,KAAA;EAAA,IAAGD,MAAM,GAAAC,KAAA,CAAND,MAAM;EAAA,OAAOA,MAAM,GAAG,GAAG;AAAA,GAC3B,UAAAE,KAAA;EAAA,IAAGF,MAAM,GAAAE,KAAA,CAANF,MAAM;EAAA,OAAOA,MAAM,GAAG,IAAI;AAAA,GAI5B,UAAAG,KAAA;EAAA,IAAGH,MAAM,GAAAG,KAAA,CAANH,MAAM;EAAA,OAAOA,MAAM;AAAA,GACxB,UAAAI,KAAA;EAAA,IAAGJ,MAAM,GAAAI,KAAA,CAANJ,MAAM;EAAA,OAAOA,MAAM,GAAG,GAAG;AAAA,GAC3B,UAAAK,KAAA;EAAA,IAAGL,MAAM,GAAAK,KAAA,CAANL,MAAM;EAAA,OAAOA,MAAM,GAAG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AM,CAAC8B,KAAK,CACtB;AAED,OAAO,IAAME,mBAAmB,gBAAG7B,MAAM,CAACD,UAAU,CAAC,CAAAgB,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,0RAQjCpB,MAAM,CAACiC,MAAM,CAgBhC","ignoreList":[]}
|
|
@@ -201,6 +201,6 @@ export interface TextEditorProps extends TextEditorImageUploadOptions {
|
|
|
201
201
|
*/
|
|
202
202
|
enforceCKEditor?: true;
|
|
203
203
|
}
|
|
204
|
-
export
|
|
204
|
+
export type KeyDownListener = (event: EventInfo, data: {
|
|
205
205
|
domEvent: Event;
|
|
206
206
|
}) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditor.types.js","names":[],"sources":["../../src/TextEditor/TextEditor.types.ts"],"sourcesContent":["import type { I18njs } from '@procore/core-i18n-js'\nimport type { TextEditorProps as CoreTextEditorProps } from '@procore/core-react'\nimport type { Locale } from '@procore/globalization-toolkit'\nimport type { ClassicEditor, EventInfo } from 'ckeditor5'\n\nexport interface TextEditorImageUploadResult {\n urls: {\n default: string\n }\n /**\n * Durable ProstoreFile id. The text editor embeds this ID in saved markup to\n * mark the image as a first-party upload (backend email/PDF sanitizers rely on\n * it). The persisted URL is a permanent, publicly fetchable Prostore URL, so\n * it renders as-is in the app, emails, and exports.\n *\n * @since 0.6.0\n */\n prostoreFileId: number | string\n width?: number\n height?: number\n}\n\nexport interface TextEditorImageUploadHandlers {\n /**\n * Uploads the selected image and returns durable backend-approved image URLs.\n *\n * @since 0.4.2\n */\n upload: (\n file: File,\n context: { signal: AbortSignal },\n callbacks: { onProgress?: (uploaded: number, total?: number) => void }\n ) => Promise<TextEditorImageUploadResult>\n i18n: Pick<I18njs, 't'>\n onError?: (message: string) => void\n onWarning?: (message: string) => void\n}\n\nexport interface TextEditorImageUploadOptions {\n /**\n * Required to enable image uploads. When omitted, the editor renders without\n * the Procore image-upload plugin.\n *\n * @since 0.5.0\n */\n companyId?: number | string\n projectId?: number | string\n /**\n * Identifier of the tool hosting the editor (e.g. `rfis`, `submittal_log`).\n * Required to enable image uploads: it is sent with each upload for\n * attribution/audit and is validated by the backend against known tools.\n * When omitted, the editor renders without the Procore image-upload plugin.\n *\n * @since 0.7.0\n */\n toolName?: string\n}\n\nexport interface TextEditorProps extends TextEditorImageUploadOptions {\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 * Indicates if the editor is in readonly mode.\n * When true, renders the content using TextEditorOutput instead of the editable editor.\n *\n * @since 0.2.0\n */\n readonly?: 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 /**\n * Placeholder text shown when the editor is empty\n *\n * @since 1.0.0\n */\n placeholder?: string\n\n /**\n * TinyMCE init configuration. Merged with internal defaults; use this to\n * pass custom content_style, paste hooks, or other TinyMCE-specific options.\n * Has no effect when CKEditor is active.\n *\n * @since 1.0.0\n */\n init?: CoreTextEditorProps['init']\n\n /**\n * Number of rows to control the editor height. When set, the editor height\n * is fixed. When omitted, the editor grows with content.\n *\n * @since 1.0.0\n */\n rows?: number\n\n /**\n * Opt in to CKEditor immediately, bypassing the gradual feature flag rollout.\n * Use this only when you explicitly want to ignore the rollout schedule.\n * When enabled, the LaunchDarkly flag is bypassed and CKEditor is rendered directly.\n *\n * @since 1.0.0\n */\n enforceCKEditor?: true\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 { I18njs } from '@procore/core-i18n-js'\nimport type { TextEditorProps as CoreTextEditorProps } from '@procore/core-react'\nimport type { Locale } from '@procore/globalization-toolkit'\nimport type { ClassicEditor, EventInfo } from 'ckeditor5'\n\nexport interface TextEditorImageUploadResult {\n urls: {\n default: string\n }\n /**\n * Durable ProstoreFile id. The text editor embeds this ID in saved markup to\n * mark the image as a first-party upload (backend email/PDF sanitizers rely on\n * it). The persisted URL is a permanent, publicly fetchable Prostore URL, so\n * it renders as-is in the app, emails, and exports.\n *\n * @since 0.6.0\n */\n prostoreFileId: number | string\n width?: number\n height?: number\n}\n\nexport interface TextEditorImageUploadHandlers {\n /**\n * Uploads the selected image and returns durable backend-approved image URLs.\n *\n * @since 0.4.2\n */\n upload: (\n file: File,\n context: { signal: AbortSignal },\n callbacks: { onProgress?: (uploaded: number, total?: number) => void }\n ) => Promise<TextEditorImageUploadResult>\n i18n: Pick<I18njs, 't'>\n onError?: (message: string) => void\n onWarning?: (message: string) => void\n}\n\nexport interface TextEditorImageUploadOptions {\n /**\n * Required to enable image uploads. When omitted, the editor renders without\n * the Procore image-upload plugin.\n *\n * @since 0.5.0\n */\n companyId?: number | string\n projectId?: number | string\n /**\n * Identifier of the tool hosting the editor (e.g. `rfis`, `submittal_log`).\n * Required to enable image uploads: it is sent with each upload for\n * attribution/audit and is validated by the backend against known tools.\n * When omitted, the editor renders without the Procore image-upload plugin.\n *\n * @since 0.7.0\n */\n toolName?: string\n}\n\nexport interface TextEditorProps extends TextEditorImageUploadOptions {\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 * Indicates if the editor is in readonly mode.\n * When true, renders the content using TextEditorOutput instead of the editable editor.\n *\n * @since 0.2.0\n */\n readonly?: 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 /**\n * Placeholder text shown when the editor is empty\n *\n * @since 1.0.0\n */\n placeholder?: string\n\n /**\n * TinyMCE init configuration. Merged with internal defaults; use this to\n * pass custom content_style, paste hooks, or other TinyMCE-specific options.\n * Has no effect when CKEditor is active.\n *\n * @since 1.0.0\n */\n init?: CoreTextEditorProps['init']\n\n /**\n * Number of rows to control the editor height. When set, the editor height\n * is fixed. When omitted, the editor grows with content.\n *\n * @since 1.0.0\n */\n rows?: number\n\n /**\n * Opt in to CKEditor immediately, bypassing the gradual feature flag rollout.\n * Use this only when you explicitly want to ignore the rollout schedule.\n * When enabled, the LaunchDarkly flag is bypassed and CKEditor is rendered directly.\n *\n * @since 1.0.0\n */\n enforceCKEditor?: true\n}\n\nexport type KeyDownListener = (\n event: EventInfo,\n data: { domEvent: Event }\n) => void\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditorI18nProvider.js","names":["useRequestTranslations","I18nProvider","useI18nContext","React","en","pseudo","TextEditorI18nProvider","_ref","children","clientI18n","cdnTranslations","locale","type","absolute_file_path","concat","oldTranslations","enableCDN","createElement","translations"],"sources":["../../src/TextEditor/TextEditorI18nProvider.tsx"],"sourcesContent":["import { useRequestTranslations } from '@procore/cdn-translations'\nimport { I18nProvider, useI18nContext } from '@procore/core-react'\nimport React from 'react'\n\nimport en from '../locales/en.json'\nimport pseudo from '../locales/pseudo.json'\n\nexport function TextEditorI18nProvider({\n children,\n}: Readonly<React.PropsWithChildren>) {\n const clientI18n = useI18nContext()\n\n const cdnTranslations = useRequestTranslations(\n {\n locale: clientI18n.locale,\n type: 'file',\n absolute_file_path: (locale) =>\n `core/packages/text-editor/src/locales/${locale}.json`,\n },\n {\n en,\n pseudo,\n },\n {\n oldTranslations: {},\n enableCDN: true,\n }\n )\n\n return (\n <I18nProvider\n locale={clientI18n.locale}\n translations={cdnTranslations.translations}\n >\n {children}\n </I18nProvider>\n )\n}\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAQ,2BAA2B;AAClE,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAClE,OAAOC,KAAK,MAAM,OAAO;AAEzB,OAAOC,EAAE,MAAM,oBAAoB;AACnC,OAAOC,MAAM,MAAM,wBAAwB;AAE3C,OAAO,SAASC,sBAAsBA,CAAAC,IAAA,EAEA;EAAA,IADpCC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;EAER,IAAMC,UAAU,GAAGP,cAAc,CAAC,CAAC;EAEnC,IAAMQ,eAAe,GAAGV,sBAAsB,CAC5C;IACEW,MAAM,EAAEF,UAAU,CAACE,MAAM;IACzBC,IAAI,EAAE,MAAM;IACZC,kBAAkB,EAAE,SAApBA,kBAAkBA,CAAGF,MAAM;MAAA,gDAAAG,MAAA,CACgBH,MAAM;IAAA;EACnD,CAAC,EACD;IACEP,EAAE,EAAFA,EAAE;IACFC,MAAM,EAANA;EACF,CAAC,EACD;IACEU,eAAe,EAAE,CAAC,CAAC;IACnBC,SAAS,EAAE;EACb,CACF,CAAC;EAED,oBACEb,KAAA,CAAAc,aAAA,CAAChB,YAAY;IACXU,MAAM,EAAEF,UAAU,CAACE,MAAO;IAC1BO,YAAY,EAAER,eAAe,CAACQ;EAAa,GAE1CV,QACW,CAAC;AAEnB"}
|
|
1
|
+
{"version":3,"file":"TextEditorI18nProvider.js","names":["useRequestTranslations","I18nProvider","useI18nContext","React","en","pseudo","TextEditorI18nProvider","_ref","children","clientI18n","cdnTranslations","locale","type","absolute_file_path","concat","oldTranslations","enableCDN","createElement","translations"],"sources":["../../src/TextEditor/TextEditorI18nProvider.tsx"],"sourcesContent":["import { useRequestTranslations } from '@procore/cdn-translations'\nimport { I18nProvider, useI18nContext } from '@procore/core-react'\nimport React from 'react'\n\nimport en from '../locales/en.json'\nimport pseudo from '../locales/pseudo.json'\n\nexport function TextEditorI18nProvider({\n children,\n}: Readonly<React.PropsWithChildren>) {\n const clientI18n = useI18nContext()\n\n const cdnTranslations = useRequestTranslations(\n {\n locale: clientI18n.locale,\n type: 'file',\n absolute_file_path: (locale) =>\n `core/packages/text-editor/src/locales/${locale}.json`,\n },\n {\n en,\n pseudo,\n },\n {\n oldTranslations: {},\n enableCDN: true,\n }\n )\n\n return (\n <I18nProvider\n locale={clientI18n.locale}\n translations={cdnTranslations.translations}\n >\n {children}\n </I18nProvider>\n )\n}\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAQ,2BAA2B;AAClE,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAClE,OAAOC,KAAK,MAAM,OAAO;AAEzB,OAAOC,EAAE,MAAM,oBAAoB;AACnC,OAAOC,MAAM,MAAM,wBAAwB;AAE3C,OAAO,SAASC,sBAAsBA,CAAAC,IAAA,EAEA;EAAA,IADpCC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;EAER,IAAMC,UAAU,GAAGP,cAAc,CAAC,CAAC;EAEnC,IAAMQ,eAAe,GAAGV,sBAAsB,CAC5C;IACEW,MAAM,EAAEF,UAAU,CAACE,MAAM;IACzBC,IAAI,EAAE,MAAM;IACZC,kBAAkB,EAAE,SAApBA,kBAAkBA,CAAGF,MAAM;MAAA,gDAAAG,MAAA,CACgBH,MAAM;IAAA;EACnD,CAAC,EACD;IACEP,EAAE,EAAFA,EAAE;IACFC,MAAM,EAANA;EACF,CAAC,EACD;IACEU,eAAe,EAAE,CAAC,CAAC;IACnBC,SAAS,EAAE;EACb,CACF,CAAC;EAED,oBACEb,KAAA,CAAAc,aAAA,CAAChB,YAAY;IACXU,MAAM,EAAEF,UAAU,CAACE,MAAO;IAC1BO,YAAY,EAAER,eAAe,CAACQ;EAAa,GAE1CV,QACW,CAAC;AAEnB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
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"}
|
|
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","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditorProvider.types.js","names":[],"sources":["../../src/TextEditor/TextEditorProvider.types.ts"],"sourcesContent":["import type React from 'react'\n\ntype TextEditorFeatureToggle = {\n stickyToolbar?: boolean\n tabAsNavigation?: boolean\n}\n\nexport interface TextEditorProviderProps {\n children: React.ReactNode\n /**\n * - `stickyToolbar` - Have the editor toolbar stick to the top when content is longer than the page length.\n * - `tabAsNavigation` - Have `Tab` key exit the editor. Support `Alt`/`Opt` + `Tab` as triple space indent.\n */\n features?: TextEditorFeatureToggle\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"TextEditorProvider.types.js","names":[],"sources":["../../src/TextEditor/TextEditorProvider.types.ts"],"sourcesContent":["import type React from 'react'\n\ntype TextEditorFeatureToggle = {\n stickyToolbar?: boolean\n tabAsNavigation?: boolean\n}\n\nexport interface TextEditorProviderProps {\n children: React.ReactNode\n /**\n * - `stickyToolbar` - Have the editor toolbar stick to the top when content is longer than the page length.\n * - `tabAsNavigation` - Have `Tab` key exit the editor. Support `Alt`/`Opt` + `Tab` as triple space indent.\n */\n features?: TextEditorFeatureToggle\n}\n"],"mappings":"","ignoreList":[]}
|