@ylzcc/editor 0.0.10 → 0.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/dist/editor.es.js +35 -34
- package/dist/editor.umd.js +4 -4
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/editor.es.js
CHANGED
|
@@ -86055,11 +86055,12 @@ const setAlign = (Ff) => {
|
|
|
86055
86055
|
}
|
|
86056
86056
|
}, ime = (ome) => /^https?:\/\//.test(ome);
|
|
86057
86057
|
return useEffect(() => {
|
|
86058
|
-
var
|
|
86059
|
-
if (kh
|
|
86060
|
-
|
|
86061
|
-
|
|
86062
|
-
|
|
86058
|
+
var lme, dme;
|
|
86059
|
+
if (!kh)
|
|
86060
|
+
return;
|
|
86061
|
+
const ome = kh.state.doc, ame = (dme = (lme = kh == null ? void 0 : kh.view) == null ? void 0 : lme.state) == null ? void 0 : dme.selection, { $from: ume, $to: cme } = ame, sme = ome.textBetween(ume.pos, cme.pos, " ");
|
|
86062
|
+
if (zP(sme ?? ""), kh != null && kh.isActive("link")) {
|
|
86063
|
+
const fme = ume.node();
|
|
86063
86064
|
fme == null || fme.forEach((pme) => {
|
|
86064
86065
|
var hme;
|
|
86065
86066
|
pme != null && pme.marks && ((hme = pme == null ? void 0 : pme.marks) == null || hme.forEach((mme) => {
|
|
@@ -86512,45 +86513,45 @@ function LowlightPlugin({
|
|
|
86512
86513
|
return B_;
|
|
86513
86514
|
}
|
|
86514
86515
|
const CodeBlockView = ({ editor: Ff, node: kh, updateAttributes: x_, extension: B_ }) => {
|
|
86515
|
-
var
|
|
86516
|
-
const $_ = useContext(shareData), [$P, zP] = useState("light"), [eme, tme] = useState(((
|
|
86516
|
+
var lme, dme, fme, pme, hme, mme, vme;
|
|
86517
|
+
const $_ = useContext(shareData), [$P, zP] = useState("light"), [eme, tme] = useState(((lme = kh == null ? void 0 : kh.attrs) == null ? void 0 : lme.exec) || !1), [nme, rme] = useState(!1), [ime, ome] = useState(!1), ame = (gme) => {
|
|
86517
86518
|
x_({
|
|
86518
|
-
language:
|
|
86519
|
+
language: gme
|
|
86519
86520
|
});
|
|
86520
|
-
},
|
|
86521
|
-
var
|
|
86522
|
-
const
|
|
86523
|
-
tme(
|
|
86524
|
-
exec:
|
|
86521
|
+
}, ume = (gme) => {
|
|
86522
|
+
var Sme;
|
|
86523
|
+
const _me = (Sme = gme == null ? void 0 : gme.target) == null ? void 0 : Sme.checked;
|
|
86524
|
+
tme(_me), x_({
|
|
86525
|
+
exec: _me
|
|
86525
86526
|
});
|
|
86526
|
-
},
|
|
86527
|
-
var
|
|
86528
|
-
(
|
|
86527
|
+
}, cme = () => {
|
|
86528
|
+
var gme;
|
|
86529
|
+
(gme = navigator == null ? void 0 : navigator.clipboard) == null || gme.writeText(kh == null ? void 0 : kh.textContent).then(() => {
|
|
86529
86530
|
rme(!0);
|
|
86530
|
-
const
|
|
86531
|
-
rme(!1), clearTimeout(
|
|
86531
|
+
const _me = setTimeout(() => {
|
|
86532
|
+
rme(!1), clearTimeout(_me);
|
|
86532
86533
|
}, 2e3);
|
|
86533
86534
|
});
|
|
86534
|
-
},
|
|
86535
|
-
var
|
|
86536
|
-
(
|
|
86535
|
+
}, sme = () => {
|
|
86536
|
+
var gme;
|
|
86537
|
+
(gme = B_ == null ? void 0 : B_.options) == null || gme.onExec(kh == null ? void 0 : kh.textContent);
|
|
86537
86538
|
};
|
|
86538
86539
|
return useEffect(() => {
|
|
86539
86540
|
zP(eme ? "dark" : "light");
|
|
86540
|
-
}, [eme]), /* @__PURE__ */ jsxRuntimeExports.
|
|
86541
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "code-block-header", contentEditable: !1, children: [
|
|
86541
|
+
}, [eme]), /* @__PURE__ */ jsxRuntimeExports.jsx(NodeViewWrapper, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `code-block code-block-${$P}`, onMouseEnter: () => ome(!0), onMouseLeave: () => ome(!1), children: [
|
|
86542
|
+
ime && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "code-block-header", contentEditable: !1, children: [
|
|
86542
86543
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "code-block-header-left", children: [
|
|
86543
86544
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
86544
86545
|
Select$1,
|
|
86545
86546
|
{
|
|
86546
86547
|
disabled: !(Ff != null && Ff.isEditable),
|
|
86547
86548
|
placeholder: "选择语言",
|
|
86548
|
-
defaultValue: ((
|
|
86549
|
+
defaultValue: ((dme = kh == null ? void 0 : kh.attrs) == null ? void 0 : dme.language) ?? "",
|
|
86549
86550
|
style: { width: 90 },
|
|
86550
|
-
onChange:
|
|
86551
|
+
onChange: ame,
|
|
86551
86552
|
options: [
|
|
86552
86553
|
{ value: "", label: "atuo" },
|
|
86553
|
-
...(
|
|
86554
|
+
...(hme = (pme = (fme = B_ == null ? void 0 : B_.options) == null ? void 0 : fme.lowlight) == null ? void 0 : pme.listLanguages()) == null ? void 0 : hme.map((gme) => ({ value: gme, label: gme }))
|
|
86554
86555
|
]
|
|
86555
86556
|
}
|
|
86556
86557
|
),
|
|
@@ -86558,15 +86559,15 @@ const CodeBlockView = ({ editor: Ff, node: kh, updateAttributes: x_, extension:
|
|
|
86558
86559
|
Select$1,
|
|
86559
86560
|
{
|
|
86560
86561
|
disabled: !0,
|
|
86561
|
-
defaultValue: ((
|
|
86562
|
+
defaultValue: ((mme = $_ == null ? void 0 : $_.template) == null ? void 0 : mme.name) || ((vme = $_ == null ? void 0 : $_.template) == null ? void 0 : vme.experEnv)
|
|
86562
86563
|
}
|
|
86563
86564
|
)
|
|
86564
86565
|
] }),
|
|
86565
|
-
($_ == null ? void 0 : $_.template) && (Ff == null ? void 0 : Ff.isEditable) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "code-block-header-right", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Checkbox$1, { checked: eme, onChange:
|
|
86566
|
+
($_ == null ? void 0 : $_.template) && (Ff == null ? void 0 : Ff.isEditable) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "code-block-header-right", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Checkbox$1, { checked: eme, onChange: ume, children: "执行" }) })
|
|
86566
86567
|
] }),
|
|
86567
86568
|
/* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "code-block-body", children: /* @__PURE__ */ jsxRuntimeExports.jsx(NodeViewContent, { as: "code" }) }),
|
|
86568
86569
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "code-block-action", contentEditable: !1, children: [
|
|
86569
|
-
eme && ($_ == null ? void 0 : $_.template) && /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { type: "primary", onClick:
|
|
86570
|
+
eme && ($_ == null ? void 0 : $_.template) && /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { type: "primary", onClick: sme, children: "执行" }),
|
|
86570
86571
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "code-block-action-copy", children: [
|
|
86571
86572
|
nme && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "copy-tip", children: [
|
|
86572
86573
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
@@ -86576,10 +86577,10 @@ const CodeBlockView = ({ editor: Ff, node: kh, updateAttributes: x_, extension:
|
|
|
86576
86577
|
] }),
|
|
86577
86578
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "复制成功" })
|
|
86578
86579
|
] }),
|
|
86579
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { type: "primary", onClick:
|
|
86580
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { type: "primary", onClick: cme, children: "复制" })
|
|
86580
86581
|
] })
|
|
86581
86582
|
] })
|
|
86582
|
-
] });
|
|
86583
|
+
] }) });
|
|
86583
86584
|
}, CodeBlockLowlight = CodeBlock.extend({
|
|
86584
86585
|
addOptions() {
|
|
86585
86586
|
var Ff;
|
|
@@ -88406,7 +88407,7 @@ const upload = async (Ff) => {
|
|
|
88406
88407
|
// getReferenceClientRect: tableDom.getBoundingClientRect
|
|
88407
88408
|
});
|
|
88408
88409
|
}, [$_, zP]);
|
|
88409
|
-
const vme = window.innerHeight / 2;
|
|
88410
|
+
const vme = window.innerHeight / 2 - 30;
|
|
88410
88411
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "tiptap-menu tiptap-scroll", style: { maxHeight: vme, overflowY: "auto" }, children: [
|
|
88411
88412
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "tiptap-menu-item", children: [
|
|
88412
88413
|
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "tiptap-menu-item-title", children: "基础" }),
|
|
@@ -88997,7 +88998,7 @@ const normalClass = "tiptap-menu-item-menus-item", lighClass = "tiptap-menu-item
|
|
|
88997
88998
|
x_ == null || x_.chain().focus(eme).deleteRange($_.range).setHorizontalRule().hideMenu().run();
|
|
88998
88999
|
}, fme = () => {
|
|
88999
89000
|
x_ == null || x_.chain().focus(eme).deleteRange($_.range).setBlockquote().hideMenu().run();
|
|
89000
|
-
}, pme = window.innerHeight / 2;
|
|
89001
|
+
}, pme = window.innerHeight / 2 - 30;
|
|
89001
89002
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "tiptap-menu tiptap-scroll", style: { maxHeight: pme, overflowY: "auto" }, ref: zP, children: [
|
|
89002
89003
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "tiptap-menu-item", children: [
|
|
89003
89004
|
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "tiptap-menu-item-title", children: "基础" }),
|
|
@@ -140112,7 +140113,7 @@ let Editor = (Ff, kh) => {
|
|
|
140112
140113
|
},
|
|
140113
140114
|
changeMdTest: (Ome) => {
|
|
140114
140115
|
console.log(Ome, sme);
|
|
140115
|
-
const Cme = sme.filter(
|
|
140116
|
+
const Cme = sme == null ? void 0 : sme.children.filter(
|
|
140116
140117
|
($me) => ($me == null ? void 0 : $me.props) !== "active" && ($me == null ? void 0 : $me.value) !== Ome[0].value
|
|
140117
140118
|
);
|
|
140118
140119
|
console.log(Cme);
|