@ctzhian/tiptap 2.3.2-beta.1 → 2.3.2-beta.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.
package/dist/extension/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import StarterKit from '@tiptap/starter-kit';
|
|
|
14
14
|
import { PLACEHOLDER } from "../contants/placeholder";
|
|
15
15
|
import { AiWritingExtension, ImeComposition, SlashCommands, StructuredDiffExtension } from "./extension";
|
|
16
16
|
import { CodeExtension } from "./mark/Code";
|
|
17
|
-
import { AlertExtension, AudioExtension, BlockAttachmentExtension, BlockLinkExtension, CodeBlockLowlightExtension, CustomBlockMathExtension, CustomHorizontalRule, CustomInlineMathExtension, CustomSubscript, CustomSuperscript, DetailsContentExtension, DetailsExtension, DetailsSummaryExtension, EmojiExtension, FileHandlerExtension, FlowExtension, IframeExtension, ImageExtension, Indent, InlineAttachmentExtension, InlineLinkExtension, InlineUploadProgressExtension, ListExtension, MentionExtension, TableExtension,
|
|
17
|
+
import { AlertExtension, AudioExtension, BlockAttachmentExtension, BlockLinkExtension, CodeBlockLowlightExtension, CustomBlockMathExtension, CustomHorizontalRule, CustomInlineMathExtension, CustomSubscript, CustomSuperscript, DetailsContentExtension, DetailsExtension, DetailsSummaryExtension, EmojiExtension, FileHandlerExtension, FlowExtension, IframeExtension, ImageExtension, Indent, InlineAttachmentExtension, InlineLinkExtension, InlineUploadProgressExtension, ListExtension, MentionExtension, TableExtension, UploadProgressExtension, VerticalAlign, VideoExtension, YamlFormat, YoutubeExtension } from "./node";
|
|
18
18
|
export var getExtensions = function getExtensions(_ref) {
|
|
19
19
|
var contentType = _ref.contentType,
|
|
20
20
|
limit = _ref.limit,
|
|
@@ -58,10 +58,9 @@ export var getExtensions = function getExtensions(_ref) {
|
|
|
58
58
|
onValidateUrl: onValidateUrl
|
|
59
59
|
})].concat(_toConsumableArray(TableExtension({
|
|
60
60
|
editable: editable
|
|
61
|
-
})), [
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}), ImageExtension({
|
|
61
|
+
})), [
|
|
62
|
+
// TableOfContentsExtension({ onTocUpdate, tableOfContentsOptions }),
|
|
63
|
+
ImageExtension({
|
|
65
64
|
onUpload: onUpload,
|
|
66
65
|
onError: onError,
|
|
67
66
|
onValidateUrl: onValidateUrl
|
|
@@ -5,10 +5,30 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
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
7
|
import { getHierarchicalIndexes, TableOfContents } from '@tiptap/extension-table-of-contents';
|
|
8
|
+
import { Plugin, PluginKey } from '@tiptap/pm/state';
|
|
8
9
|
export var TableOfContentsExtension = function TableOfContentsExtension(_ref) {
|
|
9
10
|
var onTocUpdate = _ref.onTocUpdate,
|
|
10
11
|
tableOfContentsOptions = _ref.tableOfContentsOptions;
|
|
11
|
-
return TableOfContents.
|
|
12
|
+
return TableOfContents.extend({
|
|
13
|
+
addProseMirrorPlugins: function addProseMirrorPlugins() {
|
|
14
|
+
var imeCompositionPluginKey = new PluginKey('imeComposition');
|
|
15
|
+
return [new Plugin({
|
|
16
|
+
key: new PluginKey('tableOfContentImeFix'),
|
|
17
|
+
appendTransaction: function appendTransaction(transactions, _oldState, newState) {
|
|
18
|
+
if (transactions.some(function (tr) {
|
|
19
|
+
return tr.getMeta('composition');
|
|
20
|
+
})) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
var imePluginState = imeCompositionPluginKey.getState(newState);
|
|
24
|
+
if (imePluginState !== null && imePluginState !== void 0 && imePluginState.isComposing) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
})];
|
|
30
|
+
}
|
|
31
|
+
}).configure(_objectSpread(_objectSpread({
|
|
12
32
|
getIndex: getHierarchicalIndexes
|
|
13
33
|
}, tableOfContentsOptions || {}), {}, {
|
|
14
34
|
onUpdate: function onUpdate(data, isCreate) {
|