@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
|
@@ -52,7 +52,33 @@ export interface TextEditorImageUploadOptions {
|
|
|
52
52
|
*/
|
|
53
53
|
toolName?: string;
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Height behavior. `extendable` is only accepted together with `rows`:
|
|
57
|
+
* without `rows` the editor always auto-grows, so `extendable` would be
|
|
58
|
+
* meaningless and is rejected at the type level.
|
|
59
|
+
*/
|
|
60
|
+
export type TextEditorHeightProps = {
|
|
61
|
+
/**
|
|
62
|
+
* Number of rows to control the editor height. When set, the editor
|
|
63
|
+
* height is fixed. When omitted, the editor grows with content.
|
|
64
|
+
*
|
|
65
|
+
* @since 1.0.0
|
|
66
|
+
*/
|
|
67
|
+
rows: number;
|
|
68
|
+
/**
|
|
69
|
+
* When true, the `rows` height acts as a minimum instead of a fixed
|
|
70
|
+
* size: the editor starts at that height and grows with content beyond
|
|
71
|
+
* it. When false or omitted, the `rows` height is fixed and overflowing
|
|
72
|
+
* content scrolls.
|
|
73
|
+
*
|
|
74
|
+
* @since 1.1.0
|
|
75
|
+
*/
|
|
76
|
+
extendable?: boolean;
|
|
77
|
+
} | {
|
|
78
|
+
rows?: never;
|
|
79
|
+
extendable?: never;
|
|
80
|
+
};
|
|
81
|
+
export interface TextEditorBaseProps extends TextEditorImageUploadOptions {
|
|
56
82
|
/**
|
|
57
83
|
* Unique identifier for the editor
|
|
58
84
|
*
|
|
@@ -185,13 +211,6 @@ export interface TextEditorProps extends TextEditorImageUploadOptions {
|
|
|
185
211
|
* @since 1.0.0
|
|
186
212
|
*/
|
|
187
213
|
init?: CoreTextEditorProps['init'];
|
|
188
|
-
/**
|
|
189
|
-
* Number of rows to control the editor height. When set, the editor height
|
|
190
|
-
* is fixed. When omitted, the editor grows with content.
|
|
191
|
-
*
|
|
192
|
-
* @since 1.0.0
|
|
193
|
-
*/
|
|
194
|
-
rows?: number;
|
|
195
214
|
/**
|
|
196
215
|
* Opt in to CKEditor immediately, bypassing the gradual feature flag rollout.
|
|
197
216
|
* Use this only when you explicitly want to ignore the rollout schedule.
|
|
@@ -201,6 +220,7 @@ export interface TextEditorProps extends TextEditorImageUploadOptions {
|
|
|
201
220
|
*/
|
|
202
221
|
enforceCKEditor?: true;
|
|
203
222
|
}
|
|
204
|
-
export
|
|
223
|
+
export type TextEditorProps = TextEditorBaseProps & TextEditorHeightProps;
|
|
224
|
+
export type KeyDownListener = (event: EventInfo, data: {
|
|
205
225
|
domEvent: Event;
|
|
206
226
|
}) => 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
|
|
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\n/**\n * Height behavior. `extendable` is only accepted together with `rows`:\n * without `rows` the editor always auto-grows, so `extendable` would be\n * meaningless and is rejected at the type level.\n */\nexport type TextEditorHeightProps =\n | {\n /**\n * Number of rows to control the editor height. When set, the editor\n * height is fixed. When omitted, the editor grows with content.\n *\n * @since 1.0.0\n */\n rows: number\n\n /**\n * When true, the `rows` height acts as a minimum instead of a fixed\n * size: the editor starts at that height and grows with content beyond\n * it. When false or omitted, the `rows` height is fixed and overflowing\n * content scrolls.\n *\n * @since 1.1.0\n */\n extendable?: boolean\n }\n | {\n rows?: never\n extendable?: never\n }\n\nexport interface TextEditorBaseProps 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 * 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 TextEditorProps = TextEditorBaseProps & TextEditorHeightProps\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":[]}
|
|
@@ -22,6 +22,7 @@ export var TinyMCETextEditor = function TinyMCETextEditor(props) {
|
|
|
22
22
|
readonly = props.readonly,
|
|
23
23
|
placeholder = props.placeholder,
|
|
24
24
|
rows = props.rows,
|
|
25
|
+
extendable = props.extendable,
|
|
25
26
|
onChange = props.onChange,
|
|
26
27
|
onBlur = props.onBlur,
|
|
27
28
|
onFocus = props.onFocus,
|
|
@@ -51,7 +52,7 @@ export var TinyMCETextEditor = function TinyMCETextEditor(props) {
|
|
|
51
52
|
init: _objectSpread({
|
|
52
53
|
contextmenu: false,
|
|
53
54
|
min_height: height,
|
|
54
|
-
max_height: height,
|
|
55
|
+
max_height: extendable ? undefined : height,
|
|
55
56
|
placeholder: placeholder
|
|
56
57
|
}, init),
|
|
57
58
|
onChange: onChange,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TinyMCETextEditor.js","names":["TextEditor","TinyMCEEditor","tinyMCE","React","useMemo","sanitizeTextEditorHtml","StyledReadOnlyValue","TinyMCETextEditor","props","id","value","disabled","error","readonly","placeholder","rows","onChange","onBlur","onFocus","onKeyDown","init","baseHeight","rowHeight","height","undefined","sanitizedValue","createElement","dangerouslySetInnerHTML","__html","textareaName","plugins","concat","_toConsumableArray","defaultPlugins","_objectSpread","contextmenu","min_height","max_height"],"sources":["../../src/TextEditor/TinyMCETextEditor.tsx"],"sourcesContent":["import { TextEditor as TinyMCEEditor, tinyMCE } from '@procore/core-react'\nimport React, { useMemo } from 'react'\nimport { sanitizeTextEditorHtml } from '../TextEditorOutput/TextEditorOutput.utils'\nimport { StyledReadOnlyValue } from './TextEditor.styles'\nimport type { TextEditorProps } from './TextEditor.types'\n\nexport const TinyMCETextEditor = (props: TextEditorProps) => {\n const {\n id,\n value,\n disabled,\n error,\n readonly,\n placeholder,\n rows,\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n init,\n } = props\n\n const baseHeight = 74\n const rowHeight = 22\n const height = rows === undefined ? undefined : rows * rowHeight + baseHeight\n\n const sanitizedValue = useMemo(\n () => sanitizeTextEditorHtml(value || '') || '--',\n [value]\n )\n\n if (readonly) {\n return (\n <StyledReadOnlyValue>\n <div dangerouslySetInnerHTML={{ __html: sanitizedValue }} />\n </StyledReadOnlyValue>\n )\n }\n\n return (\n <TinyMCEEditor\n id={id}\n value={value}\n disabled={disabled}\n error={error}\n aria-label={props['aria-label']}\n textareaName={props['aria-label']}\n plugins={[...tinyMCE.defaultPlugins, 'link', 'table']}\n init={{\n contextmenu: false,\n min_height: height,\n max_height: height,\n placeholder,\n ...init,\n }}\n onChange={onChange}\n onBlur={onBlur as React.ComponentProps<typeof TinyMCEEditor>['onBlur']}\n onFocus={onFocus as React.ComponentProps<typeof TinyMCEEditor>['onFocus']}\n onKeyDown={\n onKeyDown as React.ComponentProps<typeof TinyMCEEditor>['onKeyDown']\n }\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAASA,UAAU,IAAIC,aAAa,EAAEC,OAAO,QAAQ,qBAAqB;AAC1E,OAAOC,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,SAASC,sBAAsB,QAAQ,4CAA4C;AACnF,SAASC,mBAAmB,QAAQ,qBAAqB;AAGzD,OAAO,IAAMC,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAIC,KAAsB,EAAK;EAC3D,IACEC,EAAE,
|
|
1
|
+
{"version":3,"file":"TinyMCETextEditor.js","names":["TextEditor","TinyMCEEditor","tinyMCE","React","useMemo","sanitizeTextEditorHtml","StyledReadOnlyValue","TinyMCETextEditor","props","id","value","disabled","error","readonly","placeholder","rows","extendable","onChange","onBlur","onFocus","onKeyDown","init","baseHeight","rowHeight","height","undefined","sanitizedValue","createElement","dangerouslySetInnerHTML","__html","textareaName","plugins","concat","_toConsumableArray","defaultPlugins","_objectSpread","contextmenu","min_height","max_height"],"sources":["../../src/TextEditor/TinyMCETextEditor.tsx"],"sourcesContent":["import { TextEditor as TinyMCEEditor, tinyMCE } from '@procore/core-react'\nimport React, { useMemo } from 'react'\nimport { sanitizeTextEditorHtml } from '../TextEditorOutput/TextEditorOutput.utils'\nimport { StyledReadOnlyValue } from './TextEditor.styles'\nimport type { TextEditorProps } from './TextEditor.types'\n\nexport const TinyMCETextEditor = (props: TextEditorProps) => {\n const {\n id,\n value,\n disabled,\n error,\n readonly,\n placeholder,\n rows,\n extendable,\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n init,\n } = props\n\n const baseHeight = 74\n const rowHeight = 22\n const height = rows === undefined ? undefined : rows * rowHeight + baseHeight\n\n const sanitizedValue = useMemo(\n () => sanitizeTextEditorHtml(value || '') || '--',\n [value]\n )\n\n if (readonly) {\n return (\n <StyledReadOnlyValue>\n <div dangerouslySetInnerHTML={{ __html: sanitizedValue }} />\n </StyledReadOnlyValue>\n )\n }\n\n return (\n <TinyMCEEditor\n id={id}\n value={value}\n disabled={disabled}\n error={error}\n aria-label={props['aria-label']}\n textareaName={props['aria-label']}\n plugins={[...tinyMCE.defaultPlugins, 'link', 'table']}\n init={{\n contextmenu: false,\n min_height: height,\n max_height: extendable ? undefined : height,\n placeholder,\n ...init,\n }}\n onChange={onChange}\n onBlur={onBlur as React.ComponentProps<typeof TinyMCEEditor>['onBlur']}\n onFocus={onFocus as React.ComponentProps<typeof TinyMCEEditor>['onFocus']}\n onKeyDown={\n onKeyDown as React.ComponentProps<typeof TinyMCEEditor>['onKeyDown']\n }\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAASA,UAAU,IAAIC,aAAa,EAAEC,OAAO,QAAQ,qBAAqB;AAC1E,OAAOC,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,SAASC,sBAAsB,QAAQ,4CAA4C;AACnF,SAASC,mBAAmB,QAAQ,qBAAqB;AAGzD,OAAO,IAAMC,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAIC,KAAsB,EAAK;EAC3D,IACEC,EAAE,GAaAD,KAAK,CAbPC,EAAE;IACFC,KAAK,GAYHF,KAAK,CAZPE,KAAK;IACLC,QAAQ,GAWNH,KAAK,CAXPG,QAAQ;IACRC,KAAK,GAUHJ,KAAK,CAVPI,KAAK;IACLC,QAAQ,GASNL,KAAK,CATPK,QAAQ;IACRC,WAAW,GAQTN,KAAK,CARPM,WAAW;IACXC,IAAI,GAOFP,KAAK,CAPPO,IAAI;IACJC,UAAU,GAMRR,KAAK,CANPQ,UAAU;IACVC,QAAQ,GAKNT,KAAK,CALPS,QAAQ;IACRC,MAAM,GAIJV,KAAK,CAJPU,MAAM;IACNC,OAAO,GAGLX,KAAK,CAHPW,OAAO;IACPC,SAAS,GAEPZ,KAAK,CAFPY,SAAS;IACTC,IAAI,GACFb,KAAK,CADPa,IAAI;EAGN,IAAMC,UAAU,GAAG,EAAE;EACrB,IAAMC,SAAS,GAAG,EAAE;EACpB,IAAMC,MAAM,GAAGT,IAAI,KAAKU,SAAS,GAAGA,SAAS,GAAGV,IAAI,GAAGQ,SAAS,GAAGD,UAAU;EAE7E,IAAMI,cAAc,GAAGtB,OAAO,CAC5B;IAAA,OAAMC,sBAAsB,CAACK,KAAK,IAAI,EAAE,CAAC,IAAI,IAAI;EAAA,GACjD,CAACA,KAAK,CACR,CAAC;EAED,IAAIG,QAAQ,EAAE;IACZ,oBACEV,KAAA,CAAAwB,aAAA,CAACrB,mBAAmB,qBAClBH,KAAA,CAAAwB,aAAA;MAAKC,uBAAuB,EAAE;QAAEC,MAAM,EAAEH;MAAe;IAAE,CAAE,CACxC,CAAC;EAE1B;EAEA,oBACEvB,KAAA,CAAAwB,aAAA,CAAC1B,aAAa;IACZQ,EAAE,EAAEA,EAAG;IACPC,KAAK,EAAEA,KAAM;IACbC,QAAQ,EAAEA,QAAS;IACnBC,KAAK,EAAEA,KAAM;IACb,cAAYJ,KAAK,CAAC,YAAY,CAAE;IAChCsB,YAAY,EAAEtB,KAAK,CAAC,YAAY,CAAE;IAClCuB,OAAO,KAAAC,MAAA,CAAAC,kBAAA,CAAM/B,OAAO,CAACgC,cAAc,IAAE,MAAM,EAAE,OAAO,EAAE;IACtDb,IAAI,EAAAc,aAAA;MACFC,WAAW,EAAE,KAAK;MAClBC,UAAU,EAAEb,MAAM;MAClBc,UAAU,EAAEtB,UAAU,GAAGS,SAAS,GAAGD,MAAM;MAC3CV,WAAW,EAAXA;IAAW,GACRO,IAAI,CACP;IACFJ,QAAQ,EAAEA,QAAS;IACnBC,MAAM,EAAEA,MAA+D;IACvEC,OAAO,EAAEA,OAAiE;IAC1EC,SAAS,EACPA;EACD,CACF,CAAC;AAEN,CAAC","ignoreList":[]}
|
package/dist/TextEditor/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["TextEditor","TextEditorProvider"],"sources":["../../src/TextEditor/index.ts"],"sourcesContent":["export { TextEditor } from './TextEditor'\nexport * from './TextEditor.types'\nexport { TextEditorProvider } from './TextEditorProvider'\nexport type { TextEditorProviderProps } from './TextEditorProvider.types'\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,cAAc;
|
|
1
|
+
{"version":3,"file":"index.js","names":["TextEditor","TextEditorProvider"],"sources":["../../src/TextEditor/index.ts"],"sourcesContent":["export { TextEditor } from './TextEditor'\nexport type * from './TextEditor.types'\nexport { TextEditorProvider } from './TextEditorProvider'\nexport type { TextEditorProviderProps } from './TextEditorProvider.types'\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,cAAc;AAEzC,SAASC,kBAAkB,QAAQ,sBAAsB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"license_key.js","names":["DEV_CK_EDITOR_LICENSE_KEY","CK_EDITOR_LICENSE_KEY"],"sources":["../../src/TextEditor/license_key.ts"],"sourcesContent":["export const DEV_CK_EDITOR_LICENSE_KEY =\n 'eyJhbGciOiJFUzI1NiJ9.eyJleHAiOjE4MDU5MzI3OTksImp0aSI6IjVkZTZmZjM1LTkyOGMtNDVmOC1hZThjLTIxMTQ4M2JhNTJiYyIsImRpc3RyaWJ1dGlvbkNoYW5uZWwiOlsic2giLCJkcnVwYWwiXSwid2hpdGVMYWJlbCI6dHJ1ZSwibGljZW5zZVR5cGUiOiJkZXZlbG9wbWVudCIsImZlYXR1cmVzIjpbIkRSVVAiLCJETyIsIkZQIiwiU0MiLCJUT0MiLCJUUEwiLCJQT0UiLCJDQyIsIk1GIiwiU0VFIiwiRUNIIiwiRUlTIiwiTEgiLCJGT08iLCJNTEwiXSwidmMiOiI3YTc1ZTA4YyJ9.B19JLbq858FIBVNHUCaplYuN5-F1ahTg74ihITpucJJxSe0ZjYKBQV_9LH7oYtF6S56dkN6Cp4KWPBKVF1bJLw'\n\nexport const CK_EDITOR_LICENSE_KEY =\n 'eyJhbGciOiJFUzI1NiJ9.eyJleHAiOjE4MDU5MzI3OTksImp0aSI6ImJkYTE4MzliLWU3NDAtNDBkNy1hYmEyLWZkN2IxMDU1YWZhYyIsImRpc3RyaWJ1dGlvbkNoYW5uZWwiOlsic2giLCJkcnVwYWwiXSwid2hpdGVMYWJlbCI6dHJ1ZSwiZmVhdHVyZXMiOlsiRFJVUCIsIkRPIiwiRlAiLCJTQyIsIlRPQyIsIlRQTCIsIlBPRSIsIkNDIiwiTUYiLCJTRUUiLCJFQ0giLCJFSVMiLCJMSCIsIkZPTyIsIk1MTCJdLCJ2YyI6IjVkZDhlMmRiIn0.Ksi_3ee7IjEUAtZRWi_rJb7HTFpjnxDZPJ529UCqkIbMu8ujPAYzv3eDtdwAEFkWdWTa0H-8G-o19QSAJjemPg'\n"],"mappings":"AAAA,OAAO,IAAMA,yBAAyB,GACpC,0cAA0c;AAE5c,OAAO,IAAMC,qBAAqB,GAChC,qaAAqa"}
|
|
1
|
+
{"version":3,"file":"license_key.js","names":["DEV_CK_EDITOR_LICENSE_KEY","CK_EDITOR_LICENSE_KEY"],"sources":["../../src/TextEditor/license_key.ts"],"sourcesContent":["export const DEV_CK_EDITOR_LICENSE_KEY =\n 'eyJhbGciOiJFUzI1NiJ9.eyJleHAiOjE4MDU5MzI3OTksImp0aSI6IjVkZTZmZjM1LTkyOGMtNDVmOC1hZThjLTIxMTQ4M2JhNTJiYyIsImRpc3RyaWJ1dGlvbkNoYW5uZWwiOlsic2giLCJkcnVwYWwiXSwid2hpdGVMYWJlbCI6dHJ1ZSwibGljZW5zZVR5cGUiOiJkZXZlbG9wbWVudCIsImZlYXR1cmVzIjpbIkRSVVAiLCJETyIsIkZQIiwiU0MiLCJUT0MiLCJUUEwiLCJQT0UiLCJDQyIsIk1GIiwiU0VFIiwiRUNIIiwiRUlTIiwiTEgiLCJGT08iLCJNTEwiXSwidmMiOiI3YTc1ZTA4YyJ9.B19JLbq858FIBVNHUCaplYuN5-F1ahTg74ihITpucJJxSe0ZjYKBQV_9LH7oYtF6S56dkN6Cp4KWPBKVF1bJLw'\n\nexport const CK_EDITOR_LICENSE_KEY =\n 'eyJhbGciOiJFUzI1NiJ9.eyJleHAiOjE4MDU5MzI3OTksImp0aSI6ImJkYTE4MzliLWU3NDAtNDBkNy1hYmEyLWZkN2IxMDU1YWZhYyIsImRpc3RyaWJ1dGlvbkNoYW5uZWwiOlsic2giLCJkcnVwYWwiXSwid2hpdGVMYWJlbCI6dHJ1ZSwiZmVhdHVyZXMiOlsiRFJVUCIsIkRPIiwiRlAiLCJTQyIsIlRPQyIsIlRQTCIsIlBPRSIsIkNDIiwiTUYiLCJTRUUiLCJFQ0giLCJFSVMiLCJMSCIsIkZPTyIsIk1MTCJdLCJ2YyI6IjVkZDhlMmRiIn0.Ksi_3ee7IjEUAtZRWi_rJb7HTFpjnxDZPJ529UCqkIbMu8ujPAYzv3eDtdwAEFkWdWTa0H-8G-o19QSAJjemPg'\n"],"mappings":"AAAA,OAAO,IAAMA,yBAAyB,GACpC,0cAA0c;AAE5c,OAAO,IAAMC,qBAAqB,GAChC,qaAAqa","ignoreList":[]}
|
|
@@ -1,13 +1,6 @@
|
|
|
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
|
-
function _regeneratorRuntime() { "use strict"; var r = _regenerator(), e = r.m(_regeneratorRuntime), t = (Object.getPrototypeOf ? Object.getPrototypeOf(e) : e.__proto__).constructor; function n(r) { var e = "function" == typeof r && r.constructor; return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name)); } var o = { "throw": 1, "return": 2, "break": 3, "continue": 3 }; function a(r) { var e, t; return function (n) { e || (e = { stop: function stop() { return t(n.a, 2); }, "catch": function _catch() { return n.v; }, abrupt: function abrupt(r, e) { return t(n.a, o[r], e); }, delegateYield: function delegateYield(r, o, a) { return e.resultName = o, t(n.d, _regeneratorValues(r), a); }, finish: function finish(r) { return t(n.f, r); } }, t = function t(r, _t, o) { n.p = e.prev, n.n = e.next; try { return r(_t, o); } finally { e.next = n.n; } }), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n; try { return r.call(this, e); } finally { n.p = e.prev, n.n = e.next; } }; } return (_regeneratorRuntime = function _regeneratorRuntime() { return { wrap: function wrap(e, t, n, o) { return r.w(a(e), t, n, o && o.reverse()); }, isGeneratorFunction: n, mark: r.m, awrap: function awrap(r, e) { return new _OverloadYield(r, e); }, AsyncIterator: _regeneratorAsyncIterator, async: function async(r, e, t, o, u) { return (n(e) ? _regeneratorAsyncGen : _regeneratorAsync)(a(r), e, t, o, u); }, keys: _regeneratorKeys, values: _regeneratorValues }; })(); }
|
|
3
|
-
function _regeneratorValues(e) { if (null != e) { var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"], r = 0; if (t) return t.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) return { next: function next() { return e && r >= e.length && (e = void 0), { value: e && e[r++], done: !e }; } }; } throw new TypeError(_typeof(e) + " is not iterable"); }
|
|
4
|
-
function _regeneratorKeys(e) { var n = Object(e), r = []; for (var t in n) r.unshift(t); return function e() { for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = !1, e; return e.done = !0, e; }; }
|
|
5
|
-
function _regeneratorAsync(n, e, r, t, o) { var a = _regeneratorAsyncGen(n, e, r, t, o); return a.next().then(function (n) { return n.done ? n.value : a.next(); }); }
|
|
6
|
-
function _regeneratorAsyncGen(r, e, t, o, n) { return new _regeneratorAsyncIterator(_regenerator().w(r, e, t, o), n || Promise); }
|
|
7
|
-
function _regeneratorAsyncIterator(t, e) { function n(r, o, i, f) { try { var c = t[r](o), u = c.value; return u instanceof _OverloadYield ? e.resolve(u.v).then(function (t) { n("next", t, i, f); }, function (t) { n("throw", t, i, f); }) : e.resolve(u).then(function (t) { c.value = t, i(c); }, function (t) { return n("throw", t, i, f); }); } catch (t) { f(t); } } var r; this.next || (_regeneratorDefine2(_regeneratorAsyncIterator.prototype), _regeneratorDefine2(_regeneratorAsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function () { return this; })), _regeneratorDefine2(this, "_invoke", function (t, o, i) { function f() { return new e(function (e, r) { n(t, i, e, r); }); } return r = r ? r.then(f, f) : f(); }, !0); }
|
|
8
2
|
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
9
|
-
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) {
|
|
10
|
-
function _OverloadYield(e, d) { this.v = e, this.k = d; }
|
|
3
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
11
4
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
12
5
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
13
6
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
@@ -33,29 +26,29 @@ export var CutCommand = /*#__PURE__*/function (_Command) {
|
|
|
33
26
|
return _createClass(CutCommand, [{
|
|
34
27
|
key: "execute",
|
|
35
28
|
value: function () {
|
|
36
|
-
var _execute = _asyncToGenerator(
|
|
37
|
-
var model, selection, selectedContent, viewFragment, clipboardHtml;
|
|
38
|
-
return
|
|
39
|
-
while (1) switch (_context.
|
|
29
|
+
var _execute = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
30
|
+
var model, selection, selectedContent, viewFragment, clipboardHtml, _t;
|
|
31
|
+
return _regenerator().w(function (_context) {
|
|
32
|
+
while (1) switch (_context.p = _context.n) {
|
|
40
33
|
case 0:
|
|
41
34
|
model = this.editor.model;
|
|
42
35
|
selection = model.document.selection;
|
|
43
36
|
if (!selection.isCollapsed) {
|
|
44
|
-
_context.
|
|
37
|
+
_context.n = 1;
|
|
45
38
|
break;
|
|
46
39
|
}
|
|
47
|
-
return _context.
|
|
48
|
-
case
|
|
40
|
+
return _context.a(2);
|
|
41
|
+
case 1:
|
|
49
42
|
// Get selected content
|
|
50
43
|
selectedContent = model.getSelectedContent(selection); // Convert to view fragment
|
|
51
44
|
viewFragment = this.editor.data.toView(selectedContent); // Convert view to HTML string using data processor
|
|
52
45
|
clipboardHtml = this.editor.data.processor.toData(viewFragment); // Copy to clipboard
|
|
53
46
|
if (!navigator.clipboard) {
|
|
54
|
-
_context.
|
|
47
|
+
_context.n = 5;
|
|
55
48
|
break;
|
|
56
49
|
}
|
|
57
|
-
_context.
|
|
58
|
-
_context.
|
|
50
|
+
_context.p = 2;
|
|
51
|
+
_context.n = 3;
|
|
59
52
|
return navigator.clipboard.write([new ClipboardItem({
|
|
60
53
|
'text/html': new Blob([clipboardHtml], {
|
|
61
54
|
type: 'text/html'
|
|
@@ -67,21 +60,20 @@ export var CutCommand = /*#__PURE__*/function (_Command) {
|
|
|
67
60
|
type: 'text/plain'
|
|
68
61
|
})
|
|
69
62
|
})]);
|
|
70
|
-
case
|
|
71
|
-
_context.
|
|
63
|
+
case 3:
|
|
64
|
+
_context.n = 5;
|
|
72
65
|
break;
|
|
73
|
-
case
|
|
74
|
-
_context.
|
|
75
|
-
|
|
76
|
-
console.warn('Failed to copy to clipboard:',
|
|
77
|
-
case
|
|
66
|
+
case 4:
|
|
67
|
+
_context.p = 4;
|
|
68
|
+
_t = _context.v;
|
|
69
|
+
console.warn('Failed to copy to clipboard:', _t);
|
|
70
|
+
case 5:
|
|
78
71
|
// Delete selected content
|
|
79
72
|
model.deleteContent(selection);
|
|
80
|
-
case
|
|
81
|
-
|
|
82
|
-
return _context.stop();
|
|
73
|
+
case 6:
|
|
74
|
+
return _context.a(2);
|
|
83
75
|
}
|
|
84
|
-
}, _callee, this, [[
|
|
76
|
+
}, _callee, this, [[2, 4]]);
|
|
85
77
|
}));
|
|
86
78
|
function execute() {
|
|
87
79
|
return _execute.apply(this, arguments);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CutCommand.js","names":["e","t","r","Symbol","n","iterator","o","toStringTag","i","c","prototype","Generator","u","Object","create","_regeneratorDefine2","f","p","y","G","v","a","d","bind","length","l","TypeError","call","done","value","GeneratorFunction","GeneratorFunctionPrototype","getPrototypeOf","setPrototypeOf","__proto__","displayName","_regenerator","w","m","defineProperty","_regeneratorDefine","enumerable","configurable","writable","_invoke","_OverloadYield","k","asyncGeneratorStep","Promise","resolve","then","_asyncToGenerator","arguments","apply","_next","_throw","_classCallCheck","_defineProperties","_toPropertyKey","key","_createClass","_toPrimitive","_typeof","toPrimitive","String","Number","_callSuper","_getPrototypeOf","_possibleConstructorReturn","_isNativeReflectConstruct","Reflect","construct","constructor","_assertThisInitialized","ReferenceError","Boolean","valueOf","_inherits","_setPrototypeOf","Command","sanitizeHtml","CutCommand","_Command","_execute","_regeneratorRuntime","mark","_callee","model","selection","selectedContent","viewFragment","clipboardHtml","wrap","_callee$","_context","prev","next","editor","document","isCollapsed","abrupt","getSelectedContent","data","toView","processor","toData","navigator","clipboard","write","ClipboardItem","Blob","type","allowedTags","allowedAttributes","t0","console","warn","deleteContent","stop","execute","refresh","isEnabled"],"sources":["../../../../src/TextEditor/plugins/CutPlugin/CutCommand.ts"],"sourcesContent":["import { Command } from 'ckeditor5'\nimport sanitizeHtml from 'sanitize-html'\n\nexport class CutCommand extends Command {\n async execute() {\n const model = this.editor.model\n const selection = model.document.selection\n\n if (selection.isCollapsed) {\n return\n }\n\n // Get selected content\n const selectedContent = model.getSelectedContent(selection)\n\n // Convert to view fragment\n const viewFragment = this.editor.data.toView(selectedContent)\n\n // Convert view to HTML string using data processor\n const clipboardHtml = this.editor.data.processor.toData(viewFragment)\n\n // Copy to clipboard\n if (navigator.clipboard) {\n try {\n await navigator.clipboard.write([\n new ClipboardItem({\n 'text/html': new Blob([clipboardHtml], { type: 'text/html' }),\n 'text/plain': new Blob(\n [\n sanitizeHtml(clipboardHtml, {\n allowedTags: [],\n allowedAttributes: {},\n }),\n ],\n {\n type: 'text/plain',\n }\n ),\n }),\n ])\n } catch (error) {\n console.warn('Failed to copy to clipboard:', error)\n }\n }\n\n // Delete selected content\n model.deleteContent(selection)\n }\n\n refresh() {\n const selection = this.editor.model.document.selection\n this.isEnabled = !selection.isCollapsed\n }\n}\n"],"mappings":";;;;;;;0BACA,uKAAAA,CAAA,EAAAC,CAAA,EAAAC,CAAA,wBAAAC,MAAA,GAAAA,MAAA,OAAAC,CAAA,GAAAF,CAAA,CAAAG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,aAAa,EAAE;kBAC1BqB,WAAW,EAAE,EAAE;kBACfC,iBAAiB,EAAE,CAAC;gBACtB,CAAC,CAAC,CACH,EACD;kBACEF,IAAI,EAAE;gBACR,CACF;cACF,CAAC,CAAC,CACH,CAAC;YAAA;cAAAjB,QAAA,CAAAE,IAAA;cAAA;YAAA;cAAAF,QAAA,CAAAC,IAAA;cAAAD,QAAA,CAAAoB,EAAA,GAAApB,QAAA;cAEFqB,OAAO,CAACC,IAAI,CAAC,8BAA8B,EAAAtB,QAAA,CAAAoB,EAAO,CAAC;YAAA;cAIvD;cACA3B,KAAK,CAAC8B,aAAa,CAAC7B,SAAS,CAAC;YAAA;YAAA;cAAA,OAAAM,QAAA,CAAAwB,IAAA;UAAA;QAAA,GAAAhC,OAAA;MAAA,CAC/B;MAAA,SA3CKiC,OAAOA,CAAA;QAAA,OAAApC,QAAA,CAAA9B,KAAA,OAAAD,SAAA;MAAA;MAAA,OAAPmE,OAAO;IAAA;EAAA;IAAA5D,GAAA;IAAA9B,KAAA,EA6Cb,SAAA2F,OAAOA,CAAA,EAAG;MACR,IAAMhC,SAAS,GAAG,IAAI,CAACS,MAAM,CAACV,KAAK,CAACW,QAAQ,CAACV,SAAS;MACtD,IAAI,CAACiC,SAAS,GAAG,CAACjC,SAAS,CAACW,WAAW;IACzC;EAAC;AAAA,EAjD6BpB,OAAO"}
|
|
1
|
+
{"version":3,"file":"CutCommand.js","names":["e","t","r","Symbol","n","iterator","o","toStringTag","i","c","prototype","Generator","u","Object","create","_regeneratorDefine2","f","p","y","G","v","a","d","bind","length","l","TypeError","call","done","value","GeneratorFunction","GeneratorFunctionPrototype","getPrototypeOf","setPrototypeOf","__proto__","displayName","_regenerator","w","m","defineProperty","_regeneratorDefine","_invoke","enumerable","configurable","writable","asyncGeneratorStep","Promise","resolve","then","_asyncToGenerator","arguments","apply","_next","_throw","_classCallCheck","_defineProperties","_toPropertyKey","key","_createClass","_toPrimitive","_typeof","toPrimitive","String","Number","_callSuper","_getPrototypeOf","_possibleConstructorReturn","_isNativeReflectConstruct","Reflect","construct","constructor","_assertThisInitialized","ReferenceError","Boolean","valueOf","_inherits","_setPrototypeOf","Command","sanitizeHtml","CutCommand","_Command","_execute","_callee","model","selection","selectedContent","viewFragment","clipboardHtml","_t","_context","editor","document","isCollapsed","getSelectedContent","data","toView","processor","toData","navigator","clipboard","write","ClipboardItem","Blob","type","allowedTags","allowedAttributes","console","warn","deleteContent","execute","refresh","isEnabled"],"sources":["../../../../src/TextEditor/plugins/CutPlugin/CutCommand.ts"],"sourcesContent":["import { Command } from 'ckeditor5'\nimport sanitizeHtml from 'sanitize-html'\n\nexport class CutCommand extends Command {\n async execute() {\n const model = this.editor.model\n const selection = model.document.selection\n\n if (selection.isCollapsed) {\n return\n }\n\n // Get selected content\n const selectedContent = model.getSelectedContent(selection)\n\n // Convert to view fragment\n const viewFragment = this.editor.data.toView(selectedContent)\n\n // Convert view to HTML string using data processor\n const clipboardHtml = this.editor.data.processor.toData(viewFragment)\n\n // Copy to clipboard\n if (navigator.clipboard) {\n try {\n await navigator.clipboard.write([\n new ClipboardItem({\n 'text/html': new Blob([clipboardHtml], { type: 'text/html' }),\n 'text/plain': new Blob(\n [\n sanitizeHtml(clipboardHtml, {\n allowedTags: [],\n allowedAttributes: {},\n }),\n ],\n {\n type: 'text/plain',\n }\n ),\n }),\n ])\n } catch (error) {\n console.warn('Failed to copy to clipboard:', error)\n }\n }\n\n // Delete selected content\n model.deleteContent(selection)\n }\n\n refresh() {\n const selection = this.editor.model.document.selection\n this.isEnabled = !selection.isCollapsed\n }\n}\n"],"mappings":";0BACA,uKAAAA,CAAA,EAAAC,CAAA,EAAAC,CAAA,wBAAAC,MAAA,GAAAA,MAAA,OAAAC,CAAA,GAAAF,CAAA,CAAAG,QAAA,kBAAAC,CAAA,GAAAJ,CAAA,CAAAK,WAAA,8BAAAC,EAAAN,CAAA,EAAAE,CAAA,EAAAE,CAAA,EAAAE,CAAA,QAAAC,CAAA,GAAAL,CA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;cAAAuE,EAAA,GAAAC,QAAA,CAAArE,CAAA;cAEFsF,OAAO,CAACC,IAAI,CAAC,8BAA8B,EAAAnB,EAAO,CAAC;YAAA;cAIvD;cACAL,KAAK,CAACyB,aAAa,CAACxB,SAAS,CAAC;YAAA;cAAA,OAAAK,QAAA,CAAApE,CAAA;UAAA;QAAA,GAAA6D,OAAA;MAAA,CAC/B;MAAA,SA3CK2B,OAAOA,CAAA;QAAA,OAAA5B,QAAA,CAAA9B,KAAA,OAAAD,SAAA;MAAA;MAAA,OAAP2D,OAAO;IAAA;EAAA;IAAApD,GAAA;IAAA5B,KAAA,EA6Cb,SAAAiF,OAAOA,CAAA,EAAG;MACR,IAAM1B,SAAS,GAAG,IAAI,CAACM,MAAM,CAACP,KAAK,CAACQ,QAAQ,CAACP,SAAS;MACtD,IAAI,CAAC2B,SAAS,GAAG,CAAC3B,SAAS,CAACQ,WAAW;IACzC;EAAC;AAAA,EAjD6Bf,OAAO","ignoreList":[]}
|
|
@@ -29,11 +29,11 @@ export var CutPlugin = /*#__PURE__*/function (_Plugin) {
|
|
|
29
29
|
|
|
30
30
|
// Add the cut button to the toolbar
|
|
31
31
|
editor.ui.componentFactory.add('cut', function (locale) {
|
|
32
|
-
var _global$window$CKEDIT
|
|
32
|
+
var _global$window$CKEDIT;
|
|
33
33
|
var command = editor.commands.get('cut');
|
|
34
34
|
var buttonView = new ButtonView(locale);
|
|
35
35
|
buttonView.set({
|
|
36
|
-
label: (_global$window$CKEDIT = global.window.CKEDITOR_TRANSLATIONS[locale.contentLanguage]) === null || _global$window$CKEDIT === void 0
|
|
36
|
+
label: (_global$window$CKEDIT = global.window.CKEDITOR_TRANSLATIONS[locale.contentLanguage]) === null || _global$window$CKEDIT === void 0 || (_global$window$CKEDIT = _global$window$CKEDIT.dictionary) === null || _global$window$CKEDIT === void 0 ? void 0 : _global$window$CKEDIT.Cut,
|
|
37
37
|
icon: '<svg></svg>',
|
|
38
38
|
tooltip: true
|
|
39
39
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CutPlugin.js","names":["ButtonView","Plugin","CutCommand","CutPlugin","_Plugin","_classCallCheck","_callSuper","arguments","_inherits","_createClass","key","value","init","editor","commands","add","ui","componentFactory","locale","_global$window$CKEDIT","
|
|
1
|
+
{"version":3,"file":"CutPlugin.js","names":["ButtonView","Plugin","CutCommand","CutPlugin","_Plugin","_classCallCheck","_callSuper","arguments","_inherits","_createClass","key","value","init","editor","commands","add","ui","componentFactory","locale","_global$window$CKEDIT","command","get","buttonView","set","label","global","window","CKEDITOR_TRANSLATIONS","contentLanguage","dictionary","Cut","icon","tooltip","bind","to","on","execute"],"sources":["../../../../src/TextEditor/plugins/CutPlugin/CutPlugin.ts"],"sourcesContent":["import { ButtonView, Plugin } from 'ckeditor5'\nimport { CutCommand } from './CutCommand'\n\nexport class CutPlugin extends Plugin {\n static get pluginName() {\n return 'Cut'\n }\n\n init() {\n const editor = this.editor\n\n // Add the cut command\n editor.commands.add('cut', new CutCommand(editor))\n\n // Add the cut button to the toolbar\n editor.ui.componentFactory.add('cut', (locale) => {\n const command = editor.commands.get('cut')\n const buttonView = new ButtonView(locale)\n buttonView.set({\n label:\n global.window.CKEDITOR_TRANSLATIONS[locale.contentLanguage]\n ?.dictionary?.Cut,\n icon: '<svg></svg>',\n tooltip: true,\n })\n\n if (command) {\n buttonView.bind('isEnabled').to(command, 'isEnabled')\n }\n\n buttonView.on('execute', () => {\n editor.execute('cut')\n })\n\n return buttonView\n })\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,SAASA,UAAU,EAAEC,MAAM,QAAQ,WAAW;AAC9C,SAASC,UAAU,QAAQ,cAAc;AAEzC,WAAaC,SAAS,0BAAAC,OAAA;EAAA,SAAAD,UAAA;IAAAE,eAAA,OAAAF,SAAA;IAAA,OAAAG,UAAA,OAAAH,SAAA,EAAAI,SAAA;EAAA;EAAAC,SAAA,CAAAL,SAAA,EAAAC,OAAA;EAAA,OAAAK,YAAA,C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utPlugin/index.ts"],"sourcesContent":["export * from './CutPlugin'\n"],"mappings":"AAAA,cAAc,aAAa"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/TextEditor/plugins/CutPlugin/index.ts"],"sourcesContent":["export * from './CutPlugin'\n"],"mappings":"AAAA,cAAc,aAAa","ignoreList":[]}
|
package/dist/TextEditor/plugins/IndentPaddingToMarginPlugin/IndentPaddingToMarginPlugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IndentPaddingToMarginPlugin.js","names":["Plugin","IndentPaddingToMarginPlugin","_Plugin","_classCallCheck","_callSuper","arguments","_inherits","_createClass","key","value","init","editor","originalToView","data","processor","toView","bind","convertedData","replace","get"],"sources":["../../../../src/TextEditor/plugins/IndentPaddingToMarginPlugin/IndentPaddingToMarginPlugin.ts"],"sourcesContent":["import { Plugin } from 'ckeditor5'\n\n// Convert paragraph padding-left to margin-left to maintain compatibility with legacy editor output\nexport class IndentPaddingToMarginPlugin extends Plugin {\n static get pluginName() {\n return 'IndentPaddingToMargin'\n }\n\n init() {\n const editor = this.editor\n const originalToView = editor.data.processor.toView.bind(\n editor.data.processor\n )\n editor.data.processor.toView = (data: string) => {\n const convertedData = data.replace(\n /<p([^>]*style=\"[^\"]*?)padding-left:\\s*([^;]+)(;?)([^\"]*\"[^>]*>)/gi,\n '<p$1margin-left: $2$3$4'\n )\n return originalToView(convertedData)\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,SAASA,MAAM,QAAQ,WAAW;;AAElC;AACA,WAAaC,2BAA2B,0BAAAC,OAAA;EAAA,SAAAD,4BAAA;IAAAE,eAAA,OAAAF,2BAAA;IAAA,OAAAG,UAAA,OAAAH,2BAAA,EAAAI,SAAA;EAAA;EAAAC,SAAA,CAAAL,2BAAA,EAAAC,OAAA;EAAA,OAAAK,YAAA,CAAAN,2BAAA;IAAAO,GAAA;IAAAC,KAAA,EAKtC,SAAAC,IAAIA,CAAA,EAAG;MACL,IAAMC,MAAM,GAAG,IAAI,CAACA,MAAM;MAC1B,IAAMC,cAAc,GAAGD,MAAM,CAACE,IAAI,CAACC,SAAS,CAACC,MAAM,CAACC,IAAI,CACtDL,MAAM,CAACE,IAAI,CAACC,SACd,CAAC;MACDH,MAAM,CAACE,IAAI,CAACC,SAAS,CAACC,MAAM,GAAG,UAACF,IAAY,EAAK;QAC/C,IAAMI,aAAa,GAAGJ,IAAI,CAACK,OAAO,CAChC,mEAAmE,EACnE,yBACF,CAAC;QACD,OAAON,cAAc,CAACK,aAAa,CAAC;MACtC,CAAC;IACH;EAAC;IAAAT,GAAA;IAAAW,GAAA,EAhBD,SAAAA,IAAA,EAAwB;MACtB,OAAO,uBAAuB;IAChC;EAAC;AAAA,EAH8CnB,MAAM"}
|
|
1
|
+
{"version":3,"file":"IndentPaddingToMarginPlugin.js","names":["Plugin","IndentPaddingToMarginPlugin","_Plugin","_classCallCheck","_callSuper","arguments","_inherits","_createClass","key","value","init","editor","originalToView","data","processor","toView","bind","convertedData","replace","get"],"sources":["../../../../src/TextEditor/plugins/IndentPaddingToMarginPlugin/IndentPaddingToMarginPlugin.ts"],"sourcesContent":["import { Plugin } from 'ckeditor5'\n\n// Convert paragraph padding-left to margin-left to maintain compatibility with legacy editor output\nexport class IndentPaddingToMarginPlugin extends Plugin {\n static get pluginName() {\n return 'IndentPaddingToMargin'\n }\n\n init() {\n const editor = this.editor\n const originalToView = editor.data.processor.toView.bind(\n editor.data.processor\n )\n editor.data.processor.toView = (data: string) => {\n const convertedData = data.replace(\n /<p([^>]*style=\"[^\"]*?)padding-left:\\s*([^;]+)(;?)([^\"]*\"[^>]*>)/gi,\n '<p$1margin-left: $2$3$4'\n )\n return originalToView(convertedData)\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,SAASA,MAAM,QAAQ,WAAW;;AAElC;AACA,WAAaC,2BAA2B,0BAAAC,OAAA;EAAA,SAAAD,4BAAA;IAAAE,eAAA,OAAAF,2BAAA;IAAA,OAAAG,UAAA,OAAAH,2BAAA,EAAAI,SAAA;EAAA;EAAAC,SAAA,CAAAL,2BAAA,EAAAC,OAAA;EAAA,OAAAK,YAAA,CAAAN,2BAAA;IAAAO,GAAA;IAAAC,KAAA,EAKtC,SAAAC,IAAIA,CAAA,EAAG;MACL,IAAMC,MAAM,GAAG,IAAI,CAACA,MAAM;MAC1B,IAAMC,cAAc,GAAGD,MAAM,CAACE,IAAI,CAACC,SAAS,CAACC,MAAM,CAACC,IAAI,CACtDL,MAAM,CAACE,IAAI,CAACC,SACd,CAAC;MACDH,MAAM,CAACE,IAAI,CAACC,SAAS,CAACC,MAAM,GAAG,UAACF,IAAY,EAAK;QAC/C,IAAMI,aAAa,GAAGJ,IAAI,CAACK,OAAO,CAChC,mEAAmE,EACnE,yBACF,CAAC;QACD,OAAON,cAAc,CAACK,aAAa,CAAC;MACtC,CAAC;IACH;EAAC;IAAAT,GAAA;IAAAW,GAAA,EAhBD,SAAAA,IAAA,EAAwB;MACtB,OAAO,uBAAuB;IAChC;EAAC;AAAA,EAH8CnB,MAAM","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/TextEditor/plugins/IndentPaddingToMarginPlugin/index.ts"],"sourcesContent":["export * from './IndentPaddingToMarginPlugin'\n"],"mappings":"AAAA,cAAc,+BAA+B"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/TextEditor/plugins/IndentPaddingToMarginPlugin/index.ts"],"sourcesContent":["export * from './IndentPaddingToMarginPlugin'\n"],"mappings":"AAAA,cAAc,+BAA+B","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NormalizeTableWidthPlugin.js","names":["Plugin","UpcastWriter","isInvalidWidth","width","test","numeric","Number","parseFloat","isNaN","NormalizeTableWidthPlugin","_Plugin","_classCallCheck","_callSuper","arguments","_inherits","_createClass","key","value","init","editor","clipboardPipeline","plugins","get","on","_evt","data","writer","editing","view","document","normalizeNode","content","node","_element$getChildren","element","is","getStyle","removeStyle","setStyle","children","getChildren","call","_i","_Array$from","Array","from","length","child"],"sources":["../../../../src/TextEditor/plugins/NormalizeTableWidthPlugin/NormalizeTableWidthPlugin.ts"],"sourcesContent":["import type { ViewDocumentFragment, ViewElement, ViewNode } from 'ckeditor5'\nimport { Plugin, UpcastWriter } from 'ckeditor5'\n\nconst isInvalidWidth = (width: string | undefined): boolean => {\n if (!width) return false\n if (/nan/i.test(width)) return true\n const numeric = Number.parseFloat(width)\n return Number.isNaN(numeric) || numeric === 0\n}\n\n/**\n * Fixes broken table widths injected when pasting from a spreadsheet\n * (Excel / Google Sheets). Such content arrives with `width:0px` on the table\n * figure/table and can produce `width:NaN%` columns, collapsing the table.\n *\n * We intercept the clipboard `inputTransformation` (runs on the pasted view\n * fragment, before it becomes editor content) and normalize widths at the\n * source, so the bogus values never enter the model — keeping both the editing\n * view and the saved data correct.\n */\nexport class NormalizeTableWidthPlugin extends Plugin {\n static get pluginName() {\n return 'NormalizeTableWidth'\n }\n\n init() {\n const editor = this.editor\n const clipboardPipeline = editor.plugins.get('ClipboardPipeline')\n clipboardPipeline.on('inputTransformation', (_evt, data) => {\n const writer = new UpcastWriter(editor.editing.view.document)\n normalizeNode(data.content, writer)\n })\n }\n}\n\nfunction normalizeNode(\n node: ViewNode | ViewDocumentFragment,\n writer: UpcastWriter\n): void {\n const element = node as ViewElement\n\n if (element.is('element', 'figure') || element.is('element', 'table')) {\n if (isInvalidWidth(element.getStyle('width'))) {\n writer.removeStyle('width', element)\n writer.setStyle('width', '100%', element)\n }\n }\n\n const children = element.getChildren?.()\n if (children) {\n for (const child of Array.from(children)) {\n normalizeNode(child, writer)\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;AACA,SAASA,MAAM,EAAEC,YAAY,QAAQ,WAAW;AAEhD,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,KAAyB,EAAc;EAC7D,IAAI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AAC,IAAID,OAAO,CAACC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE;IACrE,IAAIjC,cAAc,CAACgC,OAAO,CAACE,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE;MAC7CV,MAAM,CAACW,WAAW,CAAC,OAAO,EAAEH,OAAO,CAAC;MACpCR,MAAM,CAACY,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAEJ,OAAO,CAAC;IAC3C;EACF;EAEA,IAAMK,QAAQ,IAAAN,oBAAA,GAAGC,OAAO,CAACM,WAAW,cAAAP,oBAAA,uBAAnBA,oBAAA,CAAAQ,IAAA,CAAAP,OAAsB,CAAC;EACxC,IAAIK,QAAQ,EAAE;IACZ,SAAAG,EAAA,MAAAC,WAAA,GAAoBC,KAAK,CAACC,IAAI,CAACN,QAAQ,CAAC,EAAAG,EAAA,GAAAC,WAAA,CAAAG,MAAA,EAAAJ,EAAA,IAAE;MAArC,IAAMK,KAAK,GAAAJ,WAAA,CAAAD,EAAA;MACdZ,aAAa,CAACiB,KAAK,EAAErB,MAAM,CAAC;IAC9B;EACF;AACF"}
|
|
1
|
+
{"version":3,"file":"NormalizeTableWidthPlugin.js","names":["Plugin","UpcastWriter","isInvalidWidth","width","test","numeric","Number","parseFloat","isNaN","NormalizeTableWidthPlugin","_Plugin","_classCallCheck","_callSuper","arguments","_inherits","_createClass","key","value","init","editor","clipboardPipeline","plugins","get","on","_evt","data","writer","editing","view","document","normalizeNode","content","node","_element$getChildren","element","is","getStyle","removeStyle","setStyle","children","getChildren","call","_i","_Array$from","Array","from","length","child"],"sources":["../../../../src/TextEditor/plugins/NormalizeTableWidthPlugin/NormalizeTableWidthPlugin.ts"],"sourcesContent":["import type { ViewDocumentFragment, ViewElement, ViewNode } from 'ckeditor5'\nimport { Plugin, UpcastWriter } from 'ckeditor5'\n\nconst isInvalidWidth = (width: string | undefined): boolean => {\n if (!width) return false\n if (/nan/i.test(width)) return true\n const numeric = Number.parseFloat(width)\n return Number.isNaN(numeric) || numeric === 0\n}\n\n/**\n * Fixes broken table widths injected when pasting from a spreadsheet\n * (Excel / Google Sheets). Such content arrives with `width:0px` on the table\n * figure/table and can produce `width:NaN%` columns, collapsing the table.\n *\n * We intercept the clipboard `inputTransformation` (runs on the pasted view\n * fragment, before it becomes editor content) and normalize widths at the\n * source, so the bogus values never enter the model — keeping both the editing\n * view and the saved data correct.\n */\nexport class NormalizeTableWidthPlugin extends Plugin {\n static get pluginName() {\n return 'NormalizeTableWidth'\n }\n\n init() {\n const editor = this.editor\n const clipboardPipeline = editor.plugins.get('ClipboardPipeline')\n clipboardPipeline.on('inputTransformation', (_evt, data) => {\n const writer = new UpcastWriter(editor.editing.view.document)\n normalizeNode(data.content, writer)\n })\n }\n}\n\nfunction normalizeNode(\n node: ViewNode | ViewDocumentFragment,\n writer: UpcastWriter\n): void {\n const element = node as ViewElement\n\n if (element.is('element', 'figure') || element.is('element', 'table')) {\n if (isInvalidWidth(element.getStyle('width'))) {\n writer.removeStyle('width', element)\n writer.setStyle('width', '100%', element)\n }\n }\n\n const children = element.getChildren?.()\n if (children) {\n for (const child of Array.from(children)) {\n normalizeNode(child, writer)\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;AACA,SAASA,MAAM,EAAEC,YAAY,QAAQ,WAAW;AAEhD,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,KAAyB,EAAc;EAC7D,IAAI,CAACA,KAAK,EAAE,OAAO,KAAK;EACxB,IAAI,MAAM,CAACC,IAAI,CAACD,KAAK,CAAC,EAAE,OAAO,IAAI;EACnC,IAAME,OAAO,GAAGC,MAAM,CAACC,UAAU,CAACJ,KAAK,CAAC;EACxC,OAAOG,MAAM,CAACE,KAAK,CAACH,OAAO,CAAC,IAAIA,OAAO,KAAK,CAAC;AAC/C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAaI,yBAAyB,0BAAAC,OAAA;EAAA,SAAAD,0BAAA;IAAAE,eA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nBA,oBAAA,CAAAQ,IAAA,CAAAP,OAAsB,CAAC;EACxC,IAAIK,QAAQ,EAAE;IACZ,SAAAG,EAAA,MAAAC,WAAA,GAAoBC,KAAK,CAACC,IAAI,CAACN,QAAQ,CAAC,EAAAG,EAAA,GAAAC,WAAA,CAAAG,MAAA,EAAAJ,EAAA,IAAE;MAArC,IAAMK,KAAK,GAAAJ,WAAA,CAAAD,EAAA;MACdZ,aAAa,CAACiB,KAAK,EAAErB,MAAM,CAAC;IAC9B;EACF;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/TextEditor/plugins/NormalizeTableWidthPlugin/index.ts"],"sourcesContent":["export * from './NormalizeTableWidthPlugin'\n"],"mappings":"AAAA,cAAc,6BAA6B"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/TextEditor/plugins/NormalizeTableWidthPlugin/index.ts"],"sourcesContent":["export * from './NormalizeTableWidthPlugin'\n"],"mappings":"AAAA,cAAc,6BAA6B","ignoreList":[]}
|
|
@@ -1,13 +1,6 @@
|
|
|
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
|
-
function _regeneratorRuntime() { "use strict"; var r = _regenerator(), e = r.m(_regeneratorRuntime), t = (Object.getPrototypeOf ? Object.getPrototypeOf(e) : e.__proto__).constructor; function n(r) { var e = "function" == typeof r && r.constructor; return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name)); } var o = { "throw": 1, "return": 2, "break": 3, "continue": 3 }; function a(r) { var e, t; return function (n) { e || (e = { stop: function stop() { return t(n.a, 2); }, "catch": function _catch() { return n.v; }, abrupt: function abrupt(r, e) { return t(n.a, o[r], e); }, delegateYield: function delegateYield(r, o, a) { return e.resultName = o, t(n.d, _regeneratorValues(r), a); }, finish: function finish(r) { return t(n.f, r); } }, t = function t(r, _t, o) { n.p = e.prev, n.n = e.next; try { return r(_t, o); } finally { e.next = n.n; } }), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n; try { return r.call(this, e); } finally { n.p = e.prev, n.n = e.next; } }; } return (_regeneratorRuntime = function _regeneratorRuntime() { return { wrap: function wrap(e, t, n, o) { return r.w(a(e), t, n, o && o.reverse()); }, isGeneratorFunction: n, mark: r.m, awrap: function awrap(r, e) { return new _OverloadYield(r, e); }, AsyncIterator: _regeneratorAsyncIterator, async: function async(r, e, t, o, u) { return (n(e) ? _regeneratorAsyncGen : _regeneratorAsync)(a(r), e, t, o, u); }, keys: _regeneratorKeys, values: _regeneratorValues }; })(); }
|
|
3
|
-
function _regeneratorValues(e) { if (null != e) { var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"], r = 0; if (t) return t.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) return { next: function next() { return e && r >= e.length && (e = void 0), { value: e && e[r++], done: !e }; } }; } throw new TypeError(_typeof(e) + " is not iterable"); }
|
|
4
|
-
function _regeneratorKeys(e) { var n = Object(e), r = []; for (var t in n) r.unshift(t); return function e() { for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = !1, e; return e.done = !0, e; }; }
|
|
5
|
-
function _regeneratorAsync(n, e, r, t, o) { var a = _regeneratorAsyncGen(n, e, r, t, o); return a.next().then(function (n) { return n.done ? n.value : a.next(); }); }
|
|
6
|
-
function _regeneratorAsyncGen(r, e, t, o, n) { return new _regeneratorAsyncIterator(_regenerator().w(r, e, t, o), n || Promise); }
|
|
7
|
-
function _regeneratorAsyncIterator(t, e) { function n(r, o, i, f) { try { var c = t[r](o), u = c.value; return u instanceof _OverloadYield ? e.resolve(u.v).then(function (t) { n("next", t, i, f); }, function (t) { n("throw", t, i, f); }) : e.resolve(u).then(function (t) { c.value = t, i(c); }, function (t) { return n("throw", t, i, f); }); } catch (t) { f(t); } } var r; this.next || (_regeneratorDefine2(_regeneratorAsyncIterator.prototype), _regeneratorDefine2(_regeneratorAsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function () { return this; })), _regeneratorDefine2(this, "_invoke", function (t, o, i) { function f() { return new e(function (e, r) { n(t, i, e, r); }); } return r = r ? r.then(f, f) : f(); }, !0); }
|
|
8
2
|
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
9
|
-
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) {
|
|
10
|
-
function _OverloadYield(e, d) { this.v = e, this.k = d; }
|
|
3
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
11
4
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
12
5
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
13
6
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
@@ -32,21 +25,21 @@ export var PasteAsTextCommand = /*#__PURE__*/function (_Command) {
|
|
|
32
25
|
return _createClass(PasteAsTextCommand, [{
|
|
33
26
|
key: "execute",
|
|
34
27
|
value: function () {
|
|
35
|
-
var _execute = _asyncToGenerator(
|
|
36
|
-
var editor, plainText;
|
|
37
|
-
return
|
|
38
|
-
while (1) switch (_context.
|
|
28
|
+
var _execute = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
29
|
+
var editor, plainText, _t;
|
|
30
|
+
return _regenerator().w(function (_context) {
|
|
31
|
+
while (1) switch (_context.p = _context.n) {
|
|
39
32
|
case 0:
|
|
40
33
|
editor = this.editor;
|
|
41
|
-
_context.
|
|
34
|
+
_context.p = 1;
|
|
42
35
|
if (!(navigator.clipboard && navigator.clipboard.readText)) {
|
|
43
|
-
_context.
|
|
36
|
+
_context.n = 3;
|
|
44
37
|
break;
|
|
45
38
|
}
|
|
46
|
-
_context.
|
|
39
|
+
_context.n = 2;
|
|
47
40
|
return navigator.clipboard.readText();
|
|
48
|
-
case
|
|
49
|
-
plainText = _context.
|
|
41
|
+
case 2:
|
|
42
|
+
plainText = _context.v;
|
|
50
43
|
if (plainText) {
|
|
51
44
|
// Insert as plain text without any formatting
|
|
52
45
|
editor.model.change(function (writer) {
|
|
@@ -54,22 +47,21 @@ export var PasteAsTextCommand = /*#__PURE__*/function (_Command) {
|
|
|
54
47
|
editor.model.insertContent(textNode);
|
|
55
48
|
});
|
|
56
49
|
}
|
|
57
|
-
_context.
|
|
50
|
+
_context.n = 4;
|
|
58
51
|
break;
|
|
59
|
-
case
|
|
52
|
+
case 3:
|
|
60
53
|
console.warn('Clipboard API not available');
|
|
61
|
-
case
|
|
62
|
-
_context.
|
|
54
|
+
case 4:
|
|
55
|
+
_context.n = 6;
|
|
63
56
|
break;
|
|
64
|
-
case
|
|
65
|
-
_context.
|
|
66
|
-
|
|
57
|
+
case 5:
|
|
58
|
+
_context.p = 5;
|
|
59
|
+
_t = _context.v;
|
|
67
60
|
console.warn('Clipboard API not available for text reading');
|
|
68
|
-
case
|
|
69
|
-
|
|
70
|
-
return _context.stop();
|
|
61
|
+
case 6:
|
|
62
|
+
return _context.a(2);
|
|
71
63
|
}
|
|
72
|
-
}, _callee, this, [[1,
|
|
64
|
+
}, _callee, this, [[1, 5]]);
|
|
73
65
|
}));
|
|
74
66
|
function execute() {
|
|
75
67
|
return _execute.apply(this, arguments);
|