opentiny 6.9.23 → 6.9.25

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/tinymce.d.ts CHANGED
@@ -1867,6 +1867,7 @@ interface BaseEditorOptions {
1867
1867
  deprecation_warnings?: boolean;
1868
1868
  directionality?: 'ltr' | 'rtl';
1869
1869
  doctype?: string;
1870
+ document_content_root_class?: string;
1870
1871
  document_base_url?: string;
1871
1872
  draggable_modal?: boolean;
1872
1873
  editable_class?: string;
@@ -2061,6 +2062,7 @@ interface EditorOptions extends NormalizedEditorOptions {
2061
2062
  custom_colors: boolean;
2062
2063
  default_font_stack: string[];
2063
2064
  document_base_url: string;
2065
+ document_content_root_class: string;
2064
2066
  init_content_sync: boolean;
2065
2067
  draggable_modal: boolean;
2066
2068
  editable_class: string;
package/tinymce.js CHANGED
@@ -6894,6 +6894,10 @@
6894
6894
  processor: bodyOptionProcessor(editor),
6895
6895
  default: ''
6896
6896
  });
6897
+ registerOption('document_content_root_class', {
6898
+ processor: 'string',
6899
+ default: 'mce-content-body'
6900
+ });
6897
6901
  registerOption('content_security_policy', {
6898
6902
  processor: 'string',
6899
6903
  default: ''
@@ -7629,6 +7633,7 @@
7629
7633
  const getDocumentBaseUrl = option('document_base_url');
7630
7634
  const getBodyId = option('body_id');
7631
7635
  const getBodyClass = option('body_class');
7636
+ const getDocumentContentRootClass = option('document_content_root_class');
7632
7637
  const getContentSecurityPolicy = option('content_security_policy');
7633
7638
  const shouldPutBrInPre$1 = option('br_in_pre');
7634
7639
  const getForcedRootBlock = option('forced_root_block');
@@ -26223,6 +26228,10 @@
26223
26228
  };
26224
26229
 
26225
26230
  const defaultMaxImageWidthPx = 300;
26231
+ const getContentRootSelector = editor => {
26232
+ const contentRootClass = getDocumentContentRootClass(editor);
26233
+ return contentRootClass.startsWith('.') ? contentRootClass : `.${ contentRootClass }`;
26234
+ };
26226
26235
  const uniqueId = createIdGenerator('mceclip');
26227
26236
  const createPasteDataTransfer = html => {
26228
26237
  const dataTransfer = createDataTransfer();
@@ -26295,8 +26304,8 @@
26295
26304
  const img = new Image();
26296
26305
  img.src = blobInfo.blobUri();
26297
26306
  img.onload = () => {
26298
- const contentBodyElement = editor.dom.select('.mce-content-body')[0].children[0];
26299
- const computedStyles = contentBodyElement ? window.getComputedStyle(contentBodyElement) : null;
26307
+ const contentRootElement = editor.dom.select(getContentRootSelector(editor))[0];
26308
+ const computedStyles = contentRootElement ? window.getComputedStyle(contentRootElement) : null;
26300
26309
  const maxImageWidth = computedStyles ? parseInt(computedStyles.width) - parseInt(computedStyles.paddingLeft) - parseInt(computedStyles.paddingRight) : defaultMaxImageWidthPx;
26301
26310
  const imageWidth = Math.min(img.naturalWidth, maxImageWidth);
26302
26311
  pasteHtml(editor, `<img src="${ blobInfo.blobUri() }" width="${ imageWidth }px">`, false, true);