@ctzhian/tiptap 1.12.5 → 1.12.7
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/EditorMarkdown/Toolbar.d.ts +10 -0
- package/dist/EditorMarkdown/Toolbar.js +840 -0
- package/dist/EditorMarkdown/demo.js +87 -104
- package/dist/EditorMarkdown/index.d.ts +2 -0
- package/dist/EditorMarkdown/index.js +46 -31
- package/dist/component/CustomDragHandle/index.js +3 -3
- package/dist/component/FloatingPopover/index.js +1 -1
- package/dist/component/Menu/NestedList.d.ts +1 -0
- package/dist/component/Menu/NestedList.js +6 -3
- package/dist/component/Menu/index.d.ts +4 -1
- package/dist/component/Menu/index.js +16 -5
- package/dist/component/Toolbar/EditorInsert/index.js +3 -3
- package/dist/contants/enums.js +1 -1
- package/dist/contants/markdown-placeholder.d.ts +1 -1
- package/dist/contants/markdown-placeholder.js +1 -1
- package/dist/contants/slash-commands.js +1 -1
- package/dist/extension/component/Link/Markdown.d.ts +4 -0
- package/dist/extension/component/Link/Markdown.js +40 -0
- package/dist/extension/component/SlashCommandsList/index.js +6 -6
- package/dist/extension/component/UploadProgress/index.d.ts +1 -1
- package/dist/extension/index.js +12 -11
- package/dist/extension/mark/Link.d.ts +2 -0
- package/dist/extension/mark/Link.js +84 -57
- package/dist/extension/node/Link/index.js +0 -19
- package/dist/extension/node/Video.js +0 -3
- package/dist/type/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -2,12 +2,62 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2
2
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
3
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
4
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
5
11
|
import { EditorMarkdown, EditorThemeProvider, useTiptap } from "./..";
|
|
6
12
|
import { Box } from '@mui/material';
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { MARKDOWN_EDITOR_PLACEHOLDER } from "../contants/markdown-placeholder";
|
|
13
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
9
14
|
import "../index.css";
|
|
10
15
|
var Reader = function Reader() {
|
|
16
|
+
var _useState = useState(''),
|
|
17
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
18
|
+
mdContent = _useState2[0],
|
|
19
|
+
setMdContent = _useState2[1];
|
|
20
|
+
var onUpload = /*#__PURE__*/function () {
|
|
21
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file, onProgress) {
|
|
22
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
23
|
+
while (1) switch (_context.prev = _context.next) {
|
|
24
|
+
case 0:
|
|
25
|
+
return _context.abrupt("return", new Promise(function (resolve) {
|
|
26
|
+
var progress = 0;
|
|
27
|
+
var interval = setInterval(function () {
|
|
28
|
+
progress += Math.random() * 20;
|
|
29
|
+
if (progress >= 100) {
|
|
30
|
+
progress = 100;
|
|
31
|
+
onProgress === null || onProgress === void 0 || onProgress({
|
|
32
|
+
progress: progress / 100
|
|
33
|
+
});
|
|
34
|
+
clearInterval(interval);
|
|
35
|
+
setTimeout(function () {
|
|
36
|
+
if (file.type.startsWith('image/')) {
|
|
37
|
+
resolve('https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg');
|
|
38
|
+
} else if (file.type.startsWith('video/')) {
|
|
39
|
+
resolve('http://vjs.zencdn.net/v/oceans.mp4');
|
|
40
|
+
} else {
|
|
41
|
+
resolve('https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg');
|
|
42
|
+
}
|
|
43
|
+
}, 200);
|
|
44
|
+
} else {
|
|
45
|
+
onProgress === null || onProgress === void 0 || onProgress({
|
|
46
|
+
progress: progress / 100
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}, 100);
|
|
50
|
+
}));
|
|
51
|
+
case 1:
|
|
52
|
+
case "end":
|
|
53
|
+
return _context.stop();
|
|
54
|
+
}
|
|
55
|
+
}, _callee);
|
|
56
|
+
}));
|
|
57
|
+
return function onUpload(_x, _x2) {
|
|
58
|
+
return _ref.apply(this, arguments);
|
|
59
|
+
};
|
|
60
|
+
}();
|
|
11
61
|
var _useTiptap = useTiptap({
|
|
12
62
|
editable: false,
|
|
13
63
|
contentType: 'markdown',
|
|
@@ -16,148 +66,79 @@ var Reader = function Reader() {
|
|
|
16
66
|
console.error('Editor Error:', error);
|
|
17
67
|
},
|
|
18
68
|
onValidateUrl: function () {
|
|
19
|
-
var _onValidateUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
20
|
-
return _regeneratorRuntime().wrap(function
|
|
21
|
-
while (1) switch (
|
|
69
|
+
var _onValidateUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(url, type) {
|
|
70
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
71
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
22
72
|
case 0:
|
|
23
73
|
console.log("\u9A8C\u8BC1 ".concat(type, " \u94FE\u63A5:"), url);
|
|
24
74
|
|
|
25
75
|
// 拦截 base64 链接
|
|
26
76
|
if (!url.startsWith('data:')) {
|
|
27
|
-
|
|
77
|
+
_context2.next = 3;
|
|
28
78
|
break;
|
|
29
79
|
}
|
|
30
80
|
throw new Error("\u4E0D\u652F\u6301 base64 \u94FE\u63A5\uFF0C\u8BF7\u4F7F\u7528\u53EF\u8BBF\u95EE\u7684 ".concat(type, " URL"));
|
|
31
81
|
case 3:
|
|
32
|
-
|
|
33
|
-
|
|
82
|
+
_context2.t0 = type;
|
|
83
|
+
_context2.next = _context2.t0 === 'image' ? 6 : _context2.t0 === 'video' ? 8 : _context2.t0 === 'audio' ? 10 : _context2.t0 === 'iframe' ? 12 : 14;
|
|
34
84
|
break;
|
|
35
85
|
case 6:
|
|
36
86
|
if (!url.match(/\.(jpg|jpeg|png|gif|webp|svg)(\?.*)?$/i)) {
|
|
37
87
|
console.warn('图片链接可能不是有效的图片格式');
|
|
38
88
|
}
|
|
39
|
-
return
|
|
89
|
+
return _context2.abrupt("break", 14);
|
|
40
90
|
case 8:
|
|
41
91
|
if (!url.match(/\.(mp4|webm|ogg|mov|avi|wmv|flv|mkv)(\?.*)?$/i)) {
|
|
42
92
|
console.warn('视频链接可能不是有效的视频格式');
|
|
43
93
|
}
|
|
44
|
-
return
|
|
94
|
+
return _context2.abrupt("break", 14);
|
|
45
95
|
case 10:
|
|
46
96
|
if (!url.match(/\.(mp3|wav|ogg|m4a|flac|aac|wma)(\?.*)?$/i)) {
|
|
47
97
|
console.warn('音频链接可能不是有效的音频格式');
|
|
48
98
|
}
|
|
49
|
-
return
|
|
99
|
+
return _context2.abrupt("break", 14);
|
|
50
100
|
case 12:
|
|
51
101
|
// iframe 可以嵌入任何 URL,但可以检查是否是 HTTPS
|
|
52
102
|
if (url.startsWith('http://') && !url.includes('localhost')) {
|
|
53
103
|
console.warn('建议使用 HTTPS 链接以确保安全性');
|
|
54
104
|
}
|
|
55
|
-
return
|
|
105
|
+
return _context2.abrupt("break", 14);
|
|
56
106
|
case 14:
|
|
57
|
-
return
|
|
107
|
+
return _context2.abrupt("return", url);
|
|
58
108
|
case 15:
|
|
59
109
|
case "end":
|
|
60
|
-
return
|
|
110
|
+
return _context2.stop();
|
|
61
111
|
}
|
|
62
|
-
},
|
|
112
|
+
}, _callee2);
|
|
63
113
|
}));
|
|
64
|
-
function onValidateUrl(
|
|
114
|
+
function onValidateUrl(_x3, _x4) {
|
|
65
115
|
return _onValidateUrl.apply(this, arguments);
|
|
66
116
|
}
|
|
67
117
|
return onValidateUrl;
|
|
68
118
|
}(),
|
|
69
119
|
onSave: function onSave(editor) {
|
|
70
120
|
var value = editor.getMarkdown();
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
121
|
+
console.log(value);
|
|
122
|
+
// editor.chain().focus().setContent(value, {
|
|
123
|
+
// contentType: 'markdown'
|
|
124
|
+
// }).run()
|
|
74
125
|
},
|
|
75
|
-
|
|
76
|
-
var _onAiWritingGetSuggestion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
|
|
77
|
-
var prefix, suffix;
|
|
78
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
79
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
80
|
-
case 0:
|
|
81
|
-
prefix = _ref.prefix, suffix = _ref.suffix;
|
|
82
|
-
return _context2.abrupt("return", new Promise(function (resolve) {
|
|
83
|
-
resolve(['this is a default suggestion.', 'we are good.', 'what is your name?', 'how are you?', 'what is your favorite color?', 'what is your favorite food?', 'what is your favorite animal?', 'what is your favorite book?', 'what is your favorite movie?', 'what is your favorite song?', 'what is your favorite artist?', 'what is your favorite band?', 'what is your favorite city?', 'what is your favorite country?', 'what is your favorite sport?'][Math.floor(Math.random() * 10)]);
|
|
84
|
-
}));
|
|
85
|
-
case 2:
|
|
86
|
-
case "end":
|
|
87
|
-
return _context2.stop();
|
|
88
|
-
}
|
|
89
|
-
}, _callee2);
|
|
90
|
-
}));
|
|
91
|
-
function onAiWritingGetSuggestion(_x3) {
|
|
92
|
-
return _onAiWritingGetSuggestion.apply(this, arguments);
|
|
93
|
-
}
|
|
94
|
-
return onAiWritingGetSuggestion;
|
|
95
|
-
}(),
|
|
96
|
-
// onTocUpdate: handleTocUpdate,
|
|
97
|
-
// onMentionFilter: async ({ query }: { query: string }) => {
|
|
98
|
-
// return new Promise((resolve) => {
|
|
99
|
-
// resolve([
|
|
100
|
-
// 'Winona Ryder',
|
|
101
|
-
// 'Molly Ringwald',
|
|
102
|
-
// 'Ally Sheedy',
|
|
103
|
-
// 'Debbie Harry',
|
|
104
|
-
// 'Olivia Newton-John',
|
|
105
|
-
// 'Elton John',
|
|
106
|
-
// 'Michael J. Fox',
|
|
107
|
-
// 'Axl Rose',
|
|
108
|
-
// 'Emilio Estevez',
|
|
109
|
-
// 'Ralph Macchio',
|
|
110
|
-
// 'Rob Lowe',
|
|
111
|
-
// 'Jennifer Grey',
|
|
112
|
-
// ].filter(item => item.toLowerCase().startsWith(query.toLowerCase()))
|
|
113
|
-
// .slice(0, 5))
|
|
114
|
-
// })
|
|
115
|
-
// },
|
|
116
|
-
onUpload: function () {
|
|
117
|
-
var _onUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(file, onProgress) {
|
|
118
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
119
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
120
|
-
case 0:
|
|
121
|
-
return _context3.abrupt("return", new Promise(function (resolve) {
|
|
122
|
-
var progress = 0;
|
|
123
|
-
var interval = setInterval(function () {
|
|
124
|
-
progress += Math.random() * 20;
|
|
125
|
-
if (progress >= 100) {
|
|
126
|
-
progress = 100;
|
|
127
|
-
onProgress === null || onProgress === void 0 || onProgress({
|
|
128
|
-
progress: progress / 100
|
|
129
|
-
});
|
|
130
|
-
clearInterval(interval);
|
|
131
|
-
setTimeout(function () {
|
|
132
|
-
if (file.type.startsWith('image/')) {
|
|
133
|
-
resolve('https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg');
|
|
134
|
-
} else if (file.type.startsWith('video/')) {
|
|
135
|
-
resolve('http://vjs.zencdn.net/v/oceans.mp4');
|
|
136
|
-
} else {
|
|
137
|
-
resolve('https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg');
|
|
138
|
-
}
|
|
139
|
-
}, 200);
|
|
140
|
-
} else {
|
|
141
|
-
onProgress === null || onProgress === void 0 || onProgress({
|
|
142
|
-
progress: progress / 100
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
}, 100);
|
|
146
|
-
}));
|
|
147
|
-
case 1:
|
|
148
|
-
case "end":
|
|
149
|
-
return _context3.stop();
|
|
150
|
-
}
|
|
151
|
-
}, _callee3);
|
|
152
|
-
}));
|
|
153
|
-
function onUpload(_x4, _x5) {
|
|
154
|
-
return _onUpload.apply(this, arguments);
|
|
155
|
-
}
|
|
156
|
-
return onUpload;
|
|
157
|
-
}(),
|
|
158
|
-
content: MARKDOWN_EDITOR_PLACEHOLDER
|
|
126
|
+
content: mdContent
|
|
159
127
|
}),
|
|
160
128
|
editor = _useTiptap.editor;
|
|
129
|
+
var handleGlobalSave = useCallback(function (event) {
|
|
130
|
+
if ((event.ctrlKey || event.metaKey) && event.key === 's') {
|
|
131
|
+
event.preventDefault();
|
|
132
|
+
var value = editor.getHTML();
|
|
133
|
+
console.log(value);
|
|
134
|
+
}
|
|
135
|
+
}, [editor]);
|
|
136
|
+
useEffect(function () {
|
|
137
|
+
document.addEventListener('keydown', handleGlobalSave);
|
|
138
|
+
return function () {
|
|
139
|
+
document.removeEventListener('keydown', handleGlobalSave);
|
|
140
|
+
};
|
|
141
|
+
}, [handleGlobalSave]);
|
|
161
142
|
return /*#__PURE__*/React.createElement(EditorThemeProvider, {
|
|
162
143
|
mode: "light"
|
|
163
144
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
@@ -173,7 +154,9 @@ var Reader = function Reader() {
|
|
|
173
154
|
}, /*#__PURE__*/React.createElement(EditorMarkdown, {
|
|
174
155
|
editor: editor,
|
|
175
156
|
height: '500px',
|
|
176
|
-
value:
|
|
157
|
+
value: mdContent,
|
|
158
|
+
onUpload: onUpload,
|
|
159
|
+
onAceChange: setMdContent
|
|
177
160
|
})));
|
|
178
161
|
};
|
|
179
162
|
export default Reader;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
/// <reference types="ace-builds/types/ace-theme" />
|
|
5
5
|
import { Editor } from '@tiptap/core';
|
|
6
6
|
import React from "react";
|
|
7
|
+
import { UploadFunction } from '../type';
|
|
7
8
|
import 'ace-builds/src-noconflict/ace';
|
|
8
9
|
import 'ace-builds/src-noconflict/ext-language_tools';
|
|
9
10
|
import 'ace-builds/src-noconflict/mode-markdown';
|
|
@@ -12,6 +13,7 @@ interface EditorMarkdownProps {
|
|
|
12
13
|
editor: Editor;
|
|
13
14
|
value?: string;
|
|
14
15
|
height: number | string;
|
|
16
|
+
onUpload?: UploadFunction;
|
|
15
17
|
onAceChange?: (value: string) => void;
|
|
16
18
|
onTiptapChange?: (value: string) => void;
|
|
17
19
|
}
|
|
@@ -15,6 +15,7 @@ import { alpha, Box, Divider, IconButton, Stack, useTheme } from "@mui/material"
|
|
|
15
15
|
import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
16
16
|
import AceEditor from "react-ace";
|
|
17
17
|
import { MARKDOWN_EDITOR_PLACEHOLDER } from "../contants/markdown-placeholder";
|
|
18
|
+
import EditorMarkdownToolbar from "./Toolbar";
|
|
18
19
|
import 'ace-builds/src-noconflict/ace';
|
|
19
20
|
import 'ace-builds/src-noconflict/ext-language_tools';
|
|
20
21
|
import 'ace-builds/src-noconflict/mode-markdown';
|
|
@@ -23,10 +24,11 @@ var EditorMarkdown = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
23
24
|
var editor = _ref.editor,
|
|
24
25
|
value = _ref.value,
|
|
25
26
|
onAceChange = _ref.onAceChange,
|
|
26
|
-
height = _ref.height
|
|
27
|
+
height = _ref.height,
|
|
28
|
+
onUpload = _ref.onUpload;
|
|
27
29
|
var theme = useTheme();
|
|
28
30
|
var aceEditorRef = useRef(null);
|
|
29
|
-
var _useState = useState('
|
|
31
|
+
var _useState = useState('edit'),
|
|
30
32
|
_useState2 = _slicedToArray(_useState, 2),
|
|
31
33
|
displayMode = _useState2[0],
|
|
32
34
|
setDisplayMode = _useState2[1];
|
|
@@ -35,13 +37,13 @@ var EditorMarkdown = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
35
37
|
isExpend = _useState4[0],
|
|
36
38
|
setIsExpend = _useState4[1];
|
|
37
39
|
var EditorHeight = useMemo(function () {
|
|
38
|
-
return isExpend ? 'calc(100vh -
|
|
40
|
+
return isExpend ? 'calc(100vh - 45px)' : height;
|
|
39
41
|
}, [isExpend, height]);
|
|
40
42
|
var onChange = function onChange(value) {
|
|
41
43
|
onAceChange === null || onAceChange === void 0 || onAceChange(value);
|
|
42
|
-
editor.
|
|
44
|
+
editor.commands.setContent(value, {
|
|
43
45
|
contentType: 'markdown'
|
|
44
|
-
})
|
|
46
|
+
});
|
|
45
47
|
};
|
|
46
48
|
useImperativeHandle(ref, function () {
|
|
47
49
|
return {
|
|
@@ -96,16 +98,43 @@ var EditorMarkdown = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
96
98
|
color: 'primary.main',
|
|
97
99
|
bgcolor: alpha(theme.palette.primary.main, 0.1)
|
|
98
100
|
},
|
|
99
|
-
'
|
|
101
|
+
'.md-display-mode:hover': {
|
|
100
102
|
borderRadius: '4px',
|
|
101
103
|
bgcolor: 'background.paper3'
|
|
102
104
|
}
|
|
103
105
|
}
|
|
104
|
-
}, /*#__PURE__*/React.createElement(
|
|
106
|
+
}, /*#__PURE__*/React.createElement(EditorMarkdownToolbar, {
|
|
107
|
+
aceEditorRef: aceEditorRef,
|
|
108
|
+
isExpend: isExpend,
|
|
109
|
+
onUpload: onUpload
|
|
110
|
+
}), /*#__PURE__*/React.createElement(Stack, {
|
|
111
|
+
direction: 'row',
|
|
112
|
+
alignItems: 'center',
|
|
113
|
+
gap: 1
|
|
114
|
+
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
115
|
+
color: "inherit",
|
|
116
|
+
onClick: function onClick() {
|
|
117
|
+
return setIsExpend(!isExpend);
|
|
118
|
+
}
|
|
119
|
+
}, isExpend ? /*#__PURE__*/React.createElement(CollapseIcon, {
|
|
120
|
+
sx: {
|
|
121
|
+
fontSize: '16px'
|
|
122
|
+
}
|
|
123
|
+
}) : /*#__PURE__*/React.createElement(ExpendIcon, {
|
|
124
|
+
sx: {
|
|
125
|
+
fontSize: '16px'
|
|
126
|
+
}
|
|
127
|
+
})), /*#__PURE__*/React.createElement(Stack, {
|
|
105
128
|
direction: 'row',
|
|
106
|
-
alignItems: 'center'
|
|
129
|
+
alignItems: 'center',
|
|
130
|
+
sx: {
|
|
131
|
+
p: 0.5,
|
|
132
|
+
borderRadius: '4px',
|
|
133
|
+
border: '1px solid',
|
|
134
|
+
borderColor: 'divider'
|
|
135
|
+
}
|
|
107
136
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
108
|
-
className: displayMode === '
|
|
137
|
+
className: displayMode === 'edit' ? 'md-display-mode-active' : 'md-display-mode',
|
|
109
138
|
sx: {
|
|
110
139
|
px: 1,
|
|
111
140
|
py: 0.25,
|
|
@@ -113,10 +142,10 @@ var EditorMarkdown = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
113
142
|
borderRadius: '4px'
|
|
114
143
|
},
|
|
115
144
|
onClick: function onClick() {
|
|
116
|
-
return setDisplayMode('
|
|
145
|
+
return setDisplayMode('edit');
|
|
117
146
|
}
|
|
118
|
-
}, "\
|
|
119
|
-
className: displayMode === '
|
|
147
|
+
}, "\u7F16\u8F91\u6A21\u5F0F"), /*#__PURE__*/React.createElement(Box, {
|
|
148
|
+
className: displayMode === 'preview' ? 'md-display-mode-active' : 'md-display-mode',
|
|
120
149
|
sx: {
|
|
121
150
|
px: 1,
|
|
122
151
|
py: 0.25,
|
|
@@ -124,10 +153,10 @@ var EditorMarkdown = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
124
153
|
borderRadius: '4px'
|
|
125
154
|
},
|
|
126
155
|
onClick: function onClick() {
|
|
127
|
-
return setDisplayMode('
|
|
156
|
+
return setDisplayMode('preview');
|
|
128
157
|
}
|
|
129
|
-
}, "\
|
|
130
|
-
className: displayMode === '
|
|
158
|
+
}, "\u9884\u89C8\u6A21\u5F0F"), /*#__PURE__*/React.createElement(Box, {
|
|
159
|
+
className: displayMode === 'split' ? 'md-display-mode-active' : 'md-display-mode',
|
|
131
160
|
sx: {
|
|
132
161
|
px: 1,
|
|
133
162
|
py: 0.25,
|
|
@@ -135,23 +164,9 @@ var EditorMarkdown = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
135
164
|
borderRadius: '4px'
|
|
136
165
|
},
|
|
137
166
|
onClick: function onClick() {
|
|
138
|
-
return setDisplayMode('
|
|
139
|
-
}
|
|
140
|
-
}, "\u9884\u89C8\u6A21\u5F0F")), /*#__PURE__*/React.createElement(IconButton, {
|
|
141
|
-
size: "small",
|
|
142
|
-
color: "inherit",
|
|
143
|
-
onClick: function onClick() {
|
|
144
|
-
return setIsExpend(!isExpend);
|
|
145
|
-
}
|
|
146
|
-
}, isExpend ? /*#__PURE__*/React.createElement(CollapseIcon, {
|
|
147
|
-
sx: {
|
|
148
|
-
fontSize: '14px'
|
|
149
|
-
}
|
|
150
|
-
}) : /*#__PURE__*/React.createElement(ExpendIcon, {
|
|
151
|
-
sx: {
|
|
152
|
-
fontSize: '14px'
|
|
167
|
+
return setDisplayMode('split');
|
|
153
168
|
}
|
|
154
|
-
}))), /*#__PURE__*/React.createElement(Stack, {
|
|
169
|
+
}, "\u5206\u5C4F\u6A21\u5F0F")))), /*#__PURE__*/React.createElement(Stack, {
|
|
155
170
|
direction: 'row',
|
|
156
171
|
alignItems: 'stretch',
|
|
157
172
|
sx: {
|
|
@@ -1072,8 +1072,8 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
1072
1072
|
current.editor.commands.toggleBlockquote();
|
|
1073
1073
|
}
|
|
1074
1074
|
}
|
|
1075
|
-
}
|
|
1076
|
-
label: '
|
|
1075
|
+
}, {
|
|
1076
|
+
label: '警告块',
|
|
1077
1077
|
selected: ((_current$node14 = current.node) === null || _current$node14 === void 0 ? void 0 : _current$node14.type.name) === 'alert',
|
|
1078
1078
|
key: 'convert-to-alert',
|
|
1079
1079
|
icon: /*#__PURE__*/React.createElement(Information2LineIcon, {
|
|
@@ -1102,7 +1102,7 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
1102
1102
|
});
|
|
1103
1103
|
}
|
|
1104
1104
|
}
|
|
1105
|
-
}]
|
|
1105
|
+
}]
|
|
1106
1106
|
}] : []), _toConsumableArray(currentNode !== null && currentNode !== void 0 && currentNode.download && ((_current$node15 = current.node) !== null && _current$node15 !== void 0 && _current$node15.attrs.src || (_current$node16 = current.node) !== null && _current$node16 !== void 0 && _current$node16.attrs.src) ? [{
|
|
1107
1107
|
label: "\u4E0B\u8F7D".concat(currentNode === null || currentNode === void 0 ? void 0 : currentNode.label),
|
|
1108
1108
|
key: 'download',
|
|
@@ -28,7 +28,8 @@ var NestedList = function NestedList(_ref) {
|
|
|
28
28
|
horizontal: 'left'
|
|
29
29
|
}
|
|
30
30
|
} : _ref$childrenProps,
|
|
31
|
-
onItemClick = _ref.onItemClick
|
|
31
|
+
onItemClick = _ref.onItemClick,
|
|
32
|
+
zIndex = _ref.zIndex;
|
|
32
33
|
var _React$useState = React.useState(null),
|
|
33
34
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
34
35
|
hoveredItem = _React$useState2[0],
|
|
@@ -102,9 +103,11 @@ var NestedList = function NestedList(_ref) {
|
|
|
102
103
|
open: Boolean(subMenuAnchor),
|
|
103
104
|
anchorEl: subMenuAnchor,
|
|
104
105
|
onClose: handleItemLeave,
|
|
105
|
-
sx: {
|
|
106
|
+
sx: _objectSpread({
|
|
106
107
|
pointerEvents: 'none'
|
|
107
|
-
},
|
|
108
|
+
}, zIndex ? {
|
|
109
|
+
zIndex: zIndex
|
|
110
|
+
} : {}),
|
|
108
111
|
disableScrollLock: true,
|
|
109
112
|
disableAutoFocus: true,
|
|
110
113
|
disableEnforceFocus: true,
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { MenuProps } from "../../type";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
|
|
3
|
+
export interface MenuRef {
|
|
4
|
+
close: () => void;
|
|
5
|
+
}
|
|
6
|
+
declare const Menu: React.ForwardRefExoticComponent<MenuProps & React.RefAttributes<MenuRef>>;
|
|
4
7
|
export default Menu;
|
|
@@ -7,7 +7,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
7
7
|
import { Box, Popover } from '@mui/material';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import NestedList from "./NestedList";
|
|
10
|
-
var Menu = function
|
|
10
|
+
var Menu = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
11
11
|
var _ref$id = _ref.id,
|
|
12
12
|
id = _ref$id === void 0 ? 'menu-select' : _ref$id,
|
|
13
13
|
width = _ref.width,
|
|
@@ -36,7 +36,8 @@ var Menu = function Menu(_ref) {
|
|
|
36
36
|
vertical: 'top',
|
|
37
37
|
horizontal: 'left'
|
|
38
38
|
}
|
|
39
|
-
} : _ref$childrenProps
|
|
39
|
+
} : _ref$childrenProps,
|
|
40
|
+
zIndex = _ref.zIndex;
|
|
40
41
|
var _React$useState = React.useState(null),
|
|
41
42
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
42
43
|
anchorEl = _React$useState2[0],
|
|
@@ -51,6 +52,11 @@ var Menu = function Menu(_ref) {
|
|
|
51
52
|
var handleClose = function handleClose() {
|
|
52
53
|
setAnchorEl(null);
|
|
53
54
|
};
|
|
55
|
+
React.useImperativeHandle(ref, function () {
|
|
56
|
+
return {
|
|
57
|
+
close: handleClose
|
|
58
|
+
};
|
|
59
|
+
});
|
|
54
60
|
var handleItemClick = function handleItemClick(item) {
|
|
55
61
|
if (item.onClick) {
|
|
56
62
|
item.onClick();
|
|
@@ -72,7 +78,10 @@ var Menu = function Menu(_ref) {
|
|
|
72
78
|
disableScrollLock: true,
|
|
73
79
|
disableAutoFocus: true,
|
|
74
80
|
disableEnforceFocus: true,
|
|
75
|
-
disableRestoreFocus: true
|
|
81
|
+
disableRestoreFocus: true,
|
|
82
|
+
sx: zIndex ? {
|
|
83
|
+
zIndex: zIndex
|
|
84
|
+
} : undefined
|
|
76
85
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
77
86
|
sx: {
|
|
78
87
|
p: 0.5
|
|
@@ -84,7 +93,9 @@ var Menu = function Menu(_ref) {
|
|
|
84
93
|
list: list,
|
|
85
94
|
arrowIcon: arrowIcon,
|
|
86
95
|
childrenProps: childrenProps,
|
|
87
|
-
onItemClick: handleItemClick
|
|
96
|
+
onItemClick: handleItemClick,
|
|
97
|
+
zIndex: zIndex
|
|
88
98
|
}))));
|
|
89
|
-
};
|
|
99
|
+
});
|
|
100
|
+
Menu.displayName = 'Menu';
|
|
90
101
|
export default Menu;
|
|
@@ -223,8 +223,8 @@ var EditorInsert = function EditorInsert(_ref) {
|
|
|
223
223
|
onClick: function onClick() {
|
|
224
224
|
return editor.chain().focus().setDetails().run();
|
|
225
225
|
}
|
|
226
|
-
}
|
|
227
|
-
label: '
|
|
226
|
+
}, {
|
|
227
|
+
label: '警告块',
|
|
228
228
|
key: 'highlight',
|
|
229
229
|
icon: /*#__PURE__*/React.createElement(Information2LineIcon, {
|
|
230
230
|
sx: {
|
|
@@ -307,7 +307,7 @@ var EditorInsert = function EditorInsert(_ref) {
|
|
|
307
307
|
}).run();
|
|
308
308
|
}
|
|
309
309
|
}]
|
|
310
|
-
}
|
|
310
|
+
}, {
|
|
311
311
|
customLabel: /*#__PURE__*/React.createElement(Typography, {
|
|
312
312
|
sx: {
|
|
313
313
|
px: 1,
|
package/dist/contants/enums.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const MARKDOWN_EDITOR_PLACEHOLDER = "\u6807\u51C6 Markdown \u8BED\u6CD5\u901F\u67E5\uFF08GFM \u517C\u5BB9\uFF09\n\n# \u6807\u9898\u4E00\n## \u6807\u9898\u4E8C\n### \u6807\u9898\u4E09\n#### \u6807\u9898\u56DB \n##### \u6807\u9898\u4E94\n###### \u6807\u9898\u516D\n\n*\u659C\u4F53* \u6216 _\u659C\u4F53_\n**\u52A0\u7C97** \u6216 __\u52A0\u7C97__\n***\u52A0\u7C97\u659C\u4F53***\n~~\u5220\u9664\u7EBF~~\n^\u4E0A^\u6807\n~\u4E0B~\u6807\n++\u4E0B\u5212\u7EBF++\n\n- [ ] functionA\n- [x] functionB\n- [ ] functionC\n\n- \u65E0\u5E8F\u5217\u8868\u9879 A\n- \u65E0\u5E8F\u5217\u8868\u9879 B\n - \u65E0\u5E8F\u5217\u8868\u9879 B1\n\n1. \u6709\u5E8F\u5217\u8868\u9879 A\n2. \u6709\u5E8F\u5217\u8868\u9879 B\n a. \u6709\u5E8F\u5217\u8868\u9879 B1\n\n\u884C\u5185\u4EE3\u7801\uFF1A`console.log(\"hi\")`\n\n\u4EE3\u7801\u5757\uFF08\u8BED\u6CD5\u9AD8\u4EAE\uFF09\uFF1A\n```js\nfunction hello() {\n console.log(\"hi\");\n}\n```\n\n> \u5F15\u7528\n\n>> \u591A\u91CD\u5F15\u7528\n\n[\u94FE\u63A5](https://example.com)\n\n[](https://example.com)\n\n\u8868\u683C\uFF1A\n| \u52171 | \u52172 | \u53F3\u5BF9\u9F50 |\n|---|:---:|---:|\n| \u5DE6 | \u4E2D | \u53F3 |\n| a | b | 123 |\n\n\u5206\u9694\u7EBF\uFF1A\n`---`\n\n`***`\n\n\u884C\u5185\u6570\u5B66\u516C\u5F0F\uFF1A$ E = mc^2 $\n\u5757\u7EA7\u6570\u5B66\u516C\u5F0F\uFF1A\n$$\nint_{0}^{1} x^2 , dx = \frac{1}{3}\n$$\n\n\u8B66\u544A\
|
|
1
|
+
export declare const MARKDOWN_EDITOR_PLACEHOLDER = "\u6807\u51C6 Markdown \u8BED\u6CD5\u901F\u67E5\uFF08GFM \u517C\u5BB9\uFF09\n\n# \u6807\u9898\u4E00\n## \u6807\u9898\u4E8C\n### \u6807\u9898\u4E09\n#### \u6807\u9898\u56DB \n##### \u6807\u9898\u4E94\n###### \u6807\u9898\u516D\n\n*\u659C\u4F53* \u6216 _\u659C\u4F53_\n**\u52A0\u7C97** \u6216 __\u52A0\u7C97__\n***\u52A0\u7C97\u659C\u4F53***\n~~\u5220\u9664\u7EBF~~\n^\u4E0A^\u6807\n~\u4E0B~\u6807\n++\u4E0B\u5212\u7EBF++\n\n- [ ] functionA\n- [x] functionB\n- [ ] functionC\n\n- \u65E0\u5E8F\u5217\u8868\u9879 A\n- \u65E0\u5E8F\u5217\u8868\u9879 B\n - \u65E0\u5E8F\u5217\u8868\u9879 B1\n\n1. \u6709\u5E8F\u5217\u8868\u9879 A\n2. \u6709\u5E8F\u5217\u8868\u9879 B\n a. \u6709\u5E8F\u5217\u8868\u9879 B1\n\n\u884C\u5185\u4EE3\u7801\uFF1A`console.log(\"hi\")`\n\n\u4EE3\u7801\u5757\uFF08\u8BED\u6CD5\u9AD8\u4EAE\uFF09\uFF1A\n```js\nfunction hello() {\n console.log(\"hi\");\n}\n```\n\n> \u5F15\u7528\n\n>> \u591A\u91CD\u5F15\u7528\n\n[\u94FE\u63A5](https://example.com)\n\n[](https://example.com)\n\n\u8868\u683C\uFF1A\n| \u52171 | \u52172 | \u53F3\u5BF9\u9F50 |\n|---|:---:|---:|\n| \u5DE6 | \u4E2D | \u53F3 |\n| a | b | 123 |\n\n\u5206\u9694\u7EBF\uFF1A\n`---`\n\n`***`\n\n\u884C\u5185\u6570\u5B66\u516C\u5F0F\uFF1A$ E = mc^2 $\n\u5757\u7EA7\u6570\u5B66\u516C\u5F0F\uFF1A\n$$\nint_{0}^{1} x^2 , dx = \frac{1}{3}\n$$\n\n\u8B66\u544A\u5757\uFF1A\n:::alert {variant=\"warning\"}\n\n\u8FD9\u662F\u4E00\u6BB5\u8B66\u544A\u5757\n\n:::\n\n\u4FE1\u606F\u63D0\u793A\uFF1A\n:::alert {variant=\"info\"}\n\n\u8FD9\u662F\u4E00\u4E2A\u4FE1\u606F\u63D0\u793A\n\n:::\n\n\u6210\u529F\u63D0\u793A\uFF1A\n:::alert {variant=\"success\"}\n\n\u8FD9\u662F\u4E00\u4E2A\u6210\u529F\u63D0\u793A\n\n:::\n\n\u9519\u8BEF\u63D0\u793A\uFF1A\n:::alert {variant=\"error\"}\n\n\u8FD9\u662F\u4E00\u4E2A\u9519\u8BEF\u63D0\u793A\n\n:::\n\n\u9ED8\u8BA4\u63D0\u793A\uFF1A\n:::alert {variant=\"default\"}\n\n\u8FD9\u662F\u4E00\u4E2A\u9ED8\u8BA4\u63D0\u793A\n\n:::\n\n\u4E0D\u5E26\u56FE\u6807\u7684\u4FE1\u606F\u63D0\u793A\uFF1A\n:::alert {variant=\"info\" type=\"text\"}\n\n\u8FD9\u662F\u4E00\u4E2A\u4E0D\u5E26\u56FE\u6807\u7684\u4FE1\u606F\u63D0\u793A\n\n:::\n\n\u6298\u53E0\u5757 Details\uFF1A\n:::details {indent=\"0\" open}\n\n:::detailsSummary {indent=\"0\"}\n\n\u8FD9\u662F\u6298\u53E0\u9762\u677F\u7684\u6807\u9898\n\n:::\n\n:::detailsContent {indent=\"0\"}\n\n\u8FD9\u662F\u6298\u53E0\u9762\u677F\u7684\u5185\u5BB9\uFF0C\u53EF\u4EE5\u5C55\u793A\u5757\u7EA7\u5143\u7D20\n\n:::\n\n:::\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export var MARKDOWN_EDITOR_PLACEHOLDER = "\u6807\u51C6 Markdown \u8BED\u6CD5\u901F\u67E5\uFF08GFM \u517C\u5BB9\uFF09\n\n# \u6807\u9898\u4E00\n## \u6807\u9898\u4E8C\n### \u6807\u9898\u4E09\n#### \u6807\u9898\u56DB \n##### \u6807\u9898\u4E94\n###### \u6807\u9898\u516D\n\n*\u659C\u4F53* \u6216 _\u659C\u4F53_\n**\u52A0\u7C97** \u6216 __\u52A0\u7C97__\n***\u52A0\u7C97\u659C\u4F53***\n~~\u5220\u9664\u7EBF~~\n^\u4E0A^\u6807\n~\u4E0B~\u6807\n++\u4E0B\u5212\u7EBF++\n\n- [ ] functionA\n- [x] functionB\n- [ ] functionC\n\n- \u65E0\u5E8F\u5217\u8868\u9879 A\n- \u65E0\u5E8F\u5217\u8868\u9879 B\n - \u65E0\u5E8F\u5217\u8868\u9879 B1\n\n1. \u6709\u5E8F\u5217\u8868\u9879 A\n2. \u6709\u5E8F\u5217\u8868\u9879 B\n a. \u6709\u5E8F\u5217\u8868\u9879 B1\n\n\u884C\u5185\u4EE3\u7801\uFF1A`console.log(\"hi\")`\n\n\u4EE3\u7801\u5757\uFF08\u8BED\u6CD5\u9AD8\u4EAE\uFF09\uFF1A\n```js\nfunction hello() {\n console.log(\"hi\");\n}\n```\n\n> \u5F15\u7528\n\n>> \u591A\u91CD\u5F15\u7528\n\n[\u94FE\u63A5](https://example.com)\n\n[](https://example.com)\n\n\u8868\u683C\uFF1A\n| \u52171 | \u52172 | \u53F3\u5BF9\u9F50 |\n|---|:---:|---:|\n| \u5DE6 | \u4E2D | \u53F3 |\n| a | b | 123 |\n\n\u5206\u9694\u7EBF\uFF1A\n`---`\n\n`***`\n\n\u884C\u5185\u6570\u5B66\u516C\u5F0F\uFF1A$ E = mc^2 $\n\u5757\u7EA7\u6570\u5B66\u516C\u5F0F\uFF1A\n$$\nint_{0}^{1} x^2 , dx = \frac{1}{3}\n$$\n\n\u8B66\u544A\
|
|
1
|
+
export var MARKDOWN_EDITOR_PLACEHOLDER = "\u6807\u51C6 Markdown \u8BED\u6CD5\u901F\u67E5\uFF08GFM \u517C\u5BB9\uFF09\n\n# \u6807\u9898\u4E00\n## \u6807\u9898\u4E8C\n### \u6807\u9898\u4E09\n#### \u6807\u9898\u56DB \n##### \u6807\u9898\u4E94\n###### \u6807\u9898\u516D\n\n*\u659C\u4F53* \u6216 _\u659C\u4F53_\n**\u52A0\u7C97** \u6216 __\u52A0\u7C97__\n***\u52A0\u7C97\u659C\u4F53***\n~~\u5220\u9664\u7EBF~~\n^\u4E0A^\u6807\n~\u4E0B~\u6807\n++\u4E0B\u5212\u7EBF++\n\n- [ ] functionA\n- [x] functionB\n- [ ] functionC\n\n- \u65E0\u5E8F\u5217\u8868\u9879 A\n- \u65E0\u5E8F\u5217\u8868\u9879 B\n - \u65E0\u5E8F\u5217\u8868\u9879 B1\n\n1. \u6709\u5E8F\u5217\u8868\u9879 A\n2. \u6709\u5E8F\u5217\u8868\u9879 B\n a. \u6709\u5E8F\u5217\u8868\u9879 B1\n\n\u884C\u5185\u4EE3\u7801\uFF1A`console.log(\"hi\")`\n\n\u4EE3\u7801\u5757\uFF08\u8BED\u6CD5\u9AD8\u4EAE\uFF09\uFF1A\n```js\nfunction hello() {\n console.log(\"hi\");\n}\n```\n\n> \u5F15\u7528\n\n>> \u591A\u91CD\u5F15\u7528\n\n[\u94FE\u63A5](https://example.com)\n\n[](https://example.com)\n\n\u8868\u683C\uFF1A\n| \u52171 | \u52172 | \u53F3\u5BF9\u9F50 |\n|---|:---:|---:|\n| \u5DE6 | \u4E2D | \u53F3 |\n| a | b | 123 |\n\n\u5206\u9694\u7EBF\uFF1A\n`---`\n\n`***`\n\n\u884C\u5185\u6570\u5B66\u516C\u5F0F\uFF1A$ E = mc^2 $\n\u5757\u7EA7\u6570\u5B66\u516C\u5F0F\uFF1A\n$$\nint_{0}^{1} x^2 , dx = \frac{1}{3}\n$$\n\n\u8B66\u544A\u5757\uFF1A\n:::alert {variant=\"warning\"}\n\n\u8FD9\u662F\u4E00\u6BB5\u8B66\u544A\u5757\n\n:::\n\n\u4FE1\u606F\u63D0\u793A\uFF1A\n:::alert {variant=\"info\"}\n\n\u8FD9\u662F\u4E00\u4E2A\u4FE1\u606F\u63D0\u793A\n\n:::\n\n\u6210\u529F\u63D0\u793A\uFF1A\n:::alert {variant=\"success\"}\n\n\u8FD9\u662F\u4E00\u4E2A\u6210\u529F\u63D0\u793A\n\n:::\n\n\u9519\u8BEF\u63D0\u793A\uFF1A\n:::alert {variant=\"error\"}\n\n\u8FD9\u662F\u4E00\u4E2A\u9519\u8BEF\u63D0\u793A\n\n:::\n\n\u9ED8\u8BA4\u63D0\u793A\uFF1A\n:::alert {variant=\"default\"}\n\n\u8FD9\u662F\u4E00\u4E2A\u9ED8\u8BA4\u63D0\u793A\n\n:::\n\n\u4E0D\u5E26\u56FE\u6807\u7684\u4FE1\u606F\u63D0\u793A\uFF1A\n:::alert {variant=\"info\" type=\"text\"}\n\n\u8FD9\u662F\u4E00\u4E2A\u4E0D\u5E26\u56FE\u6807\u7684\u4FE1\u606F\u63D0\u793A\n\n:::\n\n\u6298\u53E0\u5757 Details\uFF1A\n:::details {indent=\"0\" open}\n\n:::detailsSummary {indent=\"0\"}\n\n\u8FD9\u662F\u6298\u53E0\u9762\u677F\u7684\u6807\u9898\n\n:::\n\n:::detailsContent {indent=\"0\"}\n\n\u8FD9\u662F\u6298\u53E0\u9762\u677F\u7684\u5185\u5BB9\uFF0C\u53EF\u4EE5\u5C55\u793A\u5757\u7EA7\u5143\u7D20\n\n:::\n\n:::\n";
|