@datawhale/prosemirror-render 0.0.8 → 0.0.9

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.
Files changed (46) hide show
  1. package/dist/{AttachmentBlock-CTvDbAcS.js → AttachmentBlock-C4Swmd2b.js} +2 -2
  2. package/dist/{AttachmentBlock-P1jG1cGY.cjs → AttachmentBlock-CiL-Qygv.cjs} +1 -1
  3. package/dist/{AttachmentInline-B7Cj5QJ0.js → AttachmentInline-BU5AUs28.js} +2 -2
  4. package/dist/{AttachmentInline-Cr4Zec57.cjs → AttachmentInline-DLTAOygO.cjs} +1 -1
  5. package/dist/{AttachmentMenu-CM2tOV0z.js → AttachmentMenu-DLlR5CXP.js} +1 -1
  6. package/dist/{AttachmentMenu-ChIj7hE3.cjs → AttachmentMenu-DiZhh_3u.cjs} +1 -1
  7. package/dist/{Callout-DazLxdGD.cjs → Callout-D7puQgnx.cjs} +1 -1
  8. package/dist/{Callout-Def3dYjo.js → Callout-DbKFrj5N.js} +1 -1
  9. package/dist/{CellOutput-B26_5ev3.cjs → CellOutput-C1rqdLdu.cjs} +1 -1
  10. package/dist/{CellOutput-Dbg8ZL0H.js → CellOutput-EzCS35bu.js} +1 -1
  11. package/dist/{CodeBlock-D8In7xR8.cjs → CodeBlock-SLlc17jY.cjs} +1 -1
  12. package/dist/{CodeBlock-BsqBkTD3.js → CodeBlock-XUiYN99W.js} +1 -1
  13. package/dist/{FoldBlock-BuwPwAaK.cjs → FoldBlock-D9f0newS.cjs} +1 -1
  14. package/dist/{FoldBlock-B_C9Qoy9.js → FoldBlock-HqRqlt3p.js} +1 -1
  15. package/dist/{Grid-B79na0-H.js → Grid-DJCw7wkB.js} +1 -1
  16. package/dist/{Grid-DvLYfpeG.cjs → Grid-cLwFeDko.cjs} +1 -1
  17. package/dist/{IFrame-ChfURc_t.cjs → IFrame-CQqNUygF.cjs} +1 -1
  18. package/dist/{IFrame-BXfWlAkB.js → IFrame-CreFeGw0.js} +1 -1
  19. package/dist/{Image-RwlDCWBT.js → Image-B4Qy6xlu.js} +1 -1
  20. package/dist/{Image-BAy3DLIi.cjs → Image-DXcI8Q6W.cjs} +1 -1
  21. package/dist/{MathDisplay-fiHorxPn.js → MathDisplay-C1YaBdrr.js} +1 -1
  22. package/dist/{MathDisplay-C0esLx5a.cjs → MathDisplay-gzdi6eYn.cjs} +1 -1
  23. package/dist/{MathInline-gFzVPQ0D.js → MathInline-CHMg8M3j.js} +1 -1
  24. package/dist/{MathInline-CnkNthuZ.cjs → MathInline-Dog67RDU.cjs} +1 -1
  25. package/dist/{McChoices-BDsJqV2C.cjs → McChoices-C3ry5JEW.cjs} +1 -1
  26. package/dist/{McChoices-DDKPec4G.js → McChoices-LBSYtxIG.js} +1 -1
  27. package/dist/{McQuestion-1efXXh4O.js → McQuestion-BAxgspnR.js} +1 -1
  28. package/dist/{McQuestion-CChLZMYt.cjs → McQuestion-DNZ1Cg8x.cjs} +1 -1
  29. package/dist/{McSolution-XXRJWaYt.js → McSolution-B8Ir0TDg.js} +1 -1
  30. package/dist/{McSolution-5feP69N7.cjs → McSolution-Bd70JP5F.cjs} +1 -1
  31. package/dist/{MultipleChoice-DT_c5R8o.js → MultipleChoice-bj3npcmx.js} +4 -4
  32. package/dist/{MultipleChoice-CQ9cbLUg.cjs → MultipleChoice-mDLIyHfi.cjs} +1 -1
  33. package/dist/{Paragraph-nAepKpbl.cjs → Paragraph-Bx8A4csJ.cjs} +1 -1
  34. package/dist/{Paragraph-CWn5tuOy.js → Paragraph-HLV7U0CS.js} +1 -1
  35. package/dist/{SlotNode-DqwL4TkF.cjs → SlotNode-C_X3NC06.cjs} +1 -1
  36. package/dist/{SlotNode-BhXyQCzg.js → SlotNode-CtJD0kba.js} +1 -1
  37. package/dist/{Text-CS6RYM2H.cjs → Text-C_OxsnsP.cjs} +1 -1
  38. package/dist/{Text-Nb_IXPkh.js → Text-DZM1Me1W.js} +1 -1
  39. package/dist/index-B4Ca4BP0.cjs +1 -0
  40. package/dist/{index-CTcnNF6r.js → index-DZ9p1utK.js} +68 -51
  41. package/dist/index.cjs.js +1 -1
  42. package/dist/index.es.js +3 -2
  43. package/dist/types/components/index.d.ts +0 -1
  44. package/dist/types/index.d.ts +2 -1
  45. package/package.json +1 -1
  46. package/dist/index-kIuhy4WL.cjs +0 -1
@@ -1,5 +1,5 @@
1
- import { ref as g, createElementBlock as s, openBlock as c, defineAsyncComponent as k, defineComponent as d, computed as _, resolveComponent as b, createBlock as i, Suspense as y, withCtx as m, resolveDynamicComponent as C, unref as v, mergeProps as M, createCommentVNode as B, Fragment as x, renderList as w, useId as I, provide as l, watch as L, createVNode as R } from "vue";
2
- const A = /* @__PURE__ */ Symbol(), p = g([]), N = /* @__PURE__ */ Symbol(), S = (t) => {
1
+ import { ref as g, createElementBlock as s, openBlock as c, defineAsyncComponent as y, defineComponent as d, computed as k, resolveComponent as _, createBlock as i, Suspense as b, withCtx as l, resolveDynamicComponent as C, unref as v, mergeProps as M, createCommentVNode as B, Fragment as x, renderList as A, useId as I, provide as p, watch as w, createVNode as L } from "vue";
2
+ const R = /* @__PURE__ */ Symbol(), m = g([]), N = /* @__PURE__ */ Symbol(), S = (t) => {
3
3
  const o = [], n = (r) => {
4
4
  r.type === "image" && o.push(r), r.content && r.content.forEach((a) => n(a));
5
5
  };
@@ -9,28 +9,44 @@ const A = /* @__PURE__ */ Symbol(), p = g([]), N = /* @__PURE__ */ Symbol(), S =
9
9
  for (const [r, a] of o)
10
10
  n[r] = a;
11
11
  return n;
12
- }, $ = {}, T = { class: "error-wrapper" };
13
- function E(t, o) {
14
- return c(), s("div", T, "组件加载失败");
12
+ }, $ = {}, E = { class: "error-wrapper" };
13
+ function T(t, o) {
14
+ return c(), s("div", E, "组件加载失败");
15
15
  }
16
- const O = /* @__PURE__ */ u($, [["render", E], ["__scopeId", "data-v-4fa940a8"]]), q = {};
17
- function D(t, o) {
16
+ const D = /* @__PURE__ */ u($, [["render", T], ["__scopeId", "data-v-4fa940a8"]]), O = {};
17
+ function q(t, o) {
18
18
  return "loading...";
19
19
  }
20
- const K = /* @__PURE__ */ u(q, [["render", D]]), e = (t, o = {
21
- loadingComponent: K,
20
+ const H = /* @__PURE__ */ u(O, [["render", q]]), e = (t, o = {
21
+ loadingComponent: H,
22
22
  delay: 200,
23
- errorComponent: O,
23
+ errorComponent: D,
24
24
  timeout: 5e3
25
- }) => k({
25
+ }) => y({
26
26
  loader: t,
27
27
  ...o
28
- }), V = {
29
- "attachment-inline": e(() => import("./AttachmentInline-B7Cj5QJ0.js")),
30
- "attachment-block": e(() => import("./AttachmentBlock-CTvDbAcS.js"))
31
- }, z = {
32
- text: e(() => import("./Text-Nb_IXPkh.js")),
33
- paragraph: e(() => import("./Paragraph-CWn5tuOy.js")),
28
+ });
29
+ function oe(t) {
30
+ if (!t || !t.content || !Array.isArray(t.content))
31
+ return [t];
32
+ const o = [];
33
+ let n = [];
34
+ return t.content.forEach((r) => {
35
+ r.type === "heading" ? (n.length > 0 && o.push({
36
+ type: "doc",
37
+ content: n
38
+ }), n = [r]) : n.push(r);
39
+ }), n.length > 0 && o.push({
40
+ type: "doc",
41
+ content: n
42
+ }), o;
43
+ }
44
+ const K = {
45
+ "attachment-inline": e(() => import("./AttachmentInline-BU5AUs28.js")),
46
+ "attachment-block": e(() => import("./AttachmentBlock-C4Swmd2b.js"))
47
+ }, P = {
48
+ text: e(() => import("./Text-DZM1Me1W.js")),
49
+ paragraph: e(() => import("./Paragraph-HLV7U0CS.js")),
34
50
  heading: e(() => import("./Heading-BElRvhGn.js")),
35
51
  orderedList: e(() => import("./OrderedList-B8v1gchv.js")),
36
52
  bulletList: e(() => import("./BulletList-BQTUD69X.js")),
@@ -38,27 +54,27 @@ const K = /* @__PURE__ */ u(q, [["render", D]]), e = (t, o = {
38
54
  horizontalRule: e(() => import("./HorizontalRule-BRG45oT0.js")),
39
55
  blockquote: e(() => import("./Blockquote-BamWUQND.js")),
40
56
  hardBreak: e(() => import("./HardBreak-B2tFO31P.js"))
57
+ }, V = {
58
+ callout: e(() => import("./Callout-DbKFrj5N.js"))
59
+ }, z = {
60
+ codeBlock: e(() => import("./CodeBlock-XUiYN99W.js")),
61
+ cellOutput: e(() => import("./CellOutput-EzCS35bu.js"))
41
62
  }, F = {
42
- callout: e(() => import("./Callout-Def3dYjo.js"))
43
- }, H = {
44
- codeBlock: e(() => import("./CodeBlock-BsqBkTD3.js")),
45
- cellOutput: e(() => import("./CellOutput-Dbg8ZL0H.js"))
46
- }, P = {
47
- foldBlock: e(() => import("./FoldBlock-B_C9Qoy9.js"))
63
+ foldBlock: e(() => import("./FoldBlock-HqRqlt3p.js"))
48
64
  }, Q = {
49
- grid: e(() => import("./Grid-B79na0-H.js"))
65
+ grid: e(() => import("./Grid-DJCw7wkB.js"))
50
66
  }, j = {
51
- iframe: e(() => import("./IFrame-BXfWlAkB.js"))
67
+ iframe: e(() => import("./IFrame-CreFeGw0.js"))
52
68
  }, G = {
53
- image: e(() => import("./Image-RwlDCWBT.js"))
69
+ image: e(() => import("./Image-B4Qy6xlu.js"))
54
70
  }, J = {
55
- math_inline: e(() => import("./MathInline-gFzVPQ0D.js")),
56
- math_display: e(() => import("./MathDisplay-fiHorxPn.js"))
71
+ math_inline: e(() => import("./MathInline-CHMg8M3j.js")),
72
+ math_display: e(() => import("./MathDisplay-C1YaBdrr.js"))
57
73
  }, U = {
58
- multipleChoice: e(() => import("./MultipleChoice-DT_c5R8o.js")),
59
- mcQuestion: e(() => import("./McQuestion-1efXXh4O.js")),
60
- mcChoices: e(() => import("./McChoices-DDKPec4G.js")),
61
- mcSolution: e(() => import("./McSolution-XXRJWaYt.js"))
74
+ multipleChoice: e(() => import("./MultipleChoice-bj3npcmx.js")),
75
+ mcQuestion: e(() => import("./McQuestion-BAxgspnR.js")),
76
+ mcChoices: e(() => import("./McChoices-LBSYtxIG.js")),
77
+ mcSolution: e(() => import("./McSolution-B8Ir0TDg.js"))
62
78
  }, W = {
63
79
  table: e(() => import("./TableContainer-C9PhNGlz.js")),
64
80
  tableHeader: e(() => import("./TableHeader-C7KKz3e1.js")),
@@ -66,17 +82,17 @@ const K = /* @__PURE__ */ u(q, [["render", D]]), e = (t, o = {
66
82
  tableCell: e(() => import("./TableCell-Bp52L368.js"))
67
83
  }, X = {
68
84
  doc: e(() => import("./Doc-6s4VMDsx.js")),
69
- slotNode: e(() => import("./SlotNode-BhXyQCzg.js"))
85
+ slotNode: e(() => import("./SlotNode-CtJD0kba.js"))
70
86
  }, Y = {
71
- ...V,
87
+ ...K,
72
88
  // 附件和视频类型
73
- ...z,
89
+ ...P,
74
90
  // 基础类型,包括各种字体样式
75
- ...F,
91
+ ...V,
76
92
  // 高亮块
77
- ...H,
93
+ ...z,
78
94
  // 代码块
79
- ...P,
95
+ ...F,
80
96
  // 折叠块
81
97
  ...Q,
82
98
  // 分栏
@@ -114,14 +130,14 @@ const K = /* @__PURE__ */ u(q, [["render", D]]), e = (t, o = {
114
130
  "table",
115
131
  "iframe",
116
132
  "multipleChoice"
117
- ]), n = _(() => o.has(t.node.type) && t.node.attrs && t.node.attrs["block-id"] ? { "data-block-id": t.node.attrs["block-id"] } : {});
133
+ ]), n = k(() => o.has(t.node.type) && t.node.attrs && t.node.attrs["block-id"] ? { "data-block-id": t.node.attrs["block-id"] } : {});
118
134
  return (r, a) => {
119
- const f = b("TreeRecursive", !0);
120
- return c(), i(y, null, {
121
- default: m(() => [
135
+ const f = _("TreeRecursive", !0);
136
+ return c(), i(b, null, {
137
+ default: l(() => [
122
138
  (c(), i(C(v(Y)[t.node.type]), M({ node: t.node }, n.value), {
123
- default: m(() => [
124
- t.node.content && !(t.node.type in ["foldBlock", "grid", "callout"]) ? (c(!0), s(x, { key: 0 }, w(t.node.content, (h) => (c(), i(f, {
139
+ default: l(() => [
140
+ t.node.content && !(t.node.type in ["foldBlock", "grid", "callout"]) ? (c(!0), s(x, { key: 0 }, A(t.node.content, (h) => (c(), i(f, {
125
141
  node: h,
126
142
  key: I()
127
143
  }, null, 8, ["node"]))), 128)) : B("", !0)
@@ -133,28 +149,29 @@ const K = /* @__PURE__ */ u(q, [["render", D]]), e = (t, o = {
133
149
  });
134
150
  };
135
151
  }
136
- }), ee = { class: "tree-render" }, oe = /* @__PURE__ */ d({
152
+ }), ee = { class: "tree-render" }, ne = /* @__PURE__ */ d({
137
153
  __name: "TreeRender",
138
154
  props: {
139
155
  node: {},
140
156
  axios: {}
141
157
  },
142
158
  setup(t) {
143
- return l(N, p), l(A, t.axios), L(
159
+ return p(N, m), p(R, t.axios), w(
144
160
  () => t.node,
145
161
  (o) => {
146
- p.value = S(o);
162
+ m.value = S(o);
147
163
  },
148
164
  { immediate: !0 }
149
165
  ), (o, n) => (c(), s("div", ee, [
150
- R(Z, { node: t.node }, null, 8, ["node"])
166
+ L(Z, { node: t.node }, null, 8, ["node"])
151
167
  ]));
152
168
  }
153
169
  });
154
170
  export {
155
171
  u as _,
156
- A as a,
172
+ R as a,
157
173
  Z as b,
158
- oe as c,
159
- N as i
174
+ ne as c,
175
+ N as i,
176
+ oe as s
160
177
  };
package/dist/index.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-kIuhy4WL.cjs");exports.TreeRender=e._sfc_main$1;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-B4Ca4BP0.cjs");exports.TreeRender=e._sfc_main$1;exports.splitDocIntoMultiPagesByHeading=e.splitDocIntoMultiPagesByHeading;
package/dist/index.es.js CHANGED
@@ -1,4 +1,5 @@
1
- import { c as o } from "./index-CTcnNF6r.js";
1
+ import { c as a, s as o } from "./index-DZ9p1utK.js";
2
2
  export {
3
- o as TreeRender
3
+ a as TreeRender,
4
+ o as splitDocIntoMultiPagesByHeading
4
5
  };
@@ -1,2 +1 @@
1
1
  export { default as TreeRender } from "./TreeRender.vue";
2
- export { splitDocIntoMultiPagesByHeading } from "./collections/utils";
@@ -1,2 +1,3 @@
1
- import TreeRender from './components/TreeRender.vue';
1
+ import TreeRender from "./components/TreeRender.vue";
2
+ export { splitDocIntoMultiPagesByHeading } from "./components/collections/utils";
2
3
  export { TreeRender };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datawhale/prosemirror-render",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.es.js",
@@ -1 +0,0 @@
1
- "use strict";const e=require("vue"),a=Symbol(),l=e.ref([]),m=Symbol(),p=o=>{const t=[],n=s=>{s.type==="image"&&t.push(s),s.content&&s.content.forEach(i=>n(i))};return n(o),t},c=(o,t)=>{const n=o.__vccOpts||o;for(const[s,i]of t)n[s]=i;return n},v={},f={class:"error-wrapper"};function q(o,t){return e.openBlock(),e.createElementBlock("div",f,"组件加载失败")}const k=c(v,[["render",q],["__scopeId","data-v-4fa940a8"]]),P={};function _(o,t){return"loading..."}const g=c(P,[["render",_]]),r=(o,t={loadingComponent:g,delay:200,errorComponent:k,timeout:5e3})=>e.defineAsyncComponent({loader:o,...t}),y={"attachment-inline":r(()=>Promise.resolve().then(()=>require("./AttachmentInline-Cr4Zec57.cjs"))),"attachment-block":r(()=>Promise.resolve().then(()=>require("./AttachmentBlock-P1jG1cGY.cjs")))},B={text:r(()=>Promise.resolve().then(()=>require("./Text-CS6RYM2H.cjs"))),paragraph:r(()=>Promise.resolve().then(()=>require("./Paragraph-nAepKpbl.cjs"))),heading:r(()=>Promise.resolve().then(()=>require("./Heading-BUnffIAz.cjs"))),orderedList:r(()=>Promise.resolve().then(()=>require("./OrderedList-DMl3tvwP.cjs"))),bulletList:r(()=>Promise.resolve().then(()=>require("./BulletList-CFjF3U-l.cjs"))),listItem:r(()=>Promise.resolve().then(()=>require("./ListItem-BrjxeGxz.cjs"))),horizontalRule:r(()=>Promise.resolve().then(()=>require("./HorizontalRule-CE09LZGf.cjs"))),blockquote:r(()=>Promise.resolve().then(()=>require("./Blockquote-CQSBFnsu.cjs"))),hardBreak:r(()=>Promise.resolve().then(()=>require("./HardBreak-Dbf5Zg5o.cjs")))},b={callout:r(()=>Promise.resolve().then(()=>require("./Callout-DazLxdGD.cjs")))},C={codeBlock:r(()=>Promise.resolve().then(()=>require("./CodeBlock-D8In7xR8.cjs"))),cellOutput:r(()=>Promise.resolve().then(()=>require("./CellOutput-B26_5ev3.cjs")))},x={foldBlock:r(()=>Promise.resolve().then(()=>require("./FoldBlock-BuwPwAaK.cjs")))},M={grid:r(()=>Promise.resolve().then(()=>require("./Grid-DvLYfpeG.cjs")))},w={iframe:r(()=>Promise.resolve().then(()=>require("./IFrame-ChfURc_t.cjs")))},I={image:r(()=>Promise.resolve().then(()=>require("./Image-BAy3DLIi.cjs")))},L={math_inline:r(()=>Promise.resolve().then(()=>require("./MathInline-CnkNthuZ.cjs"))),math_display:r(()=>Promise.resolve().then(()=>require("./MathDisplay-C0esLx5a.cjs")))},N={multipleChoice:r(()=>Promise.resolve().then(()=>require("./MultipleChoice-CQ9cbLUg.cjs"))),mcQuestion:r(()=>Promise.resolve().then(()=>require("./McQuestion-CChLZMYt.cjs"))),mcChoices:r(()=>Promise.resolve().then(()=>require("./McChoices-BDsJqV2C.cjs"))),mcSolution:r(()=>Promise.resolve().then(()=>require("./McSolution-5feP69N7.cjs")))},R={table:r(()=>Promise.resolve().then(()=>require("./TableContainer-C5KXY6f7.cjs"))),tableHeader:r(()=>Promise.resolve().then(()=>require("./TableHeader-BTuqvorM.cjs"))),tableRow:r(()=>Promise.resolve().then(()=>require("./TableRow-D4F6AKFt.cjs"))),tableCell:r(()=>Promise.resolve().then(()=>require("./TableCell-BY9gdldc.cjs")))},$={doc:r(()=>Promise.resolve().then(()=>require("./Doc-D2yvlSII.cjs"))),slotNode:r(()=>Promise.resolve().then(()=>require("./SlotNode-DqwL4TkF.cjs")))},A={...y,...B,...b,...C,...x,...M,...I,...L,...N,...R,...$,...w},u=e.defineComponent({__name:"TreeRecursive",props:{node:{}},setup(o){const t=new Set(["blockquote","orderedList","bulletList","paragraph","math_display","codeBlock","cellOutput","callout","foldBlock","image","attachment-block","grid","table","iframe","multipleChoice"]),n=e.computed(()=>t.has(o.node.type)&&o.node.attrs&&o.node.attrs["block-id"]?{"data-block-id":o.node.attrs["block-id"]}:{});return(s,i)=>{const d=e.resolveComponent("TreeRecursive",!0);return e.openBlock(),e.createBlock(e.Suspense,null,{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(A)[o.node.type]),e.mergeProps({node:o.node},n.value),{default:e.withCtx(()=>[o.node.content&&!(o.node.type in["foldBlock","grid","callout"])?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(o.node.content,h=>(e.openBlock(),e.createBlock(d,{node:h,key:e.useId()},null,8,["node"]))),128)):e.createCommentVNode("",!0)]),_:1},16,["node"]))]),_:1})}}}),E={class:"tree-render"},S=e.defineComponent({__name:"TreeRender",props:{node:{},axios:{}},setup(o){return e.provide(m,l),e.provide(a,o.axios),e.watch(()=>o.node,t=>{l.value=p(t)},{immediate:!0}),(t,n)=>(e.openBlock(),e.createElementBlock("div",E,[e.createVNode(u,{node:o.node},null,8,["node"])]))}});exports._export_sfc=c;exports._sfc_main=u;exports._sfc_main$1=S;exports.axiosKey=a;exports.imageNodesKey=m;