@tiny-mce-umbraco/backoffice 16.0.0-rc2 → 16.0.0-rc2.1
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/README.md +1 -0
- package/dist-cms/README.md +1 -0
- package/dist-cms/api/client.gen.d.ts +13 -0
- package/dist-cms/api/client.gen.d.ts.map +1 -0
- package/dist-cms/api/client.gen.js +5 -0
- package/dist-cms/api/index.d.ts +3 -0
- package/dist-cms/api/index.d.ts.map +1 -0
- package/dist-cms/api/index.js +3 -0
- package/dist-cms/api/sdk.gen.d.ts +19 -0
- package/dist-cms/api/sdk.gen.d.ts.map +1 -0
- package/dist-cms/api/sdk.gen.js +16 -0
- package/dist-cms/api/types.gen.d.ts +72 -0
- package/dist-cms/api/types.gen.d.ts.map +1 -0
- package/dist-cms/api/types.gen.js +7 -0
- package/dist-cms/components/constants.d.ts +2 -0
- package/dist-cms/components/constants.d.ts.map +1 -0
- package/dist-cms/components/constants.js +1 -0
- package/dist-cms/components/index.d.ts +6 -0
- package/dist-cms/components/index.d.ts.map +1 -0
- package/dist-cms/components/index.js +5 -0
- package/dist-cms/components/input-tiny-mce/index.d.ts +7 -0
- package/dist-cms/components/input-tiny-mce/index.d.ts.map +1 -0
- package/dist-cms/components/input-tiny-mce/index.js +6 -0
- package/dist-cms/components/input-tiny-mce/input-tiny-mce.defaults.d.ts +5 -0
- package/dist-cms/components/input-tiny-mce/input-tiny-mce.defaults.d.ts.map +1 -0
- package/dist-cms/components/input-tiny-mce/input-tiny-mce.defaults.js +159 -0
- package/dist-cms/components/input-tiny-mce/input-tiny-mce.element.d.ts +37 -0
- package/dist-cms/components/input-tiny-mce/input-tiny-mce.element.d.ts.map +1 -0
- package/dist-cms/components/input-tiny-mce/input-tiny-mce.element.js +449 -0
- package/dist-cms/components/input-tiny-mce/input-tiny-mce.handlers.d.ts +3 -0
- package/dist-cms/components/input-tiny-mce/input-tiny-mce.handlers.d.ts.map +1 -0
- package/dist-cms/components/input-tiny-mce/input-tiny-mce.handlers.js +8 -0
- package/dist-cms/components/input-tiny-mce/input-tiny-mce.languages.d.ts +2 -0
- package/dist-cms/components/input-tiny-mce/input-tiny-mce.languages.d.ts.map +1 -0
- package/dist-cms/components/input-tiny-mce/input-tiny-mce.languages.js +78 -0
- package/dist-cms/components/input-tiny-mce/input-tiny-mce.sanitizer.d.ts +9 -0
- package/dist-cms/components/input-tiny-mce/input-tiny-mce.sanitizer.d.ts.map +1 -0
- package/dist-cms/components/input-tiny-mce/input-tiny-mce.sanitizer.js +47 -0
- package/dist-cms/components/input-tiny-mce/tiny-mce-plugin.d.ts +24 -0
- package/dist-cms/components/input-tiny-mce/tiny-mce-plugin.d.ts.map +1 -0
- package/dist-cms/components/input-tiny-mce/tiny-mce-plugin.js +16 -0
- package/dist-cms/components/manifests.d.ts +2 -0
- package/dist-cms/components/manifests.d.ts.map +1 -0
- package/dist-cms/components/manifests.js +2 -0
- package/dist-cms/components/stylesheet-rule-input/constants.d.ts +3 -0
- package/dist-cms/components/stylesheet-rule-input/constants.d.ts.map +1 -0
- package/dist-cms/components/stylesheet-rule-input/constants.js +2 -0
- package/dist-cms/components/stylesheet-rule-input/manifests.d.ts +3 -0
- package/dist-cms/components/stylesheet-rule-input/manifests.d.ts.map +1 -0
- package/dist-cms/components/stylesheet-rule-input/manifests.js +9 -0
- package/dist-cms/components/stylesheet-rule-input/stylesheet-rule-input.element.d.ts +18 -0
- package/dist-cms/components/stylesheet-rule-input/stylesheet-rule-input.element.d.ts.map +1 -0
- package/dist-cms/components/stylesheet-rule-input/stylesheet-rule-input.element.js +119 -0
- package/dist-cms/components/stylesheet-rule-input/stylesheet-rule-settings-modal.element.d.ts +12 -0
- package/dist-cms/components/stylesheet-rule-input/stylesheet-rule-settings-modal.element.d.ts.map +1 -0
- package/dist-cms/components/stylesheet-rule-input/stylesheet-rule-settings-modal.element.js +142 -0
- package/dist-cms/components/stylesheet-rule-input/stylesheet-rule-settings-modal.token.d.ts +7 -0
- package/dist-cms/components/stylesheet-rule-input/stylesheet-rule-settings-modal.token.d.ts.map +1 -0
- package/dist-cms/components/stylesheet-rule-input/stylesheet-rule-settings-modal.token.js +9 -0
- package/dist-cms/components/stylesheet-rule-ref/stylesheet-rule-ref.element.d.ts +16 -0
- package/dist-cms/components/stylesheet-rule-ref/stylesheet-rule-ref.element.d.ts.map +1 -0
- package/dist-cms/components/stylesheet-rule-ref/stylesheet-rule-ref.element.js +24 -0
- package/dist-cms/constants.d.ts +2 -0
- package/dist-cms/constants.d.ts.map +1 -0
- package/dist-cms/constants.js +1 -0
- package/dist-cms/entry-points/entry-point.d.ts +4 -0
- package/dist-cms/entry-points/entry-point.d.ts.map +1 -0
- package/dist-cms/entry-points/entry-point.js +25 -0
- package/dist-cms/entry-points/manifest.d.ts +2 -0
- package/dist-cms/entry-points/manifest.d.ts.map +1 -0
- package/dist-cms/entry-points/manifest.js +8 -0
- package/dist-cms/external/tinymce/index.d.ts +22 -0
- package/dist-cms/external/tinymce/index.d.ts.map +1 -0
- package/dist-cms/external/tinymce/index.js +18 -0
- package/dist-cms/icons/icons.d.ts +6 -0
- package/dist-cms/icons/icons.d.ts.map +1 -0
- package/dist-cms/icons/icons.js +1 -0
- package/dist-cms/icons/manifests.d.ts +2 -0
- package/dist-cms/icons/manifests.d.ts.map +1 -0
- package/dist-cms/icons/manifests.js +8 -0
- package/dist-cms/index.d.ts +5 -0
- package/dist-cms/index.d.ts.map +1 -0
- package/dist-cms/index.js +3 -0
- package/dist-cms/localizations/ar.d.ts +4 -0
- package/dist-cms/localizations/ar.d.ts.map +1 -0
- package/dist-cms/localizations/ar.js +5 -0
- package/dist-cms/localizations/bs.d.ts +4 -0
- package/dist-cms/localizations/bs.d.ts.map +1 -0
- package/dist-cms/localizations/bs.js +5 -0
- package/dist-cms/localizations/cs.d.ts +4 -0
- package/dist-cms/localizations/cs.d.ts.map +1 -0
- package/dist-cms/localizations/cs.js +5 -0
- package/dist-cms/localizations/cy.d.ts +4 -0
- package/dist-cms/localizations/cy.d.ts.map +1 -0
- package/dist-cms/localizations/cy.js +5 -0
- package/dist-cms/localizations/da.d.ts +4 -0
- package/dist-cms/localizations/da.d.ts.map +1 -0
- package/dist-cms/localizations/da.js +5 -0
- package/dist-cms/localizations/de.d.ts +4 -0
- package/dist-cms/localizations/de.d.ts.map +1 -0
- package/dist-cms/localizations/de.js +5 -0
- package/dist-cms/localizations/en.d.ts +4 -0
- package/dist-cms/localizations/en.d.ts.map +1 -0
- package/dist-cms/localizations/en.js +5 -0
- package/dist-cms/localizations/fr.d.ts +4 -0
- package/dist-cms/localizations/fr.d.ts.map +1 -0
- package/dist-cms/localizations/fr.js +5 -0
- package/dist-cms/localizations/hr.d.ts +4 -0
- package/dist-cms/localizations/hr.d.ts.map +1 -0
- package/dist-cms/localizations/hr.js +5 -0
- package/dist-cms/localizations/it.d.ts +4 -0
- package/dist-cms/localizations/it.d.ts.map +1 -0
- package/dist-cms/localizations/it.js +5 -0
- package/dist-cms/localizations/manifests.d.ts +2 -0
- package/dist-cms/localizations/manifests.d.ts.map +1 -0
- package/dist-cms/localizations/manifests.js +97 -0
- package/dist-cms/localizations/nl.d.ts +4 -0
- package/dist-cms/localizations/nl.d.ts.map +1 -0
- package/dist-cms/localizations/nl.js +5 -0
- package/dist-cms/localizations/tr.d.ts +4 -0
- package/dist-cms/localizations/tr.d.ts.map +1 -0
- package/dist-cms/localizations/tr.js +5 -0
- package/dist-cms/manifests.d.ts +2 -0
- package/dist-cms/manifests.d.ts.map +1 -0
- package/dist-cms/manifests.js +16 -0
- package/dist-cms/plugins/core/a11ychecker.tinymce-api.d.ts +6 -0
- package/dist-cms/plugins/core/a11ychecker.tinymce-api.d.ts.map +1 -0
- package/dist-cms/plugins/core/a11ychecker.tinymce-api.js +7 -0
- package/dist-cms/plugins/core/ai-assistant.tinymce-api.d.ts +9 -0
- package/dist-cms/plugins/core/ai-assistant.tinymce-api.d.ts.map +1 -0
- package/dist-cms/plugins/core/ai-assistant.tinymce-api.js +41 -0
- package/dist-cms/plugins/core/ai-request-factory.d.ts +2 -0
- package/dist-cms/plugins/core/ai-request-factory.d.ts.map +1 -0
- package/dist-cms/plugins/core/ai-request-factory.js +33 -0
- package/dist-cms/plugins/core/basic.tinymce-api.d.ts +6 -0
- package/dist-cms/plugins/core/basic.tinymce-api.d.ts.map +1 -0
- package/dist-cms/plugins/core/basic.tinymce-api.js +7 -0
- package/dist-cms/plugins/manifests.d.ts +3 -0
- package/dist-cms/plugins/manifests.d.ts.map +1 -0
- package/dist-cms/plugins/manifests.js +506 -0
- package/dist-cms/plugins/tiny-mce-block-picker.plugin.d.ts +8 -0
- package/dist-cms/plugins/tiny-mce-block-picker.plugin.d.ts.map +1 -0
- package/dist-cms/plugins/tiny-mce-block-picker.plugin.js +99 -0
- package/dist-cms/plugins/tiny-mce-code-editor.plugin.d.ts +7 -0
- package/dist-cms/plugins/tiny-mce-code-editor.plugin.d.ts.map +1 -0
- package/dist-cms/plugins/tiny-mce-code-editor.plugin.js +42 -0
- package/dist-cms/plugins/tiny-mce-embeddedmedia.plugin.d.ts +7 -0
- package/dist-cms/plugins/tiny-mce-embeddedmedia.plugin.d.ts.map +1 -0
- package/dist-cms/plugins/tiny-mce-embeddedmedia.plugin.js +74 -0
- package/dist-cms/plugins/tiny-mce-mediapicker.plugin.d.ts +7 -0
- package/dist-cms/plugins/tiny-mce-mediapicker.plugin.d.ts.map +1 -0
- package/dist-cms/plugins/tiny-mce-mediapicker.plugin.js +224 -0
- package/dist-cms/plugins/tiny-mce-multi-url-picker.plugin.d.ts +8 -0
- package/dist-cms/plugins/tiny-mce-multi-url-picker.plugin.d.ts.map +1 -0
- package/dist-cms/plugins/tiny-mce-multi-url-picker.plugin.js +172 -0
- package/dist-cms/plugins/tinymce-plugin.extension.d.ts +70 -0
- package/dist-cms/plugins/tinymce-plugin.extension.d.ts.map +1 -0
- package/dist-cms/plugins/tinymce-plugin.extension.js +1 -0
- package/dist-cms/plugins/types.d.ts +2 -0
- package/dist-cms/plugins/types.d.ts.map +1 -0
- package/dist-cms/plugins/types.js +1 -0
- package/dist-cms/property-editors/configEditor/property-editor-ui-tiny-mce-config-editor.element.d.ts +23 -0
- package/dist-cms/property-editors/configEditor/property-editor-ui-tiny-mce-config-editor.element.d.ts.map +1 -0
- package/dist-cms/property-editors/configEditor/property-editor-ui-tiny-mce-config-editor.element.js +102 -0
- package/dist-cms/property-editors/constants.d.ts +2 -0
- package/dist-cms/property-editors/constants.d.ts.map +1 -0
- package/dist-cms/property-editors/constants.js +1 -0
- package/dist-cms/property-editors/manifests.d.ts +2 -0
- package/dist-cms/property-editors/manifests.d.ts.map +1 -0
- package/dist-cms/property-editors/manifests.js +37 -0
- package/dist-cms/property-editors/plugin/property-editor-ui-tiny-mce-plugin-configuration.element.d.ts +25 -0
- package/dist-cms/property-editors/plugin/property-editor-ui-tiny-mce-plugin-configuration.element.d.ts.map +1 -0
- package/dist-cms/property-editors/plugin/property-editor-ui-tiny-mce-plugin-configuration.element.js +212 -0
- package/dist-cms/property-editors/tiny-mce/constants.d.ts +2 -0
- package/dist-cms/property-editors/tiny-mce/constants.d.ts.map +1 -0
- package/dist-cms/property-editors/tiny-mce/constants.js +1 -0
- package/dist-cms/property-editors/tiny-mce/manifests.d.ts +2 -0
- package/dist-cms/property-editors/tiny-mce/manifests.d.ts.map +1 -0
- package/dist-cms/property-editors/tiny-mce/manifests.js +149 -0
- package/dist-cms/property-editors/tiny-mce/property-editor-ui-tiny-mce.element.d.ts +16 -0
- package/dist-cms/property-editors/tiny-mce/property-editor-ui-tiny-mce.element.d.ts.map +1 -0
- package/dist-cms/property-editors/tiny-mce/property-editor-ui-tiny-mce.element.js +79 -0
- package/dist-cms/property-editors/toolbar/property-editor-ui-tiny-mce-toolbar-configuration.element.d.ts +25 -0
- package/dist-cms/property-editors/toolbar/property-editor-ui-tiny-mce-toolbar-configuration.element.d.ts.map +1 -0
- package/dist-cms/property-editors/toolbar/property-editor-ui-tiny-mce-toolbar-configuration.element.js +201 -0
- package/dist-cms/stylesheets/entity-actions/manifests.d.ts +2 -0
- package/dist-cms/stylesheets/entity-actions/manifests.d.ts.map +1 -0
- package/dist-cms/stylesheets/entity-actions/manifests.js +15 -0
- package/dist-cms/stylesheets/entity-actions/rte-stylesheet-create-option-action.d.ts +7 -0
- package/dist-cms/stylesheets/entity-actions/rte-stylesheet-create-option-action.d.ts.map +1 -0
- package/dist-cms/stylesheets/entity-actions/rte-stylesheet-create-option-action.js +8 -0
- package/dist-cms/stylesheets/manifests.d.ts +2 -0
- package/dist-cms/stylesheets/manifests.d.ts.map +1 -0
- package/dist-cms/stylesheets/manifests.js +3 -0
- package/dist-cms/stylesheets/stylesheet-rule-manager.d.ts +20 -0
- package/dist-cms/stylesheets/stylesheet-rule-manager.d.ts.map +1 -0
- package/dist-cms/stylesheets/stylesheet-rule-manager.js +57 -0
- package/dist-cms/stylesheets/workspace-views/manifests.d.ts +2 -0
- package/dist-cms/stylesheets/workspace-views/manifests.d.ts.map +1 -0
- package/dist-cms/stylesheets/workspace-views/manifests.js +22 -0
- package/dist-cms/stylesheets/workspace-views/stylesheet-rich-text-rule-workspace-view.element.d.ts +18 -0
- package/dist-cms/stylesheets/workspace-views/stylesheet-rich-text-rule-workspace-view.element.d.ts.map +1 -0
- package/dist-cms/stylesheets/workspace-views/stylesheet-rich-text-rule-workspace-view.element.js +100 -0
- package/dist-cms/tinymce.d.ts +2 -0
- package/dist-cms/tinymce.d.ts.map +1 -0
- package/dist-cms/tinymce.js +1 -0
- package/dist-cms/types.d.ts +6 -0
- package/dist-cms/types.d.ts.map +1 -0
- package/dist-cms/types.js +1 -0
- package/dist-cms/utils/index.d.ts +26 -0
- package/dist-cms/utils/index.d.ts.map +1 -0
- package/dist-cms/utils/index.js +108 -0
- package/package.json +10 -4
- package/dist/tiny-mce-umbraco.d.ts +0 -252
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Editor } from '@umbraco-cms/backoffice/external/tinymce';
|
|
2
|
+
/**
|
|
3
|
+
* Sizes an image in the editor
|
|
4
|
+
* @param editor
|
|
5
|
+
* @param imageDomElement
|
|
6
|
+
* @param imgUrl
|
|
7
|
+
*/
|
|
8
|
+
export declare function sizeImageInEditor(editor: Editor, imageDomElement: HTMLElement, imgUrl?: string): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Scales an image to the max size
|
|
11
|
+
* @param maxSize
|
|
12
|
+
* @param width
|
|
13
|
+
* @param height
|
|
14
|
+
*/
|
|
15
|
+
export declare function scaleToMaxSize(maxSize: number, width: number, height: number): {
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Uploads blob images to the server
|
|
21
|
+
* @param editor
|
|
22
|
+
* @param newContent
|
|
23
|
+
*/
|
|
24
|
+
export declare function uploadBlobImages(editor: Editor, newContent?: string): Promise<void>;
|
|
25
|
+
export { UmbStylesheetRuleManager } from '../stylesheets/stylesheet-rule-manager.js';
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0CAA0C,CAAC;AAEvE;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,MAAM,iBAsBpG;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;EA4B5E;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,iBAqDzE;AAED,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// TODO => this is NOT a full reimplementation of the existing media helper service, currently
|
|
2
|
+
// contains only functions referenced by the TinyMCE editor
|
|
3
|
+
// TODO: This should not be done in this way, we need to split this into separate defined helper methods. This is also very specific to TinyMCE, so should be named that way. [NL]
|
|
4
|
+
import { getProcessedImageUrl } from '@umbraco-cms/backoffice/utils';
|
|
5
|
+
/**
|
|
6
|
+
* Sizes an image in the editor
|
|
7
|
+
* @param editor
|
|
8
|
+
* @param imageDomElement
|
|
9
|
+
* @param imgUrl
|
|
10
|
+
*/
|
|
11
|
+
export async function sizeImageInEditor(editor, imageDomElement, imgUrl) {
|
|
12
|
+
const size = editor.dom.getSize(imageDomElement);
|
|
13
|
+
const maxImageSize = editor.options.get('maxImageSize');
|
|
14
|
+
if (maxImageSize && maxImageSize > 0) {
|
|
15
|
+
const newSize = scaleToMaxSize(maxImageSize, size.w, size.h);
|
|
16
|
+
editor.dom.setAttribs(imageDomElement, { width: Math.round(newSize.width), height: Math.round(newSize.height) });
|
|
17
|
+
// Images inserted via Media Picker will have a URL we can use for ImageResizer QueryStrings
|
|
18
|
+
// Images pasted/dragged in are not persisted to media until saved & thus will need to be added
|
|
19
|
+
if (imgUrl) {
|
|
20
|
+
const resizedImgUrl = await getProcessedImageUrl(imgUrl, {
|
|
21
|
+
width: newSize.width,
|
|
22
|
+
height: newSize.height,
|
|
23
|
+
});
|
|
24
|
+
editor.dom.setAttrib(imageDomElement, 'data-mce-src', resizedImgUrl);
|
|
25
|
+
}
|
|
26
|
+
editor.execCommand('mceAutoResize', false);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Scales an image to the max size
|
|
31
|
+
* @param maxSize
|
|
32
|
+
* @param width
|
|
33
|
+
* @param height
|
|
34
|
+
*/
|
|
35
|
+
export function scaleToMaxSize(maxSize, width, height) {
|
|
36
|
+
const retval = { width, height };
|
|
37
|
+
const maxWidth = maxSize; // Max width for the image
|
|
38
|
+
const maxHeight = maxSize; // Max height for the image
|
|
39
|
+
let ratio = 0; // Used for aspect ratio
|
|
40
|
+
// Check if the current width is larger than the max
|
|
41
|
+
if (width > maxWidth) {
|
|
42
|
+
ratio = maxWidth / width; // get ratio for scaling image
|
|
43
|
+
retval.width = maxWidth;
|
|
44
|
+
retval.height = height * ratio;
|
|
45
|
+
height = height * ratio; // Reset height to match scaled image
|
|
46
|
+
width = width * ratio; // Reset width to match scaled image
|
|
47
|
+
}
|
|
48
|
+
// Check if current height is larger than max
|
|
49
|
+
if (height > maxHeight) {
|
|
50
|
+
ratio = maxHeight / height; // get ratio for scaling image
|
|
51
|
+
retval.height = maxHeight;
|
|
52
|
+
retval.width = width * ratio;
|
|
53
|
+
width = width * ratio; // Reset width to match scaled image
|
|
54
|
+
}
|
|
55
|
+
return retval;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Uploads blob images to the server
|
|
59
|
+
* @param editor
|
|
60
|
+
* @param newContent
|
|
61
|
+
*/
|
|
62
|
+
export async function uploadBlobImages(editor, newContent) {
|
|
63
|
+
const content = newContent ?? editor.getContent();
|
|
64
|
+
// Upload BLOB images (dragged/pasted ones)
|
|
65
|
+
// find src attribute where value starts with `blob:`
|
|
66
|
+
// search is case-insensitive and allows single or double quotes
|
|
67
|
+
if (content.search(/src=["']blob:.*?["']/gi) !== -1) {
|
|
68
|
+
const data = await editor.uploadImages();
|
|
69
|
+
// Once all images have been uploaded
|
|
70
|
+
data.forEach((item) => {
|
|
71
|
+
// Skip items that failed upload
|
|
72
|
+
if (item.status === false) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
// Select img element
|
|
76
|
+
const img = item.element;
|
|
77
|
+
// Get img src
|
|
78
|
+
const imgSrc = img.getAttribute('src');
|
|
79
|
+
const tmpLocation = sessionStorage.getItem(`tinymce__${imgSrc}`);
|
|
80
|
+
// Select the img & add new attr which we can search for
|
|
81
|
+
// When its being persisted in RTE property editor
|
|
82
|
+
// To create a media item & delete this tmp one etc
|
|
83
|
+
editor.dom.setAttrib(img, 'data-tmpimg', tmpLocation);
|
|
84
|
+
// Resize the image to the max size configured
|
|
85
|
+
// NOTE: no imagesrc passed into func as the src is blob://...
|
|
86
|
+
// We will append ImageResizing Querystrings on perist to DB with node save
|
|
87
|
+
sizeImageInEditor(editor, img);
|
|
88
|
+
});
|
|
89
|
+
// Get all img where src starts with blob: AND does NOT have a data=tmpimg attribute
|
|
90
|
+
// This is most likely seen as a duplicate image that has already been uploaded
|
|
91
|
+
// editor.uploadImages() does not give us any indiciation that the image been uploaded already
|
|
92
|
+
const blobImageWithNoTmpImgAttribute = editor.dom.select('img[src^="blob:"]:not([data-tmpimg])');
|
|
93
|
+
//For each of these selected items
|
|
94
|
+
blobImageWithNoTmpImgAttribute.forEach((imageElement) => {
|
|
95
|
+
const blobSrcUri = editor.dom.getAttrib(imageElement, 'src');
|
|
96
|
+
// Find the same image uploaded (Should be in SessionStorage)
|
|
97
|
+
// May already exist in the editor as duplicate image
|
|
98
|
+
// OR added to the RTE, deleted & re-added again
|
|
99
|
+
// So lets fetch the tempurl out of sessionStorage for that blob URI item
|
|
100
|
+
const tmpLocation = sessionStorage.getItem(`tinymce__${blobSrcUri}`);
|
|
101
|
+
if (tmpLocation) {
|
|
102
|
+
sizeImageInEditor(editor, imageElement);
|
|
103
|
+
editor.dom.setAttrib(imageElement, 'data-tmpimg', tmpLocation);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
export { UmbStylesheetRuleManager } from '../stylesheets/stylesheet-rule-manager.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiny-mce-umbraco/backoffice",
|
|
3
|
-
"version": "16.0.0-rc2",
|
|
3
|
+
"version": "16.0.0-rc2.1",
|
|
4
4
|
"description": "This Umbraco CMS package enables access to the TinyMCE-based Rich Text Editor (RTE) in version 16 and above. It also supports the use of TinyMCE Premium plugins with a valid subscription. Additional features include streamlined configuration for RTE Data Types in Umbraco and enhanced settings that support direct JSON-based configuration via .NET (appsettings.config).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"umbraco",
|
|
@@ -13,12 +13,19 @@
|
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
15
15
|
"type": "module",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": null,
|
|
18
|
+
"./tiny-mce-umbraco": "./dist-cms/index.js"
|
|
19
|
+
},
|
|
16
20
|
"types": "types/index.d.ts",
|
|
17
|
-
"files": [
|
|
21
|
+
"files": [
|
|
22
|
+
"dist-cms",
|
|
23
|
+
"README.md"
|
|
24
|
+
],
|
|
18
25
|
"scripts": {
|
|
19
26
|
"dev": "tsc && vite build --watch",
|
|
20
27
|
"build": "tsc && vite build",
|
|
21
|
-
"build:api": "tsc -p tsconfig.api.json
|
|
28
|
+
"build:api": "tsc -p tsconfig.api.json",
|
|
22
29
|
"pack:api": "npm pack",
|
|
23
30
|
"generate-client": "node scripts/generate-openapi.js https://localhost:44308/umbraco/swagger/tiny-mce/swagger.json"
|
|
24
31
|
},
|
|
@@ -29,7 +36,6 @@
|
|
|
29
36
|
"devDependencies": {
|
|
30
37
|
"@hey-api/client-fetch": "^0.10.0",
|
|
31
38
|
"@hey-api/openapi-ts": "^0.66.1",
|
|
32
|
-
"@microsoft/api-extractor": "^7.52.8",
|
|
33
39
|
"@rollup/plugin-json": "^6.1.0",
|
|
34
40
|
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
35
41
|
"@rollup/plugin-replace": "^6.0.2",
|
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
import type { ClassConstructor } from '@umbraco-cms/backoffice/extension-api';
|
|
2
|
-
import type { Client } from '@hey-api/client-fetch';
|
|
3
|
-
import { CSSResult } from 'lit';
|
|
4
|
-
import { Editor } from 'tinymce';
|
|
5
|
-
import type { ManifestApi } from '@umbraco-cms/backoffice/extension-api';
|
|
6
|
-
import type { Options as Options_2 } from '@hey-api/client-fetch';
|
|
7
|
-
import { RawEditorOptions } from 'tinymce';
|
|
8
|
-
import { RequestResult } from '@hey-api/client-fetch';
|
|
9
|
-
import type { TDataShape } from '@hey-api/client-fetch';
|
|
10
|
-
import { TemplateResult } from 'lit-html';
|
|
11
|
-
import { TinyMceConfigResponseModel as TinyMceConfigResponseModel_2 } from './types.gen';
|
|
12
|
-
import type { UmbApi } from '@umbraco-cms/backoffice/extension-api';
|
|
13
|
-
import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api';
|
|
14
|
-
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
|
|
15
|
-
import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor';
|
|
16
|
-
import { UUIFormControlMixinElement } from '@umbraco-ui/uui-base';
|
|
17
|
-
|
|
18
|
-
export declare const availableLanguages: string[];
|
|
19
|
-
|
|
20
|
-
export declare type ClientOptions = {
|
|
21
|
-
baseUrl: 'https://localhost:44308' | (string & {});
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export declare const defaultFallbackConfig: RawEditorOptions;
|
|
25
|
-
|
|
26
|
-
export declare const defaultPremiumPluginsList: readonly ["a11ychecker", "advcode", "advtable", "advtemplate", "typography", "ai", "casechange", "checklist", "mediaembed", "export", "footnotes", "formatpainter", "mergetags", "pageembed", "powerpaste", "permanentpen", "tinymcespellchecker", "tableofcontents"];
|
|
27
|
-
|
|
28
|
-
export declare type GetConfigData = {
|
|
29
|
-
body?: never;
|
|
30
|
-
path?: never;
|
|
31
|
-
query?: never;
|
|
32
|
-
url: '/umbraco/management/api/v1/tiny-mce/config';
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export declare type GetConfigError = GetConfigErrors[keyof GetConfigErrors];
|
|
36
|
-
|
|
37
|
-
export declare type GetConfigErrors = {
|
|
38
|
-
/**
|
|
39
|
-
* The resource is protected and requires an authentication token
|
|
40
|
-
*/
|
|
41
|
-
401: unknown;
|
|
42
|
-
/**
|
|
43
|
-
* The authenticated user does not have access to this resource
|
|
44
|
-
*/
|
|
45
|
-
403: unknown;
|
|
46
|
-
/**
|
|
47
|
-
* Not Found
|
|
48
|
-
*/
|
|
49
|
-
404: ProblemDetails;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export declare type GetConfigResponse = GetConfigResponses[keyof GetConfigResponses];
|
|
53
|
-
|
|
54
|
-
export declare type GetConfigResponses = {
|
|
55
|
-
/**
|
|
56
|
-
* OK
|
|
57
|
-
*/
|
|
58
|
-
200: TinyMceConfigResponseModel;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* The manifest for a TinyMCE plugin.
|
|
63
|
-
* The plugin will be loaded into the TinyMCE editor.
|
|
64
|
-
* A plugin can add things like buttons, menu items, context menu items, etc. through the TinyMCE API.
|
|
65
|
-
* A plugin can also add custom commands to the editor.
|
|
66
|
-
* A plugin can also modify the behavior of the editor.
|
|
67
|
-
* @see [TinyMCE Plugin](https://www.tiny.cloud/docs/tinymce/6/apis/tinymce.plugin/) for more information.
|
|
68
|
-
*/
|
|
69
|
-
export declare interface ManifestTinyMcePlugin extends ManifestApi<UmbTinyMcePluginBase> {
|
|
70
|
-
type: 'tinyMcePlugin';
|
|
71
|
-
meta?: MetaTinyMcePlugin;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export declare interface MetaTinyMcePlugin {
|
|
75
|
-
/**
|
|
76
|
-
* If the plugin adds toolbar buttons, this property can be used to configure the buttons.
|
|
77
|
-
* This configuration will be used on the Rich Text Editor configuration page.
|
|
78
|
-
*/
|
|
79
|
-
plugins?: string[];
|
|
80
|
-
/**
|
|
81
|
-
* If the plugin adds toolbar buttons, this property can be used to configure the buttons.
|
|
82
|
-
* This configuration will be used on the Rich Text Editor configuration page.
|
|
83
|
-
*/
|
|
84
|
-
toolbar?: Array<{
|
|
85
|
-
/**
|
|
86
|
-
* The alias of the toolbar button that will be configured in the TinyMCE editor.
|
|
87
|
-
* @see [TinyMCE Toolbar](https://www.tiny.cloud/docs/tinymce/6/toolbar-configuration-options/) for more information.
|
|
88
|
-
*/
|
|
89
|
-
alias: string;
|
|
90
|
-
/**
|
|
91
|
-
* The label of the option shown on the Rich Text Editor configuration page.
|
|
92
|
-
*/
|
|
93
|
-
label: string;
|
|
94
|
-
/**
|
|
95
|
-
* The icon shown on the Rich Text Editor configuration page. The icon has to be a part of TinyMCE's icon set.
|
|
96
|
-
* @optional
|
|
97
|
-
* @see [TinyMCE Icon Set](https://www.tiny.cloud/docs/tinymce/6/editor-icon-identifiers/) for available default icons.
|
|
98
|
-
*/
|
|
99
|
-
icon?: string;
|
|
100
|
-
/**
|
|
101
|
-
* If this is a TinyMCE plugin that can be enabled/disabled
|
|
102
|
-
*/
|
|
103
|
-
isplugin?: boolean;
|
|
104
|
-
/**
|
|
105
|
-
* Name of the plugin this is a part of (links to the plugin for property editor UI)
|
|
106
|
-
*/
|
|
107
|
-
pluginAlias?: string;
|
|
108
|
-
}>;
|
|
109
|
-
/**
|
|
110
|
-
* @title Sets the default configuration for the TinyMCE editor.
|
|
111
|
-
* @description This configuration will be used when the editor is initialized. See the [TinyMCE Configuration](https://www.tiny.cloud/docs/configure/) for more information.
|
|
112
|
-
* @optional
|
|
113
|
-
* @TJS-type object
|
|
114
|
-
* @examples [
|
|
115
|
-
* {
|
|
116
|
-
* "plugins": "wordcount",
|
|
117
|
-
* "statusbar": true
|
|
118
|
-
* }
|
|
119
|
-
* ]
|
|
120
|
-
*/
|
|
121
|
-
config?: RawEditorOptions;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export declare type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options_2<TData, ThrowOnError> & {
|
|
125
|
-
/**
|
|
126
|
-
* You can provide a client instance returned by `createClient()` instead of
|
|
127
|
-
* individual options. This might be also useful if you want to implement a
|
|
128
|
-
* custom client.
|
|
129
|
-
*/
|
|
130
|
-
client?: Client;
|
|
131
|
-
/**
|
|
132
|
-
* You can pass arbitrary values through the `meta` object. This can be
|
|
133
|
-
* used to access values that aren't defined as part of the SDK function.
|
|
134
|
-
*/
|
|
135
|
-
meta?: Record<string, unknown>;
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
export declare const pastePreProcessHandler: RawEditorOptions['paste_preprocess'];
|
|
139
|
-
|
|
140
|
-
export declare type ProblemDetails = {
|
|
141
|
-
type?: string | null;
|
|
142
|
-
title?: string | null;
|
|
143
|
-
status?: number | null;
|
|
144
|
-
detail?: string | null;
|
|
145
|
-
instance?: string | null;
|
|
146
|
-
[key: string]: unknown | (string | null) | (string | null) | (number | null) | (string | null) | (string | null) | undefined;
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
export declare type RichTextEditorCommand = {
|
|
150
|
-
alias: string;
|
|
151
|
-
name: string;
|
|
152
|
-
mode: RichTextEditorCommandModeModel;
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
export declare enum RichTextEditorCommandModeModel {
|
|
156
|
-
INSERT = "Insert",
|
|
157
|
-
SELECTION = "Selection",
|
|
158
|
-
ALL = "All"
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export declare type RichTextEditorSettings = {
|
|
162
|
-
commands: Array<RichTextEditorCommand>;
|
|
163
|
-
plugins: Array<string>;
|
|
164
|
-
customConfig: {
|
|
165
|
-
[key: string]: string;
|
|
166
|
-
};
|
|
167
|
-
validElements: string;
|
|
168
|
-
invalidElements: string;
|
|
169
|
-
cloudApiKey?: string | null;
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
export declare type TinyMceConfigResponseModel = {
|
|
173
|
-
richTextEditor?: RichTextEditorSettings | null;
|
|
174
|
-
config?: TinyMceSettings | null;
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
export declare type TinyMcePluginArguments = {
|
|
178
|
-
host: UmbInputTinyMceElement;
|
|
179
|
-
editor: Editor;
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
export declare interface TinyMcePluginInterface {
|
|
183
|
-
init(): Promise<void>;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
export declare class TinyMceService {
|
|
187
|
-
static getConfig<ThrowOnError extends boolean = false>(options?: Options<GetConfigData, ThrowOnError>): RequestResult<TinyMceConfigResponseModel_2, unknown, ThrowOnError>;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
export declare type TinyMceSettings = {
|
|
191
|
-
apikey: string;
|
|
192
|
-
tinyMceVersion: string;
|
|
193
|
-
tinyMceUrl: string;
|
|
194
|
-
openAiApikey: string;
|
|
195
|
-
pluginsToExclude: Array<string>;
|
|
196
|
-
customConfig: {};
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
export declare const UMB_BLOCK_ENTRY_WEB_COMPONENTS_ABSOLUTE_PATH = "@umbraco-cms/backoffice/block-rte";
|
|
200
|
-
|
|
201
|
-
export declare const UMB_BLOCK_RTE_PROPERTY_EDITOR_UI_ALIAS = "Umb.PropertyEditorUi.TinyMCE";
|
|
202
|
-
|
|
203
|
-
export declare class UmbInputTinyMceElement extends UmbInputTinyMceElement_base {
|
|
204
|
-
#private;
|
|
205
|
-
configuration?: UmbPropertyEditorConfigCollection;
|
|
206
|
-
protected getFormElement(): HTMLIFrameElement | undefined;
|
|
207
|
-
set value(newValue: FormDataEntryValue | FormData);
|
|
208
|
-
get value(): FormDataEntryValue | FormData;
|
|
209
|
-
/**
|
|
210
|
-
* Sets the input to readonly mode, meaning value cannot be changed but still able to read and select its content.
|
|
211
|
-
* @type {boolean}
|
|
212
|
-
* @attr
|
|
213
|
-
* @default
|
|
214
|
-
*/
|
|
215
|
-
get readonly(): boolean;
|
|
216
|
-
set readonly(value: boolean);
|
|
217
|
-
private readonly _editorElement?;
|
|
218
|
-
getEditor(): Editor | null | undefined;
|
|
219
|
-
firstUpdated(): void;
|
|
220
|
-
disconnectedCallback(): void;
|
|
221
|
-
getFormatStyles(stylesheetPaths: Array<string>): Promise<any[]>;
|
|
222
|
-
/**
|
|
223
|
-
* Nothing rendered by default - TinyMCE initialization creates
|
|
224
|
-
* a target div and binds the RTE to that element
|
|
225
|
-
*/
|
|
226
|
-
render(): TemplateResult<1>;
|
|
227
|
-
static readonly styles: CSSResult[];
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
declare const UmbInputTinyMceElement_base: (new (...args: any[]) => UUIFormControlMixinElement<FormDataEntryValue | FormData>) & typeof UmbLitElement;
|
|
231
|
-
|
|
232
|
-
export declare class UmbTinyMcePluginBase extends UmbControllerBase implements UmbApi, TinyMcePluginInterface {
|
|
233
|
-
editor: Editor;
|
|
234
|
-
configuration?: UmbPropertyEditorConfigCollection;
|
|
235
|
-
constructor(arg: TinyMcePluginArguments);
|
|
236
|
-
static extendEditorConfig(_config: any): Promise<void>;
|
|
237
|
-
init(): Promise<void>;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
export declare interface UmbTinyMcePluginClass extends ClassConstructor<UmbTinyMcePluginBase> {
|
|
241
|
-
extendEditorConfig?: (_config: any) => Promise<void>;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Setup sanitization for preventing injecting arbitrary JavaScript execution in attributes:
|
|
246
|
-
* https://github.com/advisories/GHSA-w7jx-j77m-wp65
|
|
247
|
-
* https://github.com/advisories/GHSA-5vm8-hhgr-jcjp
|
|
248
|
-
* @param editor
|
|
249
|
-
*/
|
|
250
|
-
export declare const uriAttributeSanitizer: (editor: Editor) => void;
|
|
251
|
-
|
|
252
|
-
export { }
|