1/** 2 * TinyMCE version 7.9.1 (2025-05-29) 3 */ 4 5(function () { 6 'use strict'; 7 8 const Cell = (initial) => { 9 let value = initial; 10 const get = () => { 11 return value; 12 }; 13 const set = (v) => { 14 value = v; 15 }; 16 return { 17 get, 18 set 19 }; 20 }; 21 22 var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager'); 23 24 var global = tinymce.util.Tools.resolve('tinymce.Env'); 25 26 const fireResizeEditor = (editor) => editor.dispatch('ResizeEditor'); 27 28 const option = (name) => (editor) => editor.options.get(name); 29 const register$1 = (editor) => { 30 const registerOption = editor.options.register; 31 registerOption('autoresize_overflow_padding', { 32 processor: 'number', 33 default: 1 34 }); 35 registerOption('autoresize_bottom_margin', { 36 processor: 'number', 37 default: 50 38 }); 39 }; 40 const getMinHeight = option('min_height'); 41 const getMaxHeight = option('max_height'); 42 const getAutoResizeOverflowPadding = option('autoresize_overflow_padding'); 43 const getAutoResizeBottomMargin = option('autoresize_bottom_margin'); 44 45 /** 46 * This class contains all core logic for the autoresize plugin. 47 * 48 * @class tinymce.autoresize.Plugin 49 * @private 50 */ 51 const isFullscreen = (editor) => editor.plugins.fullscreen && editor.plugins.fullscreen.isFullscreen(); 52 const toggleScrolling = (editor, state) => { 53 const body = editor.getBody(); 54 if (body) { 55 body.style.overflowY = state ? '' : 'hidden'; 56 if (!state) { 57 body.scrollTop = 0; 58 } 59 } 60 }; 61 const parseCssValueToInt = (dom, elm, name, computed) => { 62 var _a; 63 const value = parseInt((_a = dom.getStyle(elm, name, computed)) !== null && _a !== void 0 ? _a : '', 10); 64 // The value maybe be an empty string, so in that case treat it as being 0 65 return isNaN(value) ? 0 : value; 66 }; 67 const shouldScrollIntoView = (trigger) => { 68 // Only scroll the selection into view when we're inserting content. Any other 69 // triggers the selection should already be in view and resizing would only 70 // extend the content area. 71 if ((trigger === null || trigger === void 0 ? void 0 : trigger.type.toLowerCase()) === 'setcontent') { 72 const setContentEvent = trigger; 73 return setContentEvent.selection === true || setContentEvent.paste === true; 74 } 75 else { 76 return false; 77 } 78 }; 79 /** 80 * This method gets executed each time the editor needs to resize. 81 */ 82 const resize = (editor, oldSize, trigger, getExtraMarginBottom) => { 83 var _a; 84 const dom = editor.dom; 85 const doc = editor.getDoc(); 86 if (!doc) { 87 return; 88 } 89 if (isFullscreen(editor)) { 90 toggleScrolling(editor, true); 91 return; 92 } 93 const docEle = doc.documentElement; 94 const resizeBottomMargin = getExtraMarginBottom ? getExtraMarginBottom() : getAutoResizeOverflowPadding(editor); 95 const minHeight = (_a = getMinHeight(editor)) !== null && _a !== void 0 ? _a : editor.getElement().offsetHeight; 96 let resizeHeight = minHeight; 97 // Calculate outer height of the doc element using CSS styles 98 const marginTop = parseCssValueToInt(dom, docEle, 'margin-top', true); 99 const marginBottom = parseCssValueToInt(dom, docEle, 'margin-bottom', true); 100 let contentHeight = docEle.offsetHeight + marginTop + marginBottom + resizeBottomMargin; 101 // Make sure we have a valid height 102 if (contentHeight < 0) { 103 contentHeight = 0; 104 } 105 // Determine the size of the chroming (menubar, toolbar, etc...) 106 const containerHeight = editor.getContainer().offsetHeight; 107 const contentAreaHeight = editor.getContentAreaContainer().offsetHeight; 108 const chromeHeight = containerHeight - contentAreaHeight; 109 // Don't make it smaller than the minimum height 110 if (contentHeight + chromeHeight > minHeight) { 111 resizeHeight = contentHeight + chromeHeight; 112 } 113 // If a maximum height has been defined don't exceed this height 114 const maxHeight = getMaxHeight(editor); 115 if (maxHeight && resizeHeight > maxHeight) { 116 resizeHeight = maxHeight; 117 toggleScrolling(editor, true); 118 } 119 else { 120 toggleScrolling(editor, false); 121 } 122 const old = oldSize.get(); 123 if (old.set) { 124 editor.dom.setStyles(editor.getDoc().documentElement, { 'min-height': 0 }); 125 editor.dom.setStyles(editor.getBody(), { 'min-height': 'inherit' }); 126 } 127 // Resize content element 128 if (resizeHeight !== old.totalHeight && (contentHeight - resizeBottomMargin !== old.contentHeight || !old.set)) { 129 const deltaSize = (resizeHeight - old.totalHeight); 130 dom.setStyle(editor.getContainer(), 'height', resizeHeight + 'px'); 131 oldSize.set({ 132 totalHeight: resizeHeight, 133 contentHeight, 134 set: true, 135 }); 136 fireResizeEditor(editor); 137 // iPadOS has an issue where it won't rerender the body when the iframe is resized 138 // however if we reset the scroll position then it re-renders correctly 139 if (global.browser.isSafari() && (global.os.isMacOS() || global.os.isiOS())
139) { 140 const win = editor.getWin(); 141 win.scrollTo(win.pageXOffset, win.pageYOffset); 142 } 143 // Ensure the selection is in view, as it's potentially out of view after inserting content into the editor 144 if (editor.hasFocus() && shouldScrollIntoView(trigger)) { 145 editor.selection.scrollIntoView(); 146 } 147 // WebKit doesn't decrease the size of the body element until the iframe gets resized 148 // So we need to continue to resize the iframe down until the size gets fixed 149 if ((global.browser.isSafari() || global.browser.isChromium()) && deltaSize < 0) { 150 resize(editor, oldSize, trigger, getExtraMarginBottom); 151 } 152 } 153 }; 154 const setup = (editor, oldSize) => { 155 const getExtraMarginBottom = () => getAutoResizeBottomMargin(editor); 156 editor.on('init', (e) => { 157 const overflowPadding = getAutoResizeOverflowPadding(editor); 158 const dom = editor.dom; 159 // Disable height 100% on the root document element otherwise we'll end up resizing indefinitely 160 dom.setStyles(editor.getDoc().documentElement, { 161 height: 'auto' 162 }); 163 if (global.browser.isEdge() || global.browser.isIE()) { 164 dom.setStyles(editor.getBody(), { 165 'paddingLeft': overflowPadding, 166 'paddingRight': overflowPadding, 167 // IE & Edge have a min height of 150px by default on the body, so override that 168 'min-height': 0 169 }); 170 } 171 else { 172 dom.setStyles(editor.getBody(), { 173 paddingLeft: overflowPadding, 174 paddingRight: overflowPadding 175 }); 176 } 177 resize(editor, oldSize, e, getExtraMarginBottom); 178 }); 179 editor.on('NodeChange SetContent keyup FullscreenStateChanged ResizeContent', (e) => { 180 resize(editor, oldSize, e, getExtraMarginBottom); 181 }); 182 }; 183 184 const register = (editor, oldSize) => { 185 editor.addCommand('mceAutoResize', () => { 186 resize(editor, oldSize); 187 }); 188 }; 189 190 /** 191 * This class contains all core logic for the autoresize plugin. 192 * 193 * @class tinymce.autoresize.Plugin 194 * @private 195 */ 196 var Plugin = () => { 197 global$1.add('autoresize', (editor) => { 198 register$1(editor); 199 // If autoresize is enabled, disable resize if the user hasn't explicitly enabled it 200 // TINY-8288: This currently does nothing because of a bug in the theme 201 if (!editor.options.isSet('resize')) { 202 editor.options.set('resize', false); 203 } 204 if (!editor.inline) { 205 const oldSize = Cell({ 206 totalHeight: 0, 207 contentHeight: 0, 208 set: false, 209 }); 210 register(editor, oldSize); 211 setup(editor, oldSize); 212 } 213 }); 214 }; 215 216 Plugin(); 217 /** ***** 218 * DO NOT EXPORT ANYTHING 219 * 220 * IF YOU DO ROLLUP WILL LEAVE A GLOBAL ON THE PAGE 221 *******/ 222 223})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.