[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 /** 2 * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 * Licensed under the LGPL or a commercial license. 4 * For LGPL see License.txt in the project root for license information. 5 * For commercial licenses see https://www.tiny.cloud/ 6 * 7 * Version: 5.10.5 (2022-05-25) 8 */ 9 (function () { 10 'use strict'; 11 12 var global$2 = tinymce.util.Tools.resolve('tinymce.PluginManager'); 13 14 var global$1 = tinymce.util.Tools.resolve('tinymce.Env'); 15 16 var global = tinymce.util.Tools.resolve('tinymce.util.Tools'); 17 18 var getContentStyle = function (editor) { 19 return editor.getParam('content_style', '', 'string'); 20 }; 21 var shouldUseContentCssCors = function (editor) { 22 return editor.getParam('content_css_cors', false, 'boolean'); 23 }; 24 var getBodyClassByHash = function (editor) { 25 var bodyClass = editor.getParam('body_class', '', 'hash'); 26 return bodyClass[editor.id] || ''; 27 }; 28 var getBodyClass = function (editor) { 29 var bodyClass = editor.getParam('body_class', '', 'string'); 30 if (bodyClass.indexOf('=') === -1) { 31 return bodyClass; 32 } else { 33 return getBodyClassByHash(editor); 34 } 35 }; 36 var getBodyIdByHash = function (editor) { 37 var bodyId = editor.getParam('body_id', '', 'hash'); 38 return bodyId[editor.id] || bodyId; 39 }; 40 var getBodyId = function (editor) { 41 var bodyId = editor.getParam('body_id', 'tinymce', 'string'); 42 if (bodyId.indexOf('=') === -1) { 43 return bodyId; 44 } else { 45 return getBodyIdByHash(editor); 46 } 47 }; 48 49 var getPreviewHtml = function (editor) { 50 var headHtml = ''; 51 var encode = editor.dom.encode; 52 var contentStyle = getContentStyle(editor); 53 headHtml += '<base href="' + encode(editor.documentBaseURI.getURI()) + '">'; 54 var cors = shouldUseContentCssCors(editor) ? ' crossorigin="anonymous"' : ''; 55 global.each(editor.contentCSS, function (url) { 56 headHtml += '<link type="text/css" rel="stylesheet" href="' + encode(editor.documentBaseURI.toAbsolute(url)) + '"' + cors + '>'; 57 }); 58 if (contentStyle) { 59 headHtml += '<style type="text/css">' + contentStyle + '</style>'; 60 } 61 var bodyId = getBodyId(editor); 62 var bodyClass = getBodyClass(editor); 63 var isMetaKeyPressed = global$1.mac ? 'e.metaKey' : 'e.ctrlKey && !e.altKey'; 64 var preventClicksOnLinksScript = '<script>' + 'document.addEventListener && document.addEventListener("click", function(e) {' + 'for (var elm = e.target; elm; elm = elm.parentNode) {' + 'if (elm.nodeName === "A" && !(' + isMetaKeyPressed + ')) {' + 'e.preventDefault();' + '}' + '}' + '}, false);' + '</script> '; 65 var directionality = editor.getBody().dir; 66 var dirAttr = directionality ? ' dir="' + encode(directionality) + '"' : ''; 67 var previewHtml = '<!DOCTYPE html>' + '<html>' + '<head>' + headHtml + '</head>' + '<body id="' + encode(bodyId) + '" class="mce-content-body ' + encode(bodyClass) + '"' + dirAttr + '>' + editor.getContent() + preventClicksOnLinksScript + '</body>' + '</html>'; 68 return previewHtml; 69 }; 70 71 var open = function (editor) { 72 var content = getPreviewHtml(editor); 73 var dataApi = editor.windowManager.open({ 74 title: 'Preview', 75 size: 'large', 76 body: { 77 type: 'panel', 78 items: [{ 79 name: 'preview', 80 type: 'iframe', 81 sandboxed: true 82 }] 83 }, 84 buttons: [{ 85 type: 'cancel', 86 name: 'close', 87 text: 'Close', 88 primary: true 89 }], 90 initialData: { preview: content } 91 }); 92 dataApi.focus('close'); 93 }; 94 95 var register$1 = function (editor) { 96 editor.addCommand('mcePreview', function () { 97 open(editor); 98 }); 99 }; 100 101 var register = function (editor) { 102 var onAction = function () { 103 return editor.execCommand('mcePreview'); 104 }; 105 editor.ui.registry.addButton('preview', { 106 icon: 'preview', 107 tooltip: 'Preview', 108 onAction: onAction 109 }); 110 editor.ui.registry.addMenuItem('preview', { 111 icon: 'preview', 112 text: 'Preview', 113 onAction: onAction 114 }); 115 }; 116 117 function Plugin () { 118 global$2.add('preview', function (editor) { 119 register$1(editor); 120 register(editor); 121 }); 122 } 123 124 Plugin(); 125 126 }());
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |