@limetech/lime-elements 37.18.0 → 37.19.0
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/CHANGELOG.md +8 -0
- package/dist/cjs/limel-text-editor.cjs.entry.js +88 -4
- package/dist/cjs/limel-text-editor.cjs.entry.js.map +1 -1
- package/dist/collection/components/text-editor/menu/{default-menu.js → full-menu.js} +4 -4
- package/dist/collection/components/text-editor/menu/full-menu.js.map +1 -0
- package/dist/collection/components/text-editor/menu/menu-filter.js +83 -0
- package/dist/collection/components/text-editor/menu/menu-filter.js.map +1 -0
- package/dist/collection/components/text-editor/menu/types.js +2 -0
- package/dist/collection/components/text-editor/menu/types.js.map +1 -0
- package/dist/collection/components/text-editor/text-editor.js +5 -2
- package/dist/collection/components/text-editor/text-editor.js.map +1 -1
- package/dist/esm/limel-text-editor.entry.js +88 -4
- package/dist/esm/limel-text-editor.entry.js.map +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-7968bfa0.entry.js → p-10edf8b8.entry.js} +2 -2
- package/dist/lime-elements/p-10edf8b8.entry.js.map +1 -0
- package/dist/types/components/text-editor/menu/{default-menu.d.ts → full-menu.d.ts} +3 -3
- package/dist/types/components/text-editor/menu/menu-filter.d.ts +11 -0
- package/dist/types/components/text-editor/menu/types.d.ts +35 -0
- package/package.json +2 -2
- package/dist/collection/components/text-editor/menu/default-menu.js.map +0 -1
- package/dist/lime-elements/p-7968bfa0.entry.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Schema } from 'prosemirror-model';
|
|
2
2
|
import { MenuElement } from 'prosemirror-menu';
|
|
3
3
|
/**
|
|
4
|
-
* Creates the
|
|
4
|
+
* Creates the full menu for the text editor
|
|
5
5
|
* based on the default menu already in prosemirror-example-setup
|
|
6
6
|
* @param schema - the schema to use for the menu
|
|
7
7
|
*
|
|
8
8
|
* @returns the default menu for the text editor
|
|
9
9
|
*/
|
|
10
|
-
export declare const
|
|
11
|
-
//# sourceMappingURL=
|
|
10
|
+
export declare const buildFullMenu: (schema: Schema) => MenuElement[][];
|
|
11
|
+
//# sourceMappingURL=full-menu.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MenuElement } from 'prosemirror-menu';
|
|
2
|
+
import { EditorPluginButton } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Filters the full menu recursively based on the items provided
|
|
5
|
+
*
|
|
6
|
+
* @param menu - The menu to filter
|
|
7
|
+
* @param items - The menu items to display. If undefined, all items will be displayed
|
|
8
|
+
* @returns The filtered menu
|
|
9
|
+
*/
|
|
10
|
+
export declare const getFilteredMenu: (menu: MenuElement[], items: EditorPluginButton[] | undefined) => MenuElement[];
|
|
11
|
+
//# sourceMappingURL=menu-filter.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `EditorButton` type is used to specify the type of buttons that can be used in the editor toolbar.
|
|
3
|
+
* Each string represents a different button that can be added to the toolbar.
|
|
4
|
+
*
|
|
5
|
+
* The following buttons are available:
|
|
6
|
+
* 'strong' - Button for making text bold.
|
|
7
|
+
* 'emphasis' - Button for italicizing text.
|
|
8
|
+
* 'link' - Button for adding a hyperlink.
|
|
9
|
+
* 'heading 1 - Button for creating a level 1 heading.
|
|
10
|
+
* 'heading 2 - Button for creating a level 2 heading.
|
|
11
|
+
* 'heading 3 - Button for creating a level 3 heading.
|
|
12
|
+
* 'heading 4 - Button for creating a level 4 heading.
|
|
13
|
+
* 'heading 5 - Button for creating a level 5 heading.
|
|
14
|
+
* 'heading 6 - Button for creating a level 6 heading.
|
|
15
|
+
* 'block quote' - Button for creating a block quote.
|
|
16
|
+
*
|
|
17
|
+
* @beta
|
|
18
|
+
*/
|
|
19
|
+
export type EditorButton = 'strong' | 'emphasis' | 'link' | 'heading 1' | 'heading 2' | 'heading 3' | 'heading 4' | 'heading 5' | 'heading 6' | 'block quote' | 'bullet list' | 'ordered list' | EditorPluginButton;
|
|
20
|
+
/**
|
|
21
|
+
* The `EditorPluginButton` type is used to specify the type of buttons that can be added to the editor toolbar.
|
|
22
|
+
*
|
|
23
|
+
* 'code' - Button for marking inline code.
|
|
24
|
+
* 'horizontal rule' - Button for inserting a horizontal rule.
|
|
25
|
+
* 'code block' - Button for creating a block of code.
|
|
26
|
+
* 'paragraph'- Button for creating a new paragraph.
|
|
27
|
+
* 'join above' - Button for joining the current block with the one above it.
|
|
28
|
+
* 'lift out' - Button for lifting the current block out of its parent block.
|
|
29
|
+
* 'undo' - Button for undoing the last action.
|
|
30
|
+
* 'redo' - Button for redoing the last undone action.
|
|
31
|
+
*
|
|
32
|
+
* @beta
|
|
33
|
+
*/
|
|
34
|
+
export type EditorPluginButton = 'code' | 'horizontal rule' | 'code block' | 'paragraph' | 'join above' | 'lift out' | 'undo' | 'redo';
|
|
35
|
+
//# sourceMappingURL=types.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@limetech/lime-elements",
|
|
3
|
-
"version": "37.
|
|
3
|
+
"version": "37.19.0",
|
|
4
4
|
"description": "Lime Elements",
|
|
5
5
|
"author": "Lime Technologies",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@types/html-escaper": "^3.0.2",
|
|
55
55
|
"@types/jest": "^27.4.0",
|
|
56
56
|
"@types/lodash-es": "^4.17.12",
|
|
57
|
-
"@types/react": "^18.2.
|
|
57
|
+
"@types/react": "^18.2.79",
|
|
58
58
|
"@types/react-dom": "^18.2.25",
|
|
59
59
|
"@types/tabulator-tables": "^4.9.4",
|
|
60
60
|
"@typescript-eslint/eslint-plugin": "^7.5.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default-menu.js","sourceRoot":"","sources":["../../../../src/components/text-editor/menu/default-menu.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,QAAQ,EA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AC,CAAC,CAAC,CAAC;AACzC,CAAC,CAAC","sourcesContent":["import { Schema } from 'prosemirror-model';\nimport { MenuElement, Dropdown, MenuItem } from 'prosemirror-menu';\nimport { buildMenuItems } from 'prosemirror-example-setup';\n\n/**\n * Creates the default menu for the text editor\n * based on the default menu already in prosemirror-example-setup\n * @param schema - the schema to use for the menu\n *\n * @returns the default menu for the text editor\n */\nexport const buildDefaultMenu = (schema: Schema): MenuElement[][] => {\n const menuItems = buildMenuItems(schema) as unknown as {\n blockMenu: MenuElement[][];\n fullMenu: MenuElement[][];\n inlineMenu: MenuElement[][];\n insertHorizontalRule: MenuItem;\n typeMenu: Dropdown & {\n content: MenuElement[];\n };\n };\n const { inlineMenu, insertHorizontalRule } = menuItems;\n const typeMenu = getNewMenu(menuItems.typeMenu);\n const newHorizontalRule = new MenuItem({\n ...insertHorizontalRule.spec,\n label: 'hr',\n });\n const historyButtons = menuItems.fullMenu[2];\n const blockMenu = getBlockMenu(menuItems.blockMenu);\n\n return [\n inlineMenu[0],\n [newHorizontalRule],\n ...typeMenu,\n historyButtons,\n blockMenu,\n ];\n};\n\nconst getNewMenu = (\n typeMenu: Dropdown & { content: MenuElement[] },\n): MenuElement[][] => {\n const headingDropdown: Dropdown = new Dropdown(\n (typeMenu.content[2] as Partial<{ content: MenuElement[] }>).content,\n {\n label: 'H',\n },\n );\n\n return [[typeMenu.content[0], typeMenu.content[1]], [headingDropdown]];\n};\n\nconst getBlockMenu = (blockMenu: MenuElement[][]): MenuElement[] => {\n // eslint-disable-next-line no-magic-numbers\n return [...blockMenu[0].slice(0, 5)];\n};\n"]}
|