MCPcopy
hub / github.com/antonmedv/codejar / legacyNewLineFix

Function legacyNewLineFix

codejar.ts:348–363  ·  view source on GitHub ↗
(event: KeyboardEvent)

Source from the content-addressed store, hash-verified

346 }
347
348 function legacyNewLineFix(event: KeyboardEvent) {
349 // Firefox does not support plaintext-only mode
350 // and puts <div><br></div> on Enter. Let's help.
351 if (isLegacy && event.key === 'Enter') {
352 preventDefault(event)
353 event.stopPropagation()
354 if (afterCursor() == '') {
355 insert('\n ')
356 const pos = save()
357 pos.start = --pos.end
358 restore(pos)
359 } else {
360 insert('\n')
361 }
362 }
363 }
364
365 function handleSelfClosingCharacters(event: KeyboardEvent) {
366 const open = options.autoclose.open;

Callers 2

CodeJarFunction · 0.85
handleNewLineFunction · 0.85

Calls 5

preventDefaultFunction · 0.85
afterCursorFunction · 0.85
insertFunction · 0.85
saveFunction · 0.85
restoreFunction · 0.85

Tested by

no test coverage detected