123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- import {
- __commonJS,
- init_define_APP_INFO
- } from "./chunk-XY75H3MP.js";
- // node_modules/tinymce/plugins/preview/plugin.js
- var require_plugin = __commonJS({
- "node_modules/tinymce/plugins/preview/plugin.js"() {
- init_define_APP_INFO();
- (function() {
- "use strict";
- var global$2 = tinymce.util.Tools.resolve("tinymce.PluginManager");
- var global$1 = tinymce.util.Tools.resolve("tinymce.Env");
- var global = 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 += '<base href="' + encode(editor.documentBaseURI.getURI()) + '">';
- var cors = shouldUseContentCssCors(editor) ? ' crossorigin="anonymous"' : "";
- global.each(editor.contentCSS, function(url) {
- headHtml += '<link type="text/css" rel="stylesheet" href="' + encode(editor.documentBaseURI.toAbsolute(url)) + '"' + cors + ">";
- });
- if (contentStyle) {
- headHtml += '<style type="text/css">' + contentStyle + "</style>";
- }
- var bodyId = getBodyId(editor);
- var bodyClass = getBodyClass(editor);
- var isMetaKeyPressed = global$1.mac ? "e.metaKey" : "e.ctrlKey && !e.altKey";
- 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> ";
- var directionality = editor.getBody().dir;
- var dirAttr = directionality ? ' dir="' + encode(directionality) + '"' : "";
- var previewHtml = "<!DOCTYPE html><html><head>" + headHtml + '</head><body id="' + encode(bodyId) + '" class="mce-content-body ' + encode(bodyClass) + '"' + dirAttr + ">" + editor.getContent() + preventClicksOnLinksScript + "</body></html>";
- 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$1 = function(editor) {
- editor.addCommand("mcePreview", function() {
- open(editor);
- });
- };
- var register = function(editor) {
- var onAction = function() {
- return editor.execCommand("mcePreview");
- };
- editor.ui.registry.addButton("preview", {
- icon: "preview",
- tooltip: "Preview",
- onAction
- });
- editor.ui.registry.addMenuItem("preview", {
- icon: "preview",
- text: "Preview",
- onAction
- });
- };
- function Plugin() {
- global$2.add("preview", function(editor) {
- register$1(editor);
- register(editor);
- });
- }
- Plugin();
- })();
- }
- });
- // node_modules/tinymce/plugins/preview/index.js
- var require_preview = __commonJS({
- "node_modules/tinymce/plugins/preview/index.js"() {
- init_define_APP_INFO();
- require_plugin();
- }
- });
- // dep:tinymce_plugins_preview
- init_define_APP_INFO();
- var tinymce_plugins_preview_default = require_preview();
- export {
- tinymce_plugins_preview_default as default
- };
- //# sourceMappingURL=tinymce_plugins_preview.js.map
|