tiptap-markdown
Advanced tools
Comparing version 0.8.1 to 0.8.2
@@ -260,4 +260,9 @@ 'use strict'; | ||
var md = markdownit__default['default'](); | ||
function scanDelims(text, pos) { | ||
var state = new (markdownit__default['default']().inline.State)(text, null, null, []); | ||
md.inline.State.prototype.scanDelims.call({ | ||
src: text, | ||
posMax: text.length | ||
}); | ||
var state = new md.inline.State(text, null, null, []); | ||
return state.scanDelims(pos, true); | ||
@@ -1045,6 +1050,19 @@ } | ||
function MarkdownParser(editor) { | ||
/** | ||
* @type {markdownit} | ||
*/ | ||
function MarkdownParser(editor, _ref) { | ||
var html = _ref.html, | ||
linkify = _ref.linkify, | ||
breaks = _ref.breaks; | ||
_classCallCheck(this, MarkdownParser); | ||
_defineProperty(this, "editor", null); | ||
_defineProperty(this, "md", null); | ||
this.editor = editor; | ||
this.md = markdownit__default['default']({ | ||
html: html, | ||
linkify: linkify, | ||
breaks: breaks | ||
}); | ||
} | ||
@@ -1055,14 +1073,6 @@ _createClass(MarkdownParser, [{ | ||
var _this = this; | ||
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
inline = _ref.inline; | ||
var _this$editor$storage$ = this.editor.storage.markdown.options, | ||
html = _this$editor$storage$.html, | ||
linkify = _this$editor$storage$.linkify, | ||
breaks = _this$editor$storage$.breaks; | ||
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
inline = _ref2.inline; | ||
if (typeof content === 'string') { | ||
var renderer = markdownit__default['default']({ | ||
html: html, | ||
linkify: linkify, | ||
breaks: breaks | ||
}); | ||
var renderer = this.md; | ||
this.editor.extensionManager.extensions.forEach(function (extension) { | ||
@@ -1095,5 +1105,5 @@ var _getMarkdownSpec, _getMarkdownSpec$pars, _getMarkdownSpec$pars2; | ||
value: function normalizeDOM(node) { | ||
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
inline = _ref2.inline, | ||
content = _ref2.content; | ||
var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
inline = _ref3.inline, | ||
content = _ref3.content; | ||
this.normalizeBlocks(node); | ||
@@ -1227,3 +1237,3 @@ if (inline) { | ||
options: _objectSpread2({}, this.options), | ||
parser: new MarkdownParser(this.editor), | ||
parser: new MarkdownParser(this.editor, this.options), | ||
serializer: new MarkdownSerializer(this.editor), | ||
@@ -1230,0 +1240,0 @@ getMarkdown: function getMarkdown() { |
@@ -251,4 +251,9 @@ import { Extension, Mark, getHTMLFromFragment, Node as Node$1, extensions } from '@tiptap/core'; | ||
var md = markdownit(); | ||
function scanDelims(text, pos) { | ||
var state = new (markdownit().inline.State)(text, null, null, []); | ||
md.inline.State.prototype.scanDelims.call({ | ||
src: text, | ||
posMax: text.length | ||
}); | ||
var state = new md.inline.State(text, null, null, []); | ||
return state.scanDelims(pos, true); | ||
@@ -1036,6 +1041,19 @@ } | ||
function MarkdownParser(editor) { | ||
/** | ||
* @type {markdownit} | ||
*/ | ||
function MarkdownParser(editor, _ref) { | ||
var html = _ref.html, | ||
linkify = _ref.linkify, | ||
breaks = _ref.breaks; | ||
_classCallCheck(this, MarkdownParser); | ||
_defineProperty(this, "editor", null); | ||
_defineProperty(this, "md", null); | ||
this.editor = editor; | ||
this.md = markdownit({ | ||
html: html, | ||
linkify: linkify, | ||
breaks: breaks | ||
}); | ||
} | ||
@@ -1046,14 +1064,6 @@ _createClass(MarkdownParser, [{ | ||
var _this = this; | ||
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
inline = _ref.inline; | ||
var _this$editor$storage$ = this.editor.storage.markdown.options, | ||
html = _this$editor$storage$.html, | ||
linkify = _this$editor$storage$.linkify, | ||
breaks = _this$editor$storage$.breaks; | ||
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
inline = _ref2.inline; | ||
if (typeof content === 'string') { | ||
var renderer = markdownit({ | ||
html: html, | ||
linkify: linkify, | ||
breaks: breaks | ||
}); | ||
var renderer = this.md; | ||
this.editor.extensionManager.extensions.forEach(function (extension) { | ||
@@ -1086,5 +1096,5 @@ var _getMarkdownSpec, _getMarkdownSpec$pars, _getMarkdownSpec$pars2; | ||
value: function normalizeDOM(node) { | ||
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
inline = _ref2.inline, | ||
content = _ref2.content; | ||
var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
inline = _ref3.inline, | ||
content = _ref3.content; | ||
this.normalizeBlocks(node); | ||
@@ -1218,3 +1228,3 @@ if (inline) { | ||
options: _objectSpread2({}, this.options), | ||
parser: new MarkdownParser(this.editor), | ||
parser: new MarkdownParser(this.editor, this.options), | ||
serializer: new MarkdownSerializer(this.editor), | ||
@@ -1221,0 +1231,0 @@ getMarkdown: function getMarkdown() { |
@@ -255,4 +255,9 @@ (function (global, factory) { | ||
var md = markdownit__default['default'](); | ||
function scanDelims(text, pos) { | ||
var state = new (markdownit__default['default']().inline.State)(text, null, null, []); | ||
md.inline.State.prototype.scanDelims.call({ | ||
src: text, | ||
posMax: text.length | ||
}); | ||
var state = new md.inline.State(text, null, null, []); | ||
return state.scanDelims(pos, true); | ||
@@ -1040,6 +1045,19 @@ } | ||
function MarkdownParser(editor) { | ||
/** | ||
* @type {markdownit} | ||
*/ | ||
function MarkdownParser(editor, _ref) { | ||
var html = _ref.html, | ||
linkify = _ref.linkify, | ||
breaks = _ref.breaks; | ||
_classCallCheck(this, MarkdownParser); | ||
_defineProperty(this, "editor", null); | ||
_defineProperty(this, "md", null); | ||
this.editor = editor; | ||
this.md = markdownit__default['default']({ | ||
html: html, | ||
linkify: linkify, | ||
breaks: breaks | ||
}); | ||
} | ||
@@ -1050,14 +1068,6 @@ _createClass(MarkdownParser, [{ | ||
var _this = this; | ||
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
inline = _ref.inline; | ||
var _this$editor$storage$ = this.editor.storage.markdown.options, | ||
html = _this$editor$storage$.html, | ||
linkify = _this$editor$storage$.linkify, | ||
breaks = _this$editor$storage$.breaks; | ||
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
inline = _ref2.inline; | ||
if (typeof content === 'string') { | ||
var renderer = markdownit__default['default']({ | ||
html: html, | ||
linkify: linkify, | ||
breaks: breaks | ||
}); | ||
var renderer = this.md; | ||
this.editor.extensionManager.extensions.forEach(function (extension) { | ||
@@ -1090,5 +1100,5 @@ var _getMarkdownSpec, _getMarkdownSpec$pars, _getMarkdownSpec$pars2; | ||
value: function normalizeDOM(node) { | ||
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
inline = _ref2.inline, | ||
content = _ref2.content; | ||
var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
inline = _ref3.inline, | ||
content = _ref3.content; | ||
this.normalizeBlocks(node); | ||
@@ -1222,3 +1232,3 @@ if (inline) { | ||
options: _objectSpread2({}, this.options), | ||
parser: new MarkdownParser(this.editor), | ||
parser: new MarkdownParser(this.editor, this.options), | ||
serializer: new MarkdownSerializer(this.editor), | ||
@@ -1225,0 +1235,0 @@ getMarkdown: function getMarkdown() { |
{ | ||
"name": "tiptap-markdown", | ||
"version": "0.8.1", | ||
"version": "0.8.2", | ||
"description": "Edit markdown content in tiptap editor.", | ||
@@ -34,3 +34,3 @@ "scripts": { | ||
"markdown-it-task-lists": "^2.1.1", | ||
"prosemirror-markdown": "^1.11.0" | ||
"prosemirror-markdown": "^1.11.1" | ||
}, | ||
@@ -37,0 +37,0 @@ "peerDependencies": { |
@@ -44,3 +44,3 @@ import { Extension, extensions } from '@tiptap/core'; | ||
options: { ...this.options }, | ||
parser: new MarkdownParser(this.editor), | ||
parser: new MarkdownParser(this.editor, this.options), | ||
serializer: new MarkdownSerializer(this.editor), | ||
@@ -47,0 +47,0 @@ getMarkdown: () => { |
@@ -11,20 +11,19 @@ import markdownit from "markdown-it"; | ||
editor = null; | ||
/** | ||
* @type {markdownit} | ||
*/ | ||
md = null; | ||
constructor(editor) { | ||
constructor(editor, { html, linkify, breaks }) { | ||
this.editor = editor; | ||
} | ||
parse(content, { inline } = {}) { | ||
const { | ||
this.md = markdownit({ | ||
html, | ||
linkify, | ||
breaks, | ||
} = this.editor.storage.markdown.options; | ||
}); | ||
} | ||
parse(content, { inline } = {}) { | ||
if(typeof content === 'string') { | ||
const renderer = markdownit({ | ||
html, | ||
linkify, | ||
breaks, | ||
}); | ||
const renderer = this.md; | ||
@@ -31,0 +30,0 @@ this.editor.extensionManager.extensions.forEach(extension => |
import markdownit from 'markdown-it'; | ||
const md = markdownit(); | ||
function scanDelims(text, pos) { | ||
const state = new (markdownit().inline.State)(text, null, null, []); | ||
md.inline.State.prototype.scanDelims.call({ src: text, posMax: text.length }) | ||
const state = new (md.inline.State)(text, null, null, []); | ||
return state.scanDelims(pos, true); | ||
@@ -7,0 +9,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
367540
4729
Updatedprosemirror-markdown@^1.11.1