vue-document-editor
Advanced tools
Comparing version 2.3.0 to 2.3.1
# Vue 3 | ||
## v2.3.1 | ||
- Fix [Issue 26](https://github.com/motla/vue-document-editor/issues/26) | ||
## v2.3.0 | ||
@@ -79,2 +83,6 @@ | ||
## v1.5.1 | ||
- Fix [Issue 26](https://github.com/motla/vue-document-editor/issues/26) | ||
## v1.5.0 | ||
@@ -81,0 +89,0 @@ |
@@ -1,2 +0,2 @@ | ||
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e(require("vue")):"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["VueDocumentEditor"]=e(require("vue")):t["VueDocumentEditor"]=e(t["Vue"])})("undefined"!==typeof self?self:this,(function(t){return function(){var e={9662:function(t,e,n){var r=n(614),o=n(6330),i=TypeError;t.exports=function(t){if(r(t))return t;throw i(o(t)+" is not a function")}},9670:function(t,e,n){var r=n(111),o=String,i=TypeError;t.exports=function(t){if(r(t))return t;throw i(o(t)+" is not an object")}},1318:function(t,e,n){var r=n(5656),o=n(1400),i=n(6244),s=function(t){return function(e,n,s){var a,c=r(e),u=i(c),l=o(s,u);if(t&&n!=n){while(u>l)if(a=c[l++],a!=a)return!0}else for(;u>l;l++)if((t||l in c)&&c[l]===n)return t||l||0;return!t&&-1}};t.exports={includes:s(!0),indexOf:s(!1)}},3658:function(t,e,n){"use strict";var r=n(9781),o=n(3157),i=TypeError,s=Object.getOwnPropertyDescriptor,a=r&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}();t.exports=a?function(t,e){if(o(t)&&!s(t,"length").writable)throw i("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e}},4326:function(t,e,n){var r=n(1702),o=r({}.toString),i=r("".slice);t.exports=function(t){return i(o(t),8,-1)}},9920:function(t,e,n){var r=n(2597),o=n(3887),i=n(1236),s=n(3070);t.exports=function(t,e,n){for(var a=o(e),c=s.f,u=i.f,l=0;l<a.length;l++){var p=a[l];r(t,p)||n&&r(n,p)||c(t,p,u(e,p))}}},8880:function(t,e,n){var r=n(9781),o=n(3070),i=n(9114);t.exports=r?function(t,e,n){return o.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},9114:function(t){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},8052:function(t,e,n){var r=n(614),o=n(3070),i=n(6339),s=n(3072);t.exports=function(t,e,n,a){a||(a={});var c=a.enumerable,u=void 0!==a.name?a.name:e;if(r(n)&&i(n,u,a),a.global)c?t[e]=n:s(e,n);else{try{a.unsafe?t[e]&&(c=!0):delete t[e]}catch(l){}c?t[e]=n:o.f(t,e,{value:n,enumerable:!1,configurable:!a.nonConfigurable,writable:!a.nonWritable})}return t}},3072:function(t,e,n){var r=n(7854),o=Object.defineProperty;t.exports=function(t,e){try{o(r,t,{value:e,configurable:!0,writable:!0})}catch(n){r[t]=e}return e}},9781:function(t,e,n){var r=n(7293);t.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},4154:function(t){var e="object"==typeof document&&document.all,n="undefined"==typeof e&&void 0!==e;t.exports={all:e,IS_HTMLDDA:n}},317:function(t,e,n){var r=n(7854),o=n(111),i=r.document,s=o(i)&&o(i.createElement);t.exports=function(t){return s?i.createElement(t):{}}},7207:function(t){var e=TypeError,n=9007199254740991;t.exports=function(t){if(t>n)throw e("Maximum allowed index exceeded");return t}},8113:function(t){t.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},7392:function(t,e,n){var r,o,i=n(7854),s=n(8113),a=i.process,c=i.Deno,u=a&&a.versions||c&&c.version,l=u&&u.v8;l&&(r=l.split("."),o=r[0]>0&&r[0]<4?1:+(r[0]+r[1])),!o&&s&&(r=s.match(/Edge\/(\d+)/),(!r||r[1]>=74)&&(r=s.match(/Chrome\/(\d+)/),r&&(o=+r[1]))),t.exports=o},748:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},2109:function(t,e,n){var r=n(7854),o=n(1236).f,i=n(8880),s=n(8052),a=n(3072),c=n(9920),u=n(4705);t.exports=function(t,e){var n,l,p,f,d,h,g=t.target,m=t.global,_=t.stat;if(l=m?r:_?r[g]||a(g,{}):(r[g]||{}).prototype,l)for(p in e){if(d=e[p],t.dontCallGetSet?(h=o(l,p),f=h&&h.value):f=l[p],n=u(m?p:g+(_?".":"#")+p,t.forced),!n&&void 0!==f){if(typeof d==typeof f)continue;c(d,f)}(t.sham||f&&f.sham)&&i(d,"sham",!0),s(l,p,d,t)}}},7293:function(t){t.exports=function(t){try{return!!t()}catch(e){return!0}}},4374:function(t,e,n){var r=n(7293);t.exports=!r((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},6916:function(t,e,n){var r=n(4374),o=Function.prototype.call;t.exports=r?o.bind(o):function(){return o.apply(o,arguments)}},6530:function(t,e,n){var r=n(9781),o=n(2597),i=Function.prototype,s=r&&Object.getOwnPropertyDescriptor,a=o(i,"name"),c=a&&"something"===function(){}.name,u=a&&(!r||r&&s(i,"name").configurable);t.exports={EXISTS:a,PROPER:c,CONFIGURABLE:u}},1702:function(t,e,n){var r=n(4374),o=Function.prototype,i=o.call,s=r&&o.bind.bind(i,i);t.exports=r?s:function(t){return function(){return i.apply(t,arguments)}}},5005:function(t,e,n){var r=n(7854),o=n(614),i=function(t){return o(t)?t:void 0};t.exports=function(t,e){return arguments.length<2?i(r[t]):r[t]&&r[t][e]}},8173:function(t,e,n){var r=n(9662),o=n(8554);t.exports=function(t,e){var n=t[e];return o(n)?void 0:r(n)}},7854:function(t,e,n){var r=function(t){return t&&t.Math==Math&&t};t.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof n.g&&n.g)||function(){return this}()||this||Function("return this")()},2597:function(t,e,n){var r=n(1702),o=n(7908),i=r({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return i(o(t),e)}},3501:function(t){t.exports={}},4664:function(t,e,n){var r=n(9781),o=n(7293),i=n(317);t.exports=!r&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},8361:function(t,e,n){var r=n(1702),o=n(7293),i=n(4326),s=Object,a=r("".split);t.exports=o((function(){return!s("z").propertyIsEnumerable(0)}))?function(t){return"String"==i(t)?a(t,""):s(t)}:s},2788:function(t,e,n){var r=n(1702),o=n(614),i=n(5465),s=r(Function.toString);o(i.inspectSource)||(i.inspectSource=function(t){return s(t)}),t.exports=i.inspectSource},9909:function(t,e,n){var r,o,i,s=n(4811),a=n(7854),c=n(111),u=n(8880),l=n(2597),p=n(5465),f=n(6200),d=n(3501),h="Object already initialized",g=a.TypeError,m=a.WeakMap,_=function(t){return i(t)?o(t):r(t,{})},y=function(t){return function(e){var n;if(!c(e)||(n=o(e)).type!==t)throw g("Incompatible receiver, "+t+" required");return n}};if(s||p.state){var v=p.state||(p.state=new m);v.get=v.get,v.has=v.has,v.set=v.set,r=function(t,e){if(v.has(t))throw g(h);return e.facade=t,v.set(t,e),e},o=function(t){return v.get(t)||{}},i=function(t){return v.has(t)}}else{var b=f("state");d[b]=!0,r=function(t,e){if(l(t,b))throw g(h);return e.facade=t,u(t,b,e),e},o=function(t){return l(t,b)?t[b]:{}},i=function(t){return l(t,b)}}t.exports={set:r,get:o,has:i,enforce:_,getterFor:y}},3157:function(t,e,n){var r=n(4326);t.exports=Array.isArray||function(t){return"Array"==r(t)}},614:function(t,e,n){var r=n(4154),o=r.all;t.exports=r.IS_HTMLDDA?function(t){return"function"==typeof t||t===o}:function(t){return"function"==typeof t}},4705:function(t,e,n){var r=n(7293),o=n(614),i=/#|\.prototype\./,s=function(t,e){var n=c[a(t)];return n==l||n!=u&&(o(e)?r(e):!!e)},a=s.normalize=function(t){return String(t).replace(i,".").toLowerCase()},c=s.data={},u=s.NATIVE="N",l=s.POLYFILL="P";t.exports=s},8554:function(t){t.exports=function(t){return null===t||void 0===t}},111:function(t,e,n){var r=n(614),o=n(4154),i=o.all;t.exports=o.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:r(t)||t===i}:function(t){return"object"==typeof t?null!==t:r(t)}},1913:function(t){t.exports=!1},2190:function(t,e,n){var r=n(5005),o=n(614),i=n(7976),s=n(3307),a=Object;t.exports=s?function(t){return"symbol"==typeof t}:function(t){var e=r("Symbol");return o(e)&&i(e.prototype,a(t))}},6244:function(t,e,n){var r=n(7466);t.exports=function(t){return r(t.length)}},6339:function(t,e,n){var r=n(1702),o=n(7293),i=n(614),s=n(2597),a=n(9781),c=n(6530).CONFIGURABLE,u=n(2788),l=n(9909),p=l.enforce,f=l.get,d=String,h=Object.defineProperty,g=r("".slice),m=r("".replace),_=r([].join),y=a&&!o((function(){return 8!==h((function(){}),"length",{value:8}).length})),v=String(String).split("String"),b=t.exports=function(t,e,n){"Symbol("===g(d(e),0,7)&&(e="["+m(d(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!s(t,"name")||c&&t.name!==e)&&(a?h(t,"name",{value:e,configurable:!0}):t.name=e),y&&n&&s(n,"arity")&&t.length!==n.arity&&h(t,"length",{value:n.arity});try{n&&s(n,"constructor")&&n.constructor?a&&h(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(o){}var r=p(t);return s(r,"source")||(r.source=_(v,"string"==typeof e?e:"")),t};Function.prototype.toString=b((function(){return i(this)&&f(this).source||u(this)}),"toString")},4758:function(t){var e=Math.ceil,n=Math.floor;t.exports=Math.trunc||function(t){var r=+t;return(r>0?n:e)(r)}},3070:function(t,e,n){var r=n(9781),o=n(4664),i=n(3353),s=n(9670),a=n(4948),c=TypeError,u=Object.defineProperty,l=Object.getOwnPropertyDescriptor,p="enumerable",f="configurable",d="writable";e.f=r?i?function(t,e,n){if(s(t),e=a(e),s(n),"function"===typeof t&&"prototype"===e&&"value"in n&&d in n&&!n[d]){var r=l(t,e);r&&r[d]&&(t[e]=n.value,n={configurable:f in n?n[f]:r[f],enumerable:p in n?n[p]:r[p],writable:!1})}return u(t,e,n)}:u:function(t,e,n){if(s(t),e=a(e),s(n),o)try{return u(t,e,n)}catch(r){}if("get"in n||"set"in n)throw c("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},1236:function(t,e,n){var r=n(9781),o=n(6916),i=n(5296),s=n(9114),a=n(5656),c=n(4948),u=n(2597),l=n(4664),p=Object.getOwnPropertyDescriptor;e.f=r?p:function(t,e){if(t=a(t),e=c(e),l)try{return p(t,e)}catch(n){}if(u(t,e))return s(!o(i.f,t,e),t[e])}},8006:function(t,e,n){var r=n(6324),o=n(748),i=o.concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,i)}},5181:function(t,e){e.f=Object.getOwnPropertySymbols},7976:function(t,e,n){var r=n(1702);t.exports=r({}.isPrototypeOf)},6324:function(t,e,n){var r=n(1702),o=n(2597),i=n(5656),s=n(1318).indexOf,a=n(3501),c=r([].push);t.exports=function(t,e){var n,r=i(t),u=0,l=[];for(n in r)!o(a,n)&&o(r,n)&&c(l,n);while(e.length>u)o(r,n=e[u++])&&(~s(l,n)||c(l,n));return l}},5296:function(t,e){"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,o=r&&!n.call({1:2},1);e.f=o?function(t){var e=r(this,t);return!!e&&e.enumerable}:n},2140:function(t,e,n){var r=n(6916),o=n(614),i=n(111),s=TypeError;t.exports=function(t,e){var n,a;if("string"===e&&o(n=t.toString)&&!i(a=r(n,t)))return a;if(o(n=t.valueOf)&&!i(a=r(n,t)))return a;if("string"!==e&&o(n=t.toString)&&!i(a=r(n,t)))return a;throw s("Can't convert object to primitive value")}},3887:function(t,e,n){var r=n(5005),o=n(1702),i=n(8006),s=n(5181),a=n(9670),c=o([].concat);t.exports=r("Reflect","ownKeys")||function(t){var e=i.f(a(t)),n=s.f;return n?c(e,n(t)):e}},4488:function(t,e,n){var r=n(8554),o=TypeError;t.exports=function(t){if(r(t))throw o("Can't call method on "+t);return t}},6200:function(t,e,n){var r=n(2309),o=n(9711),i=r("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},5465:function(t,e,n){var r=n(7854),o=n(3072),i="__core-js_shared__",s=r[i]||o(i,{});t.exports=s},2309:function(t,e,n){var r=n(1913),o=n(5465);(t.exports=function(t,e){return o[t]||(o[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.30.2",mode:r?"pure":"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.30.2/LICENSE",source:"https://github.com/zloirock/core-js"})},6293:function(t,e,n){var r=n(7392),o=n(7293),i=n(7854),s=i.String;t.exports=!!Object.getOwnPropertySymbols&&!o((function(){var t=Symbol();return!s(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},1400:function(t,e,n){var r=n(9303),o=Math.max,i=Math.min;t.exports=function(t,e){var n=r(t);return n<0?o(n+e,0):i(n,e)}},5656:function(t,e,n){var r=n(8361),o=n(4488);t.exports=function(t){return r(o(t))}},9303:function(t,e,n){var r=n(4758);t.exports=function(t){var e=+t;return e!==e||0===e?0:r(e)}},7466:function(t,e,n){var r=n(9303),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},7908:function(t,e,n){var r=n(4488),o=Object;t.exports=function(t){return o(r(t))}},7593:function(t,e,n){var r=n(6916),o=n(111),i=n(2190),s=n(8173),a=n(2140),c=n(5112),u=TypeError,l=c("toPrimitive");t.exports=function(t,e){if(!o(t)||i(t))return t;var n,c=s(t,l);if(c){if(void 0===e&&(e="default"),n=r(c,t,e),!o(n)||i(n))return n;throw u("Can't convert object to primitive value")}return void 0===e&&(e="number"),a(t,e)}},4948:function(t,e,n){var r=n(7593),o=n(2190);t.exports=function(t){var e=r(t,"string");return o(e)?e:e+""}},6330:function(t){var e=String;t.exports=function(t){try{return e(t)}catch(n){return"Object"}}},9711:function(t,e,n){var r=n(1702),o=0,i=Math.random(),s=r(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+s(++o+i,36)}},3307:function(t,e,n){var r=n(6293);t.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},3353:function(t,e,n){var r=n(9781),o=n(7293);t.exports=r&&o((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},4811:function(t,e,n){var r=n(7854),o=n(614),i=r.WeakMap;t.exports=o(i)&&/native code/.test(String(i))},5112:function(t,e,n){var r=n(7854),o=n(2309),i=n(2597),s=n(9711),a=n(6293),c=n(3307),u=r.Symbol,l=o("wks"),p=c?u["for"]||u:u&&u.withoutSetter||s;t.exports=function(t){return i(l,t)||(l[t]=a&&i(u,t)?u[t]:p("Symbol."+t)),l[t]}},7658:function(t,e,n){"use strict";var r=n(2109),o=n(7908),i=n(6244),s=n(3658),a=n(7207),c=n(7293),u=c((function(){return 4294967297!==[].push.call({length:4294967296},1)})),l=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(t){return t instanceof TypeError}},p=u||!l();r({target:"Array",proto:!0,arity:1,forced:p},{push:function(t){var e=o(this),n=i(e),r=arguments.length;a(n+r);for(var c=0;c<r;c++)e[n]=arguments[c],n++;return s(e,n),n}})},3744:function(t,e){"use strict";e.Z=(t,e)=>{const n=t.__vccOpts||t;for(const[r,o]of e)n[r]=o;return n}},7203:function(e){"use strict";e.exports=t}},n={};function r(t){var o=n[t];if(void 0!==o)return o.exports;var i=n[t]={exports:{}};return e[t].call(i.exports,i,i.exports,r),i.exports}!function(){r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})}}(),function(){r.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"===typeof window)return window}}()}(),function(){r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}}(),function(){r.p=""}();var o={};return function(){"use strict";if(r.d(o,{default:function(){return _}}),"undefined"!==typeof window){var t=window.document.currentScript,e=t&&t.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);e&&(r.p=e[1])}var n=r(7203);const i={class:"editor",ref:"editor"},s={key:0,class:"overlays",ref:"overlays"},a=["innerHTML"],c=["contenteditable"];function u(t,e,r,o,u,l){return(0,n.openBlock)(),(0,n.createElementBlock)("div",i,[r.overlay?((0,n.openBlock)(),(0,n.createElementBlock)("div",s,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(u.pages,((t,e)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"overlay",key:t.uuid+"-overlay",ref_for:!0,ref:e=>u.pages_overlay_refs[t.uuid]=e,innerHTML:r.overlay(e+1,u.pages.length),style:(0,n.normalizeStyle)(l.page_style(e,!1))},null,12,a)))),128))],512)):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",{class:"content",ref:"content",contenteditable:r.editable,style:(0,n.normalizeStyle)(l.page_style(-1)),onInput:e[0]||(e[0]=(...t)=>l.input&&l.input(...t)),onKeyup:e[1]||(e[1]=(...t)=>l.process_current_text_style&&l.process_current_text_style(...t)),onKeydown:e[2]||(e[2]=(...t)=>l.keydown&&l.keydown(...t))},null,44,c)],512)}r(7658);function l(t,e){if(!t||!e)return!1;const n=t.childNodes;for(let r=0;r<n.length;r++)if(n[r].s_tag==e)return n[r];return!1}function p(t,e,n,r,o){while(t.childNodes.length&&!n()){o=o||1!=t.childNodes.length;const i=t.lastChild;if(i.nodeType==Node.TEXT_NODE){const t=i.textContent.match(/(\s|\S+)/g),r=document.createTextNode("");e.prepend(r);const s=t?t.length:0;for(let e=0;e<s;e++){if(e==s-1&&!o)return;if(i.textContent=t.slice(0,s-e-1).join(""),r.textContent=t.slice(s-e-1,s).join(""),n())return}}else if(!i.childNodes.length||i.tagName.match(/h\d/i)||i.tagName.match(/tr/i)||"function"===typeof r&&r(i)){if(!o)return void console.log("Move-forward: first child reached with no stop condition. Aborting");e.prepend(i)}else{let t=l(e,i.s_tag);if(!t){if(!i.s_tag){const t=Math.random().toString(36).slice(2,8);i.s_tag=t}t=i.cloneNode(!1),t.s_tag=i.s_tag,e.prepend(t)}p(i,t,n,r,o),t.normalize()}if(t.contains(i))if(0==i.childNodes.length||""==i.innerHTML)t.removeChild(i);else if(!n())throw console.log("sub_child:",i,"that is in child:",t),Error("Document editor is trying to remove a non-empty sub-child. This is a bug and should not happen. Please report a repeatable set of actions that leaded to this error to https://github.com/motla/vue-document-editor/issues/new")}}function f(t,e,n){while(!n()){const n=e.firstChild;var r=(t,e)=>{const n=l(t,e.s_tag);n&&e.childNodes.length?r(n,e.firstChild):(t.append(e),t.normalize())};r(t,n)}}var d={props:{content:{type:Array,required:!0},display:{type:String,default:"grid"},editable:{type:Boolean,default:!0},overlay:Function,page_format_mm:{type:Array,default:()=>[210,297]},page_margins:{type:[String,Function],default:"10mm 15mm"},zoom:{type:Number,default:1},do_not_break:Function},data(){return{pages:[],pages_overlay_refs:{},pages_height:0,editor_width:0,prevent_next_content_update_from_parent:!1,current_text_style:!1,printing_mode:!1}},mounted(){this.update_editor_width(),this.update_css_media_style(),this.reset_content(),window.addEventListener("resize",this.update_editor_width),window.addEventListener("click",this.process_current_text_style),window.addEventListener("beforeprint",this.before_print),window.addEventListener("afterprint",this.after_print)},beforeUpdate(){this.pages_overlay_refs=[]},beforeUnmount(){window.removeEventListener("resize",this.update_editor_width),window.removeEventListener("click",this.process_current_text_style),window.removeEventListener("beforeprint",this.before_print),window.removeEventListener("afterprint",this.after_print)},computed:{css_media_style(){const t=document.createElement("style");return document.head.appendChild(t),t}},methods:{new_uuid:()=>Math.random().toString(36).slice(-5),reset_content(){if(this.reset_in_progress)return;if(this.reset_in_progress=!0,!this.content.length)return this.reset_in_progress=!1,void this.$emit("update:content",[""]);this.pages=this.content.map(((t,e)=>({uuid:this.new_uuid(),content_idx:e,template:t.template,props:t.props}))),this.update_pages_elts();const t=this.pages[0].elt;this.$refs.content.contains(t)||this.$refs.content.appendChild(t),this.pages_height=t.clientHeight+1;for(const e of this.pages){if(this.content[e.content_idx]){if("string"==typeof this.content[e.content_idx])e.elt.innerHTML="<div>"+this.content[e.content_idx]+"</div>";else if(e.template){const t=(0,n.defineCustomElement)(e.template);customElements.define("component-"+e.uuid,t),e.elt.appendChild(new t({modelValue:e.props}))}}else e.elt.innerHTML="<div><br></div>";this.$refs.content.contains(e.elt)||this.$refs.content.appendChild(e.elt)}this.fit_content_over_pages(),this.$refs.content.blur(),this.reset_in_progress=!1},fit_content_over_pages(){if(!this.pages_height)return;if(this.fit_in_progress)return;this.fit_in_progress=!0;for(let o=this.pages.length-1;o>=0;o--){const t=this.pages[o];t.elt&&document.body.contains(t.elt)||this.pages.splice(o,1)}if(!this.pages.length)return void this.$emit("update:content",[""]);const t=window.getSelection(),e=document.createElement("null"),n=document.createElement("null");if(t&&t.rangeCount&&t.anchorNode&&(!t.anchorNode.dataset||null==t.anchorNode.dataset.isVDEPage)){const r=t.getRangeAt(0);r.insertNode(e),r.collapse(!1),r.insertNode(n)}let r=!1;for(let o=0;o<this.pages.length;o++){const t=this.pages[o];let e=this.pages[o+1],n=e?e.elt:null;!t.template&&(r||t.elt.innerHTML!=t.prev_innerHTML||n&&!e.template&&n.innerHTML!=e.prev_innerHTML)&&(r=!0,t.elt.clientHeight<=this.pages_height&&e&&e.content_idx==t.content_idx&&f(t.elt,n,(()=>!n.childNodes.length||t.elt.clientHeight>this.pages_height)),t.elt.clientHeight>this.pages_height&&(e&&e.content_idx==t.content_idx||(e={uuid:this.new_uuid(),content_idx:t.content_idx},this.pages.splice(o+1,0,e),this.update_pages_elts(),n=e.elt),p(t.elt,n,(()=>t.elt.clientHeight<=this.pages_height),this.do_not_break)),n&&e.content_idx==t.content_idx&&!n.childNodes.length&&this.pages.splice(o+1,1)),this.update_pages_elts()}if(document.body.contains(e)){const r=document.createRange();r.setStart(e,0),document.body.contains(n)&&r.setEnd(n,0),t.removeAllRanges(),t.addRange(r)}e.parentElement&&e.parentElement.removeChild(e),n.parentElement&&n.parentElement.removeChild(n);for(const o of this.pages)o.template||o.elt.normalize(),o.prev_innerHTML=o.elt.innerHTML;this.fit_in_progress=!1},input(t){t&&(this.fit_content_over_pages(),this.emit_new_content(),"insertText"!=t.inputType&&this.process_current_text_style())},keydown(t){if(8==t.keyCode&&this.content.length<=1&&"string"==typeof this.content[0]){const e=this.content[0].replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,"");e||t.preventDefault()}},emit_new_content(){let t=!1;const e=this.content.map(((e,n)=>{const r=this.pages.filter((t=>t.content_idx==n));return r.length?"string"==typeof e?r.map((t=>{let e=t.elt;while(1==e.children.length&&e.firstChild.tagName&&"div"==e.firstChild.tagName.toLowerCase()&&!e.firstChild.getAttribute("style"))e=e.firstChild;return e.innerHTML})).join("")||!1:{template:e.template,props:{...e.props}}:(t=!0,!1)})).filter((t=>0!=t));t||(this.prevent_next_content_update_from_parent=!0),this.$emit("update:content",e)},process_current_text_style(){let t=!1;const e=window.getSelection();if(e.focusNode){const n=e.focusNode.tagName?e.focusNode:e.focusNode.parentElement;if(n&&n.isContentEditable){t=window.getComputedStyle(n),t.textDecorationStack=[],t.headerLevel=0,t.isList=!1;let e=n;while(e){const n=window.getComputedStyle(e);if(t.textDecorationStack.push(n.textDecoration),"list-item"==n.display&&(t.isList=!0),!t.headerLevel)for(let r=1;r<=6;r++)if(e.tagName.toUpperCase()=="H"+r){t.headerLevel=r;break}e=e.parentElement}}}this.current_text_style=t},page_style(t,e){const n=.2645833333333,r=this.page_format_mm[0]/n,o=10,i=(o+this.page_format_mm[0])*this.zoom/n,s=20,a=this.editor_width-2*s;let c,u,l,p,f,d,h,g=1;if("horizontal"==this.display)a>this.pages.length*i?(g=Math.floor(a/i),p=a/(2*g)*(1+2*t)-r/2):(g=this.pages.length,p=i*t+r/2*(this.zoom-1)),f=0,d=this.zoom*(this.page_format_mm[0]*g+(g-1)*o),h=this.page_format_mm[1]*this.zoom;else{g=Math.floor(a/i),(g<1||"vertical"==this.display)&&(g=1),c=t%g,u=a/(2*g)*(1+2*c)-r/2,l=Math.max(0,(r*this.zoom-a)/2),p=u+l,f=(this.page_format_mm[1]+o)*this.zoom*Math.floor(t/g);const e=Math.ceil(this.pages.length/g);d=this.zoom*(this.page_format_mm[0]*g+(g-1)*o),h=this.zoom*(this.page_format_mm[1]*e+(e-1)*o)}if(t>=0){const n={position:"absolute",left:"calc("+p+"px + "+s+"px)",top:"calc("+f+"mm + "+s+"px)",width:this.page_format_mm[0]+"mm",padding:"function"==typeof this.page_margins?this.page_margins(t+1,this.pages.length):this.page_margins,transform:"scale("+this.zoom+")"};return n[e?"minHeight":"height"]=this.page_format_mm[1]+"mm",n}return{width:"calc("+d+"mm + "+2*s+"px)",height:"calc("+h+"mm + "+2*s+"px)"}},css_to_string:t=>Object.entries(t).map((([t,e])=>t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+":"+e)).join(";"),update_pages_elts(){const t=[...this.$refs.content.children].filter((t=>!this.pages.find((e=>e.elt==t))));for(const e of t)e.remove();for(const[e,n]of this.pages.entries()){if(!n.elt){n.elt=document.createElement("div"),n.elt.className="page",n.elt.dataset.isVDEPage="";const t=this.pages[e+1];this.$refs.content.insertBefore(n.elt,t?t.elt:null)}n.elt.dataset.contentIdx=n.content_idx,this.printing_mode||(n.elt.style=Object.entries(this.page_style(e,!n.template)).map((([t,e])=>t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+":"+e)).join(";")),n.elt.contentEditable=!(!this.editable||n.template)}},update_editor_width(){this.$refs.editor.classList.add("hide_children"),this.editor_width=this.$refs.editor.clientWidth,this.update_pages_elts(),this.$refs.editor.classList.remove("hide_children")},update_css_media_style(){this.css_media_style.innerHTML="@media print { @page { size: "+this.page_format_mm[0]+"mm "+this.page_format_mm[1]+"mm; margin: 0 !important; } .hidden-print { display: none !important; } }"},before_print(){this.printing_mode=!0,this._page_body=document.body;const t=document.createElement("body");t.style.margin="0",t.style.padding="0",t.style.background="white",t.style.font=window.getComputedStyle(this.$refs.editor).font,t.className=this.$refs.editor.className;for(const[n,r]of this.pages.entries()){r.elt.style="",r.elt.style.position="relative",r.elt.style.padding="function"==typeof this.page_margins?this.page_margins(n+1,this.pages.length):this.page_margins,r.elt.style.breakBefore=n?"page":"auto",r.elt.style.overflow="hidden";const e=this.pages_overlay_refs[r.uuid];e&&(e.style.position="absolute",e.style.left="0",e.style.top="0",e.style.transform="none",e.style.padding="0",e.style.overflow="hidden",r.elt.prepend(e)),t.append(r.elt)}const e=document.createElement("div");e.className="hidden-print",e.style.position="fixed",e.style.left="0",e.style.top="0",e.style.right="0",e.style.bottom="0",e.style.display="flex",e.style.alignItems="center",e.style.justifyContent="center",e.style.background="rgba(255, 255, 255, 0.95)",e.style.cursor="pointer",e.innerHTML='<svg width="220" height="220"><path fill="rgba(0, 0, 0, 0.7)" d="M120.774,179.271v40c47.303,0,85.784-38.482,85.784-85.785c0-47.3-38.481-85.782-85.784-85.782H89.282L108.7,28.286L80.417,0L12.713,67.703l67.703,67.701l28.283-28.284L89.282,87.703h31.492c25.246,0,45.784,20.538,45.784,45.783C166.558,158.73,146.02,179.271,120.774,179.271z"/></svg>',e.addEventListener("click",this.after_print),t.append(e),document.body=t},after_print(){this.printing_mode=!1;for(const[t,e]of this.pages.entries()){e.elt.style=this.css_to_string(this.page_style(t,!e.template)),this.$refs.content.append(e.elt);const n=this.pages_overlay_refs[e.uuid];n&&(n.style=this.css_to_string(this.page_style(t,!1)),this.$refs.overlays.append(n))}document.body=this._page_body,this.update_editor_width()}},watch:{content:{handler(){this.prevent_next_content_update_from_parent?this.prevent_next_content_update_from_parent=!1:this.reset_content()},deep:!0},display:{handler(){this.update_pages_elts()}},page_format_mm:{handler(){this.update_css_media_style(),this.reset_content()}},page_margins:{handler(){this.reset_content()}},zoom:{handler(){this.update_pages_elts()}}}},h=r(3744);const g=(0,h.Z)(d,[["render",u],["__scopeId","data-v-5abf13c6"]]);var m=g,_=m}(),o=o["default"],o}()})); | ||
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e(require("vue")):"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["VueDocumentEditor"]=e(require("vue")):t["VueDocumentEditor"]=e(t["Vue"])})("undefined"!==typeof self?self:this,(function(t){return function(){var e={9662:function(t,e,n){var r=n(614),o=n(6330),i=TypeError;t.exports=function(t){if(r(t))return t;throw i(o(t)+" is not a function")}},9670:function(t,e,n){var r=n(111),o=String,i=TypeError;t.exports=function(t){if(r(t))return t;throw i(o(t)+" is not an object")}},1318:function(t,e,n){var r=n(5656),o=n(1400),i=n(6244),s=function(t){return function(e,n,s){var a,c=r(e),u=i(c),l=o(s,u);if(t&&n!=n){while(u>l)if(a=c[l++],a!=a)return!0}else for(;u>l;l++)if((t||l in c)&&c[l]===n)return t||l||0;return!t&&-1}};t.exports={includes:s(!0),indexOf:s(!1)}},3658:function(t,e,n){"use strict";var r=n(9781),o=n(3157),i=TypeError,s=Object.getOwnPropertyDescriptor,a=r&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}();t.exports=a?function(t,e){if(o(t)&&!s(t,"length").writable)throw i("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e}},4326:function(t,e,n){var r=n(1702),o=r({}.toString),i=r("".slice);t.exports=function(t){return i(o(t),8,-1)}},9920:function(t,e,n){var r=n(2597),o=n(3887),i=n(1236),s=n(3070);t.exports=function(t,e,n){for(var a=o(e),c=s.f,u=i.f,l=0;l<a.length;l++){var p=a[l];r(t,p)||n&&r(n,p)||c(t,p,u(e,p))}}},8880:function(t,e,n){var r=n(9781),o=n(3070),i=n(9114);t.exports=r?function(t,e,n){return o.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},9114:function(t){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},8052:function(t,e,n){var r=n(614),o=n(3070),i=n(6339),s=n(3072);t.exports=function(t,e,n,a){a||(a={});var c=a.enumerable,u=void 0!==a.name?a.name:e;if(r(n)&&i(n,u,a),a.global)c?t[e]=n:s(e,n);else{try{a.unsafe?t[e]&&(c=!0):delete t[e]}catch(l){}c?t[e]=n:o.f(t,e,{value:n,enumerable:!1,configurable:!a.nonConfigurable,writable:!a.nonWritable})}return t}},3072:function(t,e,n){var r=n(7854),o=Object.defineProperty;t.exports=function(t,e){try{o(r,t,{value:e,configurable:!0,writable:!0})}catch(n){r[t]=e}return e}},9781:function(t,e,n){var r=n(7293);t.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},4154:function(t){var e="object"==typeof document&&document.all,n="undefined"==typeof e&&void 0!==e;t.exports={all:e,IS_HTMLDDA:n}},317:function(t,e,n){var r=n(7854),o=n(111),i=r.document,s=o(i)&&o(i.createElement);t.exports=function(t){return s?i.createElement(t):{}}},7207:function(t){var e=TypeError,n=9007199254740991;t.exports=function(t){if(t>n)throw e("Maximum allowed index exceeded");return t}},8113:function(t){t.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},7392:function(t,e,n){var r,o,i=n(7854),s=n(8113),a=i.process,c=i.Deno,u=a&&a.versions||c&&c.version,l=u&&u.v8;l&&(r=l.split("."),o=r[0]>0&&r[0]<4?1:+(r[0]+r[1])),!o&&s&&(r=s.match(/Edge\/(\d+)/),(!r||r[1]>=74)&&(r=s.match(/Chrome\/(\d+)/),r&&(o=+r[1]))),t.exports=o},748:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},2109:function(t,e,n){var r=n(7854),o=n(1236).f,i=n(8880),s=n(8052),a=n(3072),c=n(9920),u=n(4705);t.exports=function(t,e){var n,l,p,f,d,h,g=t.target,m=t.global,_=t.stat;if(l=m?r:_?r[g]||a(g,{}):(r[g]||{}).prototype,l)for(p in e){if(d=e[p],t.dontCallGetSet?(h=o(l,p),f=h&&h.value):f=l[p],n=u(m?p:g+(_?".":"#")+p,t.forced),!n&&void 0!==f){if(typeof d==typeof f)continue;c(d,f)}(t.sham||f&&f.sham)&&i(d,"sham",!0),s(l,p,d,t)}}},7293:function(t){t.exports=function(t){try{return!!t()}catch(e){return!0}}},4374:function(t,e,n){var r=n(7293);t.exports=!r((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},6916:function(t,e,n){var r=n(4374),o=Function.prototype.call;t.exports=r?o.bind(o):function(){return o.apply(o,arguments)}},6530:function(t,e,n){var r=n(9781),o=n(2597),i=Function.prototype,s=r&&Object.getOwnPropertyDescriptor,a=o(i,"name"),c=a&&"something"===function(){}.name,u=a&&(!r||r&&s(i,"name").configurable);t.exports={EXISTS:a,PROPER:c,CONFIGURABLE:u}},1702:function(t,e,n){var r=n(4374),o=Function.prototype,i=o.call,s=r&&o.bind.bind(i,i);t.exports=r?s:function(t){return function(){return i.apply(t,arguments)}}},5005:function(t,e,n){var r=n(7854),o=n(614),i=function(t){return o(t)?t:void 0};t.exports=function(t,e){return arguments.length<2?i(r[t]):r[t]&&r[t][e]}},8173:function(t,e,n){var r=n(9662),o=n(8554);t.exports=function(t,e){var n=t[e];return o(n)?void 0:r(n)}},7854:function(t,e,n){var r=function(t){return t&&t.Math==Math&&t};t.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof n.g&&n.g)||function(){return this}()||this||Function("return this")()},2597:function(t,e,n){var r=n(1702),o=n(7908),i=r({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return i(o(t),e)}},3501:function(t){t.exports={}},4664:function(t,e,n){var r=n(9781),o=n(7293),i=n(317);t.exports=!r&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},8361:function(t,e,n){var r=n(1702),o=n(7293),i=n(4326),s=Object,a=r("".split);t.exports=o((function(){return!s("z").propertyIsEnumerable(0)}))?function(t){return"String"==i(t)?a(t,""):s(t)}:s},2788:function(t,e,n){var r=n(1702),o=n(614),i=n(5465),s=r(Function.toString);o(i.inspectSource)||(i.inspectSource=function(t){return s(t)}),t.exports=i.inspectSource},9909:function(t,e,n){var r,o,i,s=n(4811),a=n(7854),c=n(111),u=n(8880),l=n(2597),p=n(5465),f=n(6200),d=n(3501),h="Object already initialized",g=a.TypeError,m=a.WeakMap,_=function(t){return i(t)?o(t):r(t,{})},y=function(t){return function(e){var n;if(!c(e)||(n=o(e)).type!==t)throw g("Incompatible receiver, "+t+" required");return n}};if(s||p.state){var v=p.state||(p.state=new m);v.get=v.get,v.has=v.has,v.set=v.set,r=function(t,e){if(v.has(t))throw g(h);return e.facade=t,v.set(t,e),e},o=function(t){return v.get(t)||{}},i=function(t){return v.has(t)}}else{var b=f("state");d[b]=!0,r=function(t,e){if(l(t,b))throw g(h);return e.facade=t,u(t,b,e),e},o=function(t){return l(t,b)?t[b]:{}},i=function(t){return l(t,b)}}t.exports={set:r,get:o,has:i,enforce:_,getterFor:y}},3157:function(t,e,n){var r=n(4326);t.exports=Array.isArray||function(t){return"Array"==r(t)}},614:function(t,e,n){var r=n(4154),o=r.all;t.exports=r.IS_HTMLDDA?function(t){return"function"==typeof t||t===o}:function(t){return"function"==typeof t}},4705:function(t,e,n){var r=n(7293),o=n(614),i=/#|\.prototype\./,s=function(t,e){var n=c[a(t)];return n==l||n!=u&&(o(e)?r(e):!!e)},a=s.normalize=function(t){return String(t).replace(i,".").toLowerCase()},c=s.data={},u=s.NATIVE="N",l=s.POLYFILL="P";t.exports=s},8554:function(t){t.exports=function(t){return null===t||void 0===t}},111:function(t,e,n){var r=n(614),o=n(4154),i=o.all;t.exports=o.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:r(t)||t===i}:function(t){return"object"==typeof t?null!==t:r(t)}},1913:function(t){t.exports=!1},2190:function(t,e,n){var r=n(5005),o=n(614),i=n(7976),s=n(3307),a=Object;t.exports=s?function(t){return"symbol"==typeof t}:function(t){var e=r("Symbol");return o(e)&&i(e.prototype,a(t))}},6244:function(t,e,n){var r=n(7466);t.exports=function(t){return r(t.length)}},6339:function(t,e,n){var r=n(1702),o=n(7293),i=n(614),s=n(2597),a=n(9781),c=n(6530).CONFIGURABLE,u=n(2788),l=n(9909),p=l.enforce,f=l.get,d=String,h=Object.defineProperty,g=r("".slice),m=r("".replace),_=r([].join),y=a&&!o((function(){return 8!==h((function(){}),"length",{value:8}).length})),v=String(String).split("String"),b=t.exports=function(t,e,n){"Symbol("===g(d(e),0,7)&&(e="["+m(d(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!s(t,"name")||c&&t.name!==e)&&(a?h(t,"name",{value:e,configurable:!0}):t.name=e),y&&n&&s(n,"arity")&&t.length!==n.arity&&h(t,"length",{value:n.arity});try{n&&s(n,"constructor")&&n.constructor?a&&h(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(o){}var r=p(t);return s(r,"source")||(r.source=_(v,"string"==typeof e?e:"")),t};Function.prototype.toString=b((function(){return i(this)&&f(this).source||u(this)}),"toString")},4758:function(t){var e=Math.ceil,n=Math.floor;t.exports=Math.trunc||function(t){var r=+t;return(r>0?n:e)(r)}},3070:function(t,e,n){var r=n(9781),o=n(4664),i=n(3353),s=n(9670),a=n(4948),c=TypeError,u=Object.defineProperty,l=Object.getOwnPropertyDescriptor,p="enumerable",f="configurable",d="writable";e.f=r?i?function(t,e,n){if(s(t),e=a(e),s(n),"function"===typeof t&&"prototype"===e&&"value"in n&&d in n&&!n[d]){var r=l(t,e);r&&r[d]&&(t[e]=n.value,n={configurable:f in n?n[f]:r[f],enumerable:p in n?n[p]:r[p],writable:!1})}return u(t,e,n)}:u:function(t,e,n){if(s(t),e=a(e),s(n),o)try{return u(t,e,n)}catch(r){}if("get"in n||"set"in n)throw c("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},1236:function(t,e,n){var r=n(9781),o=n(6916),i=n(5296),s=n(9114),a=n(5656),c=n(4948),u=n(2597),l=n(4664),p=Object.getOwnPropertyDescriptor;e.f=r?p:function(t,e){if(t=a(t),e=c(e),l)try{return p(t,e)}catch(n){}if(u(t,e))return s(!o(i.f,t,e),t[e])}},8006:function(t,e,n){var r=n(6324),o=n(748),i=o.concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,i)}},5181:function(t,e){e.f=Object.getOwnPropertySymbols},7976:function(t,e,n){var r=n(1702);t.exports=r({}.isPrototypeOf)},6324:function(t,e,n){var r=n(1702),o=n(2597),i=n(5656),s=n(1318).indexOf,a=n(3501),c=r([].push);t.exports=function(t,e){var n,r=i(t),u=0,l=[];for(n in r)!o(a,n)&&o(r,n)&&c(l,n);while(e.length>u)o(r,n=e[u++])&&(~s(l,n)||c(l,n));return l}},5296:function(t,e){"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,o=r&&!n.call({1:2},1);e.f=o?function(t){var e=r(this,t);return!!e&&e.enumerable}:n},2140:function(t,e,n){var r=n(6916),o=n(614),i=n(111),s=TypeError;t.exports=function(t,e){var n,a;if("string"===e&&o(n=t.toString)&&!i(a=r(n,t)))return a;if(o(n=t.valueOf)&&!i(a=r(n,t)))return a;if("string"!==e&&o(n=t.toString)&&!i(a=r(n,t)))return a;throw s("Can't convert object to primitive value")}},3887:function(t,e,n){var r=n(5005),o=n(1702),i=n(8006),s=n(5181),a=n(9670),c=o([].concat);t.exports=r("Reflect","ownKeys")||function(t){var e=i.f(a(t)),n=s.f;return n?c(e,n(t)):e}},4488:function(t,e,n){var r=n(8554),o=TypeError;t.exports=function(t){if(r(t))throw o("Can't call method on "+t);return t}},6200:function(t,e,n){var r=n(2309),o=n(9711),i=r("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},5465:function(t,e,n){var r=n(7854),o=n(3072),i="__core-js_shared__",s=r[i]||o(i,{});t.exports=s},2309:function(t,e,n){var r=n(1913),o=n(5465);(t.exports=function(t,e){return o[t]||(o[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.30.2",mode:r?"pure":"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.30.2/LICENSE",source:"https://github.com/zloirock/core-js"})},6293:function(t,e,n){var r=n(7392),o=n(7293),i=n(7854),s=i.String;t.exports=!!Object.getOwnPropertySymbols&&!o((function(){var t=Symbol();return!s(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},1400:function(t,e,n){var r=n(9303),o=Math.max,i=Math.min;t.exports=function(t,e){var n=r(t);return n<0?o(n+e,0):i(n,e)}},5656:function(t,e,n){var r=n(8361),o=n(4488);t.exports=function(t){return r(o(t))}},9303:function(t,e,n){var r=n(4758);t.exports=function(t){var e=+t;return e!==e||0===e?0:r(e)}},7466:function(t,e,n){var r=n(9303),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},7908:function(t,e,n){var r=n(4488),o=Object;t.exports=function(t){return o(r(t))}},7593:function(t,e,n){var r=n(6916),o=n(111),i=n(2190),s=n(8173),a=n(2140),c=n(5112),u=TypeError,l=c("toPrimitive");t.exports=function(t,e){if(!o(t)||i(t))return t;var n,c=s(t,l);if(c){if(void 0===e&&(e="default"),n=r(c,t,e),!o(n)||i(n))return n;throw u("Can't convert object to primitive value")}return void 0===e&&(e="number"),a(t,e)}},4948:function(t,e,n){var r=n(7593),o=n(2190);t.exports=function(t){var e=r(t,"string");return o(e)?e:e+""}},6330:function(t){var e=String;t.exports=function(t){try{return e(t)}catch(n){return"Object"}}},9711:function(t,e,n){var r=n(1702),o=0,i=Math.random(),s=r(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+s(++o+i,36)}},3307:function(t,e,n){var r=n(6293);t.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},3353:function(t,e,n){var r=n(9781),o=n(7293);t.exports=r&&o((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},4811:function(t,e,n){var r=n(7854),o=n(614),i=r.WeakMap;t.exports=o(i)&&/native code/.test(String(i))},5112:function(t,e,n){var r=n(7854),o=n(2309),i=n(2597),s=n(9711),a=n(6293),c=n(3307),u=r.Symbol,l=o("wks"),p=c?u["for"]||u:u&&u.withoutSetter||s;t.exports=function(t){return i(l,t)||(l[t]=a&&i(u,t)?u[t]:p("Symbol."+t)),l[t]}},7658:function(t,e,n){"use strict";var r=n(2109),o=n(7908),i=n(6244),s=n(3658),a=n(7207),c=n(7293),u=c((function(){return 4294967297!==[].push.call({length:4294967296},1)})),l=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(t){return t instanceof TypeError}},p=u||!l();r({target:"Array",proto:!0,arity:1,forced:p},{push:function(t){var e=o(this),n=i(e),r=arguments.length;a(n+r);for(var c=0;c<r;c++)e[n]=arguments[c],n++;return s(e,n),n}})},3744:function(t,e){"use strict";e.Z=(t,e)=>{const n=t.__vccOpts||t;for(const[r,o]of e)n[r]=o;return n}},7203:function(e){"use strict";e.exports=t}},n={};function r(t){var o=n[t];if(void 0!==o)return o.exports;var i=n[t]={exports:{}};return e[t].call(i.exports,i,i.exports,r),i.exports}!function(){r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})}}(),function(){r.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"===typeof window)return window}}()}(),function(){r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}}(),function(){r.p=""}();var o={};return function(){"use strict";if(r.d(o,{default:function(){return _}}),"undefined"!==typeof window){var t=window.document.currentScript,e=t&&t.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);e&&(r.p=e[1])}var n=r(7203);const i={class:"editor",ref:"editor"},s={key:0,class:"overlays",ref:"overlays"},a=["innerHTML"],c=["contenteditable"];function u(t,e,r,o,u,l){return(0,n.openBlock)(),(0,n.createElementBlock)("div",i,[r.overlay?((0,n.openBlock)(),(0,n.createElementBlock)("div",s,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(u.pages,((t,e)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"overlay",key:t.uuid+"-overlay",ref_for:!0,ref:e=>u.pages_overlay_refs[t.uuid]=e,innerHTML:r.overlay(e+1,u.pages.length),style:(0,n.normalizeStyle)(l.page_style(e,!1))},null,12,a)))),128))],512)):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",{class:"content",ref:"content",contenteditable:r.editable,style:(0,n.normalizeStyle)(l.page_style(-1)),onInput:e[0]||(e[0]=(...t)=>l.input&&l.input(...t)),onKeyup:e[1]||(e[1]=(...t)=>l.process_current_text_style&&l.process_current_text_style(...t)),onKeydown:e[2]||(e[2]=(...t)=>l.keydown&&l.keydown(...t))},null,44,c)],512)}r(7658);function l(t,e){if(!t||!e)return!1;const n=t.childNodes;for(let r=0;r<n.length;r++)if(n[r].s_tag==e)return n[r];return!1}function p(t,e,n,r,o){while(t.childNodes.length&&!n()){o=o||1!=t.childNodes.length;const i=t.lastChild;if(i.nodeType==Node.TEXT_NODE){const t=i.textContent.match(/(\s|\S+)/g),r=document.createTextNode("");e.prepend(r);const s=t?t.length:0;for(let e=0;e<s;e++){if(e==s-1&&!o)return;if(i.textContent=t.slice(0,s-e-1).join(""),r.textContent=t.slice(s-e-1,s).join(""),n())return}}else if(!i.childNodes.length||i.tagName.match(/h\d/i)||i.tagName.match(/tr/i)||"function"===typeof r&&r(i)){if(!o)return void console.log("Move-forward: first child reached with no stop condition. Aborting");e.prepend(i)}else{let t=l(e,i.s_tag);if(!t){if(!i.s_tag){const t=Math.random().toString(36).slice(2,8);i.s_tag=t}t=i.cloneNode(!1),t.s_tag=i.s_tag,e.prepend(t)}p(i,t,n,r,o),t.normalize()}if(t.contains(i))if(0==i.childNodes.length||""==i.innerHTML)t.removeChild(i);else if(!n())throw console.log("sub_child:",i,"that is in child:",t),Error("Document editor is trying to remove a non-empty sub-child. This is a bug and should not happen. Please report a repeatable set of actions that leaded to this error to https://github.com/motla/vue-document-editor/issues/new")}}function f(t,e,n){while(!n()){const n=e.firstChild;var r=(t,e)=>{const n=l(t,e.s_tag);n&&e.childNodes.length?r(n,e.firstChild):(t.append(e),t.normalize())};r(t,n)}}var d={props:{content:{type:Array,required:!0},display:{type:String,default:"grid"},editable:{type:Boolean,default:!0},overlay:Function,page_format_mm:{type:Array,default:()=>[210,297]},page_margins:{type:[String,Function],default:"10mm 15mm"},zoom:{type:Number,default:1},do_not_break:Function},data(){return{pages:[],pages_overlay_refs:{},pages_height:0,editor_width:0,prevent_next_content_update_from_parent:!1,current_text_style:!1,printing_mode:!1}},mounted(){this.update_editor_width(),this.update_css_media_style(),this.reset_content(),window.addEventListener("resize",this.update_editor_width),window.addEventListener("click",this.process_current_text_style),window.addEventListener("beforeprint",this.before_print),window.addEventListener("afterprint",this.after_print)},beforeUpdate(){this.pages_overlay_refs=[]},beforeUnmount(){window.removeEventListener("resize",this.update_editor_width),window.removeEventListener("click",this.process_current_text_style),window.removeEventListener("beforeprint",this.before_print),window.removeEventListener("afterprint",this.after_print)},computed:{css_media_style(){const t=document.createElement("style");return document.head.appendChild(t),t}},methods:{new_uuid:()=>Math.random().toString(36).slice(-5),reset_content(){if(this.reset_in_progress)return;if(this.reset_in_progress=!0,!this.content.length)return this.reset_in_progress=!1,void this.$emit("update:content",[""]);this.pages=this.content.map(((t,e)=>({uuid:this.new_uuid(),content_idx:e,template:t.template,props:t.props}))),this.update_pages_elts();const t=this.pages[0].elt;this.$refs.content.contains(t)||this.$refs.content.appendChild(t),this.pages_height=t.clientHeight+1;for(const e of this.pages){if(this.content[e.content_idx]){if("string"==typeof this.content[e.content_idx])e.elt.innerHTML="<div>"+this.content[e.content_idx]+"</div>";else if(e.template){const t=(0,n.defineCustomElement)(e.template);customElements.define("component-"+e.uuid,t),e.elt.appendChild(new t({modelValue:e.props}))}}else e.elt.innerHTML="<div><br></div>";this.$refs.content.contains(e.elt)||this.$refs.content.appendChild(e.elt)}this.fit_content_over_pages(),this.$refs.content.blur(),this.reset_in_progress=!1},fit_content_over_pages(){if(!this.pages_height)return;if(this.fit_in_progress)return;this.fit_in_progress=!0;for(let o=this.pages.length-1;o>=0;o--){const t=this.pages[o];t.elt&&document.body.contains(t.elt)||this.pages.splice(o,1)}if(!this.pages.length)return void this.$emit("update:content",[""]);const t=window.getSelection(),e=document.createElement("null"),n=document.createElement("null");if(t&&t.rangeCount&&t.anchorNode&&(!t.anchorNode.dataset||null==t.anchorNode.dataset.isVDEPage)){const r=t.getRangeAt(0);r.insertNode(e),r.collapse(!1),r.insertNode(n)}let r=!1;for(let o=0;o<this.pages.length;o++){const t=this.pages[o];let e=this.pages[o+1],n=e?e.elt:null;!t.template&&(r||t.elt.innerHTML!=t.prev_innerHTML||n&&!e.template&&n.innerHTML!=e.prev_innerHTML)&&(r=!0,t.elt.clientHeight<=this.pages_height&&e&&e.content_idx==t.content_idx&&f(t.elt,n,(()=>!n.childNodes.length||t.elt.clientHeight>this.pages_height)),t.elt.clientHeight>this.pages_height&&(e&&e.content_idx==t.content_idx||(e={uuid:this.new_uuid(),content_idx:t.content_idx},this.pages.splice(o+1,0,e),this.update_pages_elts(),n=e.elt),p(t.elt,n,(()=>t.elt.clientHeight<=this.pages_height),this.do_not_break)),n&&e.content_idx==t.content_idx&&!n.childNodes.length&&this.pages.splice(o+1,1)),this.update_pages_elts()}if(document.body.contains(e)){const r=document.createRange();r.setStart(e,0),document.body.contains(n)&&r.setEnd(n,0),t.removeAllRanges(),t.addRange(r)}e.parentElement&&e.parentElement.removeChild(e),n.parentElement&&n.parentElement.removeChild(n);for(const o of this.pages)o.template||o.elt.normalize(),o.prev_innerHTML=o.elt.innerHTML;this.fit_in_progress=!1},input(t){t&&(this.fit_content_over_pages(),this.emit_new_content(),"insertText"!=t.inputType&&this.process_current_text_style())},keydown(t){if(8==t.keyCode&&this.content.length<=1&&"string"==typeof this.content[0]){const e=this.content[0].replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,"");e||t.preventDefault()}},emit_new_content(){let t=!1;const e=this.content.map(((e,n)=>{const r=this.pages.filter((t=>t.content_idx==n));return r.length?"string"==typeof e?r.map((t=>{let e=t.elt;while(1==e.children.length&&e.firstChild.tagName&&"div"==e.firstChild.tagName.toLowerCase()&&!e.firstChild.getAttribute("style"))e=e.firstChild;return e.innerHTML})).join("")||!1:{template:e.template,props:{...e.props}}:(t=!0,!1)})).filter((t=>0!=t));t||(this.prevent_next_content_update_from_parent=!0),this.$emit("update:content",e)},process_current_text_style(){let t=!1;const e=window.getSelection();if(e.focusNode){const n=e.focusNode.tagName?e.focusNode:e.focusNode.parentElement;if(n&&n.isContentEditable){t=window.getComputedStyle(n),t.textDecorationStack=[],t.headerLevel=0,t.isList=!1;let e=n;while(e){const n=window.getComputedStyle(e);if(t.textDecorationStack.push(n.textDecoration),"list-item"==n.display&&(t.isList=!0),!t.headerLevel)for(let r=1;r<=6;r++)if(e.tagName.toUpperCase()=="H"+r){t.headerLevel=r;break}e=e.parentElement}}}this.current_text_style=t},page_style(t,e){const n=.2645833333333,r=this.page_format_mm[0]/n,o=10,i=(o+this.page_format_mm[0])*this.zoom/n,s=20,a=this.editor_width-2*s;let c,u,l,p,f,d,h,g=1;if("horizontal"==this.display)a>this.pages.length*i?(g=Math.floor(a/i),p=a/(2*g)*(1+2*t)-r/2):(g=this.pages.length,p=i*t+r/2*(this.zoom-1)),f=0,d=this.zoom*(this.page_format_mm[0]*g+(g-1)*o),h=this.page_format_mm[1]*this.zoom;else{g=Math.floor(a/i),(g<1||"vertical"==this.display)&&(g=1),c=t%g,u=a/(2*g)*(1+2*c)-r/2,l=Math.max(0,(r*this.zoom-a)/2),p=u+l,f=(this.page_format_mm[1]+o)*this.zoom*Math.floor(t/g);const e=Math.ceil(this.pages.length/g);d=this.zoom*(this.page_format_mm[0]*g+(g-1)*o),h=this.zoom*(this.page_format_mm[1]*e+(e-1)*o)}if(t>=0){const n={position:"absolute",left:"calc("+p+"px + "+s+"px)",top:"calc("+f+"mm + "+s+"px)",width:this.page_format_mm[0]+"mm",padding:"function"==typeof this.page_margins?this.page_margins(t+1,this.pages.length):this.page_margins,transform:"scale("+this.zoom+")"};return n[e?"minHeight":"height"]=this.page_format_mm[1]+"mm",n}return{width:"calc("+d+"mm + "+2*s+"px)",height:"calc("+h+"mm + "+2*s+"px)"}},css_to_string:t=>Object.entries(t).map((([t,e])=>t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+":"+e)).join(";"),update_pages_elts(){const t=[...this.$refs.content.children].filter((t=>!this.pages.find((e=>e.elt==t))));for(const e of t)e.remove();for(const[e,n]of this.pages.entries()){if(!n.elt){n.elt=document.createElement("div"),n.elt.className="page",n.elt.dataset.isVDEPage="";const t=this.pages[e+1];this.$refs.content.insertBefore(n.elt,t?t.elt:null)}n.elt.dataset.contentIdx=n.content_idx,this.printing_mode||(n.elt.style=Object.entries(this.page_style(e,!n.template)).map((([t,e])=>t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+":"+e)).join(";")),n.elt.contentEditable=!(!this.editable||n.template)}},update_editor_width(){this.$refs.editor.classList.add("hide_children"),this.editor_width=this.$refs.editor.clientWidth,this.update_pages_elts(),this.$refs.editor.classList.remove("hide_children")},update_css_media_style(){this.css_media_style.innerHTML="@media print { @page { size: "+this.page_format_mm[0]+"mm "+this.page_format_mm[1]+"mm; margin: 0 !important; } .hidden-print { display: none !important; } }"},before_print(){this.printing_mode=!0,this._page_body=document.body;const t=document.createElement("body");t.style.margin="0",t.style.padding="0",t.style.background="white",t.style.font=window.getComputedStyle(this.$refs.editor).font,t.className=this.$refs.editor.className;for(const[n,r]of this.pages.entries()){r.elt.style="",r.elt.style.position="relative",r.elt.style.padding="function"==typeof this.page_margins?this.page_margins(n+1,this.pages.length):this.page_margins,r.elt.style.breakBefore=n?"page":"auto",r.elt.style.width="calc("+this.page_format_mm[0]+"mm - 2px)",r.elt.style.height="calc("+this.page_format_mm[1]+"mm - 2px)",r.elt.style.boxSizing="border-box",r.elt.style.overflow="hidden";const e=this.pages_overlay_refs[r.uuid];e&&(e.style.position="absolute",e.style.left="0",e.style.top="0",e.style.transform="none",e.style.padding="0",e.style.overflow="hidden",r.elt.prepend(e)),t.append(r.elt)}const e=document.createElement("div");e.className="hidden-print",e.style.position="fixed",e.style.left="0",e.style.top="0",e.style.right="0",e.style.bottom="0",e.style.display="flex",e.style.alignItems="center",e.style.justifyContent="center",e.style.background="rgba(255, 255, 255, 0.95)",e.style.cursor="pointer",e.innerHTML='<svg width="220" height="220"><path fill="rgba(0, 0, 0, 0.7)" d="M120.774,179.271v40c47.303,0,85.784-38.482,85.784-85.785c0-47.3-38.481-85.782-85.784-85.782H89.282L108.7,28.286L80.417,0L12.713,67.703l67.703,67.701l28.283-28.284L89.282,87.703h31.492c25.246,0,45.784,20.538,45.784,45.783C166.558,158.73,146.02,179.271,120.774,179.271z"/></svg>',e.addEventListener("click",this.after_print),t.append(e),document.body=t},after_print(){this.printing_mode=!1;for(const[t,e]of this.pages.entries()){e.elt.style=this.css_to_string(this.page_style(t,!e.template)),this.$refs.content.append(e.elt);const n=this.pages_overlay_refs[e.uuid];n&&(n.style=this.css_to_string(this.page_style(t,!1)),this.$refs.overlays.append(n))}document.body=this._page_body,this.update_editor_width()}},watch:{content:{handler(){this.prevent_next_content_update_from_parent?this.prevent_next_content_update_from_parent=!1:this.reset_content()},deep:!0},display:{handler(){this.update_pages_elts()}},page_format_mm:{handler(){this.update_css_media_style(),this.reset_content()}},page_margins:{handler(){this.reset_content()}},zoom:{handler(){this.update_pages_elts()}}}},h=r(3744);const g=(0,h.Z)(d,[["render",u],["__scopeId","data-v-604af7f9"]]);var m=g,_=m}(),o=o["default"],o}()})); | ||
//# sourceMappingURL=VueDocumentEditor.umd.min.js.map |
{ | ||
"name": "vue-document-editor", | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"description": "Paper-sized WYSIWYG document editor for Vue apps", | ||
@@ -5,0 +5,0 @@ "author": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
3758803
5035
654