@procore/text-editor 1.0.1 → 1.2.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 +3 -0
- package/.jest/ckeditorUtilsMock.js +14 -0
- package/.jest/setupTests.js +1 -2
- package/CHANGELOG.md +24 -0
- package/README.md +15 -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 +12 -8
- 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 +6 -6
- package/dist/TextEditor/TextEditor.styles.js.map +1 -1
- package/dist/TextEditor/TextEditor.types.d.ts +29 -9
- 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 +2 -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 +7 -1
- package/dist/TextEditor/plugins/ProcoreImageUploadPlugin/ProcoreImageUploadPlugin.js +162 -71
- 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 +30 -5
- 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 +5 -2
- package/dist/TextEditor/utils/richTextEditorHandlers.js +138 -99
- 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 +1 -1
- 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 +432 -158
- package/dist/_typedoc/TextEditor/TextEditorProvider.types.json +4 -4
- package/dist/_typedoc/TextEditorOutput/TextEditorOutput.types.json +9 -9
- package/dist/_typedoc/deprecations.json +1 -1
- 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/en.json +1 -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 +49 -47
- 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 {},
|
|
@@ -49,6 +50,7 @@ module.exports = {
|
|
|
49
50
|
ImageCaption: class extends MockPlugin {},
|
|
50
51
|
ImageInsert: class extends MockPlugin {},
|
|
51
52
|
ImageResize: class extends MockPlugin {},
|
|
53
|
+
ImageStyle: class extends MockPlugin {},
|
|
52
54
|
ImageTextAlternative: class extends MockPlugin {},
|
|
53
55
|
ImageToolbar: class extends MockPlugin {},
|
|
54
56
|
ImageUpload: class extends MockPlugin {},
|
|
@@ -63,6 +65,7 @@ module.exports = {
|
|
|
63
65
|
MultiLevelList: class extends MockPlugin {},
|
|
64
66
|
PageBreak: class extends MockPlugin {},
|
|
65
67
|
Paragraph: class extends MockPlugin {},
|
|
68
|
+
PasteFromOffice: class extends MockPlugin {},
|
|
66
69
|
RemoveFormat: class extends MockPlugin {},
|
|
67
70
|
SpecialCharacters: class extends MockPlugin {},
|
|
68
71
|
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/.jest/setupTests.js
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @procore/text-editor
|
|
2
2
|
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ff8c490: - Image uploads now show progress bar: the photo grays out and a rounded bar tracks real upload progress (storage upload switched from fetch to XMLHttpRequest to stream progress events)
|
|
8
|
+
- Images support text wrap via CKEditor ImageStyle (inline / wrap text / break text).
|
|
9
|
+
- New `extendable` prop: with `rows`, the editor starts at the rows height and grows with content instead of scrolling (CKEditor and TinyMCE)
|
|
10
|
+
- Images copied from external websites ("Copy Image") now upload the clipboard image bytes instead of pasting an external URL that the backend strips
|
|
11
|
+
|
|
12
|
+
## 1.1.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- 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.
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- 9dcbd9d: Add PasteFromOffice plugin to CKEditor config
|
|
21
|
+
- 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.
|
|
22
|
+
- e4fb2ba: Mock `@ckeditor/ckeditor5-utils` in the package's Jest setup to avoid the `ckeditor-duplicated-modules` error.
|
|
23
|
+
- `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`.
|
|
24
|
+
- 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.
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
3
27
|
## 1.0.1
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -91,6 +91,17 @@ storage, then finalizes it through
|
|
|
91
91
|
Rails stores the finalized upload as a standalone Prostore file and returns its
|
|
92
92
|
`prostore_file_id` plus a permanent, publicly fetchable URL.
|
|
93
93
|
|
|
94
|
+
While an image is uploading, CKEditor shows the image placeholder with a
|
|
95
|
+
progress bar on top of it. The direct-to-storage request is sent with
|
|
96
|
+
`XMLHttpRequest` so real upload progress events drive the bar (`fetch` cannot
|
|
97
|
+
report request upload progress). No consumer wiring is needed — the bar appears
|
|
98
|
+
automatically wherever image uploads are enabled.
|
|
99
|
+
|
|
100
|
+
Images copied from other websites ("Copy Image" in the browser) are uploaded
|
|
101
|
+
from the image bytes the browser places on the clipboard, instead of pasting a
|
|
102
|
+
link to the external site (external image URLs are stripped by the backend).
|
|
103
|
+
Rich pastes that mix text and images keep the default clipboard behavior.
|
|
104
|
+
|
|
94
105
|
The `toolName` value is sent as `tool_name` with the finalize request and is
|
|
95
106
|
used by Rails for file attribution and audit metadata. It must match a known
|
|
96
107
|
Procore tool name.
|
|
@@ -125,6 +136,7 @@ app, email, or PDF layouts.
|
|
|
125
136
|
| `onAfterDestroy` | `() => void` | — | Fired after editor is destroyed |
|
|
126
137
|
| `placeholder` | `string` | — | Placeholder text shown when editor is empty |
|
|
127
138
|
| `rows` | `number` | — | Fixed height in rows. Omit for auto-grow |
|
|
139
|
+
| `extendable` | `boolean` | `false` | With `rows`: height becomes a minimum — editor grows with content past it. No effect without `rows` |
|
|
128
140
|
| `disabled` | `boolean` | `false` | Disables the editor |
|
|
129
141
|
| `readonly` | `boolean` | `false` | Renders content as read-only output |
|
|
130
142
|
| `error` | `boolean` | `false` | Applies error styling |
|
|
@@ -145,6 +157,9 @@ Use `rows` to set a fixed editor height. Omit it for auto-grow (default).
|
|
|
145
157
|
// Fixed height — 3 rows tall, scrolls when content overflows
|
|
146
158
|
<TextEditor rows={3} value={value} onChange={setValue} />
|
|
147
159
|
|
|
160
|
+
// Minimum height — starts 3 rows tall, grows with content beyond that
|
|
161
|
+
<TextEditor rows={3} extendable value={value} onChange={setValue} />
|
|
162
|
+
|
|
148
163
|
// Auto-grow — expands with content
|
|
149
164
|
<TextEditor value={value} onChange={setValue} />
|
|
150
165
|
```
|
|
@@ -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":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["disabled", "error", "readonly", "value", "initialValue", "onChange", "onInit", "onBlur", "onKeyDown", "locale", "onDirty", "companyId", "projectId", "toolName", "placeholder", "rows"];
|
|
2
|
+
var _excluded = ["disabled", "error", "readonly", "value", "initialValue", "onChange", "onInit", "onBlur", "onKeyDown", "locale", "onDirty", "companyId", "projectId", "toolName", "placeholder", "rows", "extendable"];
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -49,6 +49,7 @@ export var CKTextEditor = function CKTextEditor(props) {
|
|
|
49
49
|
toolName = props.toolName,
|
|
50
50
|
placeholder = props.placeholder,
|
|
51
51
|
rows = props.rows,
|
|
52
|
+
extendable = props.extendable,
|
|
52
53
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
53
54
|
var ariaLabel = props['aria-label'];
|
|
54
55
|
var ariaDescription = props['aria-description'];
|
|
@@ -157,7 +158,8 @@ export var CKTextEditor = function CKTextEditor(props) {
|
|
|
157
158
|
var handlerOptions = {
|
|
158
159
|
companyId: companyId,
|
|
159
160
|
projectId: projectId,
|
|
160
|
-
toolName: toolName
|
|
161
|
+
toolName: toolName,
|
|
162
|
+
i18n: i18n
|
|
161
163
|
};
|
|
162
164
|
var upload = richTextEditorUploadHandler(handlerOptions);
|
|
163
165
|
return {
|
|
@@ -203,7 +205,7 @@ export var CKTextEditor = function CKTextEditor(props) {
|
|
|
203
205
|
if (domEvent.key === 'Enter') {
|
|
204
206
|
domEvent.stopPropagation();
|
|
205
207
|
}
|
|
206
|
-
onKeyDown === null || onKeyDown === void 0
|
|
208
|
+
onKeyDown === null || onKeyDown === void 0 || onKeyDown(domEvent, editor);
|
|
207
209
|
};
|
|
208
210
|
keyDownListenerRef.current = keyDownListener;
|
|
209
211
|
|
|
@@ -216,12 +218,12 @@ export var CKTextEditor = function CKTextEditor(props) {
|
|
|
216
218
|
var hasPendingUploads = hasPendingImageUploads(editor);
|
|
217
219
|
if (isDirty && !isDirtyState) {
|
|
218
220
|
setIsDirtyState(true);
|
|
219
|
-
onDirty === null || onDirty === void 0
|
|
221
|
+
onDirty === null || onDirty === void 0 || onDirty();
|
|
220
222
|
}
|
|
221
223
|
if (hasPendingUploads) {
|
|
222
224
|
return;
|
|
223
225
|
}
|
|
224
|
-
onChange === null || onChange === void 0
|
|
226
|
+
onChange === null || onChange === void 0 || onChange(data, isDirty);
|
|
225
227
|
}, DEBOUNCE_MS)).current;
|
|
226
228
|
var handleChange = debouncedChange;
|
|
227
229
|
var handleReady = function handleReady(editor) {
|
|
@@ -250,18 +252,20 @@ export var CKTextEditor = function CKTextEditor(props) {
|
|
|
250
252
|
var rowHeight = 22;
|
|
251
253
|
var editorHeight = rows * rowHeight + baseHeight;
|
|
252
254
|
writer.setStyle('min-height', "".concat(editorHeight, "px"), viewEditableRoot);
|
|
253
|
-
|
|
255
|
+
if (!extendable) {
|
|
256
|
+
writer.setStyle('max-height', "".concat(editorHeight, "px"), viewEditableRoot);
|
|
257
|
+
}
|
|
254
258
|
}
|
|
255
259
|
}
|
|
256
260
|
});
|
|
257
261
|
|
|
258
262
|
// Bind keydown handler when editor is ready
|
|
259
263
|
bindKeyDownHandler(editor);
|
|
260
|
-
onInit === null || onInit === void 0
|
|
264
|
+
onInit === null || onInit === void 0 || onInit(editor);
|
|
261
265
|
};
|
|
262
266
|
var handleBlur = function handleBlur(event, editor) {
|
|
263
267
|
debouncedChange.flush();
|
|
264
|
-
onBlur === null || onBlur === void 0
|
|
268
|
+
onBlur === null || onBlur === void 0 || onBlur(event, editor);
|
|
265
269
|
};
|
|
266
270
|
useStickyToolbar({
|
|
267
271
|
enabled: enableStickyToolbar,
|
|
@@ -1 +1 @@
|
|
|
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,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EvCxB,KAAA,CAAA0E,aAAA,CAAClE,kBAAkB;IAAC6F,MAAM,EAAEA,MAAM,GAAG;EAAE,CAAE,CAAC,eAC1CrG,KAAA,CAAA0E,aAAA,CAAC7D,eAAe,MAAE,CAAC,eACnBb,KAAA,CAAA0E,aAAA,CAAC9E,QAAQ,EAAAoF,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"}
|
|
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","extendable","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 extendable,\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 i18n,\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\n if (!extendable) {\n writer.setStyle('max-height', `${editorHeight}px`, viewEditableRoot)\n }\n }\n }\n })\n\n // Bind keydown handler when editor is ready\n bindKeyDownHandler(editor)\n\n onInit?.(editor)\n }\n\n const handleBlur = (\n event: EventInfo<string, unknown>,\n editor: ClassicEditor\n ) => {\n 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,SAASC,QAAQ,QAAQ,mBAAmB;AAC5C,SAASC,gBAAgB,QAAQ,iBAAiB;AAClD,SACEC,kBAAkB,EAClBC,6BAA6B,EAC7BC,iCAAiC,EACjCC,gBAAgB,QACX,qBAAqB;AAE5B,SAASC,iBAAiB,QAAQ,sBAAsB;AACxD,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,qBAAqB,QAAQ,yBAAyB;AAC/D,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,uBAAuB,EAAEC,gBAAgB,QAAQ,SAAS;AACnE,SAASC,2BAA2B,QAAQ,gCAAgC;AAE5E,IAAMC,WAAW,GAAG,GAAG;AAEvB,OAAO,IAAMC,YAAY,GAAG,SAAfA,YAAYA,CAAIC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CAACC,GAAG,CAAC9J,cAAc,CAEvD;IAED,OAAO+J,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;MAAA,IAAAC,SAAA,GAAAC,0BAAA,CACjCF,OAAO;QAAAG,KAAA;MAAA;QAA3B,KAAAF,SAAA,CAAAG,CAAA,MAAAD,KAAA,GAAAF,SAAA,CAAAI,CAAA,IAAAC,IAAA,GAA6B;UAAA,IAAlBC,KAAK,GAAAJ,KAAA,CAAAK,KAAA;UACd,IAAAC,iBAAA,GAAmBC,gBAAgB,CAACH,KAAK,CAACI,MAAM,CAAC;YAAzCC,MAAM,GAAAH,iBAAA,CAANG,MAAM;UACd,IAAMC,WAAW,GAAGC,QAAQ,CAACF,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC;UAC5ClB,KAAK,CAACqB,YAAY,CAAC,OAAO,4BAAAC,MAAA,CAA4BH,WAAW,OAAI,CAAC;QACxE;MAAC,SAAAI,GAAA;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"}
|
|
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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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} />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|
|
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;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) {
|
|
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;}.ck.ck-editor__editable .image.ck-appear,.ck.ck-editor__editable .image-inline.ck-appear{img{opacity:0.70;transition:filter 0.2s ease-out,opacity 0.2s ease-out;}&::before{content:'';position:absolute;top:16px;left:16px;right:16px;height:8px;border-radius:4px;background:", ";box-shadow:0 1px 4px rgba(0,0,0,0.25);z-index:1;}}.ck.ck-editor__editable .image .ck-progress-bar,.ck.ck-editor__editable .image-inline .ck-progress-bar{top:16px !important;height:8px !important;clip-path:inset(0 16px 0 16px round 4px);min-width:40px;background:", " !important;z-index:2;transition:width 0.15s ease-out !important;}"], function (_ref) {
|
|
5
5
|
var zIndex = _ref.zIndex;
|
|
6
6
|
return zIndex;
|
|
7
7
|
}, function (_ref2) {
|
|
@@ -28,10 +28,10 @@ export var GlobalEditorStyles = /*#__PURE__*/createGlobalStyle([":root{--ck-z-de
|
|
|
28
28
|
}, function (_ref9) {
|
|
29
29
|
var zIndex = _ref9.zIndex;
|
|
30
30
|
return zIndex + 1000;
|
|
31
|
-
});
|
|
31
|
+
}, colors.white, colors.blue45);
|
|
32
32
|
export var StyledTextEditor = /*#__PURE__*/styled.div.withConfig({
|
|
33
33
|
displayName: "StyledTextEditor",
|
|
34
|
-
componentId: "text-editor-
|
|
34
|
+
componentId: "text-editor-1_2_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_2_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_2_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_2_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","
|
|
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","white","blue45","StyledTextEditor","div","withConfig","displayName","componentId","_ref0","$ready","_ref1","error","concat","red50","StyledImageUploadWarningToast","blue40","md","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 /* Upload progress: gray the image out and show a blue bar on a white\n track inset inside the image while uploading (.ck-appear is removed\n when done). */\n .ck.ck-editor__editable .image.ck-appear,\n .ck.ck-editor__editable .image-inline.ck-appear {\n img {\n opacity: 0.70;\n transition: filter 0.2s ease-out, opacity 0.2s ease-out;\n }\n\n &::before {\n content: '';\n position: absolute;\n top: 16px;\n left: 16px;\n right: 16px;\n height: 8px;\n border-radius: 4px;\n background: ${colors.white};\n box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);\n z-index: 1;\n }\n }\n\n .ck.ck-editor__editable .image .ck-progress-bar,\n .ck.ck-editor__editable .image-inline .ck-progress-bar {\n top: 16px !important;\n height: 8px !important;\n clip-path: inset(0 16px 0 16px round 4px);\n min-width: 40px;\n background: ${colors.blue45} !important;\n z-index: 2;\n transition: width 0.15s ease-out !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,2iDAI7B,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,IAAI;AAAA,GAInC,UAAAM,KAAA;EAAA,IAAGN,MAAM,GAAAM,KAAA,CAANN,MAAM;EAAA,OAAOA,MAAM,GAAG,IAAI;AAAA,GAI7B,UAAAO,KAAA;EAAA,IAAGP,MAAM,GAAAO,KAAA,CAANP,MAAM;EAAA,OAAOA,MAAM,GAAG,IAAI;AAAA,GAS7B,UAAAQ,KAAA;EAAA,IAAGR,MAAM,GAAAQ,KAAA,CAANR,MAAM;EAAA,OAAOA,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