Selaa lähdekoodia

Correct line ends

pull/383/head
Viktor Vaczi 3 vuotta sitten
vanhempi
commit
676b673c94
5 muutettua tiedostoa jossa 14 lisäystä ja 18 poistoa
  1. +1
    -2
      prose/markdownParser.js
  2. +8
    -8
      prose/markdownSerializer.js
  3. +1
    -1
      prose/prose.js
  4. +0
    -3
      prose/schema.js
  5. +4
    -4
      static/js/prose.bundle.js

+ 1
- 2
prose/markdownParser.js Näytä tiedosto

@@ -34,7 +34,7 @@ export const writeAsMarkdownParser = new MarkdownParser(
alt: tok.children?.[0].content || null,
}),
},
// hardbreak: { node: "hard_break" },
hardbreak: { node: "hard_break" },

em: { mark: "em" },
strong: { mark: "strong" },
@@ -49,7 +49,6 @@ export const writeAsMarkdownParser = new MarkdownParser(
html_block: {
node: "readmore",
getAttrs(token) {
console.log({ token });
// TODO: Give different attributes depending on the token content
return {};
},


+ 8
- 8
prose/markdownSerializer.js Näytä tiedosto

@@ -29,7 +29,7 @@ function isPlainURL(link, parent, index, side) {
export const writeAsMarkdownSerializer = new MarkdownSerializer(
{
readmore(state, node) {
state.write("<!--more-->");
state.write("<!--more-->\n");
state.closeBlock(node);
},
// blockquote(state, node) {
@@ -78,13 +78,13 @@ export const writeAsMarkdownSerializer = new MarkdownSerializer(
})`,
);
},
// hard_break(state, node, parent, index) {
// for (let i = index + 1; i < parent.childCount; i += 1)
// if (parent.child(i).type !== node.type) {
// state.write("\\\n");
// return;
// }
// },
hard_break(state, node, parent, index) {
for (let i = index + 1; i < parent.childCount; i += 1)
if (parent.child(i).type !== node.type) {
state.write("\n");
return;
}
},
text(state, node) {
state.text(node.text || "");
},


+ 1
- 1
prose/prose.js Näytä tiedosto

@@ -58,8 +58,8 @@ class ProseMirrorView {
dispatchTransaction(transaction) {
// console.log('saving to '+window.draftKey)
const newContent = writeAsMarkdownSerializer.serialize(transaction.doc)
console.log({newContent})
$content.value = newContent
console.log({ newContent })
localStorage.setItem(window.draftKey, function () {
let draft = "";
if ($title.value != null && $title.value !== "") {


+ 0
- 3
prose/schema.js Näytä tiedosto

@@ -4,7 +4,6 @@ import { Schema } from "prosemirror-model";
export const writeFreelySchema = new Schema({
nodes: schema.spec.nodes.remove("blockquote")
.remove("horizontal_rule")
.remove("hard_break")
.addToEnd("readmore", {
inline: false,
content: "",
@@ -15,5 +14,3 @@ export const writeFreelySchema = new Schema({
}),
marks: schema.spec.marks,
});

console.log({ writeFreelySchema })

+ 4
- 4
static/js/prose.bundle.js
File diff suppressed because it is too large
Näytä tiedosto


Ladataan…
Peruuta
Tallenna