Add setting for smart quotes (#960)
parent
1fc061ac6a
commit
e2cb2ab6e7
|
@ -18,6 +18,7 @@ export type BuiltinSettings = {
|
|||
shortcuts?: Shortcut[];
|
||||
hideSyncButton?: boolean;
|
||||
hideEditButton?: boolean;
|
||||
useSmartQuotes?: boolean;
|
||||
maximumAttachmentSize?: number;
|
||||
defaultLinkStyle?: string;
|
||||
actionButtons: ActionButton[];
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { KeyBinding } from "@codemirror/view";
|
||||
import { syntaxTree } from "@codemirror/language";
|
||||
import { EditorSelection } from "@codemirror/state";
|
||||
import { Client } from "../client.ts";
|
||||
|
||||
const straightQuoteContexts = [
|
||||
"CommentBlock",
|
||||
|
@ -78,7 +79,13 @@ function keyBindingForQuote(
|
|||
};
|
||||
}
|
||||
|
||||
export const smartQuoteKeymap: KeyBinding[] = [
|
||||
keyBindingForQuote('"', "“", "”"),
|
||||
keyBindingForQuote("'", "‘", "’"),
|
||||
];
|
||||
export function createSmartQuoteKeyBindings(client: Client): KeyBinding[] {
|
||||
if (client.settings.useSmartQuotes === false) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
keyBindingForQuote('"', "“", "”"),
|
||||
keyBindingForQuote("'", "‘", "’"),
|
||||
];
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import { Client } from "./client.ts";
|
|||
import { inlineImagesPlugin } from "./cm_plugins/inline_content.ts";
|
||||
import { cleanModePlugins } from "./cm_plugins/clean.ts";
|
||||
import { lineWrapper } from "./cm_plugins/line_wrapper.ts";
|
||||
import { smartQuoteKeymap } from "./cm_plugins/smart_quotes.ts";
|
||||
import { createSmartQuoteKeyBindings } from "./cm_plugins/smart_quotes.ts";
|
||||
import { ClickEvent } from "../plug-api/types.ts";
|
||||
import {
|
||||
attachmentExtension,
|
||||
|
@ -345,7 +345,7 @@ export function createCommandKeyBindings(client: Client): KeyBinding[] {
|
|||
export function createKeyBindings(client: Client): Extension {
|
||||
return keymap.of([
|
||||
...createCommandKeyBindings(client),
|
||||
...smartQuoteKeymap,
|
||||
...createSmartQuoteKeyBindings(client),
|
||||
...closeBracketsKeymap,
|
||||
...standardKeymap,
|
||||
...completionKeymap,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#meta
|
||||
|
||||
This page contains settings for configuring SilverBullet and its Plugs. Changing any of these will go into effect immediately in most cases except `indexPage` which requires a page reload.
|
||||
This page contains settings for configuring SilverBullet and its Plugs. Changing any of these will go into effect immediately in most cases, some require a page reload.
|
||||
|
||||
```yaml
|
||||
# Initial page to load when launching SB, can contain template variables
|
||||
|
@ -60,6 +60,9 @@ pageDecorations:
|
|||
- where: 'tags = "plug"'
|
||||
prefix: "🔌 "
|
||||
|
||||
# Toggles between “smart” ‘quotes’ (left and right) and "simple" 'quotes' (good ol' ASCII)
|
||||
useSmartQuotes: true
|
||||
|
||||
# Defines files to ignore in a format compatible with .gitignore
|
||||
spaceIgnore: |
|
||||
dist
|
||||
|
|
Loading…
Reference in New Issue