Fixes #199
parent
3fd24fcae4
commit
faf46ee26c
|
@ -208,8 +208,8 @@ export class Editor {
|
||||||
// Make keyboard shortcuts work even when the editor is in read only mode or not focused
|
// Make keyboard shortcuts work even when the editor is in read only mode or not focused
|
||||||
globalThis.addEventListener("keydown", (ev) => {
|
globalThis.addEventListener("keydown", (ev) => {
|
||||||
if (!this.editorView?.hasFocus) {
|
if (!this.editorView?.hasFocus) {
|
||||||
if ((ev.target as any).classList.contains("cm-textfield")) {
|
if ((ev.target as any).closest(".cm-panel")) {
|
||||||
// Search & replace feature, ignore this
|
// In some CM panel, let's back out
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (runScopeHandlers(this.editorView!, ev, "editor")) {
|
if (runScopeHandlers(this.editorView!, ev, "editor")) {
|
||||||
|
@ -454,6 +454,15 @@ export class Editor {
|
||||||
return EditorState.create({
|
return EditorState.create({
|
||||||
doc: this.collabState ? this.collabState.ytext.toString() : text,
|
doc: this.collabState ? this.collabState.ytext.toString() : text,
|
||||||
extensions: [
|
extensions: [
|
||||||
|
// Enable vim mode, or not
|
||||||
|
[
|
||||||
|
...this.builtinSettings.vimMode
|
||||||
|
? [vim({
|
||||||
|
status: true,
|
||||||
|
})]
|
||||||
|
: [],
|
||||||
|
],
|
||||||
|
// The uber markdown mode
|
||||||
markdown({
|
markdown({
|
||||||
base: buildMarkdown(this.mdExtensions),
|
base: buildMarkdown(this.mdExtensions),
|
||||||
codeLanguages: [
|
codeLanguages: [
|
||||||
|
@ -487,8 +496,6 @@ export class Editor {
|
||||||
inlineImagesPlugin(),
|
inlineImagesPlugin(),
|
||||||
highlightSpecialChars(),
|
highlightSpecialChars(),
|
||||||
history(),
|
history(),
|
||||||
// Enable vim mode
|
|
||||||
[...this.builtinSettings.vimMode ? [vim()] : []],
|
|
||||||
drawSelection(),
|
drawSelection(),
|
||||||
dropCursor(),
|
dropCursor(),
|
||||||
indentOnInput(),
|
indentOnInput(),
|
||||||
|
|
|
@ -1,13 +1,18 @@
|
||||||
.cm-editor {
|
.cm-editor {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
padding: 0 20px;
|
|
||||||
--max-width: 800px;
|
--max-width: 800px;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
.cm-content {
|
.cm-content {
|
||||||
margin: auto;
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
max-width: var(--max-width);
|
max-width: var(--max-width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.cm-line {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.sb-inline-img {
|
.sb-inline-img {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue