芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/media.7/vendor/tinymce/plugins/preview/plugin.js
/** * Copyright (c) Tiny Technologies, Inc. All rights reserved. * Licensed under the LGPL or a commercial license. * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * * Version: 5.8.2 (2021-06-23) */ (function () { 'use strict'; var global = tinymce.util.Tools.resolve('tinymce.PluginManager'); var global$1 = tinymce.util.Tools.resolve('tinymce.Env'); var global$2 = tinymce.util.Tools.resolve('tinymce.util.Tools'); var getContentStyle = function (editor) { return editor.getParam('content_style', '', 'string'); }; var shouldUseContentCssCors = function (editor) { return editor.getParam('content_css_cors', false, 'boolean'); }; var getBodyClassByHash = function (editor) { var bodyClass = editor.getParam('body_class', '', 'hash'); return bodyClass[editor.id] || ''; }; var getBodyClass = function (editor) { var bodyClass = editor.getParam('body_class', '', 'string'); if (bodyClass.indexOf('=') === -1) { return bodyClass; } else { return getBodyClassByHash(editor); } }; var getBodyIdByHash = function (editor) { var bodyId = editor.getParam('body_id', '', 'hash'); return bodyId[editor.id] || bodyId; }; var getBodyId = function (editor) { var bodyId = editor.getParam('body_id', 'tinymce', 'string'); if (bodyId.indexOf('=') === -1) { return bodyId; } else { return getBodyIdByHash(editor); } }; var getPreviewHtml = function (editor) { var headHtml = ''; var encode = editor.dom.encode; var contentStyle = getContentStyle(editor); headHtml += '
'; var cors = shouldUseContentCssCors(editor) ? ' crossorigin="anonymous"' : ''; global$2.each(editor.contentCSS, function (url) { headHtml += '
'; }); if (contentStyle) { headHtml += ''; } var bodyId = getBodyId(editor); var bodyClass = getBodyClass(editor); var isMetaKeyPressed = global$1.mac ? 'e.metaKey' : 'e.ctrlKey && !e.altKey'; var preventClicksOnLinksScript = ' '; var directionality = editor.getBody().dir; var dirAttr = directionality ? ' dir="' + encode(directionality) + '"' : ''; var previewHtml = '' + '' + '' + headHtml + '' + '' + editor.getContent() + preventClicksOnLinksScript + '' + ''; return previewHtml; }; var open = function (editor) { var content = getPreviewHtml(editor); var dataApi = editor.windowManager.open({ title: 'Preview', size: 'large', body: { type: 'panel', items: [{ name: 'preview', type: 'iframe', sandboxed: true }] }, buttons: [{ type: 'cancel', name: 'close', text: 'Close', primary: true }], initialData: { preview: content } }); dataApi.focus('close'); }; var register = function (editor) { editor.addCommand('mcePreview', function () { open(editor); }); }; var register$1 = function (editor) { editor.ui.registry.addButton('preview', { icon: 'preview', tooltip: 'Preview', onAction: function () { return editor.execCommand('mcePreview'); } }); editor.ui.registry.addMenuItem('preview', { icon: 'preview', text: 'Preview', onAction: function () { return editor.execCommand('mcePreview'); } }); }; function Plugin () { global.add('preview', function (editor) { register(editor); register$1(editor); }); } Plugin(); }());