text/js/editor.js

3 строки
197 KiB
JavaScript
Исходник Обычный вид История

/*! For license information please see editor.js.LICENSE.txt */
(self.webpackChunktext=self.webpackChunktext||[]).push([["editor"],{506:(t,n,e)=>{"use strict";e.d(n,{Jh:()=>Pn,pf:()=>jn,Dt:()=>En});var r=e(8481),i=e(69457),o=e(79068),a=e(83142),s=e(56856),l=e(62797),c=e(85961),d=e(93427),A=e(9889),h=e(50137),u=e(6829),p=e(20510),g=e(26798),f=e(76922),m=e(99132),C=e(7049),b=e(79440),v=e.n(b),y=e(56286),x=e.n(y);const w={name:"TableView",components:{ActionButton:x(),Actions:v(),NodeViewWrapper:C.T5,NodeViewContent:C.ms},props:{editor:{type:Object,required:!0},deleteNode:{type:Function,required:!0}},computed:{t:function(){return window.t}}};var k=e(93379),j=e.n(k),P=e(7795),M=e.n(P),E=e(90569),_=e.n(E),S=e(3565),I=e.n(S),B=e(19216),D=e.n(B),O=e(44589),T=e.n(O),R=e(86185),N={};N.styleTagTransform=T(),N.setAttributes=I(),N.insert=_().bind(null,"head"),N.domAPI=M(),N.insertStyleElement=D();j()(R.Z,N);R.Z&&R.Z.locals&&R.Z.locals;var L=e(51900);const U=(0,L.Z)(w,(function(){var t=this,n=t.$createElement,e=t._self._c||n;return e("NodeViewWrapper",[e("NodeViewContent",{staticClass:"content",attrs:{as:"table"}}),t._v(" "),e("Actions",{staticClass:"table-settings",attrs:{"force-menu":!0,"default-icon":"icon-table_settings"}},[e("ActionButton",{attrs:{icon:"icon-delete","close-after-click":!0},on:{click:t.deleteNode}},[t._v("\n\t\t\t"+t._s(t.t("text","Delete this table"))+"\n\t\t")])],1)],1)}),[],!1,null,"19c94ef7",null).exports;function z(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),e.push.apply(e,r)}return e}function G(t){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?z(Object(e),!0).forEach((function(n){Z(t,n,e[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):z(Object(e)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}))}return t}function Z(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}var H=g.NB.create({name:"tableCaption",content:"inline*",addAttributes:function(){return{}},renderHTML:function(){return["caption"]},toMarkdown:function(t,n){},parseHTML:function(){return[{tag:"table caption",priority:90}]}});const F=p.iA.extend({content:"tableCaption? tableHeadRow tableRow*",addExtensions:function(){return[H]},addCommands:function(){return G(G({},this.parent()),{},{insertTable:function(){return function(t){var n=t.tr,e=t.dispatch,r=t.editor;if((0,m.Lw)(n))return!1;var i=function(t,n,e,r){for(var i=[],o=[],a=0;a<e;a+=1){var s=t.nodes.tableCell.createAndFill();s&&o.push(s);var l=t.nodes.tableHeader.createAndFill();l&&i.push(l)}for(var c=t.nodes.tableHeadRow.createChecked(null,i),d=[],A=1;A<n;A+=1)d.push(t.nodes.tableRow.createChecked(null,o));return t.nodes.table.createChecked(null,[c].concat(d))}(r.schema,3,3);if(e){var o=n.selection.anchor+1;n.replaceSelectionWith(i).scrollIntoView().setSelection(f.TextSelection.near(n.doc.resolve(o)))}return!0}},leaveTable:function(){return function(t){var n=t.tr,e=t.dispatch;t.editor;if(!(0,m.Lw)(n))return!1;var r=n.selection,i=r.$head;if(!r.empty)return!1;var o=i.depth<3?1:i.depth-2;if(e){var a=n.doc.resolve(i.after(o)+1),s=f.TextSelection.near(a);e(n.setSelection(s).scrollIntoView())}return!0}},goToNextRow:function(){return function(t){var n=t.tr,e=t.dispatch;t.editor;if(!(0,m.Lw)(n))return!1;var r=function(t){if(t.index(-1)===t.node(-1).childCount-1)return null;for(var n=t.after(),e=t.node(-1),r=t.indexAfter(-1);r<e.childCount;r++){var i=e.child(r);if(i.childCount>=t.index()){for(var o=0;o<t.index();o++)n+=i.child(o).nodeSize;return n+1}n+=i.nodeSize}}((0,m.Le)(n));if(null!=r){if(e){var i=n.doc.resolve(r),o=f.TextSelection.between(i,(0,m.SZ)(i));e(n.setSelection(o).scrollIntoView())}return!0}}}})},renderHTML:function(t){var n=t.HTMLAttributes;return["table",(0,g.P1)(this.options.HTMLAttributes,n),0]},toMarkdown:function(t,n){t.renderContent(n),t.closeBlock(n)},addKeyboardShortcuts:function(){var t=this;return G(G({},this.parent()),{}
//# sourceMappingURL=editor.js.map?v=64ef52784838ff7fc02e