mirror of
https://github.com/standardnotes/app.git
synced 2026-01-16 23:01:30 +00:00
replace ->,<- and <-> by the matching arrow characters in super notes
This commit is contained in:
parent
3bb8ffbbe0
commit
2ed468a7dc
1 changed files with 40 additions and 1 deletions
|
|
@ -25,7 +25,7 @@ import {
|
|||
$createHorizontalRuleNode,
|
||||
$isHorizontalRuleNode,
|
||||
} from '@lexical/react/LexicalHorizontalRuleNode'
|
||||
import { $isParagraphNode, $isTextNode, LexicalNode } from 'lexical'
|
||||
import { $isParagraphNode, $isTextNode, LexicalNode, $createTextNode } from 'lexical'
|
||||
import {
|
||||
$createRemoteImageNode,
|
||||
$isRemoteImageNode,
|
||||
|
|
@ -73,6 +73,42 @@ const IMAGE: TextMatchTransformer = {
|
|||
type: 'text-match',
|
||||
}
|
||||
|
||||
export const ARROW_DOUBLE: TextMatchTransformer = {
|
||||
dependencies: [],
|
||||
export: () => null,
|
||||
importRegExp: /<-> /,
|
||||
regExp: /<-> $/,
|
||||
replace: (textNode) => {
|
||||
textNode.replace($createTextNode('↔ '))
|
||||
},
|
||||
trigger: ' ',
|
||||
type: 'text-match',
|
||||
}
|
||||
|
||||
export const ARROW_RIGHT: TextMatchTransformer = {
|
||||
dependencies: [],
|
||||
export: () => null,
|
||||
importRegExp: /-> /,
|
||||
regExp: /-> $/,
|
||||
replace: (textNode) => {
|
||||
textNode.replace($createTextNode('→ '))
|
||||
},
|
||||
trigger: ' ',
|
||||
type: 'text-match',
|
||||
}
|
||||
|
||||
export const ARROW_LEFT: TextMatchTransformer = {
|
||||
dependencies: [],
|
||||
export: () => null,
|
||||
importRegExp: /<- /,
|
||||
regExp: /<- $/,
|
||||
replace: (textNode) => {
|
||||
textNode.replace($createTextNode('← '))
|
||||
},
|
||||
trigger: ' ',
|
||||
type: 'text-match',
|
||||
}
|
||||
|
||||
const INLINE_FILE: TextMatchTransformer = {
|
||||
dependencies: [InlineFileNode],
|
||||
export: (node) => {
|
||||
|
|
@ -246,6 +282,9 @@ export const MarkdownTransformers = [
|
|||
CHECK_LIST,
|
||||
IMAGE,
|
||||
INLINE_FILE,
|
||||
ARROW_DOUBLE,
|
||||
ARROW_RIGHT,
|
||||
ARROW_LEFT,
|
||||
...ELEMENT_TRANSFORMERS,
|
||||
...TEXT_FORMAT_TRANSFORMERS,
|
||||
...TEXT_MATCH_TRANSFORMERS,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue