mirror of
https://github.com/laurent22/joplin.git
synced 2026-06-18 20:16:34 +02:00
Desktop, Mobile: Fixes #14630: underline disappearing from ++insert++ syntax when cursor is on that line (#14631)
This commit is contained in:
@@ -27,4 +27,21 @@ left | right
|
||||
expect(codeBlock.textContent).toBe('`foo`');
|
||||
expect(codeBlock.parentElement.classList.contains('.cm-tableRow'));
|
||||
});
|
||||
|
||||
test.each([
|
||||
0,
|
||||
'before ++'.length + 1,
|
||||
])('should decorate ++insert++ spans when the caret is at %i', async cursorPos => {
|
||||
const editorText = 'before ++inserted++ after';
|
||||
const editor = await createTestEditor(
|
||||
editorText,
|
||||
EditorSelection.cursor(cursorPos),
|
||||
['Insert'],
|
||||
[decoratorExtension],
|
||||
);
|
||||
|
||||
const insertSpan = editor.contentDOM.querySelector('.cm-insert');
|
||||
expect(insertSpan).not.toBeNull();
|
||||
expect(insertSpan?.textContent).toContain('inserted');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -116,6 +116,10 @@ const strikethroughDecoration = Decoration.mark({
|
||||
attributes: { class: 'cm-strike' },
|
||||
});
|
||||
|
||||
const insertDecoration = Decoration.mark({
|
||||
attributes: { class: 'cm-insert' },
|
||||
});
|
||||
|
||||
const nodeNameToLineDecoration: Record<string, Decoration> = {
|
||||
'FencedCode': codeBlockDecoration,
|
||||
'CodeBlock': codeBlockDecoration,
|
||||
@@ -150,6 +154,7 @@ const nodeNameToMarkDecoration: Record<string, Decoration> = {
|
||||
'HorizontalRule': horizontalRuleDecoration,
|
||||
'TaskMarker': taskMarkerDecoration,
|
||||
'Strikethrough': strikethroughDecoration,
|
||||
'Insert': insertDecoration,
|
||||
'Highlight': markDecoration,
|
||||
};
|
||||
|
||||
|
||||
Vendored
+3
@@ -187,6 +187,9 @@ const createTheme = (theme: EditorTheme): Extension[] => {
|
||||
'& .cm-strike': {
|
||||
textDecoration: 'line-through',
|
||||
},
|
||||
'& .cm-insert': {
|
||||
textDecoration: 'underline',
|
||||
},
|
||||
|
||||
// Applying font size changes with CSS rather than the theme below works
|
||||
// around an issue where the border for code blocks in headings was too
|
||||
|
||||
Reference in New Issue
Block a user