vue-document-editor
Advanced tools
Comparing version 2.0.7 to 2.1.0
@@ -7,6 +7,8 @@ <div align="center"> | ||
###### :speech_balloon: This is the API for Vue3. [For Vue2, check the vue2 branch](https://github.com/motla/vue-document-editor/blob/vue2/API.md). | ||
## Props | ||
- **v-model:content**: `Array` (required) | ||
*Contains the initial document content. Each array item is a new set of pages containing the item. An item can either be an HTML string or this object `{ template: markRaw(YourComponent), props: {} }` for interactive templates (see [Demo.vue](src/Demo/Demo.vue) and [InvoiceTemplate.vue](src/Demo/InvoiceTemplate.vue) for an example). If an HTML content is too large, it will be split over multiple pages. On the contrary, interactive templates take one full page and any overflow is hidden. You can always restrict the edition of some content inside a page by setting `contenteditable="false"` to some HTML tags.* | ||
*Contains the initial document content. Each array item is a new set of pages containing the item. An item can either be an HTML string or this object `{ template: markRaw(YourComponent), props: {} }` for interactive templates (see [Demo.vue](src/Demo/Demo.vue) and [InvoiceTemplate.ce.vue](src/Demo/InvoiceTemplate.ce.vue) for an example). If your template contains custom CSS, you must name it with the `.ce.vue` extension ([more info here](https://vuejs.org/guide/extras/web-components.html#sfc-as-custom-element)). If an HTML content is too large, it will be split over multiple pages. On the contrary, interactive templates take one full page and any overflow is hidden. You can always restrict the edition of some content inside a page by setting `contenteditable="false"` to some HTML tags.* | ||
@@ -41,2 +43,2 @@ - **display**: `"grid"(default), "horizontal", "vertical"` - *Display mode for the pages.* | ||
###### :speech_balloon: If you need some variables that are missing, edit [the stylesheet](src/DocumentEditor/imports/doc-editor-default-styles.scss) then submit a PR, or overwrite styles using `!important` | ||
###### :speech_balloon: If you need some variables that are missing, edit [the stylesheet](src/DocumentEditor/DocumentEditor.vue#L563) then submit a PR, or overwrite styles using `!important` |
@@ -0,1 +1,10 @@ | ||
## v2.1.0 | ||
- This library core has been rewritten for Vue3 using an hoisted static `<div>` for pages content to manage page manually and avoid conflicts between DOM contenteditable elements and Vue.js. [More info here](https://vuejs.org/guide/extras/rendering-mechanism.html#static-hoisting) | ||
- SCSS has been converted to basic CSS, so you don't have to install a SCSS compiler anymore | ||
- Updating dependencies | ||
- Removing ESLint for a lighter project | ||
- Fix [Issue 16](https://github.com/motla/vue-document-editor/issues/16): The component breaks if you remove all the content | ||
- :warning: Warning: starting from this version, the new core implies that for using templates with custom CSS you must rename your single file components with `.ce.vue` extension. [More info here](https://vuejs.org/guide/extras/web-components.html#sfc-as-custom-element) | ||
## v2.0.7 | ||
@@ -2,0 +11,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")}},6077:function(t,e,n){var r=n(614),o=String,i=TypeError;t.exports=function(t){if("object"==typeof t||r(t))return t;throw i("Can't set "+o(t)+" as a prototype")}},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),f=o(s,u);if(t&&n!=n){while(u>f)if(a=c[f++],a!=a)return!0}else for(;u>f;f++)if((t||f in c)&&c[f]===n)return t||f||0;return!t&&-1}};t.exports={includes:s(!0),indexOf:s(!1)}},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)}},648:function(t,e,n){var r=n(1694),o=n(614),i=n(4326),s=n(5112),a=s("toStringTag"),c=Object,u="Arguments"==i(function(){return arguments}()),f=function(t,e){try{return t[e]}catch(n){}};t.exports=r?i:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=f(e=c(t),a))?n:u?i(e):"Object"==(r=i(e))&&o(e.callee)?"Arguments":r}},7741:function(t,e,n){var r=n(1702),o=Error,i=r("".replace),s=function(t){return String(o(t).stack)}("zxcasd"),a=/\n\s*at [^:]*:[^\n]*/,c=a.test(s);t.exports=function(t,e){if(c&&"string"==typeof t&&!o.prepareStackTrace)while(e--)t=i(t,a,"");return t}},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,f=0;f<a.length;f++){var p=a[f];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(f){}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]}))},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):{}}},8113:function(t,e,n){var r=n(5005);t.exports=r("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,f=u&&u.v8;f&&(r=f.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"]},2914:function(t,e,n){var r=n(7293),o=n(9114);t.exports=!r((function(){var t=Error("a");return!("stack"in t)||(Object.defineProperty(t,"stack",o(1,7)),7!==t.stack)}))},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,f,p,l,d,h,g=t.target,m=t.global,y=t.stat;if(f=m?r:y?r[g]||a(g,{}):(r[g]||{}).prototype,f)for(p in e){if(d=e[p],t.dontCallGetSet?(h=o(f,p),l=h&&h.value):l=f[p],n=u(m?p:g+(y?".":"#")+p,t.forced),!n&&void 0!==l){if(typeof d==typeof l)continue;c(d,l)}(t.sham||l&&l.sham)&&i(d,"sham",!0),s(f,p,d,t)}}},7293:function(t){t.exports=function(t){try{return!!t()}catch(e){return!0}}},2104:function(t,e,n){var r=n(4374),o=Function.prototype,i=o.apply,s=o.call;t.exports="object"==typeof Reflect&&Reflect.apply||(r?s.bind(i):function(){return s.apply(i,arguments)})},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.bind,s=o.call,a=r&&i.bind(s,s);t.exports=r?function(t){return t&&a(t)}:function(t){return t&&function(){return s.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);t.exports=function(t,e){var n=t[e];return null==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}()||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},9587:function(t,e,n){var r=n(614),o=n(111),i=n(7674);t.exports=function(t,e,n){var s,a;return i&&r(s=e.constructor)&&s!==n&&o(a=s.prototype)&&a!==n.prototype&&i(t,a),t}},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},8340:function(t,e,n){var r=n(111),o=n(8880);t.exports=function(t,e){r(e)&&"cause"in e&&o(t,"cause",e.cause)}},9909:function(t,e,n){var r,o,i,s=n(8536),a=n(7854),c=n(1702),u=n(111),f=n(8880),p=n(2597),l=n(5465),d=n(6200),h=n(3501),g="Object already initialized",m=a.TypeError,y=a.WeakMap,v=function(t){return i(t)?o(t):r(t,{})},_=function(t){return function(e){var n;if(!u(e)||(n=o(e)).type!==t)throw m("Incompatible receiver, "+t+" required");return n}};if(s||l.state){var b=l.state||(l.state=new y),x=c(b.get),w=c(b.has),E=c(b.set);r=function(t,e){if(w(b,t))throw new m(g);return e.facade=t,E(b,t,e),e},o=function(t){return x(b,t)||{}},i=function(t){return w(b,t)}}else{var S=d("state");h[S]=!0,r=function(t,e){if(p(t,S))throw new m(g);return e.facade=t,f(t,S,e),e},o=function(t){return p(t,S)?t[S]:{}},i=function(t){return p(t,S)}}t.exports={set:r,get:o,has:i,enforce:v,getterFor:_}},614:function(t){t.exports=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==f||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",f=s.POLYFILL="P";t.exports=s},111:function(t,e,n){var r=n(614);t.exports=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(7293),o=n(614),i=n(2597),s=n(9781),a=n(6530).CONFIGURABLE,c=n(2788),u=n(9909),f=u.enforce,p=u.get,l=Object.defineProperty,d=s&&!r((function(){return 8!==l((function(){}),"length",{value:8}).length})),h=String(String).split("String"),g=t.exports=function(t,e,n){"Symbol("===String(e).slice(0,7)&&(e="["+String(e).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!i(t,"name")||a&&t.name!==e)&&(s?l(t,"name",{value:e,configurable:!0}):t.name=e),d&&n&&i(n,"arity")&&t.length!==n.arity&&l(t,"length",{value:n.arity});try{n&&i(n,"constructor")&&n.constructor?s&&l(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(o){}var r=f(t);return i(r,"source")||(r.source=h.join("string"==typeof e?e:"")),t};Function.prototype.toString=g((function(){return o(this)&&p(this).source||c(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)}},133:function(t,e,n){var r=n(7392),o=n(7293);t.exports=!!Object.getOwnPropertySymbols&&!o((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},8536:function(t,e,n){var r=n(7854),o=n(614),i=n(2788),s=r.WeakMap;t.exports=o(s)&&/native code/.test(i(s))},6277:function(t,e,n){var r=n(1340);t.exports=function(t,e){return void 0===t?arguments.length<2?"":e:r(t)}},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,f=Object.getOwnPropertyDescriptor,p="enumerable",l="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=f(t,e);r&&r[d]&&(t[e]=n.value,n={configurable:l in n?n[l]:r[l],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),f=n(4664),p=Object.getOwnPropertyDescriptor;e.f=r?p:function(t,e){if(t=a(t),e=c(e),f)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,f=[];for(n in r)!o(a,n)&&o(r,n)&&c(f,n);while(e.length>u)o(r,n=e[u++])&&(~s(f,n)||c(f,n));return f}},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},7674:function(t,e,n){var r=n(1702),o=n(9670),i=n(6077);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{t=r(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),t(n,[]),e=n instanceof Array}catch(s){}return function(n,r){return o(n),i(r),e?t(n,r):n.__proto__=r,n}}():void 0)},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}},2626:function(t,e,n){var r=n(3070).f;t.exports=function(t,e,n){n in t||r(t,n,{configurable:!0,get:function(){return e[n]},set:function(t){e[n]=t}})}},4488:function(t){var e=TypeError;t.exports=function(t){if(void 0==t)throw e("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.24.1",mode:r?"pure":"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.24.1/LICENSE",source:"https://github.com/zloirock/core-js"})},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,f=c("toPrimitive");t.exports=function(t,e){if(!o(t)||i(t))return t;var n,c=s(t,f);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+""}},1694:function(t,e,n){var r=n(5112),o=r("toStringTag"),i={};i[o]="z",t.exports="[object z]"===String(i)},1340:function(t,e,n){var r=n(648),o=String;t.exports=function(t){if("Symbol"===r(t))throw TypeError("Cannot convert a Symbol value to a string");return o(t)}},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(133);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}))},5112:function(t,e,n){var r=n(7854),o=n(2309),i=n(2597),s=n(9711),a=n(133),c=n(3307),u=o("wks"),f=r.Symbol,p=f&&f["for"],l=c?f:f&&f.withoutSetter||s;t.exports=function(t){if(!i(u,t)||!a&&"string"!=typeof u[t]){var e="Symbol."+t;a&&i(f,t)?u[t]=f[t]:u[t]=c&&p?p(e):l(e)}return u[t]}},9191:function(t,e,n){"use strict";var r=n(5005),o=n(2597),i=n(8880),s=n(7976),a=n(7674),c=n(9920),u=n(2626),f=n(9587),p=n(6277),l=n(8340),d=n(7741),h=n(2914),g=n(9781),m=n(1913);t.exports=function(t,e,n,y){var v="stackTraceLimit",_=y?2:1,b=t.split("."),x=b[b.length-1],w=r.apply(null,b);if(w){var E=w.prototype;if(!m&&o(E,"cause")&&delete E.cause,!n)return w;var S=r("Error"),O=e((function(t,e){var n=p(y?e:t,void 0),r=y?new w(t):new w;return void 0!==n&&i(r,"message",n),h&&i(r,"stack",d(r.stack,2)),this&&s(E,this)&&f(r,this,O),arguments.length>_&&l(r,arguments[_]),r}));if(O.prototype=E,"Error"!==x?a?a(O,S):c(O,S,{name:!0}):g&&v in w&&(u(O,w,v),u(O,w,"prepareStackTrace")),c(O,w),!m)try{E.name!==x&&i(E,"name",x),E.constructor=O}catch(j){}return O}}},1703:function(t,e,n){var r=n(2109),o=n(7854),i=n(2104),s=n(9191),a="WebAssembly",c=o[a],u=7!==Error("e",{cause:7}).cause,f=function(t,e){var n={};n[t]=s(t,e,u),r({global:!0,constructor:!0,arity:1,forced:u},n)},p=function(t,e){if(c&&c[t]){var n={};n[t]=s(a+"."+t,e,u),r({target:a,stat:!0,constructor:!0,arity:1,forced:u},n)}};f("Error",(function(t){return function(e){return i(t,this,arguments)}})),f("EvalError",(function(t){return function(e){return i(t,this,arguments)}})),f("RangeError",(function(t){return function(e){return i(t,this,arguments)}})),f("ReferenceError",(function(t){return function(e){return i(t,this,arguments)}})),f("SyntaxError",(function(t){return function(e){return i(t,this,arguments)}})),f("TypeError",(function(t){return function(e){return i(t,this,arguments)}})),f("URIError",(function(t){return function(e){return i(t,this,arguments)}})),p("CompileError",(function(t){return function(e){return i(t,this,arguments)}})),p("LinkError",(function(t){return function(e){return i(t,this,arguments)}})),p("RuntimeError",(function(t){return function(e){return i(t,this,arguments)}}))},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](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 v}}),"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"},a=["innerHTML"],c=["contenteditable"],u=["data-content-idx","data-page-idx","contenteditable"];function f(t,e,r,o,f,p){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)(f.pages,((t,e)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"overlay",key:t.uuid+"-overlay",ref_for:!0,ref:e=>f.pages_overlay_refs[t.uuid]=e,innerHTML:r.overlay(e+1,f.pages.length),style:(0,n.normalizeStyle)(p.page_style(e,!1))},null,12,a)))),128))])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",{class:"content",ref:"content",contenteditable:r.editable,style:(0,n.normalizeStyle)(p.page_style(-1)),onInput:e[0]||(e[0]=(...t)=>p.input&&p.input(...t)),onKeyup:e[1]||(e[1]=(...t)=>p.process_current_text_style&&p.process_current_text_style(...t)),onKeydown:e[2]||(e[2]=(...t)=>p.keydown&&p.keydown(...t))},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(f.pages,((t,e)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"page",key:t.uuid,ref_for:!0,ref:e=>f.pages_refs[t.uuid]=e,"data-content-idx":t.content_idx,"data-page-idx":e,style:(0,n.normalizeStyle)(p.page_style(e,!t.template)),contenteditable:!(!r.editable||t.template)},[t.template?((0,n.openBlock)(),(0,n.createBlock)((0,n.resolveDynamicComponent)(t.template),{key:0,modelValue:t.props,"onUpdate:modelValue":e=>t.props=e},null,8,["modelValue","onUpdate:modelValue"])):(0,n.createCommentVNode)("",!0)],12,u)))),128))],44,c)],512)}r(1703);function p(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 l(t,e,n,r){while(t.childNodes.length&&!n()){r=r||1!=t.childNodes.length;const o=t.lastChild;if(o.nodeType==Node.TEXT_NODE){const t=o.textContent.match(/(\s|\S+)/g),i=document.createTextNode("");e.prepend(i);const s=t?t.length:0;for(let e=0;e<s;e++){if(e==s-1&&!r)return;if(o.textContent=t.slice(0,s-e-1).join(""),i.textContent=t.slice(s-e-1,s).join(""),n())return}}else if(!o.childNodes.length||o.tagName.match(/h\d/i)){if(!r)return void console.log("Move-forward: first child reached with no stop condition. Aborting");e.prepend(o)}else{let t=p(e,o.s_tag);if(!t){if(!o.s_tag){const t=Math.random().toString(36).slice(2,8);o.s_tag=t}t=o.cloneNode(!1),t.s_tag=o.s_tag,e.prepend(t)}l(o,t,n,r),t.normalize()}if(t.contains(o))if(0==o.childNodes.length||""==o.innerHTML)t.removeChild(o);else if(!n())throw console.log("sub_child:",o,"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 d(t,e,n){while(!n()){const n=e.firstChild;var r=(t,e)=>{const n=p(t,e.s_tag);n&&e.childNodes.length?r(n,e.firstChild):(t.append(e),t.normalize())};r(t,n)}}var h={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,default:"10mm 15mm"},zoom:{type:Number,default:1}},data(){return{pages:[],pages_refs:{},pages_overlay_refs:{},pages_height:0,editor_width:0,prevent_next_content_update_from_parent:!1,current_text_style:!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_refs=[],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),async 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}))),await this.$nextTick();const t=this.pages_refs[this.pages[0].uuid];this.$refs.content.contains(t)||this.$refs.content.appendChild(t),this.pages_height=t.clientHeight+1;for(const e of this.pages){const t=this.pages_refs[e.uuid];this.content[e.content_idx]?"string"==typeof this.content[e.content_idx]&&(t.innerHTML="<div>"+this.content[e.content_idx]+"</div>"):t.innerHTML="<div><br></div>",this.$refs.content.contains(t)||this.$refs.content.appendChild(t)}await this.fit_content_over_pages(),this.$refs.content.blur(),this.reset_in_progress=!1},async 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],e=this.pages_refs[t.uuid];e&&document.body.contains(e)||this.pages.splice(o,1)}if(!this.pages.length)return void this.reset_content();const t=window.getSelection(),e=document.createElement("null"),n=document.createElement("null");if(t.rangeCount){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],e=this.pages_refs[t.uuid];let n=this.pages[o+1],i=n?this.pages_refs[n.uuid]:null;!t.template&&(r||e.innerHTML!=t.prev_innerHTML||i&&!n.template&&i.innerHTML!=n.prev_innerHTML)&&(r=!0,e.clientHeight<=this.pages_height&&n&&n.content_idx==t.content_idx&&(d(e,i,(()=>!i.childNodes.length||e.clientHeight>this.pages_height)),i.childNodes.length||this.pages.splice(o+1,1)),e.clientHeight>this.pages_height&&(n&&n.content_idx==t.content_idx||(n={uuid:this.new_uuid(),content_idx:t.content_idx},this.pages.splice(o+1,0,n),await this.$nextTick(),i=this.pages_refs[n.uuid]),l(e,i,(()=>e.clientHeight<=this.pages_height)))),this.fit_in_progress=!1}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){const t=this.pages_refs[o.uuid];o.template||t.normalize(),o.prev_innerHTML=t.innerHTML}},async input(t){t&&(await 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){const e=!(!this.content[0]||"string"!=typeof this.content[0])&&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=this.pages_refs[t.uuid];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,f,p,l,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)),l=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,f=Math.max(0,(r*this.zoom-a)/2),p=u+f,l=(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 t={position:"absolute",left:"calc("+p+"px + "+s+"px)",top:"calc("+l+"mm + "+s+"px)",width:this.page_format_mm[0]+"mm",padding:this.page_margins,transform:"scale("+this.zoom+")"};return t[e?"minHeight":"height"]=this.page_format_mm[1]+"mm",t}return{width:"calc("+d+"mm + "+2*s+"px)",height:"calc("+h+"mm + "+2*s+"px)"}},update_editor_width(){this.$refs.editor.classList.add("hide_children"),this.editor_width=this.$refs.editor.clientWidth,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._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()){const e=this.pages_refs[r.uuid],o=e.cloneNode(!0);o.style="",o.style.position="relative",o.style.padding=this.page_margins,o.style.breakBefore=n?"page":"auto";const i=this.pages_overlay_refs[r.uuid];if(i){const t=i.cloneNode(!0);t.style.position="absolute",t.style.left="0",t.style.top="0",t.style.transform="none",t.style.padding="0",t.style.overflow="hidden",o.prepend(t)}t.append(o)}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(){document.body=this._page_body,this.update_editor_width()}},watch:{page_format_mm:{async handler(){this.update_css_media_style(),await this.reset_content()}},page_margins:{async handler(){await this.reset_content()}},content:{async handler(){this.prevent_next_content_update_from_parent?this.prevent_next_content_update_from_parent=!1:await this.reset_content()},deep:!0}}},g=r(3744);const m=(0,g.Z)(h,[["render",f],["__scopeId","data-v-587217e4"]]);var y=m,v=y}(),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(84),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,e,n){var r=n(5005);t.exports=r("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,y=t.stat;if(l=m?r:y?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+(y?".":"#")+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}},84: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)}}},1702:function(t,e,n){var r=n(4326),o=n(84);t.exports=function(t){if("Function"===r(t))return o(t)}},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}()||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,y=function(t){return i(t)?o(t):r(t,{})},_=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:y,getterFor:_}},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(7293),o=n(614),i=n(2597),s=n(9781),a=n(6530).CONFIGURABLE,c=n(2788),u=n(9909),l=u.enforce,p=u.get,f=Object.defineProperty,d=s&&!r((function(){return 8!==f((function(){}),"length",{value:8}).length})),h=String(String).split("String"),g=t.exports=function(t,e,n){"Symbol("===String(e).slice(0,7)&&(e="["+String(e).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!i(t,"name")||a&&t.name!==e)&&(s?f(t,"name",{value:e,configurable:!0}):t.name=e),d&&n&&i(n,"arity")&&t.length!==n.arity&&f(t,"length",{value:n.arity});try{n&&i(n,"constructor")&&n.constructor?s&&f(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(o){}var r=l(t);return i(r,"source")||(r.source=h.join("string"==typeof e?e:"")),t};Function.prototype.toString=g((function(){return o(this)&&p(this).source||c(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.26.0",mode:r?"pure":"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.26.0/LICENSE",source:"https://github.com/zloirock/core-js"})},6293:function(t,e,n){var r=n(7392),o=n(7293);t.exports=!!Object.getOwnPropertySymbols&&!o((function(){var t=Symbol();return!String(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=o("wks"),l=r.Symbol,p=l&&l["for"],f=c?l:l&&l.withoutSetter||s;t.exports=function(t){if(!i(u,t)||!a&&"string"!=typeof u[t]){var e="Symbol."+t;a&&i(l,t)?u[t]=l[t]:u[t]=c&&p?p(e):f(e)}return u[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}}();r({target:"Array",proto:!0,arity:1,forced:u||l},{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](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 y}}),"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){while(t.childNodes.length&&!n()){r=r||1!=t.childNodes.length;const o=t.lastChild;if(o.nodeType==Node.TEXT_NODE){const t=o.textContent.match(/(\s|\S+)/g),i=document.createTextNode("");e.prepend(i);const s=t?t.length:0;for(let e=0;e<s;e++){if(e==s-1&&!r)return;if(o.textContent=t.slice(0,s-e-1).join(""),i.textContent=t.slice(s-e-1,s).join(""),n())return}}else if(!o.childNodes.length||o.tagName.match(/h\d/i)){if(!r)return void console.log("Move-forward: first child reached with no stop condition. Aborting");e.prepend(o)}else{let t=l(e,o.s_tag);if(!t){if(!o.s_tag){const t=Math.random().toString(36).slice(2,8);o.s_tag=t}t=o.cloneNode(!1),t.s_tag=o.s_tag,e.prepend(t)}p(o,t,n,r),t.normalize()}if(t.contains(o))if(0==o.childNodes.length||""==o.innerHTML)t.removeChild(o);else if(!n())throw console.log("sub_child:",o,"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,default:"10mm 15mm"},zoom:{type:Number,default:1}},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.rangeCount){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))),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){const e=!(!this.content[0]||"string"!=typeof this.content[0])&&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 t={position:"absolute",left:"calc("+p+"px + "+s+"px)",top:"calc("+f+"mm + "+s+"px)",width:this.page_format_mm[0]+"mm",padding:this.page_margins,transform:"scale("+this.zoom+")"};return t[e?"minHeight":"height"]=this.page_format_mm[1]+"mm",t}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(){for(const t of this.$refs.content.children)this.pages.find((e=>e.elt==t))||t.remove();for(const[t,e]of this.pages.entries()){if(!e.elt){e.elt=document.createElement("div"),e.elt.className="page";const n=this.pages[t+1];this.$refs.content.insertBefore(e.elt,n?n.elt:null)}e.elt.dataset.contentIdx=e.content_idx,this.printing_mode||(e.elt.style=Object.entries(this.page_style(t,!e.template)).map((([t,e])=>t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+":"+e)).join(";")),e.elt.contentEditable=!(!this.editable||e.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=this.page_margins,r.elt.style.breakBefore=n?"page":"auto";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}},watch:{page_format_mm:{handler(){this.update_css_media_style(),this.reset_content()}},page_margins:{handler(){this.reset_content()}},content:{handler(){this.prevent_next_content_update_from_parent?this.prevent_next_content_update_from_parent=!1:this.reset_content()},deep:!0}}},h=r(3744);const g=(0,h.Z)(d,[["render",u],["__scopeId","data-v-68da239e"]]);var m=g,y=m}(),o=o["default"],o}()})); | ||
//# sourceMappingURL=VueDocumentEditor.umd.min.js.map |
{ | ||
"name": "vue-document-editor", | ||
"version": "2.0.7", | ||
"version": "2.1.0", | ||
"description": "Paper-sized WYSIWYG document editor for Vue apps", | ||
@@ -33,4 +33,2 @@ "author": { | ||
"build": "vue-cli-service build --dest docs && vue-cli-service build --target lib --name VueDocumentEditor src/DocumentEditor/DocumentEditor.vue", | ||
"lint": "vue-cli-service lint", | ||
"preversion": "npm run lint", | ||
"version": "npm run build && git add -A" | ||
@@ -40,30 +38,7 @@ }, | ||
"devDependencies": { | ||
"@babel/core": "^7.12.16", | ||
"@babel/eslint-parser": "^7.12.16", | ||
"@vue/cli-plugin-babel": "~5.0.0", | ||
"@vue/cli-plugin-eslint": "~5.0.0", | ||
"@vue/cli-service": "~5.0.0", | ||
"eslint": "^7.32.0", | ||
"eslint-plugin-vue": "^8.0.3", | ||
"sass": "^1.32.7", | ||
"sass-loader": "^12.0.0", | ||
"vue": "^3.2.20", | ||
"vue-file-toolbar-menu": "^2.0.0" | ||
"@vue/cli-plugin-babel": "^5.0.8", | ||
"@vue/cli-service": "^5.0.8", | ||
"vue": "^3.2.41", | ||
"vue-file-toolbar-menu": "^2.1.0" | ||
}, | ||
"eslintConfig": { | ||
"root": true, | ||
"env": { | ||
"node": true | ||
}, | ||
"extends": [ | ||
"plugin:vue/vue3-essential", | ||
"eslint:recommended" | ||
], | ||
"parserOptions": { | ||
"parser": "@babel/eslint-parser" | ||
}, | ||
"rules": { | ||
"vue/multi-word-component-names": "off" | ||
} | ||
}, | ||
"browserslist": [ | ||
@@ -70,0 +45,0 @@ "> 1%", |
@@ -39,4 +39,2 @@ <div align="center"> | ||
###### :warning: Your Vue.js project must have [`scss`](https://vue-loader.vuejs.org/guide/pre-processors.html#sass) support | ||
###### :speech_balloon: If you prefer static files, import assets from the `dist` folder | ||
@@ -68,3 +66,3 @@ | ||
<details> | ||
<summary><small>same example using static files loaded with a CDN</small></summary> | ||
<summary><small>same example using static files loaded with a CDN (Vue 3)</small></summary> | ||
@@ -99,5 +97,37 @@ ```HTML | ||
</details> | ||
<details> | ||
<summary><small>same example using static files loaded with a CDN (Vue 2)</small></summary> | ||
```HTML | ||
<html> | ||
<head> | ||
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/vue-document-editor@1/dist/VueDocumentEditor.umd.min.js"></script> | ||
<link href="https://cdn.jsdelivr.net/npm/vue-document-editor@1/dist/VueDocumentEditor.css" rel="stylesheet"> | ||
</head> | ||
<body> | ||
<div id="app"> | ||
<div style="font-family: Avenir, sans-serif"> | ||
<vue-document-editor :content.sync="content" /> | ||
</div> | ||
</div> | ||
<script> | ||
var app = new Vue({ | ||
el: '#app', | ||
components: { VueDocumentEditor }, | ||
data () { | ||
return { | ||
content: ["<h1>Hello!</h1>Fill this page with text and new pages will be created as it overflows."] | ||
} | ||
} | ||
}) | ||
</script> | ||
</body> | ||
</html> | ||
``` | ||
</details> | ||
## Complete example | ||
See the [Demo.vue](src/Demo/Demo.vue) file and the [InvoiceTemplate.vue](src/Demo/InvoiceTemplate.vue) file corresponding to the [live demo](https://motla.github.io/vue-document-editor/). | ||
See the [Demo.vue](src/Demo/Demo.vue) file and the [InvoiceTemplate.ce.vue](src/Demo/InvoiceTemplate.ce.vue) file corresponding to the [live demo](https://motla.github.io/vue-document-editor/). | ||
@@ -104,0 +134,0 @@ ## API |
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
Sorry, the diff of this file is not supported yet
4
146
3829623
45
4971