Merge branch 'dev' of github.com:laurent22/joplin into dev

pull/5061/head
Laurent Cozic 2021-06-08 20:38:05 +02:00
commit 75b66a9fff
5 changed files with 18 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
$katexcode$
Hello World:$katexcode$

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,5 @@
Hello World :
$$
katexcode
\sqrt{3x}
$$

View File

@ -608,6 +608,7 @@ function joplinEditableBlockInfo(node) {
if (!node.classList.contains('joplin-editable')) return null;
let sourceNode = null;
let isInline = false;
for (const childNode of node.childNodes) {
if (childNode.classList.contains('joplin-source')) {
sourceNode = childNode;
@ -616,11 +617,13 @@ function joplinEditableBlockInfo(node) {
}
if (!sourceNode) return null;
if (!node.isBlock) isInline = true;
return {
openCharacters: sourceNode.getAttribute('data-joplin-source-open'),
closeCharacters: sourceNode.getAttribute('data-joplin-source-close'),
content: sourceNode.textContent,
isInline
};
}
@ -637,7 +640,8 @@ rules.joplinSourceBlock = {
const info = joplinEditableBlockInfo(node);
if (!info) return;
return '\n\n' + info.openCharacters + info.content + info.closeCharacters + '\n\n';
const surroundingCharacter = info.isInline? '' : '\n\n';
return surroundingCharacter + info.openCharacters + info.content + info.closeCharacters + surroundingCharacter;
}
}