Compare commits

..

No commits in common. "39a3a9d2709b5f3e9ff7293a72a5f8ca1d1a95c7" and "f3fa3a0a9107b3733b4f21547b32c5816a0fa74d" have entirely different histories.

4 changed files with 4 additions and 49 deletions

View File

@ -5,7 +5,7 @@ import MarkdownItMark from "markdown-it-mark";
import MarkdownItKatex from "markdown-it-katex"; import MarkdownItKatex from "markdown-it-katex";
const MD = new MarkdownIt({ const MD = new MarkdownIt({
linkify: true, linkify: false,
highlight: function (str, lang) { highlight: function (str, lang) {
if (lang === 'mermaid') { if (lang === 'mermaid') {
return '<div class="mermaid">' + str + '</div>'; return '<div class="mermaid">' + str + '</div>';

View File

@ -6,8 +6,7 @@ import textareaAutosizeInit from "./textarea.autosize"
import createCursor from './cursor' import createCursor from './cursor'
import Store from './store' import Store from './store'
import Keymap from './keymap' import Keymap from './keymap'
import getCaretCoordinates from "../editor/src/caret-position" import getCaretCoordinates from "../editor/src/caret-position";
import TurndownService from "turndown"
textareaAutosizeInit($) textareaAutosizeInit($)
@ -509,34 +508,6 @@ function editor(root, inputData, options) {
return true return true
} }
if (event.originalEvent.clipboardData.types.includes("text/html")) {
let pastedData = event.originalEvent.clipboardData.getData('text/html')
const turndownService = new TurndownService({
headingStyle: 'atx',
codeBlockStyle: 'fenced',
})
const markdown = turndownService.turndown(pastedData)
let items = markdown.split(/\n+/);
console.log(items)
let item = $(this).parents('.list-item')
let id = item.attr('data-id')
const firstItem = store.value(id)
items = _.map(items, text => {
const m = text.match(/^(\s*)\*\s*(.*)$/)
if (m) {
const item = newListItem(firstItem.indented+1+Math.trunc(m[1].length/4))
item.text = m[2]
return item
}
const item = newListItem(firstItem.indented)
item.text = text
return item
})
store.insertAfter(id, ...items)
trigger('change')
return false
}
let pastedData = event.originalEvent.clipboardData.getData('text/plain') let pastedData = event.originalEvent.clipboardData.getData('text/plain')
try { try {
let items = JSON.parse(pastedData.toString()); let items = JSON.parse(pastedData.toString());

View File

@ -53,11 +53,6 @@
"resolved": "https://registry.npmjs.org/custom-event/-/custom-event-1.0.0.tgz", "resolved": "https://registry.npmjs.org/custom-event/-/custom-event-1.0.0.tgz",
"integrity": "sha1-LkYovhncSyFLXAJjDFlx6BFhgGI=" "integrity": "sha1-LkYovhncSyFLXAJjDFlx6BFhgGI="
}, },
"domino": {
"version": "2.1.6",
"resolved": "https://registry.npmjs.org/domino/-/domino-2.1.6.tgz",
"integrity": "sha512-3VdM/SXBZX2omc9JF9nOPCtDaYQ67BGp5CoLpIQlO2KCAPETs8TcDHacF26jXadGbvUteZzRTeos2fhID5+ucQ=="
},
"dragula": { "dragula": {
"version": "3.7.2", "version": "3.7.2",
"resolved": "https://registry.npmjs.org/dragula/-/dragula-3.7.2.tgz", "resolved": "https://registry.npmjs.org/dragula/-/dragula-3.7.2.tgz",
@ -169,14 +164,6 @@
"resolved": "https://registry.npmjs.org/ticky/-/ticky-1.0.1.tgz", "resolved": "https://registry.npmjs.org/ticky/-/ticky-1.0.1.tgz",
"integrity": "sha1-t8+nHnaPHJAAxJe5FRswlHxQ5G0=" "integrity": "sha1-t8+nHnaPHJAAxJe5FRswlHxQ5G0="
}, },
"turndown": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/turndown/-/turndown-7.1.1.tgz",
"integrity": "sha512-BEkXaWH7Wh7e9bd2QumhfAXk5g34+6QUmmWx+0q6ThaVOLuLUqsnkq35HQ5SBHSaxjSfSM7US5o4lhJNH7B9MA==",
"requires": {
"domino": "^2.1.6"
}
},
"wrappy": { "wrappy": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",

View File

@ -4,9 +4,7 @@
"description": "Simple editor of lists", "description": "Simple editor of lists",
"author": "Peter Stuifzand <peter@p83.nl>", "author": "Peter Stuifzand <peter@p83.nl>",
"main": "index.js", "main": "index.js",
"sideEffects": [ "sideEffects": ["**"],
"**"
],
"scripts": { "scripts": {
"test": "jasmine --require=esm" "test": "jasmine --require=esm"
}, },
@ -16,8 +14,7 @@
"dragula": "^3.7.2", "dragula": "^3.7.2",
"he": "^1.2.0", "he": "^1.2.0",
"jquery": "^3.5.1", "jquery": "^3.5.1",
"lodash": "^4.17.19", "lodash": "^4.17.19"
"turndown": "^7.1.1"
}, },
"devDependencies": { "devDependencies": {
"esm": "^3.2.25", "esm": "^3.2.25",