Skip to content

Commit

Permalink
Secret function PLUTO_TOGGLE_CM_SPELLCHECK to enable spellchecking in…
Browse files Browse the repository at this point in the history
… codemirrors
  • Loading branch information
fonsp committed Jan 23, 2024
1 parent 46d1030 commit 1b988d3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions frontend/components/CellInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import { useEventListener } from "../common/useEventListener.js"
import { moveLineDown } from "../imports/CodemirrorPlutoSetup.js"

export const ENABLE_CM_MIXED_PARSER = window.localStorage.getItem("ENABLE_CM_MIXED_PARSER") === "true"
export const ENABLE_CM_SPELLCHECK = window.localStorage.getItem("ENABLE_CM_SPELLCHECK") === "true"

if (ENABLE_CM_MIXED_PARSER) {
console.log(`YOU ENABLED THE CODEMIRROR MIXED LANGUAGE PARSER
Expand All @@ -73,8 +74,14 @@ If enough people do this, we can make it the default parser.

// Added this so we can have people test the mixed parser, because I LIKE IT SO MUCH - DRAL
// @ts-ignore
window.PLUTO_TOGGLE_CM_MIXED_PARSER = () => {
window.localStorage.setItem("ENABLE_CM_MIXED_PARSER", String(!ENABLE_CM_MIXED_PARSER))
window.PLUTO_TOGGLE_CM_MIXED_PARSER = (val = !ENABLE_CM_MIXED_PARSER) => {
window.localStorage.setItem("ENABLE_CM_MIXED_PARSER", String(val))
window.location.reload()
}

// @ts-ignore
window.PLUTO_TOGGLE_CM_SPELLCHECK = (val = !ENABLE_CM_SPELLCHECK) => {
window.localStorage.setItem("ENABLE_CM_SPELLCHECK", String(val))
window.location.reload()
}

Expand Down Expand Up @@ -751,6 +758,8 @@ export const CellInput = ({
keymap.of([...closeBracketsKeymap, ...defaultKeymap, ...historyKeymap, ...foldKeymap]),
placeholder("Enter cell code..."),

EditorView.contentAttributes.of({ spellcheck: String(ENABLE_CM_SPELLCHECK) }),

EditorView.lineWrapping,
// Wowww this has been enabled for some time now... wonder if there are issues about this yet ;) - DRAL
awesome_line_wrapping,
Expand Down

0 comments on commit 1b988d3

Please sign in to comment.