@ctzhian/tiptap 1.11.1 → 1.11.2

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.
@@ -10,7 +10,6 @@ var Reader = function Reader() {
10
10
  var isMarkdown = true;
11
11
  var _useTiptap = useTiptap({
12
12
  editable: true,
13
- contentType: isMarkdown ? 'markdown' : 'html',
14
13
  exclude: ['invisibleCharacters'],
15
14
  onError: function onError(error) {
16
15
  console.error('Editor Error:', error);
@@ -158,7 +157,7 @@ var Reader = function Reader() {
158
157
  }
159
158
  return onUpload;
160
159
  }(),
161
- content: ":::alert\n# \u798F\u5EFA\u5E08\u5927\u4F60\u770B\n\u526F\u4E66\u8BB0\u770B\u5230\u4E86\u53D1\u9001\n:::\n\n:::alert {variant=\"warning\", type=\"text\"}\nThis is a warning message with **bold** text.\n:::"
160
+ content: ''
162
161
  }),
163
162
  editor = _useTiptap.editor;
164
163
  return /*#__PURE__*/React.createElement(EditorThemeProvider, {
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import '../index.css';
3
+ declare const Reader: () => React.JSX.Element;
4
+ export default Reader;
@@ -0,0 +1,179 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
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
+ 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
+ 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
+ import { EditorMarkdown, EditorThemeProvider, useTiptap } from "./..";
6
+ import { Box } from '@mui/material';
7
+ import React from 'react';
8
+ import { MARKDOWN_EDITOR_PLACEHOLDER } from "../contants/markdown-placeholder";
9
+ import "../index.css";
10
+ var Reader = function Reader() {
11
+ var _useTiptap = useTiptap({
12
+ editable: false,
13
+ contentType: 'markdown',
14
+ exclude: ['invisibleCharacters'],
15
+ onError: function onError(error) {
16
+ console.error('Editor Error:', error);
17
+ },
18
+ onValidateUrl: function () {
19
+ var _onValidateUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url, type) {
20
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
21
+ while (1) switch (_context.prev = _context.next) {
22
+ case 0:
23
+ console.log("\u9A8C\u8BC1 ".concat(type, " \u94FE\u63A5:"), url);
24
+
25
+ // 拦截 base64 链接
26
+ if (!url.startsWith('data:')) {
27
+ _context.next = 3;
28
+ break;
29
+ }
30
+ throw new Error("\u4E0D\u652F\u6301 base64 \u94FE\u63A5\uFF0C\u8BF7\u4F7F\u7528\u53EF\u8BBF\u95EE\u7684 ".concat(type, " URL"));
31
+ case 3:
32
+ _context.t0 = type;
33
+ _context.next = _context.t0 === 'image' ? 6 : _context.t0 === 'video' ? 8 : _context.t0 === 'audio' ? 10 : _context.t0 === 'iframe' ? 12 : 14;
34
+ break;
35
+ case 6:
36
+ if (!url.match(/\.(jpg|jpeg|png|gif|webp|svg)(\?.*)?$/i)) {
37
+ console.warn('图片链接可能不是有效的图片格式');
38
+ }
39
+ return _context.abrupt("break", 14);
40
+ case 8:
41
+ if (!url.match(/\.(mp4|webm|ogg|mov|avi|wmv|flv|mkv)(\?.*)?$/i)) {
42
+ console.warn('视频链接可能不是有效的视频格式');
43
+ }
44
+ return _context.abrupt("break", 14);
45
+ case 10:
46
+ if (!url.match(/\.(mp3|wav|ogg|m4a|flac|aac|wma)(\?.*)?$/i)) {
47
+ console.warn('音频链接可能不是有效的音频格式');
48
+ }
49
+ return _context.abrupt("break", 14);
50
+ case 12:
51
+ // iframe 可以嵌入任何 URL,但可以检查是否是 HTTPS
52
+ if (url.startsWith('http://') && !url.includes('localhost')) {
53
+ console.warn('建议使用 HTTPS 链接以确保安全性');
54
+ }
55
+ return _context.abrupt("break", 14);
56
+ case 14:
57
+ return _context.abrupt("return", url);
58
+ case 15:
59
+ case "end":
60
+ return _context.stop();
61
+ }
62
+ }, _callee);
63
+ }));
64
+ function onValidateUrl(_x, _x2) {
65
+ return _onValidateUrl.apply(this, arguments);
66
+ }
67
+ return onValidateUrl;
68
+ }(),
69
+ onSave: function onSave(editor) {
70
+ var value = editor.getMarkdown();
71
+ editor.chain().focus().setContent(value, {
72
+ contentType: 'markdown'
73
+ }).run();
74
+ },
75
+ onAiWritingGetSuggestion: function () {
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
159
+ }),
160
+ editor = _useTiptap.editor;
161
+ return /*#__PURE__*/React.createElement(EditorThemeProvider, {
162
+ mode: "light"
163
+ }, /*#__PURE__*/React.createElement(Box, {
164
+ sx: {
165
+ '.tiptap': {
166
+ minHeight: '500px',
167
+ '.tableWrapper': {
168
+ maxWidth: '100%',
169
+ overflowX: 'auto'
170
+ }
171
+ }
172
+ }
173
+ }, /*#__PURE__*/React.createElement(EditorMarkdown, {
174
+ editor: editor,
175
+ height: '500px',
176
+ value: MARKDOWN_EDITOR_PLACEHOLDER
177
+ })));
178
+ };
179
+ export default Reader;
@@ -0,0 +1,22 @@
1
+ /// <reference types="ace-builds" />
2
+ /// <reference types="ace-builds/types/ace-ext" />
3
+ /// <reference types="ace-builds/ace-modes" />
4
+ /// <reference types="ace-builds/types/ace-theme" />
5
+ import { Editor } from '@tiptap/core';
6
+ import React from "react";
7
+ import 'ace-builds/src-noconflict/ace';
8
+ import 'ace-builds/src-noconflict/ext-language_tools';
9
+ import 'ace-builds/src-noconflict/mode-markdown';
10
+ import 'ace-builds/src-noconflict/theme-github';
11
+ interface EditorMarkdownProps {
12
+ editor: Editor;
13
+ value?: string;
14
+ height: number | string;
15
+ onAceChange?: (value: string) => void;
16
+ onTiptapChange?: (value: string) => void;
17
+ }
18
+ export interface MarkdownEditorRef {
19
+ scrollToHeading: (headingText: string) => void;
20
+ }
21
+ declare const EditorMarkdown: React.ForwardRefExoticComponent<EditorMarkdownProps & React.RefAttributes<MarkdownEditorRef>>;
22
+ export default EditorMarkdown;
@@ -0,0 +1,216 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
+ 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."); }
9
+ 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); }
10
+ 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; }
11
+ 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; } }
12
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
+ import { CollapseIcon, ExpendIcon, Editor as TiptapEditor } from "./..";
14
+ import { alpha, Box, Divider, IconButton, Stack, useTheme } from "@mui/material";
15
+ import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
16
+ import AceEditor from "react-ace";
17
+ import { MARKDOWN_EDITOR_PLACEHOLDER } from "../contants/markdown-placeholder";
18
+ import 'ace-builds/src-noconflict/ace';
19
+ import 'ace-builds/src-noconflict/ext-language_tools';
20
+ import 'ace-builds/src-noconflict/mode-markdown';
21
+ import 'ace-builds/src-noconflict/theme-github';
22
+ var EditorMarkdown = /*#__PURE__*/forwardRef(function (_ref, ref) {
23
+ var editor = _ref.editor,
24
+ value = _ref.value,
25
+ onAceChange = _ref.onAceChange,
26
+ height = _ref.height;
27
+ var theme = useTheme();
28
+ var aceEditorRef = useRef(null);
29
+ var _useState = useState('split'),
30
+ _useState2 = _slicedToArray(_useState, 2),
31
+ displayMode = _useState2[0],
32
+ setDisplayMode = _useState2[1];
33
+ var _useState3 = useState(false),
34
+ _useState4 = _slicedToArray(_useState3, 2),
35
+ isExpend = _useState4[0],
36
+ setIsExpend = _useState4[1];
37
+ var EditorHeight = useMemo(function () {
38
+ return isExpend ? 'calc(100vh - 33px)' : height;
39
+ }, [isExpend, height]);
40
+ var onChange = function onChange(value) {
41
+ onAceChange === null || onAceChange === void 0 || onAceChange(value);
42
+ editor.chain().focus().setContent(value, {
43
+ contentType: 'markdown'
44
+ }).run();
45
+ };
46
+ useImperativeHandle(ref, function () {
47
+ return {
48
+ scrollToHeading: function scrollToHeading(headingText) {
49
+ if (!aceEditorRef.current) return;
50
+ var aceEditor = aceEditorRef.current.editor;
51
+ var lines = (value === null || value === void 0 ? void 0 : value.split('\n')) || [];
52
+ for (var i = 0; i < lines.length; i++) {
53
+ var line = lines[i].trim();
54
+ if (line.startsWith('#')) {
55
+ var titleText = line.replace(/^#+\s*/, '').trim();
56
+ if (titleText === headingText.trim()) {
57
+ aceEditor.gotoLine(i + 1, 0, true);
58
+ aceEditor.scrollToLine(i, false, true, function () {});
59
+ break;
60
+ }
61
+ }
62
+ }
63
+ }
64
+ };
65
+ });
66
+ useEffect(function () {
67
+ if (editor.isEditable) {
68
+ editor.setEditable(false);
69
+ }
70
+ }, [editor]);
71
+ return /*#__PURE__*/React.createElement(Box, {
72
+ sx: _objectSpread({
73
+ position: 'relative',
74
+ bgcolor: 'background.default'
75
+ }, isExpend && {
76
+ position: 'fixed',
77
+ top: 0,
78
+ left: 0,
79
+ right: 0,
80
+ zIndex: 1000
81
+ })
82
+ }, /*#__PURE__*/React.createElement(Stack, {
83
+ direction: "row",
84
+ alignItems: 'center',
85
+ justifyContent: 'space-between',
86
+ sx: {
87
+ p: 0.5,
88
+ border: '1px solid',
89
+ borderColor: 'divider',
90
+ borderBottom: 'none',
91
+ borderRadius: '4px 4px 0 0',
92
+ fontSize: 12,
93
+ lineHeight: '20px',
94
+ color: 'text.tertiary',
95
+ '.md-display-mode-active': {
96
+ color: 'primary.main',
97
+ bgcolor: alpha(theme.palette.primary.main, 0.1)
98
+ },
99
+ '& :hover:not(.md-display-mode-active)': {
100
+ borderRadius: '4px',
101
+ bgcolor: 'background.paper3'
102
+ }
103
+ }
104
+ }, /*#__PURE__*/React.createElement(Stack, {
105
+ direction: 'row',
106
+ alignItems: 'center'
107
+ }, /*#__PURE__*/React.createElement(Box, {
108
+ className: displayMode === 'split' ? 'md-display-mode-active' : '',
109
+ sx: {
110
+ px: 1,
111
+ py: 0.25,
112
+ cursor: 'pointer',
113
+ borderRadius: '4px'
114
+ },
115
+ onClick: function onClick() {
116
+ return setDisplayMode('split');
117
+ }
118
+ }, "\u5206\u5C4F\u6A21\u5F0F"), /*#__PURE__*/React.createElement(Box, {
119
+ className: displayMode === 'edit' ? 'md-display-mode-active' : '',
120
+ sx: {
121
+ px: 1,
122
+ py: 0.25,
123
+ cursor: 'pointer',
124
+ borderRadius: '4px'
125
+ },
126
+ onClick: function onClick() {
127
+ return setDisplayMode('edit');
128
+ }
129
+ }, "\u7F16\u8F91\u6A21\u5F0F"), /*#__PURE__*/React.createElement(Box, {
130
+ className: displayMode === 'preview' ? 'md-display-mode-active' : '',
131
+ sx: {
132
+ px: 1,
133
+ py: 0.25,
134
+ cursor: 'pointer',
135
+ borderRadius: '4px'
136
+ },
137
+ onClick: function onClick() {
138
+ return setDisplayMode('preview');
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'
153
+ }
154
+ }))), /*#__PURE__*/React.createElement(Stack, {
155
+ direction: 'row',
156
+ alignItems: 'stretch',
157
+ sx: {
158
+ border: '1px solid',
159
+ borderColor: 'divider',
160
+ borderRadius: '0 0 4px 4px'
161
+ }
162
+ }, ['edit', 'split'].includes(displayMode) && /*#__PURE__*/React.createElement(Stack, {
163
+ direction: "column",
164
+ sx: {
165
+ flex: 1,
166
+ fontFamily: 'monospace',
167
+ '.ace_placeholder': {
168
+ transform: 'scale(1)',
169
+ height: '100%',
170
+ overflow: 'auto',
171
+ width: '100%'
172
+ }
173
+ }
174
+ }, /*#__PURE__*/React.createElement(AceEditor, {
175
+ ref: aceEditorRef,
176
+ mode: "markdown",
177
+ theme: "github",
178
+ value: value,
179
+ onChange: onChange,
180
+ name: "project-doc-editor",
181
+ wrapEnabled: true,
182
+ showPrintMargin: false,
183
+ placeholder: MARKDOWN_EDITOR_PLACEHOLDER,
184
+ fontSize: 16,
185
+ editorProps: {
186
+ $blockScrolling: true
187
+ },
188
+ setOptions: {
189
+ enableBasicAutocompletion: true,
190
+ enableLiveAutocompletion: true,
191
+ showLineNumbers: true,
192
+ tabSize: 2
193
+ },
194
+ style: {
195
+ width: '100%',
196
+ height: EditorHeight
197
+ }
198
+ })), displayMode === 'split' && /*#__PURE__*/React.createElement(Divider, {
199
+ orientation: "vertical",
200
+ flexItem: true
201
+ }), ['split', 'preview'].includes(displayMode) && /*#__PURE__*/React.createElement(Box, {
202
+ id: "markdown-preview-container",
203
+ sx: _objectSpread({
204
+ overflowY: 'scroll',
205
+ flex: 1,
206
+ p: 2,
207
+ height: EditorHeight
208
+ }, displayMode === 'preview' && isExpend && {
209
+ px: '10%'
210
+ })
211
+ }, /*#__PURE__*/React.createElement(TiptapEditor, {
212
+ editor: editor
213
+ }))));
214
+ });
215
+ EditorMarkdown.displayName = 'EditorMarkdown';
216
+ export default EditorMarkdown;
@@ -0,0 +1,6 @@
1
+ import { SvgIconProps } from "@mui/material";
2
+ import * as React from "react";
3
+ export declare const CollapseIcon: {
4
+ (props: SvgIconProps): React.JSX.Element;
5
+ displayName: string;
6
+ };
@@ -0,0 +1,15 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+ import { SvgIcon } from "@mui/material";
3
+ import * as React from "react";
4
+ export var CollapseIcon = function CollapseIcon(props) {
5
+ return /*#__PURE__*/React.createElement(SvgIcon, _extends({
6
+ viewBox: "0 0 24 24",
7
+ version: "1.1",
8
+ xmlns: "http://www.w3.org/2000/svg"
9
+ }, props), /*#__PURE__*/React.createElement("path", {
10
+ d: "M15 4.00008H13V11.0001H20V9.00008H16.4142L20.7071 4.70718L19.2929 3.29297L15 7.58586V4.00008ZM4.00008 15H7.58586L3.29297 19.2929L4.70718 20.7071L9.00008 16.4142V20H11.0001V13H4.00008V15Z"
11
+ }), /*#__PURE__*/React.createElement("path", {
12
+ d: "M9.00008 4.00008H11.0001V11.0001H4.00008V9.00008H7.58586L3.29297 4.70718L4.70718 3.29297L9.00008 7.58586V4.00008ZM20 15H16.4142L20.7071 19.2929L19.2929 20.7071L15 16.4142V20H13V13H20V15Z"
13
+ }));
14
+ };
15
+ CollapseIcon.displayName = 'icon-collapse';
@@ -0,0 +1,6 @@
1
+ import { SvgIconProps } from "@mui/material";
2
+ import * as React from "react";
3
+ export declare const ExpendIcon: {
4
+ (props: SvgIconProps): React.JSX.Element;
5
+ displayName: string;
6
+ };
@@ -0,0 +1,15 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+ import { SvgIcon } from "@mui/material";
3
+ import * as React from "react";
4
+ export var ExpendIcon = function ExpendIcon(props) {
5
+ return /*#__PURE__*/React.createElement(SvgIcon, _extends({
6
+ viewBox: "0 0 24 24",
7
+ version: "1.1",
8
+ xmlns: "http://www.w3.org/2000/svg"
9
+ }, props), /*#__PURE__*/React.createElement("path", {
10
+ d: "M17.5858 5H14V3H21V10H19V6.41421L14.7071 10.7071L13.2929 9.29289L17.5858 5ZM3 14H5V17.5858L9.29289 13.2929L10.7071 14.7071L6.41421 19H10V21H3V14Z"
11
+ }), /*#__PURE__*/React.createElement("path", {
12
+ d: "M6.41421 5H10V3H3V10H5V6.41421L9.29289 10.7071L10.7071 9.29289L6.41421 5ZM21 14H19V17.5858L14.7071 13.2929L13.2929 14.7071L17.5858 19H14V21H21V14Z"
13
+ }));
14
+ };
15
+ ExpendIcon.displayName = 'icon-expend';
@@ -28,6 +28,7 @@ export { CloseCircleFillIcon } from './close-circle-fill-icon';
28
28
  export { CodeBoxLineIcon } from './code-box-line-icon';
29
29
  export { CodeLineIcon } from './code-line-icon';
30
30
  export { CodeSSlashLineIcon } from './code-s-slash-line-icon';
31
+ export { CollapseIcon } from './collapse-icon';
31
32
  export { CommandLineIcon } from './command-line-icon';
32
33
  export { CopyIcon } from './copy-icon';
33
34
  export { CustomSizeIcon } from './custom-size-icon';
@@ -40,6 +41,7 @@ export { DraggableIcon } from './draggable-icon';
40
41
  export { EditBoxLineIcon } from './edit-box-line-icon';
41
42
  export { EraserLineIcon } from './eraser-line-icon';
42
43
  export { ErrorWarningFillIcon } from './error-warning-fill-icon';
44
+ export { ExpendIcon } from './expend-icon';
43
45
  export { ExportLineIcon } from './export-line-icon';
44
46
  export { FileCopyLineIcon } from './file-copy-line-icon';
45
47
  export { FileUploadLineIcon } from './file-upload-line-icon';
@@ -31,6 +31,7 @@ export { CloseCircleFillIcon } from "./close-circle-fill-icon";
31
31
  export { CodeBoxLineIcon } from "./code-box-line-icon";
32
32
  export { CodeLineIcon } from "./code-line-icon";
33
33
  export { CodeSSlashLineIcon } from "./code-s-slash-line-icon";
34
+ export { CollapseIcon } from "./collapse-icon";
34
35
  export { CommandLineIcon } from "./command-line-icon";
35
36
  export { CopyIcon } from "./copy-icon";
36
37
  export { CustomSizeIcon } from "./custom-size-icon";
@@ -43,6 +44,7 @@ export { DraggableIcon } from "./draggable-icon";
43
44
  export { EditBoxLineIcon } from "./edit-box-line-icon";
44
45
  export { EraserLineIcon } from "./eraser-line-icon";
45
46
  export { ErrorWarningFillIcon } from "./error-warning-fill-icon";
47
+ export { ExpendIcon } from "./expend-icon";
46
48
  export { ExportLineIcon } from "./export-line-icon";
47
49
  export { FileCopyLineIcon } from "./file-copy-line-icon";
48
50
  export { FileUploadLineIcon } from "./file-upload-line-icon";
@@ -0,0 +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![\u56FE\u7247](https://via.placeholder.com/600x400)\n[![\u56FE\u7247](https://via.placeholder.com/600x400)](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\u63D0\u793A\uFF1A\n:::alert {variant=\"warning\"}\n\n\u8FD9\u662F\u4E00\u6BB5\u8B66\u544A\u63D0\u793A\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";
@@ -0,0 +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![\u56FE\u7247](https://via.placeholder.com/600x400)\n[![\u56FE\u7247](https://via.placeholder.com/600x400)](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\u63D0\u793A\uFF1A\n:::alert {variant=\"warning\"}\n\n\u8FD9\u662F\u4E00\u6BB5\u8B66\u544A\u63D0\u793A\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,4 +1,4 @@
1
1
  import { UploadFunction } from "../../type";
2
2
  export declare const FileHandlerExtension: (props: {
3
3
  onUpload?: UploadFunction;
4
- }) => import("@tiptap/core").Extension<Omit<import("@tiptap/extension-file-handler").FileHandlePluginOptions, "editor" | "key">, any>;
4
+ }) => import("@tiptap/core").Extension<Omit<import("@tiptap/extension-file-handler").FileHandlePluginOptions, "key" | "editor">, any>;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './component/Icons';
2
2
  export { default as Editor } from './Editor';
3
3
  export { default as EditorDiff } from './EditorDiff';
4
+ export { default as EditorMarkdown, MarkdownEditorRef } from './EditorMarkdown';
4
5
  export { default as EditorThemeProvider } from './EditorThemeProvider';
5
6
  export { default as EditorToolbar } from './EditorToolbar';
6
7
  export { default as useTiptap } from './hook';
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./component/Icons";
2
2
  export { default as Editor } from "./Editor";
3
3
  export { default as EditorDiff } from "./EditorDiff";
4
+ export { default as EditorMarkdown, MarkdownEditorRef } from "./EditorMarkdown";
4
5
  export { default as EditorThemeProvider } from "./EditorThemeProvider";
5
6
  export { default as EditorToolbar } from "./EditorToolbar";
6
7
  export { default as useTiptap } from "./hook";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctzhian/tiptap",
3
- "version": "1.11.1",
3
+ "version": "1.11.2",
4
4
  "description": "基于 Tiptap 二次开发的编辑器组件",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -113,6 +113,7 @@
113
113
  "@tiptap/starter-kit": "^3.10.1",
114
114
  "@tiptap/static-renderer": "^3.10.1",
115
115
  "@tiptap/suggestion": "^3.10.1",
116
+ "ace-builds": "^1.43.4",
116
117
  "core-js": "^3.46.0",
117
118
  "diff-match-patch": "^1.0.5",
118
119
  "highlight.js": "^11.11.1",
@@ -120,6 +121,7 @@
120
121
  "katex": "^0.16.22",
121
122
  "linkifyjs": "^4.3.2",
122
123
  "lowlight": "^3.3.0",
124
+ "react-ace": "^14.0.1",
123
125
  "react-colorful": "^5.6.1",
124
126
  "react-image-crop": "^11.0.10",
125
127
  "react-photo-view": "^1.2.7",