Merge pull request #286 from StickyKnow/fix-258-paste-link
do not transform text of pasted links
This commit is contained in:
@@ -71,10 +71,10 @@ export default {
|
|||||||
new OrderedList(),
|
new OrderedList(),
|
||||||
new TodoItem(),
|
new TodoItem(),
|
||||||
new TodoList(),
|
new TodoList(),
|
||||||
|
new Link(),
|
||||||
new Bold(),
|
new Bold(),
|
||||||
new Code(),
|
new Code(),
|
||||||
new Italic(),
|
new Italic(),
|
||||||
new Link(),
|
|
||||||
new History(),
|
new History(),
|
||||||
],
|
],
|
||||||
content: `
|
content: `
|
||||||
|
|||||||
@@ -8,12 +8,14 @@ export default function (regexp, type, getAttrs) {
|
|||||||
|
|
||||||
fragment.forEach(child => {
|
fragment.forEach(child => {
|
||||||
if (child.isText) {
|
if (child.isText) {
|
||||||
const { text } = child
|
const { text, marks } = child
|
||||||
let pos = 0
|
let pos = 0
|
||||||
let match
|
let match
|
||||||
|
|
||||||
|
const isLink = !!marks.filter(x => x.type.name === 'link')[0]
|
||||||
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
while ((match = regexp.exec(text)) !== null) {
|
while (!isLink && (match = regexp.exec(text)) !== null) {
|
||||||
if (match[1]) {
|
if (match[1]) {
|
||||||
const start = match.index
|
const start = match.index
|
||||||
const end = start + match[0].length
|
const end = start + match[0].length
|
||||||
|
|||||||
Reference in New Issue
Block a user