react-reason-editor 1.0.24 → 1.0.26
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 +24 -0
- package/dist/{Attachment-DGzsbPZZ.js → Attachment-FN0H4pdR.js} +2 -2
- package/dist/Attachment.js +1 -1
- package/dist/BulletList.cjs +1 -1
- package/dist/{Callout-heY7R-Zu.js → Callout-C6kKHIbW.js} +2 -2
- package/dist/Callout.js +1 -1
- package/dist/{CodeBlock-B7Wklup8.js → CodeBlock-DLhI2Guf.js} +1 -1
- package/dist/{CodeBlock-D2OKvGCF.cjs → CodeBlock-zh4cX5EA.cjs} +1 -1
- package/dist/CodeBlock.cjs +1 -1
- package/dist/CodeBlock.js +1 -1
- package/dist/CodeView.cjs +1 -1
- package/dist/CodeView.js +1 -1
- package/dist/{Color-BxzxtvJH.cjs → Color-D5zLljFV.cjs} +1 -1
- package/dist/Color.cjs +1 -1
- package/dist/{Drawer-DxCO6TBr.cjs → Drawer-B0QvuSOf.cjs} +1 -1
- package/dist/{Drawer-Dunw22Q1.js → Drawer-bqo2XUCW.js} +12 -12
- package/dist/Drawer.cjs +1 -1
- package/dist/Drawer.js +1 -1
- package/dist/{Drawio-eqEGDkwW.js → Drawio-CIXM-WGy.js} +4 -4
- package/dist/Drawio.js +1 -1
- package/dist/{Emoji-BU-itkPp.js → Emoji-CTvSFbHz.js} +3 -3
- package/dist/Emoji.js +1 -1
- package/dist/FontFamily.js +2 -2
- package/dist/{Highlight-BeqLxfbY.cjs → Highlight-DQxtCrNN.cjs} +1 -1
- package/dist/Highlight.cjs +1 -1
- package/dist/{History-C6yBYB2w.js → History-PbMa-usl.js} +1 -1
- package/dist/History.js +1 -1
- package/dist/Image.js +1 -1
- package/dist/{ImageCropper-Dlz4nJQu.js → ImageCropper-CN_GzBBG.js} +5 -5
- package/dist/{ImageGif-D5Qw_Xf-.js → ImageGif-D9goI48J.js} +3 -3
- package/dist/ImageGif.js +1 -1
- package/dist/{ImportWord-BCcs3dYp.js → ImportWord-Bux3L57d.js} +1 -1
- package/dist/ImportWord.js +1 -1
- package/dist/{Indent-DpTPoZMk.js → Indent-fBwkYx_q.js} +1 -1
- package/dist/Indent.js +1 -1
- package/dist/{Katex-D_vF5gsD.cjs → Katex-B1xls7hE.cjs} +1 -1
- package/dist/{Katex-Bo_vfXrd.js → Katex-D2g86C-B.js} +3 -3
- package/dist/Katex.cjs +1 -1
- package/dist/Katex.js +1 -1
- package/dist/LineHeight.js +1 -1
- package/dist/{Link-C0cNnjXo.js → Link-Dpaom2jX.js} +1 -1
- package/dist/Link.js +1 -1
- package/dist/{Mention-DEkbeL04.js → Mention-D0HVk1SC.js} +1 -1
- package/dist/Mention.js +1 -1
- package/dist/{Mermaid-BB15qd24.cjs → Mermaid-3vSlkOlc.cjs} +1 -1
- package/dist/Mermaid-B3KGZMBo.js +5 -0
- package/dist/Mermaid.cjs +1 -1
- package/dist/Mermaid.js +1 -1
- package/dist/MoreMark.js +1 -1
- package/dist/OrderedList.cjs +1 -1
- package/dist/SearchAndReplace.cjs +1 -1
- package/dist/SearchAndReplace.js +1 -1
- package/dist/{SlashCommand-8LkH8bHy.js → SlashCommand-ZFZhrxKb.js} +1 -1
- package/dist/SlashCommand.js +1 -1
- package/dist/{Table-C9t-k9Qu.js → Table-6kM52sUH.js} +2 -2
- package/dist/Table.js +1 -1
- package/dist/TaskList.cjs +1 -1
- package/dist/{TextAlign-C75gn_OM.js → TextAlign-BKo82ocx.js} +1 -1
- package/dist/TextAlign.js +1 -1
- package/dist/TextDirection.js +1 -1
- package/dist/{Twitter-DyrQT0n4.cjs → Twitter-3yCP2UdP.cjs} +1 -1
- package/dist/{Twitter-D5UNfT-K.js → Twitter-D38giVew.js} +2 -2
- package/dist/Twitter.cjs +1 -1
- package/dist/Twitter.js +1 -1
- package/dist/{Video-_YlAC2R_.js → Video-DcfPDZLP.js} +3 -3
- package/dist/Video.js +1 -1
- package/dist/WordCount.js +1 -1
- package/dist/{bubble---c27x7L.js → bubble-4RecyKlX.js} +1 -1
- package/dist/bubble.cjs +1 -1
- package/dist/bubble.js +1 -1
- package/dist/editor-kit.cjs +1 -0
- package/dist/editor-kit.d.ts +13 -0
- package/dist/editor-kit.js +1 -0
- package/dist/editor-views/components/AlignToolbar.d.ts +4 -0
- package/dist/editor-views/components/BubbleMenus.d.ts +4 -0
- package/dist/editor-views/components/EditorContainer.d.ts +10 -0
- package/dist/editor-views/components/Header.d.ts +8 -0
- package/dist/editor-views/components/Toolbar.d.ts +26 -0
- package/dist/editor-views/components/constants.d.ts +14 -0
- package/dist/editor-views/components/extensions.d.ts +8 -0
- package/dist/editor-views/components/index.d.ts +9 -0
- package/dist/editor-views/config/baseKit.d.ts +7 -0
- package/dist/editor-views/config/editorConfig.d.ts +37 -0
- package/dist/editor-views/config/pluginRegistry.d.ts +43 -0
- package/dist/editorConfig-Cgs4P8O5.js +184 -0
- package/dist/editorConfig-CnzPmOCy.cjs +1 -0
- package/dist/html-to-docx.esm-DkztZsL5-BqrjWkoQ.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/reason-docs.cjs +1 -1
- package/dist/reason-docs.js +1 -1
- package/dist/{separator-BHN46aj5.cjs → separator-CXjMk9dM.cjs} +1 -1
- package/dist/src-73l1pSjp.js +463 -0
- package/dist/src-CF0U82SA.cjs +1 -0
- package/package.json +12 -2
- package/dist/Mermaid-DxpFRVu0.js +0 -5
- package/dist/html-to-docx.esm-DkztZsL5-DQYdhD3B.cjs +0 -1
- package/dist/src-C7k3RYxJ.js +0 -646
- package/dist/src-DYbBlAjR.cjs +0 -1
package/dist/bubble.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s,c as a,d as o,f as r,g as b,h as m,i as p,l as t,m as e,n as f,o as i,p as l,r as u,s as c,t as d,u as g}from"./bubble
|
|
1
|
+
import{a as s,c as a,d as o,f as r,g as b,h as m,i as p,l as t,m as e,n as f,o as i,p as l,r as u,s as c,t as d,u as g}from"./bubble-4RecyKlX.js";export{b as RichTextBubbleCallout,d as RichTextBubbleCodeBlock,m as RichTextBubbleColumns,e as RichTextBubbleDrawer,l as RichTextBubbleDrawio,r as RichTextBubbleIframe,c as RichTextBubbleImage,a as RichTextBubbleImageGif,o as RichTextBubbleKatex,g as RichTextBubbleLink,f as RichTextBubbleMenuDragHandle,i as RichTextBubbleMermaid,s as RichTextBubbleTable,p as RichTextBubbleText,u as RichTextBubbleTwitter,t as RichTextBubbleVideo};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./rolldown-runtime-BeavJI0R.cjs");const e=require("./editorConfig-CnzPmOCy.cjs");exports.BubbleMenus=e.BubbleMenus,exports.RichTextProvider=e.RichTextProvider,exports.RichTextToolbar=e.RichTextToolbar,exports.buildExtensions=e.buildExtensions,exports.createDefaultConfig=e.createDefaultConfig,exports.debounce=e.debounce;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Headless building blocks for embedding a full-featured reason-editor
|
|
3
|
+
* surface (toolbar, bubble menus, default extension set) in a host that
|
|
4
|
+
* owns its own single-document load/save lifecycle instead of the
|
|
5
|
+
* ReasonDocs app shell's own document store — e.g. a VS Code custom
|
|
6
|
+
* editor backed by a real file on disk. Mirrors what the demo's
|
|
7
|
+
* `TabEditorOnly` composes from internal `src/` paths, but as a stable
|
|
8
|
+
* public subpath (`react-reason-editor/editor-kit`) any consumer of the
|
|
9
|
+
* published package can import.
|
|
10
|
+
*/
|
|
11
|
+
export { RichTextProvider } from './components/RichTextProvider';
|
|
12
|
+
export { RichTextToolbar, BubbleMenus, debounce } from './editor-views/components';
|
|
13
|
+
export { buildExtensions, createDefaultConfig, type EditorConfig, } from './editor-views/config/editorConfig';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,i as s,n as o,o as r,r as i,t}from"./editorConfig-Cgs4P8O5.js";export{s as BubbleMenus,r as RichTextProvider,a as RichTextToolbar,t as buildExtensions,o as createDefaultConfig,i as debounce};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
interface EditorContainerProps {
|
|
3
|
+
editor: Editor | null;
|
|
4
|
+
theme: string;
|
|
5
|
+
setTheme: (theme: string) => void;
|
|
6
|
+
/** Opens the parent-owned settings modal (config-driven editors only). */
|
|
7
|
+
onOpenSettings?: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const EditorContainer: ({ editor, theme, setTheme, onOpenSettings }: EditorContainerProps) => import("react").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Full formatting toolbar for the example editor, wiring each extension's RichText control together. Provides the top row of editing actions users interact with.
|
|
3
|
+
*/
|
|
4
|
+
interface ToolbarProps {
|
|
5
|
+
theme: string;
|
|
6
|
+
setTheme: (theme: string) => void;
|
|
7
|
+
/**
|
|
8
|
+
* When provided, the Settings button opens the config modal owned by the
|
|
9
|
+
* parent (language, theme, and the plugin manager) instead of the legacy
|
|
10
|
+
* quick dropdown. The modal lives outside the editor provider so it survives
|
|
11
|
+
* the editor being rebuilt when a plugin is toggled.
|
|
12
|
+
*/
|
|
13
|
+
onOpenSettings?: () => void;
|
|
14
|
+
/** Wraps the current selection in a new comment mark, when comments are enabled. */
|
|
15
|
+
onAddComment?: () => void;
|
|
16
|
+
/** True while there is no text selected, so "Add Comment" can be disabled. */
|
|
17
|
+
commentDisabled?: boolean;
|
|
18
|
+
/** Whether the comments sidebar is currently open. */
|
|
19
|
+
showComments?: boolean;
|
|
20
|
+
/** Toggles the comments sidebar open/closed. */
|
|
21
|
+
onToggleComments?: () => void;
|
|
22
|
+
/** Count of open (unresolved) comment threads, shown as a badge. */
|
|
23
|
+
commentCount?: number;
|
|
24
|
+
}
|
|
25
|
+
export declare const RichTextToolbar: ({ theme, setTheme, onOpenSettings, onAddComment, commentDisabled, showComments, onToggleComments, commentCount, }: ToolbarProps) => import("react").JSX.Element;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants and mock data (default content, sample users, debounce helper) for the example editor. Keeps the demo's configuration in one place.
|
|
3
|
+
*/
|
|
4
|
+
export declare const MOCK_USERS: {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
avatar: {
|
|
8
|
+
src: string;
|
|
9
|
+
};
|
|
10
|
+
}[];
|
|
11
|
+
export declare const DEFAULT_CONTENT = "<pre dir=\"auto\"><code class=\"language-js\">const a = 2;</code></pre><p dir=\"auto\"></p>";
|
|
12
|
+
export declare function getRandomColor(): string;
|
|
13
|
+
export declare function convertBase64ToBlob(base64: string): Blob;
|
|
14
|
+
export declare function debounce(func: any, wait: number): (...args: any[]) => void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backward-compatible default extension list for the example editor. The set of
|
|
3
|
+
* extensions is now derived from the JSON editor config (see
|
|
4
|
+
* `../config/editorConfig`) so the same list can be toggled at runtime from the
|
|
5
|
+
* Settings modal. This module simply exposes the default (out-of-the-box)
|
|
6
|
+
* configuration's extensions for consumers that want a static array.
|
|
7
|
+
*/
|
|
8
|
+
export declare const extensions: any[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Barrel re-exporting the example editor's building blocks (header, toolbar, container, extensions). Simplifies imports for the demo composition.
|
|
3
|
+
*/
|
|
4
|
+
export { Header } from './Header';
|
|
5
|
+
export { RichTextToolbar } from './Toolbar';
|
|
6
|
+
export { BubbleMenus } from './BubbleMenus';
|
|
7
|
+
export { EditorContainer } from './EditorContainer';
|
|
8
|
+
export { extensions } from './extensions';
|
|
9
|
+
export * from './constants';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The always-on core extensions every editor instance needs (document schema,
|
|
3
|
+
* text, paragraph, cursors, list item, text style, placeholder). These are not
|
|
4
|
+
* user-toggleable — they are the substrate the optional plugins build on — so
|
|
5
|
+
* they live outside the plugin registry and are prepended by `buildExtensions`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildBaseKit(): any[];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ThemeColorType } from '../../theme/theme';
|
|
2
|
+
export interface PluginConfigEntry {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
/** overrides for the plugin's settings-schema defaults (only what changed) */
|
|
5
|
+
settings?: Record<string, any>;
|
|
6
|
+
}
|
|
7
|
+
export interface EditorConfig {
|
|
8
|
+
/** active UI language code (matches the locale bundle keys) */
|
|
9
|
+
language: string;
|
|
10
|
+
/** light / dark appearance */
|
|
11
|
+
theme: 'light' | 'dark';
|
|
12
|
+
/** accent color preset */
|
|
13
|
+
accentColor: ThemeColorType;
|
|
14
|
+
/** per-plugin enable flags and settings, keyed by plugin key */
|
|
15
|
+
plugins: Record<string, PluginConfigEntry>;
|
|
16
|
+
}
|
|
17
|
+
export declare const CONFIG_STORAGE_KEY = "reason-editor-config";
|
|
18
|
+
/** Build the out-of-the-box config straight from the plugin registry. */
|
|
19
|
+
export declare function createDefaultConfig(): EditorConfig;
|
|
20
|
+
/**
|
|
21
|
+
* Merge a (possibly stale) saved config against the current registry so that
|
|
22
|
+
* newly-added plugins appear and removed ones drop out, without losing the
|
|
23
|
+
* user's existing toggles and settings overrides.
|
|
24
|
+
*/
|
|
25
|
+
export declare function normalizeConfig(saved: Partial<EditorConfig> | null | undefined): EditorConfig;
|
|
26
|
+
export declare function loadConfig(): EditorConfig;
|
|
27
|
+
export declare function saveConfig(config: EditorConfig): void;
|
|
28
|
+
/**
|
|
29
|
+
* A stable signature of the parts of the config that require the editor to be
|
|
30
|
+
* rebuilt (which plugins are enabled and their settings). Language, theme and
|
|
31
|
+
* accent are applied without recreating the editor, so they are excluded.
|
|
32
|
+
*/
|
|
33
|
+
export declare function extensionsSignature(config: EditorConfig): string;
|
|
34
|
+
/** Turn the config JSON into the concrete Tiptap extension array to mount. */
|
|
35
|
+
export declare function buildExtensions(config: EditorConfig): any[];
|
|
36
|
+
export { PLUGIN_REGISTRY, PLUGIN_BY_KEY, resolvePluginSettings, } from './pluginRegistry';
|
|
37
|
+
export type { PluginDefinition, SettingField, SettingFieldType } from './pluginRegistry';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Central registry describing every toggleable editor plugin (extension). Each
|
|
3
|
+
* entry carries the metadata the Settings UI renders (label, description,
|
|
4
|
+
* category, whether it ships in the default set) plus an optional settings
|
|
5
|
+
* schema and a `create()` factory that builds the underlying Tiptap
|
|
6
|
+
* extension(s) from the resolved settings. This is the single source of truth
|
|
7
|
+
* that both `buildExtensions` (runtime) and the Settings modal (UI) read from,
|
|
8
|
+
* so adding a plugin here makes it appear in the config JSON, the pill box, and
|
|
9
|
+
* the discovery list automatically.
|
|
10
|
+
*/
|
|
11
|
+
export type SettingFieldType = 'text' | 'number' | 'boolean' | 'color';
|
|
12
|
+
export interface SettingField {
|
|
13
|
+
/** key stored under the plugin's `settings` object in the config JSON */
|
|
14
|
+
key: string;
|
|
15
|
+
label: string;
|
|
16
|
+
type: SettingFieldType;
|
|
17
|
+
default: string | number | boolean;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
/** optional hint rendered under the field */
|
|
20
|
+
help?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface PluginDefinition {
|
|
23
|
+
/** stable key used in the config JSON and everywhere in the UI */
|
|
24
|
+
key: string;
|
|
25
|
+
/** human-readable name shown on the pill / discovery list */
|
|
26
|
+
label: string;
|
|
27
|
+
description: string;
|
|
28
|
+
category: string;
|
|
29
|
+
/** whether the plugin is part of the default (out-of-the-box) set */
|
|
30
|
+
defaultEnabled: boolean;
|
|
31
|
+
/** schema whose fields generate the plugin's settings form once enabled */
|
|
32
|
+
settings?: SettingField[];
|
|
33
|
+
/**
|
|
34
|
+
* Builds the Tiptap extension(s). Receives the resolved settings values
|
|
35
|
+
* (defaults merged with any user overrides). May return a single extension
|
|
36
|
+
* or an array; the result is flattened by `buildExtensions`.
|
|
37
|
+
*/
|
|
38
|
+
create: (settings: Record<string, any>) => any;
|
|
39
|
+
}
|
|
40
|
+
export declare const PLUGIN_REGISTRY: PluginDefinition[];
|
|
41
|
+
export declare const PLUGIN_BY_KEY: Record<string, PluginDefinition>;
|
|
42
|
+
/** Resolve a plugin's settings by merging schema defaults with saved overrides. */
|
|
43
|
+
export declare function resolvePluginSettings(def: PluginDefinition, saved?: Record<string, any>): Record<string, any>;
|