editor-svg 1.0.21 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ import{TitleLevel as e,ElementType as t,ListType as s}from"editor-svg";const l={1:e.FIRST,2:e.SECOND,3:e.THIRD,4:e.FOURTH,5:e.FIFTH,6:e.SIXTH};function u(e){const u=e.command;u.executeInsertMarkdown=e=>{const i=function(e){const u=[],i=e.trim().split("\n");for(let a=0;a<i.length;a++){const e=i[a];if(e.startsWith("#")){const s=e.indexOf(" ");u.push({type:t.TITLE,level:l[s],value:"",valueList:[{value:e.slice(s+1)}]})}else if(e.startsWith("- "))u.push({type:t.LIST,listType:s.UL,value:"",valueList:[{value:e.slice(2)}]});else if(/^\d+\.\s/.test(e))u.push({type:t.LIST,listType:s.OL,value:"",valueList:[{value:e.replace(/^\d+\.\s/,"")}]});else if(/^\[.*?\]\(.*?\)$/.test(e)){const s=e.match(/^\[(.*?)\]\((.*?)\)$/);u.push({type:t.HYPERLINK,value:"",valueList:[{value:s[1]}],url:s[2]})}else if(/^\*\*(.*?)\*\*$/.test(e)){const s=e.match(/^\*\*(.*?)\*\*$/);u.push({type:t.TEXT,value:s[1],bold:!0})}else if(/^\*(.*?)\*$/.test(e)){const s=e.match(/^\*(.*?)\*$/);u.push({type:t.TEXT,value:s[1],italic:!0})}else if(/^__(.*?)__$/.test(e)){const s=e.match(/^__(.*?)__$/);u.push({type:t.TEXT,value:s[1],underline:!0})}else if(/^~~(.*?)~~$/.test(e)){const s=e.match(/^~~(.*?)~~$/);u.push({type:t.TEXT,value:s[1],strikeout:!0})}else u.push({type:t.TEXT,value:e})}return u}(e);u.executeInsertElementList(i)}}export{u as markdownPlugin,l as titleNodeNameMapping};
2
+ //# sourceMappingURL=markdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.js","sources":["../../../src/plugins/markdown/index.ts"],"sourcesContent":[null],"names":["titleNodeNameMapping","TitleLevel","FIRST","SECOND","THIRD","FOURTH","FIFTH","SIXTH","markdownPlugin","editor","command","executeInsertMarkdown","markdown","elementList","lines","trim","split","l","length","line","startsWith","level","indexOf","push","type","ElementType","TITLE","value","valueList","slice","LIST","listType","ListType","UL","test","OL","replace","match","HYPERLINK","url","TEXT","bold","italic","underline","strikeout","convertMarkdownToElement","executeInsertElementList"],"mappings":"uEAaO,MAAMA,EAAmD,CAC9D,EAAKC,EAAWC,MAChB,EAAKD,EAAWE,OAChB,EAAKF,EAAWG,MAChB,EAAKH,EAAWI,OAChB,EAAKJ,EAAWK,MAChB,EAAKL,EAAWM,OA4FZ,SAAAC,EAAyBC,GAC7B,MAAMC,EAA+BD,EAAOC,QACpCA,EAAAC,sBAAyBC,IAC/B,MAAMC,EA5FV,SAAkCD,GAChC,MAAMC,EAA0B,GAC1BC,EAAQF,EAASG,OAAOC,MAAM,MACpC,IAAA,IAASC,EAAI,EAAGA,EAAIH,EAAMI,OAAQD,IAAK,CACrC,MAAME,EAAOL,EAAMG,GACf,GAAAE,EAAKC,WAAW,KAAM,CAClB,MAAAC,EAAQF,EAAKG,QAAQ,KAC3BT,EAAYU,KAAK,CACfC,KAAMC,EAAYC,MAClBL,MAAOrB,EAAqBqB,GAC5BM,MAAO,GACPC,UAAW,CACT,CACED,MAAOR,EAAKU,MAAMR,EAAQ,YAIvB,GAAAF,EAAKC,WAAW,MACzBP,EAAYU,KAAK,CACfC,KAAMC,EAAYK,KAClBC,SAAUC,EAASC,GACnBN,MAAO,GACPC,UAAW,CACT,CACED,MAAOR,EAAKU,MAAM,YAIf,GAAA,WAAWK,KAAKf,GACzBN,EAAYU,KAAK,CACfC,KAAMC,EAAYK,KAClBC,SAAUC,EAASG,GACnBR,MAAO,GACPC,UAAW,CACT,CACED,MAAOR,EAAKiB,QAAQ,WAAY,aAI7B,GAAA,mBAAmBF,KAAKf,GAAO,CAClC,MAAAkB,EAAQlB,EAAKkB,MAAM,wBACzBxB,EAAYU,KAAK,CACfC,KAAMC,EAAYa,UAClBX,MAAO,GACPC,UAAW,CACT,CACED,MAAOU,EAAO,KAGlBE,IAAKF,EAAO,UAEL,GAAA,kBAAkBH,KAAKf,GAAO,CACjC,MAAAkB,EAAQlB,EAAKkB,MAAM,mBACzBxB,EAAYU,KAAK,CACfC,KAAMC,EAAYe,KAClBb,MAAOU,EAAO,GACdI,MAAM,SAEC,GAAA,cAAcP,KAAKf,GAAO,CAC7B,MAAAkB,EAAQlB,EAAKkB,MAAM,eACzBxB,EAAYU,KAAK,CACfC,KAAMC,EAAYe,KAClBb,MAAOU,EAAO,GACdK,QAAQ,SAED,GAAA,cAAcR,KAAKf,GAAO,CAC7B,MAAAkB,EAAQlB,EAAKkB,MAAM,eACzBxB,EAAYU,KAAK,CACfC,KAAMC,EAAYe,KAClBb,MAAOU,EAAO,GACdM,WAAW,SAEJ,GAAA,cAAcT,KAAKf,GAAO,CAC7B,MAAAkB,EAAQlB,EAAKkB,MAAM,eACzBxB,EAAYU,KAAK,CACfC,KAAMC,EAAYe,KAClBb,MAAOU,EAAO,GACdO,WAAW,SAGb/B,EAAYU,KAAK,CACfC,KAAMC,EAAYe,KAClBb,MAAOR,IAIN,OAAAN,EAMegC,CAAyBjC,GAC7CF,EAAQoC,yBAAyBjC"}
@@ -237,7 +237,7 @@ export declare class Draw {
237
237
  computeRowList(payload: IComputeRowListPayload): IRow[];
238
238
  /**
239
239
  * 拆分表格
240
- * @param element 表格元素
240
+ * @param tableElement 表格元素
241
241
  * @param remainHeight 第一个表格的可用高度
242
242
  * @param mainHeight 主体高度
243
243
  * @param option 配置
@@ -0,0 +1,5 @@
1
+ import Editor from 'editor-svg';
2
+ export interface ICopyWithCopyrightOption {
3
+ copyrightText: string;
4
+ }
5
+ export declare function copyWithCopyrightPlugin(editor: Editor, options?: ICopyWithCopyrightOption): void;
@@ -0,0 +1,9 @@
1
+ import { Command } from 'editor-svg';
2
+ export interface IExportDocxOption {
3
+ fileName: string;
4
+ isFile?: boolean;
5
+ }
6
+ export type CommandWithExportDocx = Command & {
7
+ executeExportDocx(options: IExportDocxOption): void;
8
+ };
9
+ export default function createExportDocx(command: Command): (options: IExportDocxOption) => Promise<void> | Promise<Blob>;
@@ -0,0 +1,8 @@
1
+ import { Command } from 'editor-svg';
2
+ export interface IImportDocxOption {
3
+ arrayBuffer: ArrayBuffer;
4
+ }
5
+ export type CommandWithImportDocx = Command & {
6
+ executeImportDocx(options: IImportDocxOption): Promise<void>;
7
+ };
8
+ export default function createImportDocx(command: Command): (options: IImportDocxOption) => Promise<void>;
@@ -0,0 +1,6 @@
1
+ import Editor from 'editor-svg';
2
+ import { CommandWithExportDocx, IExportDocxOption } from './exportDocx';
3
+ import { CommandWithImportDocx, IImportDocxOption } from './importDocx';
4
+ export type CommandWithDocx = CommandWithExportDocx & CommandWithImportDocx;
5
+ export type { IExportDocxOption, IImportDocxOption };
6
+ export default function docxPlugin(editor: Editor): void;
@@ -0,0 +1 @@
1
+ export declare function saveAs(blob: Blob, name: string): void;
@@ -0,0 +1,6 @@
1
+ import Editor, { Command, TitleLevel } from 'editor-svg';
2
+ export type CommandWithMarkdown = Command & {
3
+ executeInsertMarkdown(markdown: string): void;
4
+ };
5
+ export declare const titleNodeNameMapping: Record<string, TitleLevel>;
6
+ export declare function markdownPlugin(editor: Editor): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "editor-svg",
3
- "version": "1.0.21",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "description": "基于canvas-editor的二次开发",
6
6
  "keywords": [
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "scripts": {
29
29
  "dev": "vite",
30
- "lib": "npm run lint && tsc && vite build --mode lib",
30
+ "lib": "npm run lint && tsc && vite build --mode lib && vite build --mode lib:docx && vite build --mode lib:copy && vite build --mode lib:markdown",
31
31
  "build": "npm run lint && tsc && vite build --mode app",
32
32
  "serve": "vite preview",
33
33
  "lint": "eslint .",