Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ckeditor/ckeditor5-html-embed

Package Overview
Dependencies
Maintainers
1
Versions
677
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckeditor/ckeditor5-html-embed - npm Package Compare versions

Comparing version 32.0.0 to 33.0.0

build/html-embed.js.map

4

build/html-embed.js
!function(e){const t=e.en=e.en||{};t.dictionary=Object.assign(t.dictionary||{},{"Edit source":"Edit source","Empty snippet content":"Empty snippet content","HTML snippet":"HTML snippet","Insert HTML":"Insert HTML","No preview available":"No preview available","Paste raw HTML here...":"Paste raw HTML here...","Save changes":"Save changes"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),
/*!
* @license Copyright (c) 2003-2022, CKSource - Frederico Knabben. All rights reserved.
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md.
*/(()=>{var e={600:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(609),a=n.n(r)()((function(e){return e[1]}));a.push([e.id,".ck-widget.raw-html-embed{margin:.9em auto;position:relative;display:flow-root;min-width:15em;font-style:normal}.ck-widget.raw-html-embed:before{position:absolute;z-index:1}.ck-widget.raw-html-embed .raw-html-embed__buttons-wrapper{position:absolute;display:flex;flex-direction:column}.ck-widget.raw-html-embed .raw-html-embed__preview{position:relative;overflow:hidden;display:flex}.ck-widget.raw-html-embed .raw-html-embed__preview-content{width:100%;position:relative;margin:auto;display:table;border-collapse:separate;border-spacing:7px}.ck-widget.raw-html-embed .raw-html-embed__preview-placeholder{position:absolute;left:0;top:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}:root{--ck-html-embed-content-width:calc(100% - var(--ck-icon-size)*1.5);--ck-html-embed-source-height:10em;--ck-html-embed-unfocused-outline-width:1px;--ck-html-embed-content-min-height:calc(var(--ck-icon-size) + var(--ck-spacing-standard));--ck-html-embed-source-disabled-background:var(--ck-color-base-foreground);--ck-html-embed-source-disabled-color:#737373}.ck-widget.raw-html-embed{font-size:var(--ck-font-size-base);background-color:var(--ck-color-base-foreground)}.ck-widget.raw-html-embed:not(.ck-widget_selected):not(:hover){outline:var(--ck-html-embed-unfocused-outline-width) dashed var(--ck-color-widget-blurred-border)}.ck-widget.raw-html-embed[dir=ltr]{text-align:left}.ck-widget.raw-html-embed[dir=rtl]{text-align:right}.ck-widget.raw-html-embed:before{content:attr(data-html-embed-label);top:calc(var(--ck-html-embed-unfocused-outline-width)*-1);left:var(--ck-spacing-standard);background:#999;transition:background var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve);padding:calc(var(--ck-spacing-tiny) + var(--ck-html-embed-unfocused-outline-width)) var(--ck-spacing-small) var(--ck-spacing-tiny);border-radius:0 0 var(--ck-border-radius) var(--ck-border-radius);color:var(--ck-color-base-background);font-size:var(--ck-font-size-tiny);font-family:var(--ck-font-face)}.ck-widget.raw-html-embed[dir=rtl]:before{left:auto;right:var(--ck-spacing-standard)}.ck-widget.raw-html-embed[dir=ltr] .ck-widget__type-around .ck-widget__type-around__button.ck-widget__type-around__button_before{margin-left:50px}.ck.ck-editor__editable.ck-blurred .ck-widget.raw-html-embed.ck-widget_selected:before{top:0;padding:var(--ck-spacing-tiny) var(--ck-spacing-small)}.ck.ck-editor__editable:not(.ck-blurred) .ck-widget.raw-html-embed.ck-widget_selected:before{top:0;padding:var(--ck-spacing-tiny) var(--ck-spacing-small);background:var(--ck-color-focus-border)}.ck.ck-editor__editable .ck-widget.raw-html-embed:not(.ck-widget_selected):hover:before{top:0;padding:var(--ck-spacing-tiny) var(--ck-spacing-small)}.ck-widget.raw-html-embed .raw-html-embed__content-wrapper{padding:var(--ck-spacing-standard)}.ck-widget.raw-html-embed .raw-html-embed__buttons-wrapper{top:var(--ck-spacing-standard);right:var(--ck-spacing-standard)}.ck-widget.raw-html-embed .raw-html-embed__buttons-wrapper .ck-button.raw-html-embed__save-button{color:var(--ck-color-button-save)}.ck-widget.raw-html-embed .raw-html-embed__buttons-wrapper .ck-button.raw-html-embed__cancel-button{color:var(--ck-color-button-cancel)}.ck-widget.raw-html-embed .raw-html-embed__buttons-wrapper .ck-button:not(:first-child){margin-top:var(--ck-spacing-small)}.ck-widget.raw-html-embed[dir=rtl] .raw-html-embed__buttons-wrapper{left:var(--ck-spacing-standard);right:auto}.ck-widget.raw-html-embed .raw-html-embed__source{box-sizing:border-box;height:var(--ck-html-embed-source-height);width:var(--ck-html-embed-content-width);resize:none;min-width:0;padding:var(--ck-spacing-standard);font-family:monospace;tab-size:4;white-space:pre-wrap;font-size:var(--ck-font-size-base);text-align:left;direction:ltr}.ck-widget.raw-html-embed .raw-html-embed__source[disabled]{background:var(--ck-html-embed-source-disabled-background);color:var(--ck-html-embed-source-disabled-color);-webkit-text-fill-color:var(--ck-html-embed-source-disabled-color);opacity:1}.ck-widget.raw-html-embed .raw-html-embed__preview{min-height:var(--ck-html-embed-content-min-height);width:var(--ck-html-embed-content-width)}.ck-editor__editable:not(.ck-read-only) .ck-widget.raw-html-embed .raw-html-embed__preview{pointer-events:none}.ck-widget.raw-html-embed .raw-html-embed__preview-content{box-sizing:border-box;background-color:var(--ck-color-base-foreground)}.ck-widget.raw-html-embed .raw-html-embed__preview-content>*{margin-left:auto;margin-right:auto}.ck-widget.raw-html-embed .raw-html-embed__preview-placeholder{color:var(--ck-html-embed-source-disabled-color)}",""]);const i=a},609:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=e(t);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"==typeof e&&(e=[[null,e,""]]);var a={};if(r)for(var i=0;i<this.length;i++){var o=this[i][0];null!=o&&(a[o]=!0)}for(var c=0;c<e.length;c++){var l=[].concat(e[c]);r&&a[l[0]]||(n&&(l[2]?l[2]="".concat(n," and ").concat(l[2]):l[2]=n),t.push(l))}},t}},62:(e,t,n)=>{"use strict";var r,a=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},i=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),o=[];function c(e){for(var t=-1,n=0;n<o.length;n++)if(o[n].identifier===e){t=n;break}return t}function l(e,t){for(var n={},r=[],a=0;a<e.length;a++){var i=e[a],l=t.base?i[0]+t.base:i[0],d=n[l]||0,s="".concat(l," ").concat(d);n[l]=d+1;var m=c(s),u={css:i[1],media:i[2],sourceMap:i[3]};-1!==m?(o[m].references++,o[m].updater(u)):o.push({identifier:s,updater:w(u,t),references:1}),r.push(s)}return r}function d(e){var t=document.createElement("style"),r=e.attributes||{};if(void 0===r.nonce){var a=n.nc;a&&(r.nonce=a)}if(Object.keys(r).forEach((function(e){t.setAttribute(e,r[e])})),"function"==typeof e.insert)e.insert(t);else{var o=i(e.insert||"head");if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(t)}return t}var s,m=(s=[],function(e,t){return s[e]=t,s.filter(Boolean).join("\n")});function u(e,t,n,r){var a=n?"":r.media?"@media ".concat(r.media," {").concat(r.css,"}"):r.css;if(e.styleSheet)e.styleSheet.cssText=m(t,a);else{var i=document.createTextNode(a),o=e.childNodes;o[t]&&e.removeChild(o[t]),o.length?e.insertBefore(i,o[t]):e.appendChild(i)}}function b(e,t,n){var r=n.css,a=n.media,i=n.sourceMap;if(a?e.setAttribute("media",a):e.removeAttribute("media"),i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),e.styleSheet)e.styleSheet.cssText=r;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(r))}}var h=null,p=0;function w(e,t){var n,r,a;if(t.singleton){var i=p++;n=h||(h=d(t)),r=u.bind(null,n,i,!1),a=u.bind(null,n,i,!0)}else n=d(t),r=b.bind(null,n,t),a=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else a()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=a());var n=l(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var r=0;r<n.length;r++){var a=c(n[r]);o[a].references--}for(var i=l(e,t),d=0;d<n.length;d++){var s=c(n[d]);0===o[s].references&&(o[s].updater(),o.splice(s,1))}n=i}}}},704:(e,t,n)=>{e.exports=n(79)("./src/core.js")},273:(e,t,n)=>{e.exports=n(79)("./src/ui.js")},209:(e,t,n)=>{e.exports=n(79)("./src/utils.js")},995:(e,t,n)=>{e.exports=n(79)("./src/widget.js")},79:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var i=t[r]={id:r,exports:{}};return e[r](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{"use strict";n.r(r),n.d(r,{HtmlEmbed:()=>p,HtmlEmbedEditing:()=>u,HtmlEmbedUI:()=>h});var e=n(704),t=n(995),a=n(273),i=n(209);class o extends e.Command{refresh(){const e=this.editor.model,n=e.schema,r=e.document.selection,a=c(r);this.isEnabled=function(e,n,r){const a=function(e,n){const r=(0,t.findOptimalInsertionRange)(e,n).start.parent;if(r.isEmpty&&!r.is("element","$root"))return r.parent;return r}(e,r);return n.checkChild(a,"rawHtml")}(r,n,e),this.value=a?a.getAttribute("value")||"":null}execute(e){const t=this.editor.model,n=t.document.selection;t.change((r=>{let a;null!==this.value?a=c(n):(a=r.createElement("rawHtml"),t.insertContent(a),r.setSelection(a,"on")),r.setAttribute("value",e,a)}))}}function c(e){const t=e.getSelectedElement();return t&&t.is("element","rawHtml")?t:null}var l=n(62),d=n.n(l),s=n(600),m={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};d()(s.Z,m);s.Z.locals;class u extends e.Plugin{static get pluginName(){return"HtmlEmbedEditing"}constructor(e){super(e),e.config.define("htmlEmbed",{showPreviews:!1,sanitizeHtml:e=>((0,i.logWarning)("html-embed-provide-sanitize-function"),{html:e,hasChanged:!1})}),this._widgetButtonViewReferences=new Set}init(){const e=this.editor;e.model.schema.register("rawHtml",{isObject:!0,allowWhere:"$block",allowAttributes:["value"]}),e.commands.add("htmlEmbed",new o(e)),this._setupConversion()}_setupConversion(){const e=this.editor,n=e.t,r=e.editing.view,a=this._widgetButtonViewReferences,o=e.config.get("htmlEmbed");function c({domElement:e,editor:t,state:r,props:o}){e.textContent="";const c=e.ownerDocument;let d;if(r.isEditable){const t={isDisabled:!1,placeholder:o.textareaPlaceholder};d=l({domDocument:c,state:r,props:t}),e.append(d)}else if(r.showPreviews){const a={sanitizeHtml:o.sanitizeHtml};e.append(function({domDocument:e,state:t,props:r,editor:a}){const o=r.sanitizeHtml(t.getRawHtmlValue()),c=t.getRawHtmlValue().length>0?n("No preview available"):n("Empty snippet content"),l=(0,i.createElement)(e,"div",{class:"ck ck-reset_all raw-html-embed__preview-placeholder"},c),d=(0,i.createElement)(e,"div",{class:"raw-html-embed__preview-content",dir:a.locale.contentLanguageDirection}),s=e.createRange().createContextualFragment(o.html);d.appendChild(s);return(0,i.createElement)(e,"div",{class:"raw-html-embed__preview"},[l,d])}({domDocument:c,state:r,props:a,editor:t}))}else{const t={isDisabled:!0,placeholder:o.textareaPlaceholder};e.append(l({domDocument:c,state:r,props:t}))}const s={onEditClick:o.onEditClick,onSaveClick:()=>{o.onSaveClick(d.value)},onCancelClick:o.onCancelClick};e.prepend(function({editor:e,domDocument:t,state:n,props:r}){const o=(0,i.createElement)(t,"div",{class:"raw-html-embed__buttons-wrapper"});if(n.isEditable){const t=b(e,"save",r.onSaveClick),n=b(e,"cancel",r.onCancelClick);o.append(t.element,n.element),a.add(t).add(n)}else{const t=b(e,"edit",r.onEditClick);o.append(t.element),a.add(t)}return o}({editor:t,domDocument:c,state:r,props:s}))}function l({domDocument:e,state:t,props:n}){const r=(0,i.createElement)(e,"textarea",{placeholder:n.placeholder,class:"ck ck-reset ck-input ck-input-text raw-html-embed__source"});return r.disabled=n.isDisabled,r.value=t.getRawHtmlValue(),r}this.editor.editing.view.on("render",(()=>{for(const e of a){if(e.element.isConnected)return;e.destroy(),a.delete(e)}}),{priority:"lowest"}),e.data.registerRawContentMatcher({name:"div",classes:"raw-html-embed"}),e.conversion.for("upcast").elementToElement({view:{name:"div",classes:"raw-html-embed"},model:(e,{writer:t})=>t.createElement("rawHtml",{value:e.getCustomProperty("$rawContent")})}),e.conversion.for("dataDowncast").elementToElement({model:"rawHtml",view:(e,{writer:t})=>t.createRawElement("div",{class:"raw-html-embed"},(function(t){t.innerHTML=e.getAttribute("value")||""}))}),e.conversion.for("editingDowncast").elementToElement({triggerBy:{attributes:["value"]},model:"rawHtml",view:(a,{writer:i})=>{let l,d,s;const m=i.createContainerElement("div",{class:"raw-html-embed","data-html-embed-label":n("HTML snippet"),dir:e.locale.uiLanguageDirection}),u=i.createRawElement("div",{class:"raw-html-embed__content-wrapper"},(function(t){l=t,c({domElement:t,editor:e,state:d,props:s}),l.addEventListener("mousedown",(()=>{if(d.isEditable){const t=e.model;t.document.selection.getSelectedElement()!==a&&t.change((e=>e.setSelection(a,"on")))}}),!0)})),b={makeEditable(){d=Object.assign({},d,{isEditable:!0}),c({domElement:l,editor:e,state:d,props:s}),r.change((e=>{e.setAttribute("data-cke-ignore-events","true",u)})),l.querySelector("textarea").focus()},save(t){t!==d.getRawHtmlValue()?(e.execute("htmlEmbed",t),e.editing.view.focus()):this.cancel()},cancel(){d=Object.assign({},d,{isEditable:!1}),c({domElement:l,editor:e,state:d,props:s}),e.editing.view.focus(),r.change((e=>{e.removeAttribute("data-cke-ignore-events",u)}))}};return d={showPreviews:o.showPreviews,isEditable:!1,getRawHtmlValue:()=>a.getAttribute("value")||""},s={sanitizeHtml:o.sanitizeHtml,textareaPlaceholder:n("Paste raw HTML here..."),onEditClick(){b.makeEditable()},onSaveClick(e){b.save(e)},onCancelClick(){b.cancel()}},i.insert(i.createPositionAt(m,0),u),i.setCustomProperty("rawHtmlApi",b,m),i.setCustomProperty("rawHtml",!0,m),(0,t.toWidget)(m,i,{widgetLabel:n("HTML snippet"),hasSelectionHandle:!0})}})}}function b(t,n,r){const i=t.locale.t,o=new a.ButtonView(t.locale),c=t.commands.get("htmlEmbed");return o.set({class:`raw-html-embed__${n}-button`,icon:e.icons.pencil,tooltip:!0,tooltipPosition:"rtl"===t.locale.uiLanguageDirection?"e":"w"}),o.render(),"edit"===n?(o.set({icon:e.icons.pencil,label:i("Edit source")}),o.bind("isEnabled").to(c)):"save"===n?(o.set({icon:e.icons.check,label:i("Save changes")}),o.bind("isEnabled").to(c)):o.set({icon:e.icons.cancel,label:i("Cancel")}),o.on("execute",r),o}class h extends e.Plugin{static get pluginName(){return"HtmlEmbedUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("htmlEmbed",(n=>{const r=e.commands.get("htmlEmbed"),i=new a.ButtonView(n);return i.set({label:t("Insert HTML"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M17 0a2 2 0 0 1 2 2v7a1 1 0 0 1 1 1v5a1 1 0 0 1-.883.993l-.118.006L19 17a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2l-.001-1.001-.116-.006A1 1 0 0 1 0 15v-5a1 1 0 0 1 .999-1L1 2a2 2 0 0 1 2-2h14zm.499 15.999h-15L2.5 17a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5l-.001-1.001zm-3.478-6.013-.014.014H14v.007l-1.525 1.525-1.46-1.46-.015.013V10h-1v5h1v-3.53l1.428 1.43.048.043.131-.129L14 11.421V15h1v-5h-.965l-.014-.014zM2 10H1v5h1v-2h2v2h1v-5H4v2H2v-2zm7 0H6v1h1v4h1v-4h1v-1zm8 0h-1v5h3v-1h-2v-4zm0-8.5H3a.5.5 0 0 0-.5.5l-.001 6.999h15L17.5 2a.5.5 0 0 0-.5-.5zM10 7v1H4V7h6zm3-2v1H4V5h9zm-3-2v1H4V3h6z"/></svg>',tooltip:!0}),i.bind("isEnabled").to(r,"isEnabled"),this.listenTo(i,"execute",(()=>{e.execute("htmlEmbed"),e.editing.view.focus();e.editing.view.document.selection.getSelectedElement().getCustomProperty("rawHtmlApi").makeEditable()})),i}))}}class p extends e.Plugin{static get requires(){return[u,h,t.Widget]}static get pluginName(){return"HtmlEmbed"}}})(),(window.CKEditor5=window.CKEditor5||{}).htmlEmbed=r})();
*/(()=>{var e={600:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(609),a=n.n(r)()((function(e){return e[1]}));a.push([e.id,".ck-widget.raw-html-embed{margin:.9em auto;position:relative;display:flow-root;min-width:15em;font-style:normal}.ck-widget.raw-html-embed:before{position:absolute;z-index:1}.ck-widget.raw-html-embed .raw-html-embed__buttons-wrapper{position:absolute;display:flex;flex-direction:column}.ck-widget.raw-html-embed .raw-html-embed__preview{position:relative;overflow:hidden;display:flex}.ck-widget.raw-html-embed .raw-html-embed__preview-content{width:100%;position:relative;margin:auto;display:table;border-collapse:separate;border-spacing:7px}.ck-widget.raw-html-embed .raw-html-embed__preview-placeholder{position:absolute;left:0;top:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}:root{--ck-html-embed-content-width:calc(100% - var(--ck-icon-size)*1.5);--ck-html-embed-source-height:10em;--ck-html-embed-unfocused-outline-width:1px;--ck-html-embed-content-min-height:calc(var(--ck-icon-size) + var(--ck-spacing-standard));--ck-html-embed-source-disabled-background:var(--ck-color-base-foreground);--ck-html-embed-source-disabled-color:#737373}.ck-widget.raw-html-embed{font-size:var(--ck-font-size-base);background-color:var(--ck-color-base-foreground)}.ck-widget.raw-html-embed:not(.ck-widget_selected):not(:hover){outline:var(--ck-html-embed-unfocused-outline-width) dashed var(--ck-color-widget-blurred-border)}.ck-widget.raw-html-embed[dir=ltr]{text-align:left}.ck-widget.raw-html-embed[dir=rtl]{text-align:right}.ck-widget.raw-html-embed:before{content:attr(data-html-embed-label);top:calc(var(--ck-html-embed-unfocused-outline-width)*-1);left:var(--ck-spacing-standard);background:#999;transition:background var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve);padding:calc(var(--ck-spacing-tiny) + var(--ck-html-embed-unfocused-outline-width)) var(--ck-spacing-small) var(--ck-spacing-tiny);border-radius:0 0 var(--ck-border-radius) var(--ck-border-radius);color:var(--ck-color-base-background);font-size:var(--ck-font-size-tiny);font-family:var(--ck-font-face)}.ck-widget.raw-html-embed[dir=rtl]:before{left:auto;right:var(--ck-spacing-standard)}.ck-widget.raw-html-embed[dir=ltr] .ck-widget__type-around .ck-widget__type-around__button.ck-widget__type-around__button_before{margin-left:50px}.ck.ck-editor__editable.ck-blurred .ck-widget.raw-html-embed.ck-widget_selected:before{top:0;padding:var(--ck-spacing-tiny) var(--ck-spacing-small)}.ck.ck-editor__editable:not(.ck-blurred) .ck-widget.raw-html-embed.ck-widget_selected:before{top:0;padding:var(--ck-spacing-tiny) var(--ck-spacing-small);background:var(--ck-color-focus-border)}.ck.ck-editor__editable .ck-widget.raw-html-embed:not(.ck-widget_selected):hover:before{top:0;padding:var(--ck-spacing-tiny) var(--ck-spacing-small)}.ck-widget.raw-html-embed .raw-html-embed__content-wrapper{padding:var(--ck-spacing-standard)}.ck-widget.raw-html-embed .raw-html-embed__buttons-wrapper{top:var(--ck-spacing-standard);right:var(--ck-spacing-standard)}.ck-widget.raw-html-embed .raw-html-embed__buttons-wrapper .ck-button.raw-html-embed__save-button{color:var(--ck-color-button-save)}.ck-widget.raw-html-embed .raw-html-embed__buttons-wrapper .ck-button.raw-html-embed__cancel-button{color:var(--ck-color-button-cancel)}.ck-widget.raw-html-embed .raw-html-embed__buttons-wrapper .ck-button:not(:first-child){margin-top:var(--ck-spacing-small)}.ck-widget.raw-html-embed[dir=rtl] .raw-html-embed__buttons-wrapper{left:var(--ck-spacing-standard);right:auto}.ck-widget.raw-html-embed .raw-html-embed__source{box-sizing:border-box;height:var(--ck-html-embed-source-height);width:var(--ck-html-embed-content-width);resize:none;min-width:0;padding:var(--ck-spacing-standard);font-family:monospace;tab-size:4;white-space:pre-wrap;font-size:var(--ck-font-size-base);text-align:left;direction:ltr}.ck-widget.raw-html-embed .raw-html-embed__source[disabled]{background:var(--ck-html-embed-source-disabled-background);color:var(--ck-html-embed-source-disabled-color);-webkit-text-fill-color:var(--ck-html-embed-source-disabled-color);opacity:1}.ck-widget.raw-html-embed .raw-html-embed__preview{min-height:var(--ck-html-embed-content-min-height);width:var(--ck-html-embed-content-width)}.ck-editor__editable:not(.ck-read-only) .ck-widget.raw-html-embed .raw-html-embed__preview{pointer-events:none}.ck-widget.raw-html-embed .raw-html-embed__preview-content{box-sizing:border-box;background-color:var(--ck-color-base-foreground)}.ck-widget.raw-html-embed .raw-html-embed__preview-content>*{margin-left:auto;margin-right:auto}.ck-widget.raw-html-embed .raw-html-embed__preview-placeholder{color:var(--ck-html-embed-source-disabled-color)}",""]);const i=a},609:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=e(t);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"==typeof e&&(e=[[null,e,""]]);var a={};if(r)for(var i=0;i<this.length;i++){var o=this[i][0];null!=o&&(a[o]=!0)}for(var c=0;c<e.length;c++){var l=[].concat(e[c]);r&&a[l[0]]||(n&&(l[2]?l[2]="".concat(n," and ").concat(l[2]):l[2]=n),t.push(l))}},t}},62:(e,t,n)=>{"use strict";var r,a=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},i=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),o=[];function c(e){for(var t=-1,n=0;n<o.length;n++)if(o[n].identifier===e){t=n;break}return t}function l(e,t){for(var n={},r=[],a=0;a<e.length;a++){var i=e[a],l=t.base?i[0]+t.base:i[0],d=n[l]||0,s="".concat(l," ").concat(d);n[l]=d+1;var m=c(s),u={css:i[1],media:i[2],sourceMap:i[3]};-1!==m?(o[m].references++,o[m].updater(u)):o.push({identifier:s,updater:w(u,t),references:1}),r.push(s)}return r}function d(e){var t=document.createElement("style"),r=e.attributes||{};if(void 0===r.nonce){var a=n.nc;a&&(r.nonce=a)}if(Object.keys(r).forEach((function(e){t.setAttribute(e,r[e])})),"function"==typeof e.insert)e.insert(t);else{var o=i(e.insert||"head");if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(t)}return t}var s,m=(s=[],function(e,t){return s[e]=t,s.filter(Boolean).join("\n")});function u(e,t,n,r){var a=n?"":r.media?"@media ".concat(r.media," {").concat(r.css,"}"):r.css;if(e.styleSheet)e.styleSheet.cssText=m(t,a);else{var i=document.createTextNode(a),o=e.childNodes;o[t]&&e.removeChild(o[t]),o.length?e.insertBefore(i,o[t]):e.appendChild(i)}}function b(e,t,n){var r=n.css,a=n.media,i=n.sourceMap;if(a?e.setAttribute("media",a):e.removeAttribute("media"),i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),e.styleSheet)e.styleSheet.cssText=r;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(r))}}var h=null,p=0;function w(e,t){var n,r,a;if(t.singleton){var i=p++;n=h||(h=d(t)),r=u.bind(null,n,i,!1),a=u.bind(null,n,i,!0)}else n=d(t),r=b.bind(null,n,t),a=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else a()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=a());var n=l(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var r=0;r<n.length;r++){var a=c(n[r]);o[a].references--}for(var i=l(e,t),d=0;d<n.length;d++){var s=c(n[d]);0===o[s].references&&(o[s].updater(),o.splice(s,1))}n=i}}}},704:(e,t,n)=>{e.exports=n(79)("./src/core.js")},273:(e,t,n)=>{e.exports=n(79)("./src/ui.js")},209:(e,t,n)=>{e.exports=n(79)("./src/utils.js")},995:(e,t,n)=>{e.exports=n(79)("./src/widget.js")},79:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var i=t[r]={id:r,exports:{}};return e[r](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{"use strict";n.r(r),n.d(r,{HtmlEmbed:()=>p,HtmlEmbedEditing:()=>u,HtmlEmbedUI:()=>h});var e=n(704),t=n(995),a=n(273),i=n(209);class o extends e.Command{refresh(){const e=this.editor.model,n=e.schema,r=e.document.selection,a=c(r);this.isEnabled=function(e,n,r){const a=function(e,n){const r=(0,t.findOptimalInsertionRange)(e,n).start.parent;if(r.isEmpty&&!r.is("element","$root"))return r.parent;return r}(e,r);return n.checkChild(a,"rawHtml")}(r,n,e),this.value=a?a.getAttribute("value")||"":null}execute(e){const t=this.editor.model,n=t.document.selection;t.change((r=>{let a;null!==this.value?a=c(n):(a=r.createElement("rawHtml"),t.insertContent(a),r.setSelection(a,"on")),r.setAttribute("value",e,a)}))}}function c(e){const t=e.getSelectedElement();return t&&t.is("element","rawHtml")?t:null}var l=n(62),d=n.n(l),s=n(600),m={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};d()(s.Z,m);s.Z.locals;class u extends e.Plugin{static get pluginName(){return"HtmlEmbedEditing"}constructor(e){super(e),e.config.define("htmlEmbed",{showPreviews:!1,sanitizeHtml:e=>((0,i.logWarning)("html-embed-provide-sanitize-function"),{html:e,hasChanged:!1})}),this._widgetButtonViewReferences=new Set}init(){const e=this.editor;e.model.schema.register("rawHtml",{isObject:!0,allowWhere:"$block",allowAttributes:["value"]}),e.commands.add("htmlEmbed",new o(e)),this._setupConversion()}_setupConversion(){const e=this.editor,n=e.t,r=e.editing.view,a=this._widgetButtonViewReferences,o=e.config.get("htmlEmbed");function c({domElement:e,editor:t,state:r,props:o}){e.textContent="";const c=e.ownerDocument;let d;if(r.isEditable){const t={isDisabled:!1,placeholder:o.textareaPlaceholder};d=l({domDocument:c,state:r,props:t}),e.append(d)}else if(r.showPreviews){const a={sanitizeHtml:o.sanitizeHtml};e.append(function({domDocument:e,state:t,props:r,editor:a}){const o=r.sanitizeHtml(t.getRawHtmlValue()),c=t.getRawHtmlValue().length>0?n("No preview available"):n("Empty snippet content"),l=(0,i.createElement)(e,"div",{class:"ck ck-reset_all raw-html-embed__preview-placeholder"},c),d=(0,i.createElement)(e,"div",{class:"raw-html-embed__preview-content",dir:a.locale.contentLanguageDirection}),s=e.createRange().createContextualFragment(o.html);d.appendChild(s);return(0,i.createElement)(e,"div",{class:"raw-html-embed__preview"},[l,d])}({domDocument:c,state:r,props:a,editor:t}))}else{const t={isDisabled:!0,placeholder:o.textareaPlaceholder};e.append(l({domDocument:c,state:r,props:t}))}const s={onEditClick:o.onEditClick,onSaveClick:()=>{o.onSaveClick(d.value)},onCancelClick:o.onCancelClick};e.prepend(function({editor:e,domDocument:t,state:n,props:r}){const o=(0,i.createElement)(t,"div",{class:"raw-html-embed__buttons-wrapper"});if(n.isEditable){const t=b(e,"save",r.onSaveClick),n=b(e,"cancel",r.onCancelClick);o.append(t.element,n.element),a.add(t).add(n)}else{const t=b(e,"edit",r.onEditClick);o.append(t.element),a.add(t)}return o}({editor:t,domDocument:c,state:r,props:s}))}function l({domDocument:e,state:t,props:n}){const r=(0,i.createElement)(e,"textarea",{placeholder:n.placeholder,class:"ck ck-reset ck-input ck-input-text raw-html-embed__source"});return r.disabled=n.isDisabled,r.value=t.getRawHtmlValue(),r}this.editor.editing.view.on("render",(()=>{for(const e of a){if(e.element.isConnected)return;e.destroy(),a.delete(e)}}),{priority:"lowest"}),e.data.registerRawContentMatcher({name:"div",classes:"raw-html-embed"}),e.conversion.for("upcast").elementToElement({view:{name:"div",classes:"raw-html-embed"},model:(e,{writer:t})=>t.createElement("rawHtml",{value:e.getCustomProperty("$rawContent")})}),e.conversion.for("dataDowncast").elementToElement({model:"rawHtml",view:(e,{writer:t})=>t.createRawElement("div",{class:"raw-html-embed"},(function(t){t.innerHTML=e.getAttribute("value")||""}))}),e.conversion.for("editingDowncast").elementToStructure({model:{name:"rawHtml",attributes:["value"]},view:(a,{writer:i})=>{let l,d,s;const m=i.createRawElement("div",{class:"raw-html-embed__content-wrapper"},(function(t){l=t,c({domElement:t,editor:e,state:d,props:s}),l.addEventListener("mousedown",(()=>{if(d.isEditable){const t=e.model;t.document.selection.getSelectedElement()!==a&&t.change((e=>e.setSelection(a,"on")))}}),!0)})),u={makeEditable(){d=Object.assign({},d,{isEditable:!0}),c({domElement:l,editor:e,state:d,props:s}),r.change((e=>{e.setAttribute("data-cke-ignore-events","true",m)})),l.querySelector("textarea").focus()},save(t){t!==d.getRawHtmlValue()?(e.execute("htmlEmbed",t),e.editing.view.focus()):this.cancel()},cancel(){d=Object.assign({},d,{isEditable:!1}),c({domElement:l,editor:e,state:d,props:s}),e.editing.view.focus(),r.change((e=>{e.removeAttribute("data-cke-ignore-events",m)}))}};d={showPreviews:o.showPreviews,isEditable:!1,getRawHtmlValue:()=>a.getAttribute("value")||""},s={sanitizeHtml:o.sanitizeHtml,textareaPlaceholder:n("Paste raw HTML here..."),onEditClick(){u.makeEditable()},onSaveClick(e){u.save(e)},onCancelClick(){u.cancel()}};const b=i.createContainerElement("div",{class:"raw-html-embed","data-html-embed-label":n("HTML snippet"),dir:e.locale.uiLanguageDirection},m);return i.setCustomProperty("rawHtmlApi",u,b),i.setCustomProperty("rawHtml",!0,b),(0,t.toWidget)(b,i,{widgetLabel:n("HTML snippet"),hasSelectionHandle:!0})}})}}function b(t,n,r){const i=t.locale.t,o=new a.ButtonView(t.locale),c=t.commands.get("htmlEmbed");return o.set({class:`raw-html-embed__${n}-button`,icon:e.icons.pencil,tooltip:!0,tooltipPosition:"rtl"===t.locale.uiLanguageDirection?"e":"w"}),o.render(),"edit"===n?(o.set({icon:e.icons.pencil,label:i("Edit source")}),o.bind("isEnabled").to(c)):"save"===n?(o.set({icon:e.icons.check,label:i("Save changes")}),o.bind("isEnabled").to(c)):o.set({icon:e.icons.cancel,label:i("Cancel")}),o.on("execute",r),o}class h extends e.Plugin{static get pluginName(){return"HtmlEmbedUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("htmlEmbed",(n=>{const r=e.commands.get("htmlEmbed"),i=new a.ButtonView(n);return i.set({label:t("Insert HTML"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M17 0a2 2 0 0 1 2 2v7a1 1 0 0 1 1 1v5a1 1 0 0 1-.883.993l-.118.006L19 17a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2l-.001-1.001-.116-.006A1 1 0 0 1 0 15v-5a1 1 0 0 1 .999-1L1 2a2 2 0 0 1 2-2h14zm.499 15.999h-15L2.5 17a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5l-.001-1.001zm-3.478-6.013-.014.014H14v.007l-1.525 1.525-1.46-1.46-.015.013V10h-1v5h1v-3.53l1.428 1.43.048.043.131-.129L14 11.421V15h1v-5h-.965l-.014-.014zM2 10H1v5h1v-2h2v2h1v-5H4v2H2v-2zm7 0H6v1h1v4h1v-4h1v-1zm8 0h-1v5h3v-1h-2v-4zm0-8.5H3a.5.5 0 0 0-.5.5l-.001 6.999h15L17.5 2a.5.5 0 0 0-.5-.5zM10 7v1H4V7h6zm3-2v1H4V5h9zm-3-2v1H4V3h6z"/></svg>',tooltip:!0}),i.bind("isEnabled").to(r,"isEnabled"),this.listenTo(i,"execute",(()=>{e.execute("htmlEmbed"),e.editing.view.focus();e.editing.view.document.selection.getSelectedElement().getCustomProperty("rawHtmlApi").makeEditable()})),i}))}}class p extends e.Plugin{static get requires(){return[u,h,t.Widget]}static get pluginName(){return"HtmlEmbed"}}})(),(window.CKEditor5=window.CKEditor5||{}).htmlEmbed=r})();

@@ -1,1 +0,1 @@

!function(e){const n=e.es=e.es||{};n.dictionary=Object.assign(n.dictionary||{},{"Edit source":"Editar fuente","Empty snippet content":"","HTML snippet":"","Insert HTML":"Insertar HTML","No preview available":"No hay ninguna previsualización","Paste raw HTML here...":"Pegue HTML en bruto aquí…","Save changes":"Guardar cambios"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
!function(e){const a=e.es=e.es||{};a.dictionary=Object.assign(a.dictionary||{},{"Edit source":"Editar fuente","Empty snippet content":"Fragmento vacío","HTML snippet":"Fragmento HTML","Insert HTML":"Insertar HTML","No preview available":"No hay ninguna previsualización","Paste raw HTML here...":"Pegue el código HTML aquí…","Save changes":"Guardar cambios"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
{
"name": "@ckeditor/ckeditor5-html-embed",
"version": "32.0.0",
"version": "33.0.0",
"description": "HTML embed feature for CKEditor 5.",

@@ -15,17 +15,17 @@ "keywords": [

"dependencies": {
"ckeditor5": "^32.0.0"
"ckeditor5": "^33.0.0"
},
"devDependencies": {
"@ckeditor/ckeditor5-basic-styles": "^32.0.0",
"@ckeditor/ckeditor5-core": "^32.0.0",
"@ckeditor/ckeditor5-dev-utils": "^27.1.0",
"@ckeditor/ckeditor5-clipboard": "^32.0.0",
"@ckeditor/ckeditor5-editor-classic": "^32.0.0",
"@ckeditor/ckeditor5-engine": "^32.0.0",
"@ckeditor/ckeditor5-media-embed": "^32.0.0",
"@ckeditor/ckeditor5-paragraph": "^32.0.0",
"@ckeditor/ckeditor5-table": "^32.0.0",
"@ckeditor/ckeditor5-ui": "^32.0.0",
"@ckeditor/ckeditor5-theme-lark": "^32.0.0",
"@ckeditor/ckeditor5-widget": "^32.0.0",
"@ckeditor/ckeditor5-basic-styles": "^33.0.0",
"@ckeditor/ckeditor5-core": "^33.0.0",
"@ckeditor/ckeditor5-dev-utils": "^28.0.1",
"@ckeditor/ckeditor5-clipboard": "^33.0.0",
"@ckeditor/ckeditor5-editor-classic": "^33.0.0",
"@ckeditor/ckeditor5-engine": "^33.0.0",
"@ckeditor/ckeditor5-media-embed": "^33.0.0",
"@ckeditor/ckeditor5-paragraph": "^33.0.0",
"@ckeditor/ckeditor5-table": "^33.0.0",
"@ckeditor/ckeditor5-ui": "^33.0.0",
"@ckeditor/ckeditor5-theme-lark": "^33.0.0",
"@ckeditor/ckeditor5-widget": "^33.0.0",
"lodash-es": "^4.17.15",

@@ -32,0 +32,0 @@ "sanitize-html": "^2.1.0",

@@ -142,17 +142,7 @@ /**

editor.conversion.for( 'editingDowncast' ).elementToElement( {
triggerBy: {
attributes: [ 'value' ]
},
model: 'rawHtml',
editor.conversion.for( 'editingDowncast' ).elementToStructure( {
model: { name: 'rawHtml', attributes: [ 'value' ] },
view: ( modelElement, { writer } ) => {
let domContentWrapper, state, props;
const viewContainer = writer.createContainerElement( 'div', {
class: 'raw-html-embed',
'data-html-embed-label': t( 'HTML snippet' ),
dir: editor.locale.uiLanguageDirection
} );
// Widget cannot be a raw element because the widget system would not be able
// to add its UI to it. Thus, we need this wrapper.
const viewContentWrapper = writer.createRawElement( 'div', {

@@ -242,3 +232,7 @@ class: 'raw-html-embed__content-wrapper'

writer.insert( writer.createPositionAt( viewContainer, 0 ), viewContentWrapper );
const viewContainer = writer.createContainerElement( 'div', {
class: 'raw-html-embed',
'data-html-embed-label': t( 'HTML snippet' ),
dir: editor.locale.uiLanguageDirection
}, viewContentWrapper );

@@ -245,0 +239,0 @@ writer.setCustomProperty( 'rawHtmlApi', rawHtmlApi, viewContainer );

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc