You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-23 22:36:32 +02:00
Desktop, Mobile: Move several features from Extra Markdown Editor Settings into the main app (#12747)
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { Decoration, EditorView } from '@codemirror/view';
|
||||
import makeInlineReplaceExtension from './utils/makeInlineReplaceExtension';
|
||||
|
||||
const linkClassName = 'cm-ext-unfocused-link';
|
||||
const urlMarkDecoration = Decoration.mark({ class: linkClassName });
|
||||
const strikethroughClassName = 'cm-ext-strikethrough';
|
||||
const strikethroughMarkDecoration = Decoration.mark({ class: strikethroughClassName });
|
||||
|
||||
const addFormattingClasses = [
|
||||
EditorView.theme({
|
||||
[`& .${linkClassName}, & .${linkClassName} span`]: {
|
||||
textDecoration: 'underline',
|
||||
},
|
||||
[`& .${strikethroughClassName}, & .${strikethroughClassName} span`]: {
|
||||
textDecoration: 'line-through',
|
||||
},
|
||||
}),
|
||||
makeInlineReplaceExtension({
|
||||
createDecoration: (node) => {
|
||||
if (node.name === 'URL' || node.name === 'Link') {
|
||||
return urlMarkDecoration;
|
||||
}
|
||||
if (node.name === 'Strikethrough') {
|
||||
return strikethroughMarkDecoration;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
}),
|
||||
];
|
||||
|
||||
export default addFormattingClasses;
|
||||
Reference in New Issue
Block a user