@opositatest/markdown-text-editor 1.0.6 → 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.
- package/README.md +52 -0
- package/dist/editor.css +1 -1
- package/dist/editor.js +26 -17
- package/dist/react/index.js +20 -13
- package/package.json +1 -1
package/dist/editor.js
CHANGED
|
@@ -64328,7 +64328,7 @@ function Eme(e) {
|
|
|
64328
64328
|
linkToolbar: !1,
|
|
64329
64329
|
slashMenu: !1,
|
|
64330
64330
|
sideMenu: !1,
|
|
64331
|
-
filePanel: !
|
|
64331
|
+
filePanel: !0,
|
|
64332
64332
|
tableHandles: !1,
|
|
64333
64333
|
emojiPicker: !1
|
|
64334
64334
|
});
|
|
@@ -86531,10 +86531,17 @@ function mge(e, t) {
|
|
|
86531
86531
|
}
|
|
86532
86532
|
//#endregion
|
|
86533
86533
|
//#region src/hooks/use-app-block-note-editor/use-app-block-note-editor.ts
|
|
86534
|
-
function hge(e) {
|
|
86534
|
+
async function hge(e) {
|
|
86535
|
+
return new Promise((t) => {
|
|
86536
|
+
let n = new FileReader();
|
|
86537
|
+
n.onloadend = () => t(n.result), n.readAsDataURL(e);
|
|
86538
|
+
});
|
|
86539
|
+
}
|
|
86540
|
+
function gge(e) {
|
|
86535
86541
|
let { placeholder: t } = e;
|
|
86536
86542
|
return b0({
|
|
86537
86543
|
schema: fge,
|
|
86544
|
+
uploadFile: hge,
|
|
86538
86545
|
placeholders: t ? {
|
|
86539
86546
|
default: t,
|
|
86540
86547
|
emptyDocument: t
|
|
@@ -86543,8 +86550,8 @@ function hge(e) {
|
|
|
86543
86550
|
}
|
|
86544
86551
|
//#endregion
|
|
86545
86552
|
//#region src/editor/editor-field/editor-field-markdown.ts
|
|
86546
|
-
function
|
|
86547
|
-
let n =
|
|
86553
|
+
function _ge(e, t) {
|
|
86554
|
+
let n = vge(t).flatMap((t) => t.type === "math" ? [{
|
|
86548
86555
|
type: "math",
|
|
86549
86556
|
props: { latex: t.value }
|
|
86550
86557
|
}] : t.value.trim() ? e.tryParseMarkdownToBlocks(t.value) : []);
|
|
@@ -86566,7 +86573,7 @@ function $9(e, t = e.document) {
|
|
|
86566
86573
|
}
|
|
86567
86574
|
return i(), n.join("\n\n").trim();
|
|
86568
86575
|
}
|
|
86569
|
-
function
|
|
86576
|
+
function vge(e) {
|
|
86570
86577
|
let t = e.replace(/\r\n?/g, "\n");
|
|
86571
86578
|
if (!t.trim()) return [];
|
|
86572
86579
|
let n = t.split("\n"), r = [], i = [], a = null;
|
|
@@ -86595,9 +86602,9 @@ function _ge(e) {
|
|
|
86595
86602
|
}
|
|
86596
86603
|
//#endregion
|
|
86597
86604
|
//#region src/editor/hooks/use-editor-field-controller.ts
|
|
86598
|
-
function
|
|
86599
|
-
let { defaultValue: t, onChange: n, onReady: r, placeholder: i, ref: a, value: o } = e, s = (0, E.useRef)(o ?? t ?? ""), c = (0, E.useRef)(!1), l =
|
|
86600
|
-
c.current = !0, l.replaceBlocks(l.document,
|
|
86605
|
+
function yge(e) {
|
|
86606
|
+
let { defaultValue: t, onChange: n, onReady: r, placeholder: i, ref: a, value: o } = e, s = (0, E.useRef)(o ?? t ?? ""), c = (0, E.useRef)(!1), l = gge({ placeholder: i }), u = l, d = (0, E.useCallback)((e) => {
|
|
86607
|
+
c.current = !0, l.replaceBlocks(l.document, _ge(u, e)), s.current = $9(u), c.current = !1;
|
|
86601
86608
|
}, [l, u]), f = (0, E.useCallback)(() => {
|
|
86602
86609
|
l.focus();
|
|
86603
86610
|
}, [l]), p = (0, E.useCallback)(() => s.current, []), m = (0, E.useCallback)((e) => {
|
|
@@ -86647,19 +86654,19 @@ function vge(e) {
|
|
|
86647
86654
|
}
|
|
86648
86655
|
//#endregion
|
|
86649
86656
|
//#region src/editor/editor-field/editor-field.tsx
|
|
86650
|
-
function
|
|
86657
|
+
function bge(e, t) {
|
|
86651
86658
|
let n = {};
|
|
86652
86659
|
if (e && (n.width = e), t && (n.height = t, n["--markdown-text-editor-height"] = t), !(!e && !t)) return n;
|
|
86653
86660
|
}
|
|
86654
|
-
var
|
|
86655
|
-
let { editor: d, handleBlockNoteChange: f, handleSuggestionMenuItems: p } =
|
|
86661
|
+
var xge = (0, E.forwardRef)(function({ className: e, defaultValue: t, disabled: n = !1, height: r, onChange: i, onReady: a, placeholder: o, readonly: s = !1, value: c, width: l }, u) {
|
|
86662
|
+
let { editor: d, handleBlockNoteChange: f, handleSuggestionMenuItems: p } = yge({
|
|
86656
86663
|
defaultValue: t,
|
|
86657
86664
|
onChange: i,
|
|
86658
86665
|
onReady: a,
|
|
86659
86666
|
placeholder: o,
|
|
86660
86667
|
ref: u,
|
|
86661
86668
|
value: c
|
|
86662
|
-
}), m =
|
|
86669
|
+
}), m = bge(l, r);
|
|
86663
86670
|
return /* @__PURE__ */ (0, D.jsx)("div", {
|
|
86664
86671
|
className: e,
|
|
86665
86672
|
"data-disabled": n ? "true" : void 0,
|
|
@@ -86677,7 +86684,7 @@ var bge = (0, E.forwardRef)(function({ className: e, defaultValue: t, disabled:
|
|
|
86677
86684
|
})
|
|
86678
86685
|
})
|
|
86679
86686
|
});
|
|
86680
|
-
}),
|
|
86687
|
+
}), Sge = class extends HTMLElement {
|
|
86681
86688
|
static formAssociated = !0;
|
|
86682
86689
|
static get observedAttributes() {
|
|
86683
86690
|
return [...m];
|
|
@@ -86785,7 +86792,7 @@ var bge = (0, E.forwardRef)(function({ className: e, defaultValue: t, disabled:
|
|
|
86785
86792
|
return this.required && !this.disabled && !this.readOnly && this.currentValue === "";
|
|
86786
86793
|
}
|
|
86787
86794
|
renderReact() {
|
|
86788
|
-
!this.isConnected || !this.root || this.root.render(/* @__PURE__ */ (0, D.jsx)(
|
|
86795
|
+
!this.isConnected || !this.root || this.root.render(/* @__PURE__ */ (0, D.jsx)(xge, {
|
|
86789
86796
|
ref: this.handleEditorRef,
|
|
86790
86797
|
value: this.currentValue,
|
|
86791
86798
|
disabled: this.disabled,
|
|
@@ -86852,8 +86859,10 @@ var bge = (0, E.forwardRef)(function({ className: e, defaultValue: t, disabled:
|
|
|
86852
86859
|
};
|
|
86853
86860
|
//#endregion
|
|
86854
86861
|
//#region src/markdown-text-editor/register-markdown-text-editor.ts
|
|
86855
|
-
function
|
|
86856
|
-
customElements.get("markdown-text-editor") || customElements.define(d,
|
|
86862
|
+
function Cge() {
|
|
86863
|
+
customElements.get("markdown-text-editor") || customElements.define(d, Sge);
|
|
86857
86864
|
}
|
|
86858
|
-
|
|
86865
|
+
Cge();
|
|
86859
86866
|
//#endregion
|
|
86867
|
+
|
|
86868
|
+
export {};
|
package/dist/react/index.js
CHANGED
|
@@ -73472,7 +73472,7 @@ function Dfe(e) {
|
|
|
73472
73472
|
linkToolbar: !1,
|
|
73473
73473
|
slashMenu: !1,
|
|
73474
73474
|
sideMenu: !1,
|
|
73475
|
-
filePanel: !
|
|
73475
|
+
filePanel: !0,
|
|
73476
73476
|
tableHandles: !1,
|
|
73477
73477
|
emojiPicker: !1
|
|
73478
73478
|
});
|
|
@@ -95675,10 +95675,17 @@ function hme(e, t) {
|
|
|
95675
95675
|
}
|
|
95676
95676
|
//#endregion
|
|
95677
95677
|
//#region src/hooks/use-app-block-note-editor/use-app-block-note-editor.ts
|
|
95678
|
-
function gme(e) {
|
|
95678
|
+
async function gme(e) {
|
|
95679
|
+
return new Promise((t) => {
|
|
95680
|
+
let n = new FileReader();
|
|
95681
|
+
n.onloadend = () => t(n.result), n.readAsDataURL(e);
|
|
95682
|
+
});
|
|
95683
|
+
}
|
|
95684
|
+
function _me(e) {
|
|
95679
95685
|
let { placeholder: t } = e;
|
|
95680
95686
|
return B1({
|
|
95681
95687
|
schema: pme,
|
|
95688
|
+
uploadFile: gme,
|
|
95682
95689
|
placeholders: t ? {
|
|
95683
95690
|
default: t,
|
|
95684
95691
|
emptyDocument: t
|
|
@@ -95687,8 +95694,8 @@ function gme(e) {
|
|
|
95687
95694
|
}
|
|
95688
95695
|
//#endregion
|
|
95689
95696
|
//#region src/editor/editor-field/editor-field-markdown.ts
|
|
95690
|
-
function
|
|
95691
|
-
let n =
|
|
95697
|
+
function vme(e, t) {
|
|
95698
|
+
let n = yme(t).flatMap((t) => t.type === "math" ? [{
|
|
95692
95699
|
type: "math",
|
|
95693
95700
|
props: { latex: t.value }
|
|
95694
95701
|
}] : t.value.trim() ? e.tryParseMarkdownToBlocks(t.value) : []);
|
|
@@ -95710,7 +95717,7 @@ function $9(e, t = e.document) {
|
|
|
95710
95717
|
}
|
|
95711
95718
|
return i(), n.join("\n\n").trim();
|
|
95712
95719
|
}
|
|
95713
|
-
function
|
|
95720
|
+
function yme(e) {
|
|
95714
95721
|
let t = e.replace(/\r\n?/g, "\n");
|
|
95715
95722
|
if (!t.trim()) return [];
|
|
95716
95723
|
let n = t.split("\n"), r = [], i = [], a = null;
|
|
@@ -95739,9 +95746,9 @@ function vme(e) {
|
|
|
95739
95746
|
}
|
|
95740
95747
|
//#endregion
|
|
95741
95748
|
//#region src/editor/hooks/use-editor-field-controller.ts
|
|
95742
|
-
function
|
|
95743
|
-
let { defaultValue: t, onChange: n, onReady: r, placeholder: i, ref: a, value: o } = e, s = b(o ?? t ?? ""), c = b(!1), l =
|
|
95744
|
-
c.current = !0, l.replaceBlocks(l.document,
|
|
95749
|
+
function bme(e) {
|
|
95750
|
+
let { defaultValue: t, onChange: n, onReady: r, placeholder: i, ref: a, value: o } = e, s = b(o ?? t ?? ""), c = b(!1), l = _me({ placeholder: i }), u = l, d = f((e) => {
|
|
95751
|
+
c.current = !0, l.replaceBlocks(l.document, vme(u, e)), s.current = $9(u), c.current = !1;
|
|
95745
95752
|
}, [l, u]), p = f(() => {
|
|
95746
95753
|
l.focus();
|
|
95747
95754
|
}, [l]), m = f(() => s.current, []), g = f((e) => {
|
|
@@ -95791,19 +95798,19 @@ function yme(e) {
|
|
|
95791
95798
|
}
|
|
95792
95799
|
//#endregion
|
|
95793
95800
|
//#region src/editor/editor-field/editor-field.tsx
|
|
95794
|
-
function
|
|
95801
|
+
function xme(e, t) {
|
|
95795
95802
|
let n = {};
|
|
95796
95803
|
if (e && (n.width = e), t && (n.height = t, n["--markdown-text-editor-height"] = t), !(!e && !t)) return n;
|
|
95797
95804
|
}
|
|
95798
|
-
var
|
|
95799
|
-
let { editor: d, handleBlockNoteChange: f, handleSuggestionMenuItems: p } =
|
|
95805
|
+
var Sme = l(function({ className: e, defaultValue: t, disabled: n = !1, height: r, onChange: i, onReady: a, placeholder: o, readonly: s = !1, value: c, width: l }, u) {
|
|
95806
|
+
let { editor: d, handleBlockNoteChange: f, handleSuggestionMenuItems: p } = bme({
|
|
95800
95807
|
defaultValue: t,
|
|
95801
95808
|
onChange: i,
|
|
95802
95809
|
onReady: a,
|
|
95803
95810
|
placeholder: o,
|
|
95804
95811
|
ref: u,
|
|
95805
95812
|
value: c
|
|
95806
|
-
}), m =
|
|
95813
|
+
}), m = xme(l, r);
|
|
95807
95814
|
return /* @__PURE__ */ T("div", {
|
|
95808
95815
|
className: e,
|
|
95809
95816
|
"data-disabled": n ? "true" : void 0,
|
|
@@ -95823,4 +95830,4 @@ var xme = l(function({ className: e, defaultValue: t, disabled: n = !1, height:
|
|
|
95823
95830
|
});
|
|
95824
95831
|
});
|
|
95825
95832
|
//#endregion
|
|
95826
|
-
export {
|
|
95833
|
+
export { Sme as MarkdownTextEditor };
|