tiptap-markdown
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -1140,2 +1140,10 @@ 'use strict'; | ||
function patchCommand(editor, commandName, implementation) { | ||
var _editor$commandManage; | ||
var commands = (_editor$commandManage = editor.commandManager.rawCommands) !== null && _editor$commandManage !== void 0 ? _editor$commandManage : editor.commandManager.commands; | ||
var rawCommand = commands[commandName]; | ||
commands[commandName] = implementation.call(editor, rawCommand); | ||
} | ||
var defaultMarkdownOptions = { | ||
@@ -1162,20 +1170,18 @@ html: true, | ||
_this = _super.call(this, options); | ||
var _this$commandManager$ = _this.commandManager.commands, | ||
setContent = _this$commandManager$.setContent, | ||
insertContentAt = _this$commandManager$.insertContentAt; | ||
_this.commandManager.commands.setContent = function (content, emitUpdate, parseOptions) { | ||
return function (props) { | ||
return setContent(_this.parseMarkdown(content), emitUpdate, parseOptions)(props); | ||
patchCommand(_assertThisInitialized(_this), 'setContent', function (setContent) { | ||
return function (content, emitUpdate, parseOptions) { | ||
return function (props) { | ||
return setContent(_this.parseMarkdown(content), emitUpdate, parseOptions)(props); | ||
}; | ||
}; | ||
}; | ||
_this.commandManager.commands.insertContentAt = function (range, content) { | ||
return function (props) { | ||
return insertContentAt(range, _this.parseMarkdown(content, { | ||
inline: true | ||
}))(props); | ||
}); | ||
patchCommand(_assertThisInitialized(_this), 'insertContentAt', function (insertContentAt) { | ||
return function (range, content) { | ||
return function (props) { | ||
return insertContentAt(range, _this.parseMarkdown(content, { | ||
inline: true | ||
}))(props); | ||
}; | ||
}; | ||
}; | ||
}); | ||
return _this; | ||
@@ -1182,0 +1188,0 @@ } |
@@ -1130,2 +1130,10 @@ import { MarkdownSerializerState as MarkdownSerializerState$1, defaultMarkdownSerializer } from 'prosemirror-markdown'; | ||
function patchCommand(editor, commandName, implementation) { | ||
var _editor$commandManage; | ||
var commands = (_editor$commandManage = editor.commandManager.rawCommands) !== null && _editor$commandManage !== void 0 ? _editor$commandManage : editor.commandManager.commands; | ||
var rawCommand = commands[commandName]; | ||
commands[commandName] = implementation.call(editor, rawCommand); | ||
} | ||
var defaultMarkdownOptions = { | ||
@@ -1152,20 +1160,18 @@ html: true, | ||
_this = _super.call(this, options); | ||
var _this$commandManager$ = _this.commandManager.commands, | ||
setContent = _this$commandManager$.setContent, | ||
insertContentAt = _this$commandManager$.insertContentAt; | ||
_this.commandManager.commands.setContent = function (content, emitUpdate, parseOptions) { | ||
return function (props) { | ||
return setContent(_this.parseMarkdown(content), emitUpdate, parseOptions)(props); | ||
patchCommand(_assertThisInitialized(_this), 'setContent', function (setContent) { | ||
return function (content, emitUpdate, parseOptions) { | ||
return function (props) { | ||
return setContent(_this.parseMarkdown(content), emitUpdate, parseOptions)(props); | ||
}; | ||
}; | ||
}; | ||
_this.commandManager.commands.insertContentAt = function (range, content) { | ||
return function (props) { | ||
return insertContentAt(range, _this.parseMarkdown(content, { | ||
inline: true | ||
}))(props); | ||
}); | ||
patchCommand(_assertThisInitialized(_this), 'insertContentAt', function (insertContentAt) { | ||
return function (range, content) { | ||
return function (props) { | ||
return insertContentAt(range, _this.parseMarkdown(content, { | ||
inline: true | ||
}))(props); | ||
}; | ||
}; | ||
}; | ||
}); | ||
return _this; | ||
@@ -1172,0 +1178,0 @@ } |
@@ -1135,2 +1135,10 @@ (function (global, factory) { | ||
function patchCommand(editor, commandName, implementation) { | ||
var _editor$commandManage; | ||
var commands = (_editor$commandManage = editor.commandManager.rawCommands) !== null && _editor$commandManage !== void 0 ? _editor$commandManage : editor.commandManager.commands; | ||
var rawCommand = commands[commandName]; | ||
commands[commandName] = implementation.call(editor, rawCommand); | ||
} | ||
var defaultMarkdownOptions = { | ||
@@ -1157,20 +1165,18 @@ html: true, | ||
_this = _super.call(this, options); | ||
var _this$commandManager$ = _this.commandManager.commands, | ||
setContent = _this$commandManager$.setContent, | ||
insertContentAt = _this$commandManager$.insertContentAt; | ||
_this.commandManager.commands.setContent = function (content, emitUpdate, parseOptions) { | ||
return function (props) { | ||
return setContent(_this.parseMarkdown(content), emitUpdate, parseOptions)(props); | ||
patchCommand(_assertThisInitialized(_this), 'setContent', function (setContent) { | ||
return function (content, emitUpdate, parseOptions) { | ||
return function (props) { | ||
return setContent(_this.parseMarkdown(content), emitUpdate, parseOptions)(props); | ||
}; | ||
}; | ||
}; | ||
_this.commandManager.commands.insertContentAt = function (range, content) { | ||
return function (props) { | ||
return insertContentAt(range, _this.parseMarkdown(content, { | ||
inline: true | ||
}))(props); | ||
}); | ||
patchCommand(_assertThisInitialized(_this), 'insertContentAt', function (insertContentAt) { | ||
return function (range, content) { | ||
return function (props) { | ||
return insertContentAt(range, _this.parseMarkdown(content, { | ||
inline: true | ||
}))(props); | ||
}; | ||
}; | ||
}; | ||
}); | ||
return _this; | ||
@@ -1177,0 +1183,0 @@ } |
{ | ||
"name": "tiptap-markdown", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Edit markdown content in tiptap editor.", | ||
@@ -62,5 +62,5 @@ "scripts": { | ||
"peerDependencies": { | ||
"@tiptap/core": "^2.0.0-beta.120", | ||
"@tiptap/core": "^2.0.0-beta.125", | ||
"prosemirror-model": "^1.14.1" | ||
} | ||
} |
@@ -5,2 +5,3 @@ import { serialize } from "./serialize"; | ||
import { MarkdownTightLists } from "./extensions/tiptap/tight-lists"; | ||
import { patchCommand } from "./util/editor"; | ||
@@ -24,9 +25,12 @@ | ||
super(options); | ||
const { setContent, insertContentAt } = this.commandManager.commands; | ||
this.commandManager.commands.setContent = (content, emitUpdate, parseOptions) => (props) => { | ||
return setContent(this.parseMarkdown(content), emitUpdate, parseOptions)(props); | ||
} | ||
this.commandManager.commands.insertContentAt = (range, content) => (props) => { | ||
return insertContentAt(range, this.parseMarkdown(content, { inline: true }))(props); | ||
} | ||
patchCommand(this, 'setContent', setContent => | ||
(content, emitUpdate, parseOptions) => (props) => { | ||
return setContent(this.parseMarkdown(content), emitUpdate, parseOptions)(props); | ||
} | ||
); | ||
patchCommand(this, 'insertContentAt', insertContentAt => | ||
(range, content) => (props) => { | ||
return insertContentAt(range, this.parseMarkdown(content, { inline: true }))(props); | ||
} | ||
); | ||
} | ||
@@ -33,0 +37,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
326770
47
4043