(wrapper: string)
| 112 | }; |
| 113 | |
| 114 | export const getStyleReplacement = (wrapper: string): GetReplacementFn => { |
| 115 | return (type: CursorType, { word, selection: [start] }) => { |
| 116 | const replacement = `${wrapper}${word}${wrapper}`; |
| 117 | |
| 118 | if (type === CursorType.Isolated) { |
| 119 | const offset = start + wrapper.length; |
| 120 | return { replacement, offset: [offset, offset] }; |
| 121 | } |
| 122 | |
| 123 | return { replacement }; |
| 124 | }; |
| 125 | }; |
| 126 | |
| 127 | export const getMentionReplacement: GetReplacementFn = ( |
| 128 | type, |