@blocklet/editor 2.4.89 → 2.4.91

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.
Files changed (44) hide show
  1. package/lib/blocklet-editor-viewer.d.ts +4 -0
  2. package/lib/blocklet-editor-viewer.js +12 -0
  3. package/lib/blocklet-editor.d.ts +2 -0
  4. package/lib/blocklet-editor.js +12 -0
  5. package/lib/ext/CustomComponent/CustomComponentNode.js +1 -0
  6. package/lib/ext/CustomComponent/components/Code.js +2 -1
  7. package/lib/ext/CustomComponent/components/Field.d.ts +9 -0
  8. package/lib/ext/CustomComponent/components/Field.js +32 -0
  9. package/lib/ext/CustomComponent/components/index.d.ts +2 -0
  10. package/lib/ext/CustomComponent/components/index.js +2 -0
  11. package/lib/ext/PagesKitComponent/PagesKitComponentRenderer.js +2 -2
  12. package/lib/index.d.ts +0 -3
  13. package/lib/index.js +2 -2
  14. package/lib/main/editor-root.d.ts +2 -0
  15. package/lib/main/editor-root.js +46 -0
  16. package/lib/main/hooks/use-mobile.d.ts +4 -0
  17. package/lib/main/hooks/use-mobile.js +6 -0
  18. package/lib/main/index.css +0 -954
  19. package/lib/main/index.d.ts +3 -0
  20. package/lib/main/index.js +7 -12
  21. package/lib/main/markdown-editor/index.js +1 -9
  22. package/lib/main/nodes/PlaygroundNodes.js +0 -2
  23. package/lib/main/style/editable.css +476 -0
  24. package/lib/main/themes/code-highlight/index.d.ts +2 -32
  25. package/lib/main/themes/code-highlight/index.js +10 -65
  26. package/lib/main/themes/customTheme.js +17 -18
  27. package/lib/main/viewer/index.d.ts +5 -0
  28. package/lib/main/viewer/index.js +26 -0
  29. package/lib/main/viewer/types.d.ts +14 -0
  30. package/lib/main/viewer/types.js +1 -0
  31. package/lib/main/viewer/viewer.d.ts +3 -0
  32. package/lib/main/viewer/viewer.js +30 -0
  33. package/lib/types.d.ts +2 -1
  34. package/package.json +4 -2
  35. package/lib/main/Settings.d.ts +0 -9
  36. package/lib/main/Settings.js +0 -39
  37. package/lib/main/plugins/KeywordsPlugin/index.d.ts +0 -9
  38. package/lib/main/plugins/KeywordsPlugin/index.js +0 -38
  39. package/lib/main/plugins/PasteLogPlugin/index.d.ts +0 -9
  40. package/lib/main/plugins/PasteLogPlugin/index.js +0 -34
  41. package/lib/main/plugins/TestRecorderPlugin/index.d.ts +0 -10
  42. package/lib/main/plugins/TestRecorderPlugin/index.js +0 -340
  43. package/lib/main/ui/Switch.d.ts +0 -15
  44. package/lib/main/ui/Switch.js +0 -6
@@ -1,9 +1,8 @@
1
1
  import { css } from '@emotion/css';
2
2
  import { useTheme } from '@mui/material';
3
3
  import defaultTheme from './defaultTheme';
4
- import { codeHighlightLight, codeHighlightDark } from './code-highlight';
4
+ import codeHighlight from './code-highlight';
5
5
  const createCustomTheme = (theme) => {
6
- const { palette } = theme;
7
6
  const noMarginTopStyle = css(`
8
7
  // 首个元素的 margin-top 设置为 0
9
8
  .be-editable &:first-child {
@@ -30,7 +29,7 @@ const createCustomTheme = (theme) => {
30
29
  `, theme.typography.body1, noMarginTopStyle);
31
30
  const quote = css(`
32
31
  margin: 1.6em 0;
33
- border-left-color: ${palette.grey[200]};
32
+ border-left-color: var(--mui-palette-grey-200);
34
33
  border-left-width: 2px;
35
34
  border-left-style: solid;
36
35
  padding-left: 1.5rem;
@@ -76,7 +75,7 @@ const createCustomTheme = (theme) => {
76
75
  const link = css(`
77
76
  color: inherit;
78
77
  text-decoration: none;
79
- border-bottom: 1px solid ${palette.primary.main};
78
+ border-bottom: 1px solid var(--mui-palette-primary-main);
80
79
  &:hover {
81
80
  border-bottom-width: 2px;
82
81
  }
@@ -108,12 +107,12 @@ const createCustomTheme = (theme) => {
108
107
  fontSize: '.875em',
109
108
  fontWeight: 500,
110
109
  borderRadius: '.25rem',
111
- border: `1px solid ${palette.grey[200]}`,
110
+ border: '1px solid var(--mui-palette-grey-200)',
112
111
  padding: '1px .375rem',
113
112
  fontFamily: 'Menlo, Consolas, Monaco, monospace',
114
113
  fontVariantLigatures: 'none',
115
- backgroundColor: palette.grey[50],
116
- ...(palette.mode === 'dark' && { color: palette.grey[800] }),
114
+ backgroundColor: 'var(--mui-palette-grey-50)',
115
+ color: 'var(--lexical-text-code)',
117
116
  });
118
117
  const olCommon = {
119
118
  margin: 0,
@@ -156,15 +155,15 @@ const createCustomTheme = (theme) => {
156
155
  padding-left: 24px;
157
156
  padding-right: 24px;
158
157
  &:before {
159
- border: 1px solid ${palette.primary.main};
160
- background-color: ${palette.primary.main};
158
+ border: 1px solid var(--mui-palette-primary-main);
159
+ background-color: var(--mui-palette-primary-main);
161
160
  top: 4px;
162
161
  }
163
162
  &:after {
164
163
  top: 7px;
165
164
  }
166
165
  &:focus:before {
167
- box-shadow: 0 0 0 1px ${palette.primary.light};
166
+ box-shadow: 0 0 0 1px var(--mui-palette-primary-light);
168
167
  }
169
168
  `;
170
169
  const listItemUnchecked = css `
@@ -177,7 +176,7 @@ const createCustomTheme = (theme) => {
177
176
  left: 1px;
178
177
  }
179
178
  &:focus:before {
180
- box-shadow: 0 0 0 1px ${palette.primary.light};
179
+ box-shadow: 0 0 0 1px var(--mui-palette-primary-light);
181
180
  }
182
181
  `;
183
182
  const nestedListItem = css `
@@ -193,14 +192,14 @@ const createCustomTheme = (theme) => {
193
192
  padding: 8px 0;
194
193
  `;
195
194
  const embedBlockFocus = css `
196
- outline: 2px solid ${palette.primary.light};
195
+ outline: 2px solid var(--mui-palette-primary-light);
197
196
  `;
198
197
  const alert = css `
199
198
  // user-select: none;
200
199
  padding: 8px 0;
201
200
  `;
202
201
  const alertFocus = css `
203
- outline: 2px solid ${palette.primary.light};
202
+ outline: 2px solid var(--mui-palette-primary-light);
204
203
  `;
205
204
  const image = css `
206
205
  .image-caption-container {
@@ -220,7 +219,7 @@ const createCustomTheme = (theme) => {
220
219
  .ImageNode__contentEditable {
221
220
  padding: 0;
222
221
  p {
223
- color: ${palette.text.secondary};
222
+ color: var(--mui-palette-text-secondary);
224
223
  font-size: 12px;
225
224
  }
226
225
  }
@@ -228,8 +227,8 @@ const createCustomTheme = (theme) => {
228
227
  }
229
228
  `;
230
229
  const code = css `
231
- background-color: ${palette.background.paper};
232
- color: ${palette.text.primary};
230
+ background-color: var(--mui-palette-background-paper);
231
+ color: var(--mui-palette-text-primary);
233
232
  font-family: Menlo, Consolas, Monaco, monospace;
234
233
  display: block;
235
234
  // padding: 16px;
@@ -244,7 +243,7 @@ const createCustomTheme = (theme) => {
244
243
  overflow-x: auto;
245
244
  position: relative;
246
245
  border-radius: ${theme.shape.borderRadius}px;
247
- border: 1px solid ${palette.divider};
246
+ border: 1px solid var(--mui-palette-divider);
248
247
 
249
248
  &:before {
250
249
  content: attr(data-gutter);
@@ -294,7 +293,7 @@ const createCustomTheme = (theme) => {
294
293
  olDepth: [ol1, ol2, ol3, ol4, ol5],
295
294
  ul,
296
295
  },
297
- codeHighlight: palette.mode === 'dark' ? codeHighlightDark : codeHighlightLight,
296
+ codeHighlight,
298
297
  embedBlock: {
299
298
  base: embedBlock,
300
299
  focus: embedBlockFocus,
@@ -0,0 +1,5 @@
1
+ import '../index.css';
2
+ import { type JSX } from 'react';
3
+ import { EditorViewerProps } from './types';
4
+ export declare function BlockletEditorViewer({ editorState, markdown, ...props }: EditorViewerProps): JSX.Element;
5
+ export type { EditorViewerProps };
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import '../index.css';
3
+ import { cx } from '@emotion/css';
4
+ import { LexicalComposer } from '@lexical/react/LexicalComposer';
5
+ import { $convertFromMarkdownString } from '@lexical/markdown';
6
+ import { useTheme } from '@mui/material';
7
+ import PlaygroundNodes from '../nodes/PlaygroundNodes';
8
+ import { useCustomTheme } from '../themes/customTheme';
9
+ import { PLAYGROUND_TRANSFORMERS } from '../plugins/MarkdownTransformers';
10
+ import { EditorViewer } from './viewer';
11
+ import { EditorRoot } from '../editor-root';
12
+ export function BlockletEditorViewer({ editorState, markdown, ...props }) {
13
+ const muiTheme = useTheme();
14
+ const theme = useCustomTheme();
15
+ const initialConfig = {
16
+ namespace: 'Playground',
17
+ editorState: markdown && editorState ? () => $convertFromMarkdownString(editorState, PLAYGROUND_TRANSFORMERS) : editorState,
18
+ nodes: PlaygroundNodes,
19
+ editable: false,
20
+ onError: (error) => {
21
+ throw error;
22
+ },
23
+ theme,
24
+ };
25
+ return (_jsx(LexicalComposer, { initialConfig: initialConfig, children: _jsx(EditorRoot, { className: cx(props.className, 'be-shell'), "data-mode": muiTheme.palette.mode, children: _jsx(EditorViewer, { ...props }) }) }, muiTheme.palette.mode));
26
+ }
@@ -0,0 +1,14 @@
1
+ import { EditorState, LexicalEditor } from 'lexical';
2
+ import { MutableRefObject, ReactNode } from 'react';
3
+ export interface EditorViewerProps {
4
+ editorState?: string;
5
+ markdown?: boolean;
6
+ children?: ReactNode;
7
+ prepend?: ReactNode;
8
+ onChange?: (editorState: EditorState, editor: LexicalEditor) => void;
9
+ editorRef?: React.RefCallback<LexicalEditor> | MutableRefObject<LexicalEditor | null>;
10
+ onReady?: () => void;
11
+ enableHeadingsIdPlugin?: boolean;
12
+ onCheckboxChange?: (content: string) => Promise<any>;
13
+ className?: string;
14
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { type JSX } from 'react';
2
+ import { EditorViewerProps } from './types';
3
+ export declare function EditorViewer({ children, prepend, onChange, editorRef, onReady, enableHeadingsIdPlugin, onCheckboxChange, }: EditorViewerProps): JSX.Element;
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cx } from '@emotion/css';
3
+ import { CheckListPlugin } from '@lexical/react/LexicalCheckListPlugin';
4
+ import { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary';
5
+ import { LinkPlugin } from '@lexical/react/LexicalLinkPlugin';
6
+ import { ListPlugin } from '@lexical/react/LexicalListPlugin';
7
+ import { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin';
8
+ import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin';
9
+ import useHasNodes from '../hooks/useHasNodes';
10
+ import ClickableLinkPlugin from '../plugins/ClickableLinkPlugin';
11
+ import CodeHighlightPlugin from '../plugins/CodeHighlightPlugin';
12
+ import CollapsiblePlugin from '../plugins/CollapsiblePlugin';
13
+ import ListMaxIndentLevelPlugin from '../plugins/ListMaxIndentLevelPlugin';
14
+ import MarkdownShortcutPlugin from '../plugins/MarkdownShortcutPlugin';
15
+ import TabFocusPlugin from '../plugins/TabFocusPlugin';
16
+ import ContentEditable from '../ui/ContentEditable';
17
+ import { EditorRefPlugin } from '../../ext/LexicalEditorRefPlugin';
18
+ import { HeadingsIdPlugin } from '../../ext/HeadingsIdPlugin';
19
+ import { EditorReadyPlugin } from '../../ext/EditorReadyPlugin';
20
+ import { BlurTextPlugin } from '../../ext/BlurTextPlugin';
21
+ import { useResponsiveTable } from '../hooks/useResponsiveTable';
22
+ import { EditorHolderPlugin } from '../../ext/EditorHolderPlugin';
23
+ import { StyledEditorContent } from '../styled-editor-content';
24
+ import { CodeCopyPlugin } from '../../ext/CodeCopyPlugin';
25
+ import CheckboxPlugin from '../../ext/CheckboxPlugin';
26
+ export function EditorViewer({ children, prepend, onChange, editorRef, onReady, enableHeadingsIdPlugin, onCheckboxChange, }) {
27
+ useResponsiveTable();
28
+ const hasNodes = useHasNodes();
29
+ return (_jsxs(_Fragment, { children: [prepend, _jsx(StyledEditorContent, { className: "be-content", children: _jsx(RichTextPlugin, { contentEditable: _jsx(ContentEditable, { className: cx('be-editable', 'notranslate') }), ErrorBoundary: LexicalErrorBoundary }) }), _jsx(MarkdownShortcutPlugin, {}), hasNodes('code', 'code-highlight') && _jsx(CodeHighlightPlugin, {}), hasNodes('code') && _jsx(CodeCopyPlugin, {}), hasNodes('list', 'listitem') && _jsx(ListPlugin, {}), hasNodes('list', 'listitem') && _jsx(CheckListPlugin, {}), hasNodes('list', 'listitem') && _jsx(ListMaxIndentLevelPlugin, { maxDepth: 7 }), hasNodes('link') && _jsx(LinkPlugin, {}), _jsx(BlurTextPlugin, {}), hasNodes('link') && _jsx(ClickableLinkPlugin, {}), _jsx(TabFocusPlugin, {}), hasNodes('collapsible-container', 'collapsible-content', 'collapsible-title') && _jsx(CollapsiblePlugin, {}), onChange && _jsx(OnChangePlugin, { onChange: onChange }), enableHeadingsIdPlugin && _jsx(HeadingsIdPlugin, {}), _jsx(EditorHolderPlugin, {}), editorRef && _jsx(EditorRefPlugin, { editorRef: editorRef }), onReady && _jsx(EditorReadyPlugin, { onReady: onReady }), _jsx(CheckboxPlugin, { send: onCheckboxChange }), children] }));
30
+ }
package/lib/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { Completions, FetchTemplateTags, FetchTemplates } from './ext/Aide/types';
1
+ import type { Completions, FetchTemplateTags, FetchTemplates } from './ext/Aide/types';
2
+ export type { EditorState } from 'lexical';
2
3
  export * from './ext/Aide/types';
3
4
  export interface User {
4
5
  did: string;
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@blocklet/editor",
3
- "version": "2.4.89",
3
+ "version": "2.4.91",
4
4
  "main": "lib/index.js",
5
+ "sideEffects": false,
5
6
  "publishConfig": {
6
7
  "access": "public"
7
8
  },
@@ -64,6 +65,7 @@
64
65
  "mermaid": "^11.6.0",
65
66
  "path-parser": "^6.1.0",
66
67
  "react-error-boundary": "^3.1.4",
68
+ "react-lazy-with-preload": "^2.2.1",
67
69
  "react-player": "^2.16.0",
68
70
  "react-popper": "^2.3.0",
69
71
  "shiki": "1.14.1",
@@ -71,7 +73,7 @@
71
73
  "ufo": "^1.5.4",
72
74
  "url-join": "^4.0.1",
73
75
  "zustand": "^4.5.5",
74
- "@blocklet/pdf": "2.4.89"
76
+ "@blocklet/pdf": "2.4.91"
75
77
  },
76
78
  "devDependencies": {
77
79
  "@babel/core": "^7.25.2",
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- import { type JSX } from 'react';
9
- export default function Settings(): JSX.Element;
@@ -1,39 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- // eslint-disable-next-line unicorn/filename-case
3
- /**
4
- * Copyright (c) Meta Platforms, Inc. and affiliates.
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE file in the root directory of this source tree.
8
- *
9
- */
10
- import { useMemo, useState } from 'react';
11
- import { isDevPlayground } from './appSettings';
12
- import { useSettings } from './context/SettingsContext';
13
- import Switch from './ui/Switch';
14
- export default function Settings() {
15
- const windowLocation = window.location;
16
- const { setOption, settings: { measureTypingPerf, isRichText, isMaxLength, isCharLimit, isCharLimitUtf8, isAutocomplete, disableBeforeInput, showTableOfContents, }, } = useSettings();
17
- const [showSettings, setShowSettings] = useState(false);
18
- const [isSplitScreen, search] = useMemo(() => {
19
- const parentWindow = window.parent;
20
- const _search = windowLocation.search;
21
- const _isSplitScreen = parentWindow && parentWindow.location.pathname === '/split/';
22
- return [_isSplitScreen, _search];
23
- }, [windowLocation]);
24
- return (_jsxs(_Fragment, { children: [_jsx("span", { id: "options-button", className: `editor-dev-button ${showSettings ? 'active' : ''}`, onClick: () => setShowSettings(!showSettings) }), showSettings ? (_jsxs("div", { className: "switches", children: [isDevPlayground && (_jsx(Switch, { onClick: () => {
25
- if (isSplitScreen) {
26
- window.parent.location.href = `/${search}`;
27
- }
28
- else {
29
- window.location.href = `/split/${search}`;
30
- }
31
- }, checked: isSplitScreen, text: "Split Screen" })), _jsx(Switch, { onClick: () => setOption('measureTypingPerf', !measureTypingPerf), checked: measureTypingPerf, text: "Measure Perf" }), _jsx(Switch, { onClick: () => {
32
- setOption('isRichText', !isRichText);
33
- }, checked: isRichText, text: "Rich Text" }), _jsx(Switch, { onClick: () => setOption('isCharLimit', !isCharLimit), checked: isCharLimit, text: "Char Limit" }), _jsx(Switch, { onClick: () => setOption('isCharLimitUtf8', !isCharLimitUtf8), checked: isCharLimitUtf8, text: "Char Limit (UTF-8)" }), _jsx(Switch, { onClick: () => setOption('isMaxLength', !isMaxLength), checked: isMaxLength, text: "Max Length" }), _jsx(Switch, { onClick: () => setOption('isAutocomplete', !isAutocomplete), checked: isAutocomplete, text: "Autocomplete" }), _jsx(Switch, { onClick: () => {
34
- setOption('disableBeforeInput', !disableBeforeInput);
35
- setTimeout(() => window.location.reload(), 500);
36
- }, checked: disableBeforeInput, text: "Legacy Events" }), _jsx(Switch, { onClick: () => {
37
- setOption('showTableOfContents', !showTableOfContents);
38
- }, checked: showTableOfContents, text: "Table Of Contents" })] })) : null] }));
39
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- import { type JSX } from 'react';
9
- export default function KeywordsPlugin(): JSX.Element | null;
@@ -1,38 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
9
- import { useLexicalTextEntity } from '@lexical/react/useLexicalTextEntity';
10
- import { useCallback, useEffect } from 'react';
11
- import { $createKeywordNode, KeywordNode } from '../../nodes/KeywordNode';
12
- const KEYWORDS_REGEX = /(^|$|[^A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ])(congrats|congratulations|gratuluju|gratuluji|gratulujeme|blahopřeju|blahopřeji|blahopřejeme|Til lykke|Tillykke|Glückwunsch|Gratuliere|felicitaciones|enhorabuena|paljon onnea|onnittelut|Félicitations|gratula|gratulálok|gratulálunk|congratulazioni|complimenti|おめでとう|おめでとうございます|축하해|축하해요|gratulerer|Gefeliciteerd|gratulacje|Parabéns|parabéns|felicitações|felicitări|мои поздравления|поздравляем|поздравляю|gratulujem|blahoželám|ยินดีด้วย|ขอแสดงความยินดี|tebrikler|tebrik ederim|恭喜|祝贺你|恭喜你|恭喜|恭喜|baie geluk|veels geluk|অভিনন্দন|Čestitam|Čestitke|Čestitamo|Συγχαρητήρια|Μπράβο|અભિનંદન|badhai|बधाई|अभिनंदन|Честитам|Свака част|hongera|வாழ்த்துகள்|வாழ்த்துக்கள்|అభినందనలు|അഭിനന്ദനങ്ങൾ|Chúc mừng|מזל טוב|mazel tov|mazal tov)(^|$|[^A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ])/i;
13
- export default function KeywordsPlugin() {
14
- const [editor] = useLexicalComposerContext();
15
- useEffect(() => {
16
- if (!editor.hasNodes([KeywordNode])) {
17
- throw new Error('KeywordsPlugin: KeywordNode not registered on editor');
18
- }
19
- }, [editor]);
20
- const createKeywordNode = useCallback((textNode) => {
21
- return $createKeywordNode(textNode.getTextContent());
22
- }, []);
23
- const getKeywordMatch = useCallback((text) => {
24
- const matchArr = KEYWORDS_REGEX.exec(text);
25
- if (matchArr === null) {
26
- return null;
27
- }
28
- const hashtagLength = matchArr[2].length;
29
- const startOffset = matchArr.index + matchArr[1].length;
30
- const endOffset = startOffset + hashtagLength;
31
- return {
32
- end: endOffset,
33
- start: startOffset,
34
- };
35
- }, []);
36
- useLexicalTextEntity(getKeywordMatch, KeywordNode, createKeywordNode);
37
- return null;
38
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- import { type JSX } from 'react';
9
- export default function PasteLogPlugin(): JSX.Element;
@@ -1,34 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- /**
3
- * Copyright (c) Meta Platforms, Inc. and affiliates.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- *
8
- */
9
- import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
10
- import { COMMAND_PRIORITY_NORMAL, PASTE_COMMAND } from 'lexical';
11
- import { useEffect, useState } from 'react';
12
- export default function PasteLogPlugin() {
13
- const [editor] = useLexicalComposerContext();
14
- const [isActive, setIsActive] = useState(false);
15
- const [lastClipboardData, setLastClipboardData] = useState(null);
16
- useEffect(() => {
17
- if (isActive) {
18
- return editor.registerCommand(PASTE_COMMAND, (e) => {
19
- const { clipboardData } = e;
20
- const allData = [];
21
- if (clipboardData && clipboardData.types) {
22
- clipboardData.types.forEach((type) => {
23
- allData.push(type.toUpperCase(), clipboardData.getData(type));
24
- });
25
- }
26
- setLastClipboardData(allData.join('\n\n'));
27
- return false;
28
- }, COMMAND_PRIORITY_NORMAL);
29
- }
30
- }, [editor, isActive]);
31
- return (_jsxs(_Fragment, { children: [_jsx("button", { id: "paste-log-button", className: `editor-dev-button ${isActive ? 'active' : ''}`, onClick: () => {
32
- setIsActive(!isActive);
33
- }, title: isActive ? 'Disable paste log' : 'Enable paste log' }), isActive && lastClipboardData !== null ? _jsx("pre", { children: lastClipboardData }) : null] }));
34
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- import { type JSX } from 'react';
9
- export declare function isSelectAll(event: KeyboardEvent): boolean;
10
- export default function TestRecorderPlugin(): JSX.Element;