@usememos/editor 26.10.12 → 26.10.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -13
- package/dist/base.css +101 -31
- package/dist/emoji-data-WTFGY3MU.js +6 -0
- package/dist/emoji-data-WTFGY3MU.js.map +7 -0
- package/dist/emoji.js +74 -0
- package/dist/emoji.js.map +7 -0
- package/dist/index.js +1146 -114
- package/dist/index.js.map +4 -4
- package/dist/react.js.map +2 -2
- package/dist/style.css +310 -55
- package/dist/theme.css +86 -25
- package/dist/types/commands.d.ts +48 -3
- package/dist/types/editor.d.ts +65 -3
- package/dist/types/emoji/data.d.ts +1 -0
- package/dist/types/emoji/index.d.ts +21 -0
- package/dist/types/emoji/search.d.ts +17 -0
- package/dist/types/icons.d.ts +39 -0
- package/dist/types/labels.d.ts +21 -0
- package/dist/types/markdown/blocks.d.ts +2 -0
- package/dist/types/markdown/htmlSection.d.ts +37 -0
- package/dist/types/markdown/inline.d.ts +2 -0
- package/dist/types/markdown/options.d.ts +14 -0
- package/dist/types/markdown/serialize.d.ts +10 -1
- package/dist/types/model.d.ts +42 -5
- package/dist/types/react/index.d.ts +1 -1
- package/dist/types/theme.d.ts +8 -0
- package/dist/types/ui/linkCard.d.ts +46 -0
- package/dist/types/view/dom.d.ts +12 -1
- package/package.json +5 -1
package/dist/react.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/react/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Editor, type EditorOptions, type SuggestionState } from '@usememos/editor';\nimport { type CSSProperties, type ForwardedRef, forwardRef, useEffect, useRef, useState } from 'react';\nimport { flushSync } from 'react-dom';\n\nexport type { Editor, SuggestionState } from '@usememos/editor';\n\n/** Constructor options that the React components take as props. */\ntype EditorProps = Pick<\n EditorOptions,\n | 'markdown'\n | 'extensions'\n | 'placeholder'\n | 'editable'\n | 'taskToggle'\n | 'autofocus'\n | 'attributes'\n | 'resolveUrl'\n | 'referrerPolicy'\n | 'headingIds'\n | 'onLinkClick'\n | 'theme'\n | 'toolbar'\n | 'slashMenu'\n | 'labels'\n | 'icons'\n>;\n\nexport interface MarkdownEditorProps extends EditorProps {\n /** Markdown. The editor updates only when this is not a value it emitted itself. */\n value?: string;\n /** Initial Markdown for uncontrolled use. */\n defaultValue?: string;\n /** Called after document changes, at most once per animation frame. */\n onChange?: (markdown: string) => void;\n /** Called on Mod+Enter or Ctrl+Enter with the current Markdown. */\n onSubmit?: (markdown: string) => void;\n onFocus?: () => void;\n onBlur?: () => void;\n className?: string;\n style?: CSSProperties;\n}\n\n/** Options that `setOptions` applies without recreating the editor. `extensions` updates suggestion callbacks only. */\nconst LIVE = ['placeholder', 'editable', 'taskToggle', 'attributes', 'resolveUrl', 'onLinkClick', 'theme', 'extensions'] as const;\n\n/** The extension list's identity for recreating the editor: names, so an inline array does not recreate it on every render. */\nconst extensionKey = (extensions: EditorOptions['extensions']) => (extensions ?? []).map((e) => e.name).join('\\n');\n\n/**\n * The editor as a controlled React component. A `ref` gives the core `Editor`.\n *\n * `placeholder`, `editable`, `taskToggle`, `attributes`, `resolveUrl`, `onLinkClick` and `theme` update live.\n * A change to the names in `extensions` recreates the editor, keeping its\n * Markdown; with the same names, the callbacks of `suggestion()` extensions\n * (`items`, `command`, `match`, `allow`) update live. Other props are read\n * when the editor is created; change the component's `key` to apply new values.\n *\n * A `value` that arrives while an input method is composing text is applied\n * when the composition ends, so it does not break the composition.\n */\nexport const MarkdownEditor = forwardRef(function MarkdownEditor(props: MarkdownEditorProps, ref: ForwardedRef<Editor | null>) {\n const container = useRef<HTMLDivElement>(null);\n const editorRef = useRef<Editor | null>(null);\n // Values the editor emitted that the parent has not passed back yet, oldest\n // first. While the user keeps typing, React may hand back an older one;\n // those echoes must not reset the document.\n const pending = useRef<string[]>([]);\n // An outside value that arrived during IME composition.\n const deferred = useRef<string | null>(null);\n // Callbacks are read through a ref so changing them does not recreate the editor.\n const latest = useRef(props);\n latest.current = props;\n const extensions = extensionKey(props.extensions);\n\n useEffect(() => {\n const { value, defaultValue, onChange, onSubmit, onFocus, onBlur, className, style, ...options } = latest.current;\n const previous = editorRef.current;\n const editor = new Editor({\n ...options,\n element: container.current!,\n content: previous?.getMarkdown() ?? value ?? defaultValue ?? '',\n onChange: (markdown) => {\n pending.current.push(markdown);\n if (pending.current.length > 100) pending.current.shift();\n // Render the parent's update now, as React does for a native input's\n // onChange. Left to React's scheduler, it can still be waiting when\n // the parent sets a new value (clearing the box on submit) that equals\n // the value it last rendered; the value effect would then not run.\n flushSync(() => latest.current.onChange?.(markdown));\n },\n onSubmit: (markdown) => latest.current.onSubmit?.(markdown),\n onFocus: () => latest.current.onFocus?.(),\n onBlur: () => latest.current.onBlur?.(),\n });\n editorRef.current = editor;\n pending.current = [];\n assignRef(ref, editor);\n const root = container.current!;\n const onCompositionEnd = () => {\n // Runs after the editor's own compositionend handler, which was added first.\n const value = deferred.current;\n deferred.current = null;\n if (value !== null && value !== editor.getMarkdown()) {\n pending.current = [];\n editor.setMarkdown(value);\n }\n };\n root.addEventListener('compositionend', onCompositionEnd);\n return () => {\n root.removeEventListener('compositionend', onCompositionEnd);\n editor.destroy();\n if (editorRef.current === editor) editorRef.current = null;\n assignRef(ref, null);\n };\n // Recreate only when the extension names change; see the note on the component.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [extensions]);\n\n useEffect(() => {\n const editor = editorRef.current;\n if (!editor || props.value === undefined) return;\n const echo = pending.current.indexOf(props.value);\n if (echo >= 0) {\n // The parent caught up to a value the editor emitted.\n pending.current.splice(0, echo + 1);\n return;\n }\n if (props.value === editor.getMarkdown()) return;\n if (editor.isComposing) {\n deferred.current = props.value;\n return;\n }\n pending.current = [];\n editor.setMarkdown(props.value);\n }, [props.value]);\n\n useLiveOptions(editorRef, props);\n\n return <div ref={container} className={props.className} style={props.style} />;\n});\n\n/** Applies the live options when they change. */\nfunction useLiveOptions(editorRef: { current: Editor | null }, props: EditorProps): void {\n const applied = useRef<{ editor: Editor | null; props: Partial<EditorProps> }>({ editor: null, props: {} });\n useEffect(() => {\n const editor = editorRef.current;\n if (!editor) return;\n if (applied.current.editor !== editor) {\n // A new editor was created with these props.\n applied.current = { editor, props: { ...props } };\n return;\n }\n const changed: Partial<Pick<EditorOptions, (typeof LIVE)[number]>> = {};\n let any = false;\n for (const key of LIVE) {\n if (props[key] === applied.current.props[key]) continue;\n (changed as Record<string, unknown>)[key] = key === 'editable' ? (props.editable ?? true) : key === 'taskToggle' ? (props.taskToggle ?? false) : props[key];\n any = true;\n }\n applied.current = { editor, props: { ...props } };\n if (any) editor.setOptions(changed);\n });\n}\n\n/**\n * Creates an editor for the lifetime of the component, or until a value in\n * `deps` changes. Returns null until the editor exists. Pair it with\n * `<EditorContent editor={editor} />`, which shows it.\n *\n * Callbacks in `options` are read when called, so they may change between\n * renders without recreating the editor. So do the callbacks of\n * `suggestion()` extensions, matched by name.\n */\nexport function useEditor(options: Omit<EditorOptions, 'element'>, deps: readonly unknown[] = []): Editor | null {\n const [editor, setEditor] = useState<Editor | null>(null);\n const latest = useRef(options);\n latest.current = options;\n\n useEffect(() => {\n if (editor && options.extensions) editor.setOptions({ extensions: options.extensions });\n }, [editor, options.extensions]);\n\n useEffect(() => {\n const o = latest.current;\n const element = document.createElement('div');\n const instance = new Editor({\n ...o,\n element,\n // A detached element cannot take focus; EditorContent focuses once mounted.\n autofocus: false,\n onChange: (markdown, e) => latest.current.onChange?.(markdown, e),\n onSubmit: (markdown, e) => latest.current.onSubmit?.(markdown, e),\n onFocus: (e) => latest.current.onFocus?.(e),\n onBlur: (e) => latest.current.onBlur?.(e),\n onLinkClick: (ctx) => latest.current.onLinkClick?.(ctx),\n });\n if (o.autofocus) pendingAutofocus.set(instance, o.autofocus === 'end' ? 'end' : 'start');\n setEditor(instance);\n return () => {\n instance.destroy();\n setEditor(null);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n\n return editor;\n}\n\n/**\n * The open autocomplete popup of `editor`, or of its suggestion `name`, and\n * a re-render on each change. With `render: false` on a suggestion, draw your\n * own popup from it: put it at `state.anchorRect()`, give the listbox\n * `id={state.listboxId}` and each option `id={state.optionId(i)}`, highlight\n * `state.active`, and call `editor.suggestion.accept(i)` on click.\n */\nexport function useSuggestion(editor: Editor | null, name?: string): SuggestionState | null {\n const select = (state: SuggestionState | null | undefined) => (state && (name === undefined || state.name === name) ? state : null);\n const [state, setState] = useState<SuggestionState | null>(() => select(editor?.suggestion.state));\n useEffect(() => {\n if (!editor) {\n setState(null);\n return;\n }\n setState(select(editor.suggestion.state));\n return editor.on('suggestionChange', ({ state }) => setState(select(state)));\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [editor, name]);\n return state;\n}\n\nexport interface EditorContentProps {\n editor: Editor | null;\n className?: string;\n style?: CSSProperties;\n}\n\n/** Shows an editor created with `useEditor`. */\nexport function EditorContent({ editor, className, style }: EditorContentProps) {\n const container = useRef<HTMLDivElement>(null);\n useEffect(() => {\n const host = container.current;\n if (!editor || !host) return;\n host.appendChild(editor.root);\n const autofocus = pendingAutofocus.get(editor);\n if (autofocus) {\n pendingAutofocus.delete(editor);\n editor.commands.focus(autofocus);\n }\n return () => {\n if (editor.root.parentNode === host) host.removeChild(editor.root);\n };\n }, [editor]);\n return <div ref={container} className={className} style={style} />;\n}\n\n/** Where to focus an editor from `useEditor` once `EditorContent` mounts it. */\nconst pendingAutofocus = new WeakMap<Editor, 'start' | 'end'>();\n\nfunction assignRef<T>(ref: ForwardedRef<T>, value: T): void {\n if (typeof ref === 'function') ref(value);\n else if (ref) ref.current = value;\n}\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,cAAwD;AACjE,SAAgD,YAAY,WAAW,QAAQ,gBAAgB;AAC/F,SAAS,iBAAiB;
|
|
4
|
+
"sourcesContent": ["import { Editor, type EditorOptions, type SuggestionState } from '@usememos/editor';\nimport { type CSSProperties, type ForwardedRef, forwardRef, useEffect, useRef, useState } from 'react';\nimport { flushSync } from 'react-dom';\n\nexport type { Editor, SuggestionState } from '@usememos/editor';\n\n/** Constructor options that the React components take as props. */\ntype EditorProps = Pick<\n EditorOptions,\n | 'markdown'\n | 'extensions'\n | 'placeholder'\n | 'editable'\n | 'taskToggle'\n | 'autofocus'\n | 'attributes'\n | 'resolveUrl'\n | 'referrerPolicy'\n | 'headingIds'\n | 'onLinkClick'\n | 'theme'\n | 'toolbar'\n | 'linkCard'\n | 'slashMenu'\n | 'slashHint'\n | 'labels'\n | 'icons'\n>;\n\nexport interface MarkdownEditorProps extends EditorProps {\n /** Markdown. The editor updates only when this is not a value it emitted itself. */\n value?: string;\n /** Initial Markdown for uncontrolled use. */\n defaultValue?: string;\n /** Called after document changes, at most once per animation frame. */\n onChange?: (markdown: string) => void;\n /** Called on Mod+Enter or Ctrl+Enter with the current Markdown. */\n onSubmit?: (markdown: string) => void;\n onFocus?: () => void;\n onBlur?: () => void;\n className?: string;\n style?: CSSProperties;\n}\n\n/** Options that `setOptions` applies without recreating the editor. `extensions` updates suggestion callbacks only. */\nconst LIVE = ['placeholder', 'editable', 'taskToggle', 'attributes', 'resolveUrl', 'onLinkClick', 'theme', 'extensions'] as const;\n\n/** The extension list's identity for recreating the editor: names, so an inline array does not recreate it on every render. */\nconst extensionKey = (extensions: EditorOptions['extensions']) => (extensions ?? []).map((e) => e.name).join('\\n');\n\n/**\n * The editor as a controlled React component. A `ref` gives the core `Editor`.\n *\n * `placeholder`, `editable`, `taskToggle`, `attributes`, `resolveUrl`, `onLinkClick` and `theme` update live.\n * A change to the names in `extensions` recreates the editor, keeping its\n * Markdown; with the same names, the callbacks of `suggestion()` extensions\n * (`items`, `command`, `match`, `allow`) update live. Other props are read\n * when the editor is created; change the component's `key` to apply new values.\n *\n * A `value` that arrives while an input method is composing text is applied\n * when the composition ends, so it does not break the composition.\n */\nexport const MarkdownEditor = forwardRef(function MarkdownEditor(props: MarkdownEditorProps, ref: ForwardedRef<Editor | null>) {\n const container = useRef<HTMLDivElement>(null);\n const editorRef = useRef<Editor | null>(null);\n // Values the editor emitted that the parent has not passed back yet, oldest\n // first. While the user keeps typing, React may hand back an older one;\n // those echoes must not reset the document.\n const pending = useRef<string[]>([]);\n // An outside value that arrived during IME composition.\n const deferred = useRef<string | null>(null);\n // Callbacks are read through a ref so changing them does not recreate the editor.\n const latest = useRef(props);\n latest.current = props;\n const extensions = extensionKey(props.extensions);\n\n useEffect(() => {\n const { value, defaultValue, onChange, onSubmit, onFocus, onBlur, className, style, ...options } = latest.current;\n const previous = editorRef.current;\n const editor = new Editor({\n ...options,\n element: container.current!,\n content: previous?.getMarkdown() ?? value ?? defaultValue ?? '',\n onChange: (markdown) => {\n pending.current.push(markdown);\n if (pending.current.length > 100) pending.current.shift();\n // Render the parent's update now, as React does for a native input's\n // onChange. Left to React's scheduler, it can still be waiting when\n // the parent sets a new value (clearing the box on submit) that equals\n // the value it last rendered; the value effect would then not run.\n flushSync(() => latest.current.onChange?.(markdown));\n },\n onSubmit: (markdown) => latest.current.onSubmit?.(markdown),\n onFocus: () => latest.current.onFocus?.(),\n onBlur: () => latest.current.onBlur?.(),\n });\n editorRef.current = editor;\n pending.current = [];\n assignRef(ref, editor);\n const root = container.current!;\n const onCompositionEnd = () => {\n // Runs after the editor's own compositionend handler, which was added first.\n const value = deferred.current;\n deferred.current = null;\n if (value !== null && value !== editor.getMarkdown()) {\n pending.current = [];\n editor.setMarkdown(value);\n }\n };\n root.addEventListener('compositionend', onCompositionEnd);\n return () => {\n root.removeEventListener('compositionend', onCompositionEnd);\n editor.destroy();\n if (editorRef.current === editor) editorRef.current = null;\n assignRef(ref, null);\n };\n // Recreate only when the extension names change; see the note on the component.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [extensions]);\n\n useEffect(() => {\n const editor = editorRef.current;\n if (!editor || props.value === undefined) return;\n const echo = pending.current.indexOf(props.value);\n if (echo >= 0) {\n // The parent caught up to a value the editor emitted.\n pending.current.splice(0, echo + 1);\n return;\n }\n if (props.value === editor.getMarkdown()) return;\n if (editor.isComposing) {\n deferred.current = props.value;\n return;\n }\n pending.current = [];\n editor.setMarkdown(props.value);\n }, [props.value]);\n\n useLiveOptions(editorRef, props);\n\n return <div ref={container} className={props.className} style={props.style} />;\n});\n\n/** Applies the live options when they change. */\nfunction useLiveOptions(editorRef: { current: Editor | null }, props: EditorProps): void {\n const applied = useRef<{ editor: Editor | null; props: Partial<EditorProps> }>({ editor: null, props: {} });\n useEffect(() => {\n const editor = editorRef.current;\n if (!editor) return;\n if (applied.current.editor !== editor) {\n // A new editor was created with these props.\n applied.current = { editor, props: { ...props } };\n return;\n }\n const changed: Partial<Pick<EditorOptions, (typeof LIVE)[number]>> = {};\n let any = false;\n for (const key of LIVE) {\n if (props[key] === applied.current.props[key]) continue;\n (changed as Record<string, unknown>)[key] = key === 'editable' ? (props.editable ?? true) : key === 'taskToggle' ? (props.taskToggle ?? false) : props[key];\n any = true;\n }\n applied.current = { editor, props: { ...props } };\n if (any) editor.setOptions(changed);\n });\n}\n\n/**\n * Creates an editor for the lifetime of the component, or until a value in\n * `deps` changes. Returns null until the editor exists. Pair it with\n * `<EditorContent editor={editor} />`, which shows it.\n *\n * Callbacks in `options` are read when called, so they may change between\n * renders without recreating the editor. So do the callbacks of\n * `suggestion()` extensions, matched by name.\n */\nexport function useEditor(options: Omit<EditorOptions, 'element'>, deps: readonly unknown[] = []): Editor | null {\n const [editor, setEditor] = useState<Editor | null>(null);\n const latest = useRef(options);\n latest.current = options;\n\n useEffect(() => {\n if (editor && options.extensions) editor.setOptions({ extensions: options.extensions });\n }, [editor, options.extensions]);\n\n useEffect(() => {\n const o = latest.current;\n const element = document.createElement('div');\n const instance = new Editor({\n ...o,\n element,\n // A detached element cannot take focus; EditorContent focuses once mounted.\n autofocus: false,\n onChange: (markdown, e) => latest.current.onChange?.(markdown, e),\n onSubmit: (markdown, e) => latest.current.onSubmit?.(markdown, e),\n onFocus: (e) => latest.current.onFocus?.(e),\n onBlur: (e) => latest.current.onBlur?.(e),\n onLinkClick: (ctx) => latest.current.onLinkClick?.(ctx),\n });\n if (o.autofocus) pendingAutofocus.set(instance, o.autofocus === 'end' ? 'end' : 'start');\n setEditor(instance);\n return () => {\n instance.destroy();\n setEditor(null);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n\n return editor;\n}\n\n/**\n * The open autocomplete popup of `editor`, or of its suggestion `name`, and\n * a re-render on each change. With `render: false` on a suggestion, draw your\n * own popup from it: put it at `state.anchorRect()`, give the listbox\n * `id={state.listboxId}` and each option `id={state.optionId(i)}`, highlight\n * `state.active`, and call `editor.suggestion.accept(i)` on click.\n */\nexport function useSuggestion(editor: Editor | null, name?: string): SuggestionState | null {\n const select = (state: SuggestionState | null | undefined) => (state && (name === undefined || state.name === name) ? state : null);\n const [state, setState] = useState<SuggestionState | null>(() => select(editor?.suggestion.state));\n useEffect(() => {\n if (!editor) {\n setState(null);\n return;\n }\n setState(select(editor.suggestion.state));\n return editor.on('suggestionChange', ({ state }) => setState(select(state)));\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [editor, name]);\n return state;\n}\n\nexport interface EditorContentProps {\n editor: Editor | null;\n className?: string;\n style?: CSSProperties;\n}\n\n/** Shows an editor created with `useEditor`. */\nexport function EditorContent({ editor, className, style }: EditorContentProps) {\n const container = useRef<HTMLDivElement>(null);\n useEffect(() => {\n const host = container.current;\n if (!editor || !host) return;\n host.appendChild(editor.root);\n const autofocus = pendingAutofocus.get(editor);\n if (autofocus) {\n pendingAutofocus.delete(editor);\n editor.commands.focus(autofocus);\n }\n return () => {\n if (editor.root.parentNode === host) host.removeChild(editor.root);\n };\n }, [editor]);\n return <div ref={container} className={className} style={style} />;\n}\n\n/** Where to focus an editor from `useEditor` once `EditorContent` mounts it. */\nconst pendingAutofocus = new WeakMap<Editor, 'start' | 'end'>();\n\nfunction assignRef<T>(ref: ForwardedRef<T>, value: T): void {\n if (typeof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AAa,KAAsB,OAAgB;AAC1D,MAAI,OAAO,QAAQ,WAAY,KAAI,KAAK;AAAA,WAC/B,IAAK,KAAI,UAAU;AAC9B;",
|
|
6
6
|
"names": ["MarkdownEditor", "value", "state"]
|
|
7
7
|
}
|
package/dist/style.css
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
caret-color: currentColor;
|
|
12
12
|
position: relative;
|
|
13
13
|
}
|
|
14
|
-
.mbe-root > .mbe-block {
|
|
14
|
+
:is(.mbe-root, .mbe-flow) > .mbe-block {
|
|
15
15
|
margin: var(--mbe-block-gap) 0;
|
|
16
16
|
position: relative;
|
|
17
17
|
display: flow-root;
|
|
@@ -28,42 +28,104 @@
|
|
|
28
28
|
content-visibility: auto;
|
|
29
29
|
contain-intrinsic-size: auto 24px;
|
|
30
30
|
}
|
|
31
|
-
.mbe-root > :is(h1, h2).mbe-block {
|
|
31
|
+
:is(.mbe-root, .mbe-flow) > :is(h1, h2).mbe-block {
|
|
32
32
|
margin-top: 20px;
|
|
33
33
|
}
|
|
34
|
-
.mbe-root > h3.mbe-block {
|
|
34
|
+
:is(.mbe-root, .mbe-flow) > h3.mbe-block {
|
|
35
35
|
margin-top: 20px;
|
|
36
36
|
margin-bottom: 6px;
|
|
37
37
|
}
|
|
38
|
-
.mbe-root > :is(h4, h5, h6).mbe-block {
|
|
38
|
+
:is(.mbe-root, .mbe-flow) > :is(h4, h5, h6).mbe-block {
|
|
39
39
|
margin-top: 16px;
|
|
40
40
|
margin-bottom: 4px;
|
|
41
41
|
}
|
|
42
|
-
.mbe-root > blockquote[data-quote-joined] {
|
|
42
|
+
:is(.mbe-root, .mbe-flow) > blockquote[data-quote-joined] {
|
|
43
43
|
margin-top: calc(-1 * var(--mbe-block-gap));
|
|
44
44
|
padding-top: var(--mbe-block-gap);
|
|
45
45
|
}
|
|
46
|
-
.mbe-root
|
|
46
|
+
.mbe-root .mbe-callout-title {
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
gap: 8px;
|
|
50
|
+
user-select: none;
|
|
51
|
+
-webkit-user-select: none;
|
|
52
|
+
}
|
|
53
|
+
:is(.mbe-root, .mbe-flow) > blockquote[data-quote-joined] > .mbe-callout-title {
|
|
54
|
+
display: none;
|
|
55
|
+
}
|
|
56
|
+
.mbe-root:not(.mbe-readonly) > blockquote > .mbe-callout-title {
|
|
57
|
+
cursor: pointer;
|
|
58
|
+
}
|
|
59
|
+
:is(.mbe-root, .mbe-flow) > .mbe-details {
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: flex-start;
|
|
62
|
+
}
|
|
63
|
+
.mbe-root .mbe-details > .mbe-content {
|
|
64
|
+
flex: 1;
|
|
65
|
+
min-width: 0;
|
|
66
|
+
position: relative;
|
|
67
|
+
}
|
|
68
|
+
.mbe-root .mbe-details-marker {
|
|
69
|
+
flex: none;
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
justify-content: center;
|
|
73
|
+
width: var(--mbe-indent-size);
|
|
74
|
+
height: 1.5em;
|
|
75
|
+
height: 1lh;
|
|
76
|
+
user-select: none;
|
|
77
|
+
-webkit-user-select: none;
|
|
78
|
+
}
|
|
79
|
+
.mbe-root .mbe-details-toggle {
|
|
80
|
+
display: inline-flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
justify-content: center;
|
|
83
|
+
border: 0;
|
|
84
|
+
background: none;
|
|
85
|
+
padding: 2px;
|
|
86
|
+
font: inherit;
|
|
87
|
+
color: inherit;
|
|
88
|
+
cursor: pointer;
|
|
89
|
+
}
|
|
90
|
+
.mbe-root .mbe-details-toggle > .mbe-icon {
|
|
91
|
+
transition: transform 0.12s ease;
|
|
92
|
+
transform: rotate(90deg);
|
|
93
|
+
}
|
|
94
|
+
.mbe-root .mbe-details[data-collapsed] .mbe-details-toggle > .mbe-icon {
|
|
95
|
+
transform: none;
|
|
96
|
+
}
|
|
97
|
+
.mbe-root .mbe-details[data-collapsed]:dir(rtl) .mbe-details-toggle > .mbe-icon {
|
|
98
|
+
transform: scaleX(-1);
|
|
99
|
+
}
|
|
100
|
+
:is(.mbe-root, .mbe-flow) > .mbe-details-end.mbe-block {
|
|
101
|
+
display: block;
|
|
102
|
+
height: 0;
|
|
103
|
+
margin: 0;
|
|
104
|
+
}
|
|
105
|
+
:is(.mbe-root, .mbe-flow) > [data-section-hidden] {
|
|
106
|
+
display: none !important;
|
|
107
|
+
}
|
|
108
|
+
:is(.mbe-root, .mbe-flow) > .mbe-list-item {
|
|
47
109
|
display: flex;
|
|
48
110
|
align-items: flex-start;
|
|
49
111
|
margin: 2px 0;
|
|
50
112
|
}
|
|
51
|
-
.mbe-root > .mbe-list-item[data-list-start] {
|
|
113
|
+
:is(.mbe-root, .mbe-flow) > .mbe-list-item[data-list-start] {
|
|
52
114
|
margin-top: var(--mbe-block-gap);
|
|
53
115
|
}
|
|
54
|
-
.mbe-root > .mbe-list-item[data-indent="1"] {
|
|
116
|
+
:is(.mbe-root, .mbe-flow) > .mbe-list-item[data-indent="1"] {
|
|
55
117
|
padding-inline-start: var(--mbe-indent-size);
|
|
56
118
|
}
|
|
57
|
-
.mbe-root > .mbe-list-item[data-indent="2"] {
|
|
119
|
+
:is(.mbe-root, .mbe-flow) > .mbe-list-item[data-indent="2"] {
|
|
58
120
|
padding-inline-start: calc(2 * var(--mbe-indent-size));
|
|
59
121
|
}
|
|
60
|
-
.mbe-root > .mbe-list-item[data-indent="3"] {
|
|
122
|
+
:is(.mbe-root, .mbe-flow) > .mbe-list-item[data-indent="3"] {
|
|
61
123
|
padding-inline-start: calc(3 * var(--mbe-indent-size));
|
|
62
124
|
}
|
|
63
|
-
.mbe-root > .mbe-list-item[data-indent="4"] {
|
|
125
|
+
:is(.mbe-root, .mbe-flow) > .mbe-list-item[data-indent="4"] {
|
|
64
126
|
padding-inline-start: calc(4 * var(--mbe-indent-size));
|
|
65
127
|
}
|
|
66
|
-
.mbe-root > .mbe-list-item[data-indent="5"] {
|
|
128
|
+
:is(.mbe-root, .mbe-flow) > .mbe-list-item[data-indent="5"] {
|
|
67
129
|
padding-inline-start: calc(5 * var(--mbe-indent-size));
|
|
68
130
|
}
|
|
69
131
|
.mbe-root .mbe-marker {
|
|
@@ -183,51 +245,91 @@
|
|
|
183
245
|
padding: 0;
|
|
184
246
|
width: 12em;
|
|
185
247
|
}
|
|
186
|
-
.mbe-root > .mbe-code pre,
|
|
187
|
-
.mbe-root > pre.mbe-raw {
|
|
248
|
+
:is(.mbe-root, .mbe-flow) > .mbe-code pre,
|
|
249
|
+
:is(.mbe-root, .mbe-flow) > pre.mbe-raw {
|
|
188
250
|
white-space: pre-wrap;
|
|
189
251
|
tab-size: 2;
|
|
190
252
|
}
|
|
191
|
-
.mbe-root > .mbe-code pre {
|
|
253
|
+
:is(.mbe-root, .mbe-flow) > .mbe-code pre {
|
|
192
254
|
margin: 0;
|
|
193
255
|
}
|
|
194
|
-
.mbe-root > .mbe-code pre code {
|
|
256
|
+
:is(.mbe-root, .mbe-flow) > .mbe-code pre code {
|
|
195
257
|
display: block;
|
|
196
258
|
}
|
|
197
|
-
.mbe-root > .mbe-view-block {
|
|
259
|
+
:is(.mbe-root, .mbe-flow) > .mbe-view-block {
|
|
198
260
|
overflow-x: auto;
|
|
199
261
|
overflow-y: hidden;
|
|
200
262
|
}
|
|
201
|
-
.mbe-root > .mbe-view-block > * {
|
|
263
|
+
:is(.mbe-root, .mbe-flow) > .mbe-view-block > * {
|
|
202
264
|
margin-block: 0;
|
|
203
265
|
}
|
|
204
|
-
.mbe-root
|
|
266
|
+
.mbe-root .mbe-view-block.mbe-view-html {
|
|
267
|
+
white-space: normal;
|
|
268
|
+
}
|
|
269
|
+
.mbe-root .mbe-view-html .mbe-flow {
|
|
270
|
+
white-space: pre-wrap;
|
|
271
|
+
margin-block: var(--mbe-block-gap);
|
|
272
|
+
}
|
|
273
|
+
.mbe-root .mbe-view-html :is(p, blockquote, pre, ul, ol, dl, table, details, figure, hr, h1, h2, h3, h4, h5, h6):not(.mbe-flow *) {
|
|
274
|
+
margin-block: var(--mbe-block-gap);
|
|
275
|
+
}
|
|
276
|
+
.mbe-root .mbe-view-html :is(ul, ol):not(.mbe-flow *) {
|
|
277
|
+
padding-inline-start: var(--mbe-indent-size);
|
|
278
|
+
}
|
|
279
|
+
.mbe-root .mbe-view-html ul:not(.mbe-flow *) {
|
|
280
|
+
list-style: disc;
|
|
281
|
+
}
|
|
282
|
+
.mbe-root .mbe-view-html ol:not(.mbe-flow *) {
|
|
283
|
+
list-style: decimal;
|
|
284
|
+
}
|
|
285
|
+
.mbe-root .mbe-view-html pre:not(.mbe-flow *) {
|
|
286
|
+
white-space: pre;
|
|
287
|
+
overflow-x: auto;
|
|
288
|
+
}
|
|
289
|
+
.mbe-root .mbe-view-html summary:not(.mbe-flow *) {
|
|
290
|
+
cursor: pointer;
|
|
291
|
+
}
|
|
292
|
+
.mbe-root .mbe-view-html img:not(.mbe-flow *) {
|
|
293
|
+
max-width: 100%;
|
|
294
|
+
}
|
|
295
|
+
.mbe-root .mbe-view-html :is(details, blockquote, li, td, th, div, section):not(.mbe-flow *) > :first-child,
|
|
296
|
+
.mbe-root .mbe-view-block.mbe-view-html > :first-child {
|
|
297
|
+
margin-top: 0;
|
|
298
|
+
}
|
|
299
|
+
.mbe-root .mbe-view-html :is(details, blockquote, li, td, th, div, section):not(.mbe-flow *) > :last-child,
|
|
300
|
+
.mbe-root .mbe-view-block.mbe-view-html > :last-child {
|
|
301
|
+
margin-bottom: 0;
|
|
302
|
+
}
|
|
303
|
+
:is(.mbe-root, .mbe-flow) > .mbe-divider.mbe-block {
|
|
205
304
|
margin: 16px 0;
|
|
206
305
|
padding: 4px 0;
|
|
207
306
|
cursor: default;
|
|
208
307
|
}
|
|
209
|
-
.mbe-root > .mbe-divider hr {
|
|
308
|
+
:is(.mbe-root, .mbe-flow) > .mbe-divider hr {
|
|
210
309
|
margin: 0;
|
|
211
310
|
}
|
|
212
|
-
.mbe-root > .mbe-table {
|
|
311
|
+
:is(.mbe-root, .mbe-flow) > .mbe-table {
|
|
213
312
|
overflow-x: auto;
|
|
214
313
|
}
|
|
215
|
-
.mbe-root > .mbe-table table {
|
|
314
|
+
:is(.mbe-root, .mbe-flow) > .mbe-table table {
|
|
216
315
|
border-collapse: separate;
|
|
217
316
|
border-spacing: 0;
|
|
218
317
|
}
|
|
219
|
-
.mbe-root > .mbe-table th,
|
|
220
|
-
.mbe-root > .mbe-table td {
|
|
318
|
+
:is(.mbe-root, .mbe-flow) > .mbe-table th,
|
|
319
|
+
:is(.mbe-root, .mbe-flow) > .mbe-table td {
|
|
221
320
|
padding: 4px 8px;
|
|
222
321
|
min-width: 4em;
|
|
223
322
|
vertical-align: top;
|
|
224
323
|
text-align: start;
|
|
225
324
|
outline: none;
|
|
226
325
|
}
|
|
227
|
-
.mbe-root
|
|
326
|
+
:is(.mbe-root, .mbe-flow) > [data-in-section] {
|
|
327
|
+
margin-inline-start: calc(var(--mbe-section-depth, 0) * var(--mbe-indent-size));
|
|
328
|
+
}
|
|
329
|
+
:is(.mbe-root, .mbe-flow) > .mbe-block:first-child {
|
|
228
330
|
margin-top: 0;
|
|
229
331
|
}
|
|
230
|
-
.mbe-root > .mbe-block:last-child {
|
|
332
|
+
:is(.mbe-root, .mbe-flow) > .mbe-block:last-child {
|
|
231
333
|
margin-bottom: 0;
|
|
232
334
|
}
|
|
233
335
|
.mbe-root .mbe-empty-content {
|
|
@@ -235,8 +337,9 @@
|
|
|
235
337
|
}
|
|
236
338
|
.mbe-root > .mbe-paragraph.mbe-empty:only-child::before,
|
|
237
339
|
.mbe-root > .mbe-paragraph.mbe-empty.mbe-show-hint::before,
|
|
238
|
-
.mbe-root > .mbe-empty[data-hint]:is(h1, h2, h3, h4, h5, h6, blockquote)::before,
|
|
239
|
-
.mbe-root > .mbe-list-item.mbe-empty[data-hint] > .mbe-content::before
|
|
340
|
+
.mbe-root:not(.mbe-readonly) > .mbe-empty[data-hint]:is(h1, h2, h3, h4, h5, h6, blockquote)::before,
|
|
341
|
+
.mbe-root:not(.mbe-readonly) > .mbe-list-item.mbe-empty[data-hint] > .mbe-content::before,
|
|
342
|
+
.mbe-root:not(.mbe-readonly) > .mbe-details.mbe-empty[data-hint] > .mbe-content::before {
|
|
240
343
|
opacity: 0.5;
|
|
241
344
|
pointer-events: none;
|
|
242
345
|
position: absolute;
|
|
@@ -247,8 +350,9 @@
|
|
|
247
350
|
.mbe-root > .mbe-paragraph.mbe-empty.mbe-show-hint::before {
|
|
248
351
|
content: var(--mbe-slash-hint, "");
|
|
249
352
|
}
|
|
250
|
-
.mbe-root > .mbe-empty[data-hint]:is(h1, h2, h3, h4, h5, h6, blockquote)::before,
|
|
251
|
-
.mbe-root > .mbe-list-item.mbe-empty[data-hint] > .mbe-content::before
|
|
353
|
+
.mbe-root:not(.mbe-readonly) > .mbe-empty[data-hint]:is(h1, h2, h3, h4, h5, h6, blockquote)::before,
|
|
354
|
+
.mbe-root:not(.mbe-readonly) > .mbe-list-item.mbe-empty[data-hint] > .mbe-content::before,
|
|
355
|
+
.mbe-root:not(.mbe-readonly) > .mbe-details.mbe-empty[data-hint] > .mbe-content::before {
|
|
252
356
|
content: attr(data-hint);
|
|
253
357
|
}
|
|
254
358
|
.mbe-root > .mbe-widget {
|
|
@@ -271,6 +375,7 @@
|
|
|
271
375
|
}
|
|
272
376
|
.mbe-menu,
|
|
273
377
|
.mbe-toolbar,
|
|
378
|
+
.mbe-link-card,
|
|
274
379
|
.mbe-input-popover {
|
|
275
380
|
position: fixed;
|
|
276
381
|
background: Canvas;
|
|
@@ -315,6 +420,10 @@
|
|
|
315
420
|
.mbe-suggestion-menu {
|
|
316
421
|
max-width: 360px;
|
|
317
422
|
}
|
|
423
|
+
.mbe-emoji-menu .mbe-menu-icon {
|
|
424
|
+
font-size: 18px;
|
|
425
|
+
line-height: 1;
|
|
426
|
+
}
|
|
318
427
|
.mbe-suggestion-menu .mbe-menu-label {
|
|
319
428
|
min-width: 0;
|
|
320
429
|
overflow: hidden;
|
|
@@ -425,6 +534,27 @@
|
|
|
425
534
|
gap: 4px;
|
|
426
535
|
padding: 4px;
|
|
427
536
|
}
|
|
537
|
+
.mbe-link-card {
|
|
538
|
+
box-sizing: border-box;
|
|
539
|
+
display: flex;
|
|
540
|
+
align-items: center;
|
|
541
|
+
gap: 2px;
|
|
542
|
+
padding: 4px;
|
|
543
|
+
max-width: min(420px, calc(100vw - 16px));
|
|
544
|
+
}
|
|
545
|
+
.mbe-link-card-url {
|
|
546
|
+
flex: 0 1 auto;
|
|
547
|
+
min-width: 0;
|
|
548
|
+
padding: 0 6px;
|
|
549
|
+
overflow: hidden;
|
|
550
|
+
text-overflow: ellipsis;
|
|
551
|
+
white-space: nowrap;
|
|
552
|
+
color: LinkText;
|
|
553
|
+
}
|
|
554
|
+
.mbe-tool:disabled {
|
|
555
|
+
opacity: 0.4;
|
|
556
|
+
cursor: default;
|
|
557
|
+
}
|
|
428
558
|
.mbe-image-frame {
|
|
429
559
|
position: fixed;
|
|
430
560
|
pointer-events: none;
|
|
@@ -534,6 +664,11 @@
|
|
|
534
664
|
0 2px 4px -2px light-dark(rgb(0 0 0 / 0.1), transparent);
|
|
535
665
|
--mbe-block-code-bg: color-mix(in oklab, var(--mbe-code-bg) 45%, transparent);
|
|
536
666
|
--mbe-quote-border: color-mix(in oklab, var(--mbe-muted) 25%, transparent);
|
|
667
|
+
--mbe-callout-note: light-dark(var(--mbe-callout-note-light, oklch(0.55 0.17 255)), var(--mbe-callout-note-dark, oklch(0.68 0.15 255)));
|
|
668
|
+
--mbe-callout-tip: light-dark(var(--mbe-callout-tip-light, oklch(0.52 0.13 150)), var(--mbe-callout-tip-dark, oklch(0.72 0.17 150)));
|
|
669
|
+
--mbe-callout-important: light-dark(var(--mbe-callout-important-light, oklch(0.52 0.2 295)), var(--mbe-callout-important-dark, oklch(0.7 0.15 295)));
|
|
670
|
+
--mbe-callout-warning: light-dark(var(--mbe-callout-warning-light, oklch(0.55 0.12 75)), var(--mbe-callout-warning-dark, oklch(0.74 0.14 80)));
|
|
671
|
+
--mbe-callout-caution: light-dark(var(--mbe-callout-caution-light, oklch(0.55 0.2 25)), var(--mbe-callout-caution-dark, oklch(0.68 0.19 25)));
|
|
537
672
|
}
|
|
538
673
|
:where([data-theme=light]) :is(.mbe-root, .mbe-ui),
|
|
539
674
|
.mbe-root[data-theme=light],
|
|
@@ -552,26 +687,26 @@
|
|
|
552
687
|
color: var(--mbe-text);
|
|
553
688
|
background: var(--mbe-bg);
|
|
554
689
|
}
|
|
555
|
-
.mbe-root > :is(h1, h2, h3, h4, h5, h6) {
|
|
690
|
+
:is(.mbe-root, .mbe-flow) > :is(h1, h2, h3, h4, h5, h6) {
|
|
556
691
|
font-weight: 600;
|
|
557
692
|
}
|
|
558
|
-
.mbe-root > h1 {
|
|
693
|
+
:is(.mbe-root, .mbe-flow) > h1 {
|
|
559
694
|
font-size: 24px;
|
|
560
695
|
line-height: 32px;
|
|
561
696
|
}
|
|
562
|
-
.mbe-root > h2 {
|
|
697
|
+
:is(.mbe-root, .mbe-flow) > h2 {
|
|
563
698
|
font-size: 20px;
|
|
564
699
|
line-height: 28px;
|
|
565
700
|
}
|
|
566
|
-
.mbe-root > h3 {
|
|
701
|
+
:is(.mbe-root, .mbe-flow) > h3 {
|
|
567
702
|
font-size: 18px;
|
|
568
703
|
line-height: 26px;
|
|
569
704
|
}
|
|
570
|
-
.mbe-root > :is(h4, h5, h6) {
|
|
705
|
+
:is(.mbe-root, .mbe-flow) > :is(h4, h5, h6) {
|
|
571
706
|
font-size: 16px;
|
|
572
707
|
line-height: 24px;
|
|
573
708
|
}
|
|
574
|
-
.mbe-root > h6 {
|
|
709
|
+
:is(.mbe-root, .mbe-flow) > h6 {
|
|
575
710
|
color: var(--mbe-muted);
|
|
576
711
|
}
|
|
577
712
|
.mbe-root > .mbe-block.mbe-block-selected {
|
|
@@ -621,7 +756,7 @@
|
|
|
621
756
|
.mbe-root.mbe-readonly .mbe-footnote-ref {
|
|
622
757
|
cursor: pointer;
|
|
623
758
|
}
|
|
624
|
-
.mbe-root > .mbe-footnote {
|
|
759
|
+
:is(.mbe-root, .mbe-flow) > .mbe-footnote {
|
|
625
760
|
font-size: 0.875em;
|
|
626
761
|
color: var(--mbe-muted);
|
|
627
762
|
}
|
|
@@ -629,14 +764,48 @@
|
|
|
629
764
|
margin-inline-end: 0.375em;
|
|
630
765
|
color: var(--mbe-link);
|
|
631
766
|
}
|
|
632
|
-
.mbe-root > blockquote {
|
|
767
|
+
:is(.mbe-root, .mbe-flow) > blockquote {
|
|
633
768
|
border-inline-start: 3px solid var(--mbe-quote-border);
|
|
634
769
|
padding-inline-start: 12px;
|
|
635
770
|
color: var(--mbe-muted);
|
|
636
771
|
}
|
|
772
|
+
:is(.mbe-root, .mbe-flow) > blockquote[data-callout] {
|
|
773
|
+
color: inherit;
|
|
774
|
+
border-inline-start-color: var(--mbe-callout);
|
|
775
|
+
}
|
|
776
|
+
:is(.mbe-root, .mbe-flow) > blockquote[data-callout=note] {
|
|
777
|
+
--mbe-callout: var(--mbe-callout-note);
|
|
778
|
+
}
|
|
779
|
+
:is(.mbe-root, .mbe-flow) > blockquote[data-callout=tip] {
|
|
780
|
+
--mbe-callout: var(--mbe-callout-tip);
|
|
781
|
+
}
|
|
782
|
+
:is(.mbe-root, .mbe-flow) > blockquote[data-callout=important] {
|
|
783
|
+
--mbe-callout: var(--mbe-callout-important);
|
|
784
|
+
}
|
|
785
|
+
:is(.mbe-root, .mbe-flow) > blockquote[data-callout=warning] {
|
|
786
|
+
--mbe-callout: var(--mbe-callout-warning);
|
|
787
|
+
}
|
|
788
|
+
:is(.mbe-root, .mbe-flow) > blockquote[data-callout=caution] {
|
|
789
|
+
--mbe-callout: var(--mbe-callout-caution);
|
|
790
|
+
}
|
|
791
|
+
.mbe-root .mbe-callout-title {
|
|
792
|
+
color: var(--mbe-callout);
|
|
793
|
+
font-weight: 500;
|
|
794
|
+
}
|
|
637
795
|
.mbe-root .mbe-marker {
|
|
638
796
|
color: var(--mbe-muted);
|
|
639
797
|
}
|
|
798
|
+
.mbe-root .mbe-details-toggle {
|
|
799
|
+
color: var(--mbe-muted);
|
|
800
|
+
border-radius: 4px;
|
|
801
|
+
}
|
|
802
|
+
.mbe-root .mbe-details-toggle:hover {
|
|
803
|
+
color: var(--mbe-text);
|
|
804
|
+
background: var(--mbe-hover);
|
|
805
|
+
}
|
|
806
|
+
:is(.mbe-root, .mbe-flow) > .mbe-details {
|
|
807
|
+
font-weight: 500;
|
|
808
|
+
}
|
|
640
809
|
.mbe-root .mbe-checkbox {
|
|
641
810
|
appearance: none;
|
|
642
811
|
-webkit-appearance: none;
|
|
@@ -649,7 +818,7 @@
|
|
|
649
818
|
border-color: var(--mbe-accent);
|
|
650
819
|
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
|
|
651
820
|
}
|
|
652
|
-
.mbe-root > .mbe-code:not(.mbe-view-block) {
|
|
821
|
+
:is(.mbe-root, .mbe-flow) > .mbe-code:not(.mbe-view-block) {
|
|
653
822
|
background: var(--mbe-block-code-bg);
|
|
654
823
|
border-radius: var(--mbe-radius);
|
|
655
824
|
overflow: hidden;
|
|
@@ -678,58 +847,134 @@
|
|
|
678
847
|
.mbe-root .mbe-code-copy.mbe-copied {
|
|
679
848
|
color: var(--mbe-accent);
|
|
680
849
|
}
|
|
681
|
-
.mbe-root > .mbe-code pre,
|
|
682
|
-
.mbe-root > pre.mbe-raw {
|
|
850
|
+
:is(.mbe-root, .mbe-flow) > .mbe-code pre,
|
|
851
|
+
:is(.mbe-root, .mbe-flow) > pre.mbe-raw {
|
|
683
852
|
font-size: 14px;
|
|
684
853
|
line-height: 22px;
|
|
685
854
|
font-family: var(--mbe-mono);
|
|
686
855
|
}
|
|
687
|
-
.mbe-root > .mbe-code pre {
|
|
856
|
+
:is(.mbe-root, .mbe-flow) > .mbe-code pre {
|
|
688
857
|
padding: 2px 12px 10px;
|
|
689
858
|
}
|
|
690
|
-
.mbe-root > .mbe-code pre code {
|
|
859
|
+
:is(.mbe-root, .mbe-flow) > .mbe-code pre code {
|
|
691
860
|
background: none;
|
|
692
861
|
padding: 0;
|
|
693
862
|
border-radius: 0;
|
|
694
863
|
font: inherit;
|
|
695
864
|
}
|
|
696
|
-
.mbe-root > pre.mbe-raw {
|
|
865
|
+
:is(.mbe-root, .mbe-flow) > pre.mbe-raw {
|
|
866
|
+
color: var(--mbe-muted);
|
|
867
|
+
}
|
|
868
|
+
.mbe-root .mbe-view-html blockquote:not(.mbe-flow *) {
|
|
869
|
+
border-inline-start: 3px solid var(--mbe-quote-border);
|
|
870
|
+
padding-inline-start: 12px;
|
|
871
|
+
color: var(--mbe-muted);
|
|
872
|
+
}
|
|
873
|
+
.mbe-root .mbe-view-html pre:not(.mbe-flow *) {
|
|
874
|
+
background: var(--mbe-block-code-bg);
|
|
875
|
+
border-radius: var(--mbe-radius);
|
|
876
|
+
padding: 10px 12px;
|
|
877
|
+
font-size: 14px;
|
|
878
|
+
line-height: 22px;
|
|
879
|
+
font-family: var(--mbe-mono);
|
|
880
|
+
}
|
|
881
|
+
.mbe-root .mbe-view-html pre code:not(.mbe-flow *) {
|
|
882
|
+
background: none;
|
|
883
|
+
padding: 0;
|
|
884
|
+
border-radius: 0;
|
|
885
|
+
font: inherit;
|
|
886
|
+
}
|
|
887
|
+
.mbe-root .mbe-view-html :is(h1, h2, h3, h4, h5, h6):not(.mbe-flow *) {
|
|
888
|
+
font-weight: 600;
|
|
889
|
+
}
|
|
890
|
+
.mbe-root .mbe-view-html h1:not(.mbe-flow *) {
|
|
891
|
+
font-size: 24px;
|
|
892
|
+
line-height: 32px;
|
|
893
|
+
}
|
|
894
|
+
.mbe-root .mbe-view-html h2:not(.mbe-flow *) {
|
|
895
|
+
font-size: 20px;
|
|
896
|
+
line-height: 28px;
|
|
897
|
+
}
|
|
898
|
+
.mbe-root .mbe-view-html h3:not(.mbe-flow *) {
|
|
899
|
+
font-size: 18px;
|
|
900
|
+
line-height: 26px;
|
|
901
|
+
}
|
|
902
|
+
.mbe-root .mbe-view-html h6:not(.mbe-flow *) {
|
|
697
903
|
color: var(--mbe-muted);
|
|
698
904
|
}
|
|
699
|
-
.mbe-root
|
|
905
|
+
.mbe-root .mbe-view-html hr:not(.mbe-flow *) {
|
|
700
906
|
border: none;
|
|
701
907
|
border-top: 1px solid var(--mbe-border);
|
|
702
908
|
}
|
|
703
|
-
.mbe-root
|
|
909
|
+
.mbe-root .mbe-view-html a:not(.mbe-link) {
|
|
910
|
+
color: var(--mbe-link);
|
|
911
|
+
text-decoration: underline;
|
|
912
|
+
text-underline-offset: 2px;
|
|
913
|
+
}
|
|
914
|
+
.mbe-root .mbe-view-html table:not(.mbe-flow *) {
|
|
915
|
+
border-collapse: collapse;
|
|
916
|
+
font-size: 14px;
|
|
917
|
+
line-height: 20px;
|
|
918
|
+
}
|
|
919
|
+
.mbe-root .mbe-view-html :is(th, td):not(.mbe-flow *) {
|
|
920
|
+
border: 1px solid var(--mbe-border);
|
|
921
|
+
padding: 6px 10px;
|
|
922
|
+
text-align: start;
|
|
923
|
+
vertical-align: top;
|
|
924
|
+
}
|
|
925
|
+
.mbe-root .mbe-view-html th:not(.mbe-flow *) {
|
|
926
|
+
font-weight: 500;
|
|
927
|
+
background: var(--mbe-block-code-bg);
|
|
928
|
+
}
|
|
929
|
+
.mbe-root .mbe-view-html kbd {
|
|
930
|
+
font-family: var(--mbe-mono);
|
|
931
|
+
font-size: 0.8125em;
|
|
932
|
+
line-height: 1;
|
|
933
|
+
padding: 2px 5px;
|
|
934
|
+
border: 1px solid var(--mbe-border);
|
|
935
|
+
border-bottom-width: 2px;
|
|
936
|
+
border-radius: 4px;
|
|
937
|
+
background: var(--mbe-block-code-bg);
|
|
938
|
+
}
|
|
939
|
+
.mbe-root .mbe-view-html mark {
|
|
940
|
+
background: color-mix(in oklab, #facc15 40%, transparent);
|
|
941
|
+
color: inherit;
|
|
942
|
+
}
|
|
943
|
+
:is(.mbe-root, .mbe-flow) > .mbe-divider hr {
|
|
944
|
+
border: none;
|
|
945
|
+
border-top: 1px solid var(--mbe-border);
|
|
946
|
+
}
|
|
947
|
+
:is(.mbe-root, .mbe-flow) > .mbe-table table {
|
|
704
948
|
font-size: 14px;
|
|
705
949
|
line-height: 20px;
|
|
706
950
|
border: 1px solid var(--mbe-border);
|
|
707
951
|
border-radius: var(--mbe-radius);
|
|
708
952
|
}
|
|
709
|
-
.mbe-root > .mbe-table :is(th, td) {
|
|
953
|
+
:is(.mbe-root, .mbe-flow) > .mbe-table :is(th, td) {
|
|
710
954
|
padding: 6px 10px;
|
|
711
955
|
min-width: 8em;
|
|
712
956
|
}
|
|
713
|
-
.mbe-root > .mbe-table :is(th, td):not(:first-child) {
|
|
957
|
+
:is(.mbe-root, .mbe-flow) > .mbe-table :is(th, td):not(:first-child) {
|
|
714
958
|
border-inline-start: 1px solid var(--mbe-border);
|
|
715
959
|
}
|
|
716
|
-
.mbe-root > .mbe-table tr:not(:first-child) > * {
|
|
960
|
+
:is(.mbe-root, .mbe-flow) > .mbe-table tr:not(:first-child) > * {
|
|
717
961
|
border-top: 1px solid var(--mbe-border);
|
|
718
962
|
}
|
|
719
|
-
.mbe-root > .mbe-table th {
|
|
963
|
+
:is(.mbe-root, .mbe-flow) > .mbe-table th {
|
|
720
964
|
font-weight: 500;
|
|
721
965
|
background: var(--mbe-block-code-bg);
|
|
722
966
|
}
|
|
723
|
-
.mbe-root > .mbe-table tr:first-child > :first-child {
|
|
967
|
+
:is(.mbe-root, .mbe-flow) > .mbe-table tr:first-child > :first-child {
|
|
724
968
|
border-start-start-radius: calc(var(--mbe-radius) - 1px);
|
|
725
969
|
}
|
|
726
|
-
.mbe-root > .mbe-table tr:first-child > :last-child {
|
|
970
|
+
:is(.mbe-root, .mbe-flow) > .mbe-table tr:first-child > :last-child {
|
|
727
971
|
border-start-end-radius: calc(var(--mbe-radius) - 1px);
|
|
728
972
|
}
|
|
729
973
|
.mbe-root > .mbe-paragraph.mbe-empty:only-child::before,
|
|
730
974
|
.mbe-root > .mbe-paragraph.mbe-empty.mbe-show-hint::before,
|
|
731
|
-
.mbe-root > .mbe-empty[data-hint]:is(h1, h2, h3, h4, h5, h6, blockquote)::before,
|
|
732
|
-
.mbe-root > .mbe-list-item.mbe-empty[data-hint] > .mbe-content::before
|
|
975
|
+
.mbe-root:not(.mbe-readonly) > .mbe-empty[data-hint]:is(h1, h2, h3, h4, h5, h6, blockquote)::before,
|
|
976
|
+
.mbe-root:not(.mbe-readonly) > .mbe-list-item.mbe-empty[data-hint] > .mbe-content::before,
|
|
977
|
+
.mbe-root:not(.mbe-readonly) > .mbe-details.mbe-empty[data-hint] > .mbe-content::before {
|
|
733
978
|
color: var(--mbe-muted);
|
|
734
979
|
opacity: 0.7;
|
|
735
980
|
}
|
|
@@ -741,6 +986,7 @@
|
|
|
741
986
|
}
|
|
742
987
|
.mbe-menu,
|
|
743
988
|
.mbe-toolbar,
|
|
989
|
+
.mbe-link-card,
|
|
744
990
|
.mbe-input-popover {
|
|
745
991
|
color: var(--mbe-text);
|
|
746
992
|
background: var(--mbe-popup-bg);
|
|
@@ -782,9 +1028,18 @@
|
|
|
782
1028
|
font-size: 12px;
|
|
783
1029
|
color: var(--mbe-muted);
|
|
784
1030
|
}
|
|
785
|
-
.mbe-toolbar
|
|
1031
|
+
.mbe-toolbar,
|
|
1032
|
+
.mbe-link-card {
|
|
786
1033
|
border-radius: calc(var(--mbe-radius) + 2px);
|
|
787
1034
|
}
|
|
1035
|
+
.mbe-link-card-url {
|
|
1036
|
+
font-size: 13px;
|
|
1037
|
+
color: var(--mbe-link);
|
|
1038
|
+
text-decoration: none;
|
|
1039
|
+
}
|
|
1040
|
+
.mbe-link-card-url:hover {
|
|
1041
|
+
text-decoration: underline;
|
|
1042
|
+
}
|
|
788
1043
|
.mbe-tool {
|
|
789
1044
|
border-radius: 7px;
|
|
790
1045
|
}
|