@datawhale/prosemirror-render 0.0.12 → 0.0.14

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 (55) hide show
  1. package/dist/{AttachmentBlock-CPpG2dPv.js → AttachmentBlock-ByHtTWuI.js} +2 -2
  2. package/dist/{AttachmentBlock-BXCk0hjn.cjs → AttachmentBlock-tnlBhmh1.cjs} +1 -1
  3. package/dist/{AttachmentInline-Bmi7A-PO.cjs → AttachmentInline-B1iq2ZzJ.cjs} +1 -1
  4. package/dist/{AttachmentInline-DeqcVAAu.js → AttachmentInline-CVcQynCS.js} +2 -2
  5. package/dist/{AttachmentMenu-CqB_XZH_.cjs → AttachmentMenu-BFzuLVvs.cjs} +1 -1
  6. package/dist/{AttachmentMenu-BlYR8886.js → AttachmentMenu-oBI7t5eW.js} +1 -1
  7. package/dist/{Callout-A58rxjcd.js → Callout-CAAjU4gc.js} +1 -1
  8. package/dist/{Callout-D4hGVBL_.cjs → Callout-CZlxGY4m.cjs} +1 -1
  9. package/dist/{CellOutput-CgpD9ZVf.cjs → CellOutput-B0B-15G4.cjs} +1 -1
  10. package/dist/{CellOutput-DDtmytFi.js → CellOutput-CSND51qF.js} +1 -1
  11. package/dist/{CodeBlock-DYTo0bg9.cjs → CodeBlock-C-HQYt0D.cjs} +1 -1
  12. package/dist/{CodeBlock-DzHugjpL.js → CodeBlock-esh4GRUm.js} +1 -1
  13. package/dist/{FoldBlock-DuHOT0cm.cjs → FoldBlock-DPjAMxNU.cjs} +1 -1
  14. package/dist/{FoldBlock-CJ3VZP86.js → FoldBlock-GqZ4Q6gf.js} +1 -1
  15. package/dist/{Grid-wjd8RU78.cjs → Grid-CWblUZA1.cjs} +1 -1
  16. package/dist/{Grid-CQMBfo8m.js → Grid-DgWoulAe.js} +1 -1
  17. package/dist/{IFrame-thNWtKGt.js → IFrame-BZYrBDpx.js} +1 -1
  18. package/dist/{IFrame-CuNyVByE.cjs → IFrame-Ch4uHCg5.cjs} +1 -1
  19. package/dist/{Image-BpCN7g0S.js → Image-BGDBIQBQ.js} +32 -33
  20. package/dist/Image-DO6aHhWw.cjs +1 -0
  21. package/dist/{MathDisplay-BXmKwa-7.js → MathDisplay-C0EWPqfF.js} +1 -1
  22. package/dist/{MathDisplay-Bk51oHnp.cjs → MathDisplay-C9wXYcrr.cjs} +1 -1
  23. package/dist/{MathInline-BT1QFQpO.js → MathInline-BnR24HSK.js} +1 -1
  24. package/dist/{MathInline-rUQCNe0b.cjs → MathInline-CRd3OFdA.cjs} +1 -1
  25. package/dist/{McChoices-D8svqhmT.cjs → McChoices-BRXKs2zr.cjs} +1 -1
  26. package/dist/{McChoices-CXvkhpsm.js → McChoices-C5FkOVA3.js} +1 -1
  27. package/dist/{McQuestion-BPDceSgZ.js → McQuestion-Ctvd6D_8.js} +1 -1
  28. package/dist/{McQuestion-uwFwxlQo.cjs → McQuestion-DZnm3GYh.cjs} +1 -1
  29. package/dist/{McSolution-BveHl5G0.js → McSolution-CIp9mRqD.js} +1 -1
  30. package/dist/{McSolution-DB6fl73p.cjs → McSolution-Ddp2JqTg.cjs} +1 -1
  31. package/dist/{MultipleChoice-DNKuX9FK.js → MultipleChoice-BLWPtgSX.js} +4 -4
  32. package/dist/{MultipleChoice-DgTOWVtn.cjs → MultipleChoice-Dn1ewqwh.cjs} +1 -1
  33. package/dist/{Paragraph-BsBVTwg-.cjs → Paragraph-D9tNHRR2.cjs} +1 -1
  34. package/dist/{Paragraph-NxCCIiIf.js → Paragraph-WPKhTw9U.js} +1 -1
  35. package/dist/{SlotNode-QH4h4XFh.cjs → SlotNode-CuhFzL_Q.cjs} +1 -1
  36. package/dist/{SlotNode-DiKoiDD2.js → SlotNode-mfYYyUtZ.js} +1 -1
  37. package/dist/{Text-Buwy2OVC.cjs → Text-CO8w66wD.cjs} +1 -1
  38. package/dist/{Text-D1jF9H18.js → Text-Cs5aiGbS.js} +1 -1
  39. package/dist/VideoPlayer-BEvuUlWw.cjs +1 -0
  40. package/dist/VideoPlayer-CN37442r.js +33 -0
  41. package/dist/index-C3GRUUlT.cjs +1 -0
  42. package/dist/index-Dnk-53ct.js +217 -0
  43. package/dist/index.cjs.js +1 -1
  44. package/dist/index.es.js +4 -3
  45. package/dist/prosemirror-render.css +1 -1
  46. package/dist/types/components/MediaRender.vue.d.ts +9 -0
  47. package/dist/types/components/collections/file/VideoPlayer.vue.d.ts +7 -0
  48. package/dist/types/components/collections/file/index.d.ts +1 -0
  49. package/dist/types/components/collections/utils.d.ts +11 -1
  50. package/dist/types/index.d.ts +2 -1
  51. package/dist/types/types.d.ts +10 -0
  52. package/package.json +1 -1
  53. package/dist/Image-D6kgI-oO.cjs +0 -1
  54. package/dist/index-ByaYOIDK.cjs +0 -1
  55. package/dist/index-D5y1u4eT.js +0 -186
@@ -1 +0,0 @@
1
- "use strict";const e=require("vue"),m=Symbol(),u=e.ref([]),d=Symbol(),p=r=>{if(!r)return[];const o=[],n=s=>{s.type==="image"&&o.push(s),s.content&&s.content.forEach(i=>n(i))};return n(r),o},l=(r,o)=>{const n=r.__vccOpts||r;for(const[s,i]of o)n[s]=i;return n},v={},f={class:"error-wrapper"};function k(r,o){return e.openBlock(),e.createElementBlock("div",f,"组件加载失败")}const g=l(v,[["render",k],["__scopeId","data-v-4fa940a8"]]),q={};function P(r,o){return"loading..."}const y=l(q,[["render",P]]),t=(r,o={loadingComponent:y,delay:200,errorComponent:g,timeout:5e3})=>e.defineAsyncComponent({loader:r,...o});function B(r){if(!r||!r.content)return[r];const o=[];let n=[],s=null;return r.content.forEach(i=>{if(i.type==="heading"||i.type==="heading"){const c=i.attrs?.level;s===null&&(s=c),c===s&&n.length>0&&(o.push({type:"doc",content:n}),n=[])}n.push(i)}),n.length>0&&o.push({type:"doc",content:n}),o}const _={"attachment-inline":t(()=>Promise.resolve().then(()=>require("./AttachmentInline-Bmi7A-PO.cjs"))),"attachment-block":t(()=>Promise.resolve().then(()=>require("./AttachmentBlock-BXCk0hjn.cjs")))},C={text:t(()=>Promise.resolve().then(()=>require("./Text-Buwy2OVC.cjs"))),paragraph:t(()=>Promise.resolve().then(()=>require("./Paragraph-BsBVTwg-.cjs"))),heading:t(()=>Promise.resolve().then(()=>require("./Heading-BUnffIAz.cjs"))),orderedList:t(()=>Promise.resolve().then(()=>require("./OrderedList-DMl3tvwP.cjs"))),bulletList:t(()=>Promise.resolve().then(()=>require("./BulletList-CFjF3U-l.cjs"))),listItem:t(()=>Promise.resolve().then(()=>require("./ListItem-BrjxeGxz.cjs"))),horizontalRule:t(()=>Promise.resolve().then(()=>require("./HorizontalRule-CE09LZGf.cjs"))),blockquote:t(()=>Promise.resolve().then(()=>require("./Blockquote-CQSBFnsu.cjs"))),hardBreak:t(()=>Promise.resolve().then(()=>require("./HardBreak-Dbf5Zg5o.cjs")))},b={callout:t(()=>Promise.resolve().then(()=>require("./Callout-D4hGVBL_.cjs")))},M={codeBlock:t(()=>Promise.resolve().then(()=>require("./CodeBlock-DYTo0bg9.cjs"))),cellOutput:t(()=>Promise.resolve().then(()=>require("./CellOutput-CgpD9ZVf.cjs")))},x={foldBlock:t(()=>Promise.resolve().then(()=>require("./FoldBlock-DuHOT0cm.cjs")))},I={grid:t(()=>Promise.resolve().then(()=>require("./Grid-wjd8RU78.cjs")))},L={iframe:t(()=>Promise.resolve().then(()=>require("./IFrame-CuNyVByE.cjs")))},w={image:t(()=>Promise.resolve().then(()=>require("./Image-D6kgI-oO.cjs")))},E={math_inline:t(()=>Promise.resolve().then(()=>require("./MathInline-rUQCNe0b.cjs"))),math_display:t(()=>Promise.resolve().then(()=>require("./MathDisplay-Bk51oHnp.cjs")))},N={multipleChoice:t(()=>Promise.resolve().then(()=>require("./MultipleChoice-DgTOWVtn.cjs"))),mcQuestion:t(()=>Promise.resolve().then(()=>require("./McQuestion-uwFwxlQo.cjs"))),mcChoices:t(()=>Promise.resolve().then(()=>require("./McChoices-D8svqhmT.cjs"))),mcSolution:t(()=>Promise.resolve().then(()=>require("./McSolution-DB6fl73p.cjs")))},R={table:t(()=>Promise.resolve().then(()=>require("./TableContainer-C5KXY6f7.cjs"))),tableHeader:t(()=>Promise.resolve().then(()=>require("./TableHeader-BTuqvorM.cjs"))),tableRow:t(()=>Promise.resolve().then(()=>require("./TableRow-D4F6AKFt.cjs"))),tableCell:t(()=>Promise.resolve().then(()=>require("./TableCell-BY9gdldc.cjs")))},$={doc:t(()=>Promise.resolve().then(()=>require("./Doc-D2yvlSII.cjs"))),slotNode:t(()=>Promise.resolve().then(()=>require("./SlotNode-QH4h4XFh.cjs")))},A={..._,...C,...b,...M,...x,...I,...w,...E,...N,...R,...$,...L},h=e.defineComponent({__name:"TreeRecursive",props:{node:{}},setup(r){const o=new Set(["blockquote","orderedList","bulletList","paragraph","math_display","codeBlock","cellOutput","callout","foldBlock","image","attachment-block","grid","table","iframe","multipleChoice"]),n=e.computed(()=>o.has(r.node.type)&&r.node.attrs&&r.node.attrs["block-id"]?{"data-block-id":r.node.attrs["block-id"]}:{});return(s,i)=>{const a=e.resolveComponent("TreeRecursive",!0);return e.openBlock(),e.createBlock(e.Suspense,null,{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(A)[r.node.type]),e.mergeProps({node:r.node},n.value),{default:e.withCtx(()=>[r.node.content&&!(r.node.type in["foldBlock","grid","callout"])?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(r.node.content,c=>(e.openBlock(),e.createBlock(a,{node:c,key:e.useId()},null,8,["node"]))),128)):e.createCommentVNode("",!0)]),_:1},16,["node"]))]),_:1})}}}),H={class:"tree-render"},S=e.defineComponent({__name:"TreeRender",props:{node:{},axios:{}},setup(r){return e.provide(d,u),e.provide(m,r.axios),e.watch(()=>r.node,o=>{u.value=p(o)},{immediate:!0}),(o,n)=>(e.openBlock(),e.createElementBlock("div",H,[r.node?(e.openBlock(),e.createBlock(h,{key:0,node:r.node},null,8,["node"])):e.createCommentVNode("",!0)]))}});exports._export_sfc=l;exports._sfc_main=h;exports._sfc_main$1=S;exports.axiosKey=m;exports.imageNodesKey=d;exports.splitDocIntoMultiPagesByHeading=B;
@@ -1,186 +0,0 @@
1
- import { ref as y, createElementBlock as l, openBlock as a, defineAsyncComponent as k, defineComponent as f, computed as _, resolveComponent as b, createBlock as s, Suspense as v, withCtx as p, resolveDynamicComponent as C, unref as M, mergeProps as B, createCommentVNode as h, Fragment as x, renderList as L, useId as I, provide as d, watch as w } from "vue";
2
- const R = /* @__PURE__ */ Symbol(), u = y([]), A = /* @__PURE__ */ Symbol(), S = (t) => {
3
- if (!t)
4
- return [];
5
- const o = [], n = (r) => {
6
- r.type === "image" && o.push(r), r.content && r.content.forEach((c) => n(c));
7
- };
8
- return n(t), o;
9
- }, g = (t, o) => {
10
- const n = t.__vccOpts || t;
11
- for (const [r, c] of o)
12
- n[r] = c;
13
- return n;
14
- }, $ = {}, E = { class: "error-wrapper" };
15
- function H(t, o) {
16
- return a(), l("div", E, "组件加载失败");
17
- }
18
- const N = /* @__PURE__ */ g($, [["render", H], ["__scopeId", "data-v-4fa940a8"]]), T = {};
19
- function D(t, o) {
20
- return "loading...";
21
- }
22
- const O = /* @__PURE__ */ g(T, [["render", D]]), e = (t, o = {
23
- loadingComponent: O,
24
- delay: 200,
25
- errorComponent: N,
26
- timeout: 5e3
27
- }) => k({
28
- loader: t,
29
- ...o
30
- });
31
- function te(t) {
32
- if (!t || !t.content)
33
- return [t];
34
- const o = [];
35
- let n = [], r = null;
36
- return t.content.forEach((c) => {
37
- if (c.type === "heading" || c.type === "heading") {
38
- const i = c.attrs?.level;
39
- r === null && (r = i), i === r && n.length > 0 && (o.push({
40
- type: "doc",
41
- content: n
42
- }), n = []);
43
- }
44
- n.push(c);
45
- }), n.length > 0 && o.push({
46
- type: "doc",
47
- content: n
48
- }), o;
49
- }
50
- const q = {
51
- "attachment-inline": e(() => import("./AttachmentInline-DeqcVAAu.js")),
52
- "attachment-block": e(() => import("./AttachmentBlock-CPpG2dPv.js"))
53
- }, K = {
54
- text: e(() => import("./Text-D1jF9H18.js")),
55
- paragraph: e(() => import("./Paragraph-NxCCIiIf.js")),
56
- heading: e(() => import("./Heading-BElRvhGn.js")),
57
- orderedList: e(() => import("./OrderedList-B8v1gchv.js")),
58
- bulletList: e(() => import("./BulletList-BQTUD69X.js")),
59
- listItem: e(() => import("./ListItem-X0T7a_z8.js")),
60
- horizontalRule: e(() => import("./HorizontalRule-BRG45oT0.js")),
61
- blockquote: e(() => import("./Blockquote-BamWUQND.js")),
62
- hardBreak: e(() => import("./HardBreak-B2tFO31P.js"))
63
- }, P = {
64
- callout: e(() => import("./Callout-A58rxjcd.js"))
65
- }, z = {
66
- codeBlock: e(() => import("./CodeBlock-DzHugjpL.js")),
67
- cellOutput: e(() => import("./CellOutput-DDtmytFi.js"))
68
- }, F = {
69
- foldBlock: e(() => import("./FoldBlock-CJ3VZP86.js"))
70
- }, Q = {
71
- grid: e(() => import("./Grid-CQMBfo8m.js"))
72
- }, V = {
73
- iframe: e(() => import("./IFrame-thNWtKGt.js"))
74
- }, j = {
75
- image: e(() => import("./Image-BpCN7g0S.js"))
76
- }, G = {
77
- math_inline: e(() => import("./MathInline-BT1QFQpO.js")),
78
- math_display: e(() => import("./MathDisplay-BXmKwa-7.js"))
79
- }, J = {
80
- multipleChoice: e(() => import("./MultipleChoice-DNKuX9FK.js")),
81
- mcQuestion: e(() => import("./McQuestion-BPDceSgZ.js")),
82
- mcChoices: e(() => import("./McChoices-CXvkhpsm.js")),
83
- mcSolution: e(() => import("./McSolution-BveHl5G0.js"))
84
- }, U = {
85
- table: e(() => import("./TableContainer-C9PhNGlz.js")),
86
- tableHeader: e(() => import("./TableHeader-C7KKz3e1.js")),
87
- tableRow: e(() => import("./TableRow-OzpVq1qW.js")),
88
- tableCell: e(() => import("./TableCell-Bp52L368.js"))
89
- }, W = {
90
- doc: e(() => import("./Doc-6s4VMDsx.js")),
91
- slotNode: e(() => import("./SlotNode-DiKoiDD2.js"))
92
- }, X = {
93
- ...q,
94
- // 附件和视频类型
95
- ...K,
96
- // 基础类型,包括各种字体样式
97
- ...P,
98
- // 高亮块
99
- ...z,
100
- // 代码块
101
- ...F,
102
- // 折叠块
103
- ...Q,
104
- // 分栏
105
- ...j,
106
- // 图片
107
- ...G,
108
- // 数学公式
109
- ...J,
110
- //选择题
111
- ...U,
112
- // 表格
113
- ...W,
114
- // 容器
115
- ...V
116
- // iframe
117
- }, Y = /* @__PURE__ */ f({
118
- __name: "TreeRecursive",
119
- props: {
120
- node: {}
121
- },
122
- setup(t) {
123
- const o = /* @__PURE__ */ new Set([
124
- "blockquote",
125
- "orderedList",
126
- "bulletList",
127
- "paragraph",
128
- "math_display",
129
- "codeBlock",
130
- "cellOutput",
131
- "callout",
132
- "foldBlock",
133
- "image",
134
- "attachment-block",
135
- "grid",
136
- "table",
137
- "iframe",
138
- "multipleChoice"
139
- ]), n = _(() => o.has(t.node.type) && t.node.attrs && t.node.attrs["block-id"] ? { "data-block-id": t.node.attrs["block-id"] } : {});
140
- return (r, c) => {
141
- const m = b("TreeRecursive", !0);
142
- return a(), s(v, null, {
143
- default: p(() => [
144
- (a(), s(C(M(X)[t.node.type]), B({ node: t.node }, n.value), {
145
- default: p(() => [
146
- t.node.content && !(t.node.type in ["foldBlock", "grid", "callout"]) ? (a(!0), l(x, { key: 0 }, L(t.node.content, (i) => (a(), s(m, {
147
- node: i,
148
- key: I()
149
- }, null, 8, ["node"]))), 128)) : h("", !0)
150
- ]),
151
- _: 1
152
- }, 16, ["node"]))
153
- ]),
154
- _: 1
155
- });
156
- };
157
- }
158
- }), Z = { class: "tree-render" }, oe = /* @__PURE__ */ f({
159
- __name: "TreeRender",
160
- props: {
161
- node: {},
162
- axios: {}
163
- },
164
- setup(t) {
165
- return d(A, u), d(R, t.axios), w(
166
- () => t.node,
167
- (o) => {
168
- u.value = S(o);
169
- },
170
- { immediate: !0 }
171
- ), (o, n) => (a(), l("div", Z, [
172
- t.node ? (a(), s(Y, {
173
- key: 0,
174
- node: t.node
175
- }, null, 8, ["node"])) : h("", !0)
176
- ]));
177
- }
178
- });
179
- export {
180
- g as _,
181
- R as a,
182
- Y as b,
183
- oe as c,
184
- A as i,
185
- te as s
186
- };