@kopexa/tiptap 17.9.2 → 17.10.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/dist/index.d.mts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +830 -272
- package/dist/index.mjs +847 -285
- package/package.json +25 -25
package/dist/index.js
CHANGED
|
@@ -55,6 +55,7 @@ __export(index_exports, {
|
|
|
55
55
|
sanitizeUrl: () => sanitizeUrl,
|
|
56
56
|
useCollaboration: () => useCollaboration,
|
|
57
57
|
useCollaborationRequired: () => useCollaborationRequired,
|
|
58
|
+
useCurrentEditor: () => import_react64.useCurrentEditor,
|
|
58
59
|
useDocumentVisibility: () => useDocumentVisibility,
|
|
59
60
|
useEditorFile: () => useEditorFile,
|
|
60
61
|
useEditorFileRequired: () => useEditorFileRequired,
|
|
@@ -63,6 +64,7 @@ __export(index_exports, {
|
|
|
63
64
|
useVariablesWithFallback: () => useVariablesWithFallback
|
|
64
65
|
});
|
|
65
66
|
module.exports = __toCommonJS(index_exports);
|
|
67
|
+
var import_react64 = require("@tiptap/react");
|
|
66
68
|
|
|
67
69
|
// src/context/collaboration-context.tsx
|
|
68
70
|
var import_provider = require("@hocuspocus/provider");
|
|
@@ -3732,6 +3734,64 @@ var Selection = import_react30.Extension.create({
|
|
|
3732
3734
|
}
|
|
3733
3735
|
});
|
|
3734
3736
|
|
|
3737
|
+
// src/extensions/tab-handler/index.ts
|
|
3738
|
+
var import_core9 = require("@tiptap/core");
|
|
3739
|
+
var TabHandler = import_core9.Extension.create({
|
|
3740
|
+
name: "tabHandler",
|
|
3741
|
+
addOptions() {
|
|
3742
|
+
return {
|
|
3743
|
+
spaces: 4
|
|
3744
|
+
};
|
|
3745
|
+
},
|
|
3746
|
+
addKeyboardShortcuts() {
|
|
3747
|
+
return {
|
|
3748
|
+
Tab: ({ editor }) => {
|
|
3749
|
+
if (editor.isActive("listItem") || editor.isActive("taskItem")) {
|
|
3750
|
+
if (editor.can().sinkListItem("listItem")) {
|
|
3751
|
+
return editor.commands.sinkListItem("listItem");
|
|
3752
|
+
}
|
|
3753
|
+
if (editor.can().sinkListItem("taskItem")) {
|
|
3754
|
+
return editor.commands.sinkListItem("taskItem");
|
|
3755
|
+
}
|
|
3756
|
+
}
|
|
3757
|
+
const spaces = " ".repeat(this.options.spaces);
|
|
3758
|
+
return editor.commands.insertContent(spaces);
|
|
3759
|
+
},
|
|
3760
|
+
"Shift-Tab": ({ editor }) => {
|
|
3761
|
+
if (editor.isActive("listItem") || editor.isActive("taskItem")) {
|
|
3762
|
+
if (editor.can().liftListItem("listItem")) {
|
|
3763
|
+
return editor.commands.liftListItem("listItem");
|
|
3764
|
+
}
|
|
3765
|
+
if (editor.can().liftListItem("taskItem")) {
|
|
3766
|
+
return editor.commands.liftListItem("taskItem");
|
|
3767
|
+
}
|
|
3768
|
+
}
|
|
3769
|
+
const { state } = editor;
|
|
3770
|
+
const { $from, from } = state.selection;
|
|
3771
|
+
const spacesToCheck = this.options.spaces;
|
|
3772
|
+
const parent = $from.parent;
|
|
3773
|
+
const offsetInParent = $from.parentOffset;
|
|
3774
|
+
if (offsetInParent === 0 || !parent.isTextblock) {
|
|
3775
|
+
return true;
|
|
3776
|
+
}
|
|
3777
|
+
const textBeforeCursor = parent.textContent.slice(0, offsetInParent);
|
|
3778
|
+
const trailingSpaces = textBeforeCursor.match(/[ ]+$/);
|
|
3779
|
+
if (trailingSpaces) {
|
|
3780
|
+
const spacesToRemove = Math.min(
|
|
3781
|
+
trailingSpaces[0].length,
|
|
3782
|
+
spacesToCheck
|
|
3783
|
+
);
|
|
3784
|
+
return editor.commands.deleteRange({
|
|
3785
|
+
from: from - spacesToRemove,
|
|
3786
|
+
to: from
|
|
3787
|
+
});
|
|
3788
|
+
}
|
|
3789
|
+
return true;
|
|
3790
|
+
}
|
|
3791
|
+
};
|
|
3792
|
+
}
|
|
3793
|
+
});
|
|
3794
|
+
|
|
3735
3795
|
// src/extensions/trailing-node/index.ts
|
|
3736
3796
|
var import_state5 = require("@tiptap/pm/state");
|
|
3737
3797
|
var import_react31 = require("@tiptap/react");
|
|
@@ -3791,7 +3851,7 @@ var TrailingNode = import_react31.Extension.create({
|
|
|
3791
3851
|
});
|
|
3792
3852
|
|
|
3793
3853
|
// src/extensions/ui-state/index.ts
|
|
3794
|
-
var
|
|
3854
|
+
var import_core10 = require("@tiptap/core");
|
|
3795
3855
|
var defaultUiState = {
|
|
3796
3856
|
aiGenerationIsSelection: false,
|
|
3797
3857
|
aiGenerationIsLoading: false,
|
|
@@ -3801,7 +3861,7 @@ var defaultUiState = {
|
|
|
3801
3861
|
lockDragHandle: false,
|
|
3802
3862
|
isDragging: false
|
|
3803
3863
|
};
|
|
3804
|
-
var UiState =
|
|
3864
|
+
var UiState = import_core10.Extension.create({
|
|
3805
3865
|
name: "uiState",
|
|
3806
3866
|
addStorage() {
|
|
3807
3867
|
return {
|
|
@@ -4027,10 +4087,15 @@ var useCreateEditor = ({
|
|
|
4027
4087
|
const fileHandler = fileHandlerProp != null ? fileHandlerProp : fileHandlerFromContext;
|
|
4028
4088
|
const collaboration = useCollaboration();
|
|
4029
4089
|
const [collabSyncing, setCollabSyncing] = (0, import_react33.useState)(!!collaboration);
|
|
4090
|
+
const placeholderRef = (0, import_react33.useRef)(placeholder);
|
|
4091
|
+
placeholderRef.current = placeholder;
|
|
4030
4092
|
const [extensions] = (0, import_react33.useState)(
|
|
4031
4093
|
() => getExtensions({
|
|
4032
4094
|
editable,
|
|
4033
|
-
placeholder
|
|
4095
|
+
placeholder: () => {
|
|
4096
|
+
const current = placeholderRef.current;
|
|
4097
|
+
return typeof current === "function" ? current() : current;
|
|
4098
|
+
},
|
|
4034
4099
|
enableControls,
|
|
4035
4100
|
controlResolver,
|
|
4036
4101
|
fileHandler,
|
|
@@ -4154,6 +4219,7 @@ function getExtensions({
|
|
|
4154
4219
|
}),
|
|
4155
4220
|
UiState,
|
|
4156
4221
|
import_extension_table.TableKit,
|
|
4222
|
+
TabHandler,
|
|
4157
4223
|
NodeAlignment,
|
|
4158
4224
|
NodeBackground,
|
|
4159
4225
|
TocNode,
|
|
@@ -4308,6 +4374,7 @@ var import_extension_table2 = require("@kopexa/extension-table");
|
|
|
4308
4374
|
var import_theme9 = require("@kopexa/theme");
|
|
4309
4375
|
var import_react60 = require("@tiptap/react");
|
|
4310
4376
|
var import_react61 = require("react");
|
|
4377
|
+
var import_react_intl26 = require("react-intl");
|
|
4311
4378
|
|
|
4312
4379
|
// src/context/editor-context.ts
|
|
4313
4380
|
var import_react_utils = require("@kopexa/react-utils");
|
|
@@ -4808,6 +4875,425 @@ var import_icons10 = require("@kopexa/icons");
|
|
|
4808
4875
|
var import_toolbar2 = require("@kopexa/toolbar");
|
|
4809
4876
|
var import_react36 = require("@tiptap/react");
|
|
4810
4877
|
var import_react37 = require("react");
|
|
4878
|
+
var import_react_intl16 = require("react-intl");
|
|
4879
|
+
|
|
4880
|
+
// src/ui/messages.ts
|
|
4881
|
+
var import_react_intl15 = require("react-intl");
|
|
4882
|
+
var messages7 = (0, import_react_intl15.defineMessages)({
|
|
4883
|
+
// Turn Into Dropdown - Block Types
|
|
4884
|
+
block_text: {
|
|
4885
|
+
id: "editor.toolbar.block.text",
|
|
4886
|
+
defaultMessage: "Text",
|
|
4887
|
+
description: "Regular text paragraph block type"
|
|
4888
|
+
},
|
|
4889
|
+
block_heading_1: {
|
|
4890
|
+
id: "editor.toolbar.block.heading_1",
|
|
4891
|
+
defaultMessage: "Heading 1",
|
|
4892
|
+
description: "Heading level 1 block type"
|
|
4893
|
+
},
|
|
4894
|
+
block_heading_2: {
|
|
4895
|
+
id: "editor.toolbar.block.heading_2",
|
|
4896
|
+
defaultMessage: "Heading 2",
|
|
4897
|
+
description: "Heading level 2 block type"
|
|
4898
|
+
},
|
|
4899
|
+
block_heading_3: {
|
|
4900
|
+
id: "editor.toolbar.block.heading_3",
|
|
4901
|
+
defaultMessage: "Heading 3",
|
|
4902
|
+
description: "Heading level 3 block type"
|
|
4903
|
+
},
|
|
4904
|
+
block_heading_4: {
|
|
4905
|
+
id: "editor.toolbar.block.heading_4",
|
|
4906
|
+
defaultMessage: "Heading 4",
|
|
4907
|
+
description: "Heading level 4 block type"
|
|
4908
|
+
},
|
|
4909
|
+
block_bullet_list: {
|
|
4910
|
+
id: "editor.toolbar.block.bullet_list",
|
|
4911
|
+
defaultMessage: "Bulleted list",
|
|
4912
|
+
description: "Bulleted/unordered list block type"
|
|
4913
|
+
},
|
|
4914
|
+
block_ordered_list: {
|
|
4915
|
+
id: "editor.toolbar.block.ordered_list",
|
|
4916
|
+
defaultMessage: "Numbered list",
|
|
4917
|
+
description: "Numbered/ordered list block type"
|
|
4918
|
+
},
|
|
4919
|
+
block_task_list: {
|
|
4920
|
+
id: "editor.toolbar.block.task_list",
|
|
4921
|
+
defaultMessage: "To-do list",
|
|
4922
|
+
description: "Task/to-do list block type"
|
|
4923
|
+
},
|
|
4924
|
+
block_blockquote: {
|
|
4925
|
+
id: "editor.toolbar.block.blockquote",
|
|
4926
|
+
defaultMessage: "Blockquote",
|
|
4927
|
+
description: "Blockquote block type"
|
|
4928
|
+
},
|
|
4929
|
+
block_code_block: {
|
|
4930
|
+
id: "editor.toolbar.block.code_block",
|
|
4931
|
+
defaultMessage: "Code block",
|
|
4932
|
+
description: "Code block type"
|
|
4933
|
+
},
|
|
4934
|
+
// Turn Into Dropdown
|
|
4935
|
+
turn_into: {
|
|
4936
|
+
id: "editor.toolbar.turn_into",
|
|
4937
|
+
defaultMessage: "Turn into",
|
|
4938
|
+
description: "Turn into dropdown tooltip"
|
|
4939
|
+
},
|
|
4940
|
+
turn_into_current: {
|
|
4941
|
+
id: "editor.toolbar.turn_into_current",
|
|
4942
|
+
defaultMessage: "Turn into (current: {current})",
|
|
4943
|
+
description: "Turn into dropdown aria-label with current block type"
|
|
4944
|
+
},
|
|
4945
|
+
// Formatting
|
|
4946
|
+
reset_formatting: {
|
|
4947
|
+
id: "editor.toolbar.reset_formatting",
|
|
4948
|
+
defaultMessage: "Reset formatting",
|
|
4949
|
+
description: "Reset all formatting button tooltip"
|
|
4950
|
+
},
|
|
4951
|
+
bold: {
|
|
4952
|
+
id: "editor.toolbar.bold",
|
|
4953
|
+
defaultMessage: "Bold",
|
|
4954
|
+
description: "Bold formatting button"
|
|
4955
|
+
},
|
|
4956
|
+
italic: {
|
|
4957
|
+
id: "editor.toolbar.italic",
|
|
4958
|
+
defaultMessage: "Italic",
|
|
4959
|
+
description: "Italic formatting button"
|
|
4960
|
+
},
|
|
4961
|
+
underline: {
|
|
4962
|
+
id: "editor.toolbar.underline",
|
|
4963
|
+
defaultMessage: "Underline",
|
|
4964
|
+
description: "Underline formatting button"
|
|
4965
|
+
},
|
|
4966
|
+
strikethrough: {
|
|
4967
|
+
id: "editor.toolbar.strikethrough",
|
|
4968
|
+
defaultMessage: "Strikethrough",
|
|
4969
|
+
description: "Strikethrough formatting button"
|
|
4970
|
+
},
|
|
4971
|
+
code: {
|
|
4972
|
+
id: "editor.toolbar.code",
|
|
4973
|
+
defaultMessage: "Code",
|
|
4974
|
+
description: "Inline code formatting button"
|
|
4975
|
+
},
|
|
4976
|
+
superscript: {
|
|
4977
|
+
id: "editor.toolbar.superscript",
|
|
4978
|
+
defaultMessage: "Superscript",
|
|
4979
|
+
description: "Superscript formatting button"
|
|
4980
|
+
},
|
|
4981
|
+
subscript: {
|
|
4982
|
+
id: "editor.toolbar.subscript",
|
|
4983
|
+
defaultMessage: "Subscript",
|
|
4984
|
+
description: "Subscript formatting button"
|
|
4985
|
+
},
|
|
4986
|
+
// Link Bubble
|
|
4987
|
+
link_save: {
|
|
4988
|
+
id: "editor.toolbar.link.save",
|
|
4989
|
+
defaultMessage: "Save link",
|
|
4990
|
+
description: "Save link button"
|
|
4991
|
+
},
|
|
4992
|
+
link_open: {
|
|
4993
|
+
id: "editor.toolbar.link.open",
|
|
4994
|
+
defaultMessage: "Open link in new tab",
|
|
4995
|
+
description: "Open link in new tab button"
|
|
4996
|
+
},
|
|
4997
|
+
link_edit: {
|
|
4998
|
+
id: "editor.toolbar.link.edit",
|
|
4999
|
+
defaultMessage: "Edit link",
|
|
5000
|
+
description: "Edit link button"
|
|
5001
|
+
},
|
|
5002
|
+
link_remove: {
|
|
5003
|
+
id: "editor.toolbar.link.remove",
|
|
5004
|
+
defaultMessage: "Remove link",
|
|
5005
|
+
description: "Remove link button"
|
|
5006
|
+
},
|
|
5007
|
+
link_placeholder: {
|
|
5008
|
+
id: "editor.toolbar.link.placeholder",
|
|
5009
|
+
defaultMessage: "Enter URL...",
|
|
5010
|
+
description: "Link input placeholder"
|
|
5011
|
+
},
|
|
5012
|
+
// Undo/Redo
|
|
5013
|
+
undo: {
|
|
5014
|
+
id: "editor.toolbar.undo",
|
|
5015
|
+
defaultMessage: "Undo",
|
|
5016
|
+
description: "Undo button"
|
|
5017
|
+
},
|
|
5018
|
+
redo: {
|
|
5019
|
+
id: "editor.toolbar.redo",
|
|
5020
|
+
defaultMessage: "Redo",
|
|
5021
|
+
description: "Redo button"
|
|
5022
|
+
},
|
|
5023
|
+
// Slash Menu - Groups
|
|
5024
|
+
group_ai: {
|
|
5025
|
+
id: "editor.slash.group.ai",
|
|
5026
|
+
defaultMessage: "AI",
|
|
5027
|
+
description: "AI commands group"
|
|
5028
|
+
},
|
|
5029
|
+
group_style: {
|
|
5030
|
+
id: "editor.slash.group.style",
|
|
5031
|
+
defaultMessage: "Style",
|
|
5032
|
+
description: "Style/formatting commands group"
|
|
5033
|
+
},
|
|
5034
|
+
group_insert: {
|
|
5035
|
+
id: "editor.slash.group.insert",
|
|
5036
|
+
defaultMessage: "Insert",
|
|
5037
|
+
description: "Insert elements commands group"
|
|
5038
|
+
},
|
|
5039
|
+
group_upload: {
|
|
5040
|
+
id: "editor.slash.group.upload",
|
|
5041
|
+
defaultMessage: "Upload",
|
|
5042
|
+
description: "Upload commands group"
|
|
5043
|
+
},
|
|
5044
|
+
// Slash Menu - AI
|
|
5045
|
+
slash_continue_writing: {
|
|
5046
|
+
id: "editor.slash.continue_writing",
|
|
5047
|
+
defaultMessage: "Continue Writing",
|
|
5048
|
+
description: "Continue writing with AI command"
|
|
5049
|
+
},
|
|
5050
|
+
slash_continue_writing_subtext: {
|
|
5051
|
+
id: "editor.slash.continue_writing.subtext",
|
|
5052
|
+
defaultMessage: "Continue writing from the current position",
|
|
5053
|
+
description: "Continue writing command description"
|
|
5054
|
+
},
|
|
5055
|
+
slash_ask_ai: {
|
|
5056
|
+
id: "editor.slash.ask_ai",
|
|
5057
|
+
defaultMessage: "Ask AI",
|
|
5058
|
+
description: "Ask AI command"
|
|
5059
|
+
},
|
|
5060
|
+
slash_ask_ai_subtext: {
|
|
5061
|
+
id: "editor.slash.ask_ai.subtext",
|
|
5062
|
+
defaultMessage: "Ask AI to generate content",
|
|
5063
|
+
description: "Ask AI command description"
|
|
5064
|
+
},
|
|
5065
|
+
// Slash Menu - Style
|
|
5066
|
+
slash_text: {
|
|
5067
|
+
id: "editor.slash.text",
|
|
5068
|
+
defaultMessage: "Text",
|
|
5069
|
+
description: "Text paragraph command"
|
|
5070
|
+
},
|
|
5071
|
+
slash_text_subtext: {
|
|
5072
|
+
id: "editor.slash.text.subtext",
|
|
5073
|
+
defaultMessage: "Regular text paragraph",
|
|
5074
|
+
description: "Text command description"
|
|
5075
|
+
},
|
|
5076
|
+
slash_heading_1: {
|
|
5077
|
+
id: "editor.slash.heading_1",
|
|
5078
|
+
defaultMessage: "Heading 1",
|
|
5079
|
+
description: "Heading 1 command"
|
|
5080
|
+
},
|
|
5081
|
+
slash_heading_1_subtext: {
|
|
5082
|
+
id: "editor.slash.heading_1.subtext",
|
|
5083
|
+
defaultMessage: "Top-level heading",
|
|
5084
|
+
description: "Heading 1 command description"
|
|
5085
|
+
},
|
|
5086
|
+
slash_heading_2: {
|
|
5087
|
+
id: "editor.slash.heading_2",
|
|
5088
|
+
defaultMessage: "Heading 2",
|
|
5089
|
+
description: "Heading 2 command"
|
|
5090
|
+
},
|
|
5091
|
+
slash_heading_2_subtext: {
|
|
5092
|
+
id: "editor.slash.heading_2.subtext",
|
|
5093
|
+
defaultMessage: "Key section heading",
|
|
5094
|
+
description: "Heading 2 command description"
|
|
5095
|
+
},
|
|
5096
|
+
slash_heading_3: {
|
|
5097
|
+
id: "editor.slash.heading_3",
|
|
5098
|
+
defaultMessage: "Heading 3",
|
|
5099
|
+
description: "Heading 3 command"
|
|
5100
|
+
},
|
|
5101
|
+
slash_heading_3_subtext: {
|
|
5102
|
+
id: "editor.slash.heading_3.subtext",
|
|
5103
|
+
defaultMessage: "Subsection and group heading",
|
|
5104
|
+
description: "Heading 3 command description"
|
|
5105
|
+
},
|
|
5106
|
+
slash_bullet_list: {
|
|
5107
|
+
id: "editor.slash.bullet_list",
|
|
5108
|
+
defaultMessage: "Bullet List",
|
|
5109
|
+
description: "Bullet list command"
|
|
5110
|
+
},
|
|
5111
|
+
slash_bullet_list_subtext: {
|
|
5112
|
+
id: "editor.slash.bullet_list.subtext",
|
|
5113
|
+
defaultMessage: "List with unordered items",
|
|
5114
|
+
description: "Bullet list command description"
|
|
5115
|
+
},
|
|
5116
|
+
slash_ordered_list: {
|
|
5117
|
+
id: "editor.slash.ordered_list",
|
|
5118
|
+
defaultMessage: "Numbered List",
|
|
5119
|
+
description: "Numbered list command"
|
|
5120
|
+
},
|
|
5121
|
+
slash_ordered_list_subtext: {
|
|
5122
|
+
id: "editor.slash.ordered_list.subtext",
|
|
5123
|
+
defaultMessage: "List with ordered items",
|
|
5124
|
+
description: "Numbered list command description"
|
|
5125
|
+
},
|
|
5126
|
+
slash_task_list: {
|
|
5127
|
+
id: "editor.slash.task_list",
|
|
5128
|
+
defaultMessage: "To-do list",
|
|
5129
|
+
description: "To-do list command"
|
|
5130
|
+
},
|
|
5131
|
+
slash_task_list_subtext: {
|
|
5132
|
+
id: "editor.slash.task_list.subtext",
|
|
5133
|
+
defaultMessage: "List with tasks",
|
|
5134
|
+
description: "To-do list command description"
|
|
5135
|
+
},
|
|
5136
|
+
slash_blockquote: {
|
|
5137
|
+
id: "editor.slash.blockquote",
|
|
5138
|
+
defaultMessage: "Blockquote",
|
|
5139
|
+
description: "Blockquote command"
|
|
5140
|
+
},
|
|
5141
|
+
slash_blockquote_subtext: {
|
|
5142
|
+
id: "editor.slash.blockquote.subtext",
|
|
5143
|
+
defaultMessage: "Blockquote block",
|
|
5144
|
+
description: "Blockquote command description"
|
|
5145
|
+
},
|
|
5146
|
+
slash_code_block: {
|
|
5147
|
+
id: "editor.slash.code_block",
|
|
5148
|
+
defaultMessage: "Code Block",
|
|
5149
|
+
description: "Code block command"
|
|
5150
|
+
},
|
|
5151
|
+
slash_code_block_subtext: {
|
|
5152
|
+
id: "editor.slash.code_block.subtext",
|
|
5153
|
+
defaultMessage: "Code block with syntax highlighting",
|
|
5154
|
+
description: "Code block command description"
|
|
5155
|
+
},
|
|
5156
|
+
// Slash Menu - Insert
|
|
5157
|
+
slash_control: {
|
|
5158
|
+
id: "editor.slash.control",
|
|
5159
|
+
defaultMessage: "Control",
|
|
5160
|
+
description: "Control block command"
|
|
5161
|
+
},
|
|
5162
|
+
slash_control_subtext: {
|
|
5163
|
+
id: "editor.slash.control.subtext",
|
|
5164
|
+
defaultMessage: "Insert a control block",
|
|
5165
|
+
description: "Control block command description"
|
|
5166
|
+
},
|
|
5167
|
+
slash_separator: {
|
|
5168
|
+
id: "editor.slash.separator",
|
|
5169
|
+
defaultMessage: "Separator",
|
|
5170
|
+
description: "Horizontal separator command"
|
|
5171
|
+
},
|
|
5172
|
+
slash_separator_subtext: {
|
|
5173
|
+
id: "editor.slash.separator.subtext",
|
|
5174
|
+
defaultMessage: "Horizontal line to separate content",
|
|
5175
|
+
description: "Separator command description"
|
|
5176
|
+
},
|
|
5177
|
+
slash_table: {
|
|
5178
|
+
id: "editor.slash.table",
|
|
5179
|
+
defaultMessage: "Table",
|
|
5180
|
+
description: "Table command"
|
|
5181
|
+
},
|
|
5182
|
+
slash_table_subtext: {
|
|
5183
|
+
id: "editor.slash.table.subtext",
|
|
5184
|
+
defaultMessage: "Insert a table",
|
|
5185
|
+
description: "Table command description"
|
|
5186
|
+
},
|
|
5187
|
+
slash_toc: {
|
|
5188
|
+
id: "editor.slash.toc",
|
|
5189
|
+
defaultMessage: "Table of Contents",
|
|
5190
|
+
description: "Table of contents command"
|
|
5191
|
+
},
|
|
5192
|
+
slash_toc_subtext: {
|
|
5193
|
+
id: "editor.slash.toc.subtext",
|
|
5194
|
+
defaultMessage: "Auto-generated list of headings",
|
|
5195
|
+
description: "Table of contents command description"
|
|
5196
|
+
},
|
|
5197
|
+
slash_callout: {
|
|
5198
|
+
id: "editor.slash.callout",
|
|
5199
|
+
defaultMessage: "Callout",
|
|
5200
|
+
description: "Callout command"
|
|
5201
|
+
},
|
|
5202
|
+
slash_callout_subtext: {
|
|
5203
|
+
id: "editor.slash.callout.subtext",
|
|
5204
|
+
defaultMessage: "Highlighted block for important information",
|
|
5205
|
+
description: "Callout command description"
|
|
5206
|
+
},
|
|
5207
|
+
slash_warning: {
|
|
5208
|
+
id: "editor.slash.warning",
|
|
5209
|
+
defaultMessage: "Warning",
|
|
5210
|
+
description: "Warning callout command"
|
|
5211
|
+
},
|
|
5212
|
+
slash_warning_subtext: {
|
|
5213
|
+
id: "editor.slash.warning.subtext",
|
|
5214
|
+
defaultMessage: "Warning callout block",
|
|
5215
|
+
description: "Warning callout command description"
|
|
5216
|
+
},
|
|
5217
|
+
slash_formula: {
|
|
5218
|
+
id: "editor.slash.formula",
|
|
5219
|
+
defaultMessage: "Formula",
|
|
5220
|
+
description: "Math formula command"
|
|
5221
|
+
},
|
|
5222
|
+
slash_formula_subtext: {
|
|
5223
|
+
id: "editor.slash.formula.subtext",
|
|
5224
|
+
defaultMessage: "LaTeX math formula block",
|
|
5225
|
+
description: "Formula command description"
|
|
5226
|
+
},
|
|
5227
|
+
// Slash Menu - Upload
|
|
5228
|
+
slash_image: {
|
|
5229
|
+
id: "editor.slash.image",
|
|
5230
|
+
defaultMessage: "Image",
|
|
5231
|
+
description: "Image upload command"
|
|
5232
|
+
},
|
|
5233
|
+
slash_image_subtext: {
|
|
5234
|
+
id: "editor.slash.image.subtext",
|
|
5235
|
+
defaultMessage: "Resizable image with caption",
|
|
5236
|
+
description: "Image command description"
|
|
5237
|
+
},
|
|
5238
|
+
// Slash Menu - Filter
|
|
5239
|
+
slash_filter_placeholder: {
|
|
5240
|
+
id: "editor.slash.filter_placeholder",
|
|
5241
|
+
defaultMessage: "Filter...",
|
|
5242
|
+
description: "Slash menu filter placeholder"
|
|
5243
|
+
},
|
|
5244
|
+
// Table
|
|
5245
|
+
table_insert: {
|
|
5246
|
+
id: "editor.toolbar.table.insert",
|
|
5247
|
+
defaultMessage: "Insert table",
|
|
5248
|
+
description: "Insert table button"
|
|
5249
|
+
},
|
|
5250
|
+
// Color/Highlight
|
|
5251
|
+
text_color: {
|
|
5252
|
+
id: "editor.toolbar.text_color",
|
|
5253
|
+
defaultMessage: "Text color",
|
|
5254
|
+
description: "Text color button"
|
|
5255
|
+
},
|
|
5256
|
+
highlight_color: {
|
|
5257
|
+
id: "editor.toolbar.highlight_color",
|
|
5258
|
+
defaultMessage: "Highlight color",
|
|
5259
|
+
description: "Highlight color button"
|
|
5260
|
+
},
|
|
5261
|
+
// Alignment
|
|
5262
|
+
align_left: {
|
|
5263
|
+
id: "editor.toolbar.align.left",
|
|
5264
|
+
defaultMessage: "Align left",
|
|
5265
|
+
description: "Align left button"
|
|
5266
|
+
},
|
|
5267
|
+
align_center: {
|
|
5268
|
+
id: "editor.toolbar.align.center",
|
|
5269
|
+
defaultMessage: "Align center",
|
|
5270
|
+
description: "Align center button"
|
|
5271
|
+
},
|
|
5272
|
+
align_right: {
|
|
5273
|
+
id: "editor.toolbar.align.right",
|
|
5274
|
+
defaultMessage: "Align right",
|
|
5275
|
+
description: "Align right button"
|
|
5276
|
+
},
|
|
5277
|
+
align_justify: {
|
|
5278
|
+
id: "editor.toolbar.align.justify",
|
|
5279
|
+
defaultMessage: "Justify",
|
|
5280
|
+
description: "Justify text button"
|
|
5281
|
+
},
|
|
5282
|
+
// Editor placeholder
|
|
5283
|
+
editor_placeholder: {
|
|
5284
|
+
id: "editor.placeholder",
|
|
5285
|
+
defaultMessage: "Write, type '/' for commands\u2026",
|
|
5286
|
+
description: "Empty editor placeholder text"
|
|
5287
|
+
},
|
|
5288
|
+
// Toolbar misc
|
|
5289
|
+
more_options: {
|
|
5290
|
+
id: "editor.toolbar.more_options",
|
|
5291
|
+
defaultMessage: "More options",
|
|
5292
|
+
description: "More options button in toolbar"
|
|
5293
|
+
}
|
|
5294
|
+
});
|
|
5295
|
+
|
|
5296
|
+
// src/ui/mark-button/index.tsx
|
|
4811
5297
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
4812
5298
|
var markIcons = {
|
|
4813
5299
|
bold: import_icons10.BoldIcon,
|
|
@@ -4860,16 +5346,26 @@ function shouldShowMarkButton(params) {
|
|
|
4860
5346
|
}
|
|
4861
5347
|
return true;
|
|
4862
5348
|
}
|
|
4863
|
-
|
|
4864
|
-
|
|
5349
|
+
var markMessages = {
|
|
5350
|
+
bold: messages7.bold,
|
|
5351
|
+
italic: messages7.italic,
|
|
5352
|
+
underline: messages7.underline,
|
|
5353
|
+
strike: messages7.strikethrough,
|
|
5354
|
+
code: messages7.code,
|
|
5355
|
+
superscript: messages7.superscript,
|
|
5356
|
+
subscript: messages7.subscript
|
|
5357
|
+
};
|
|
5358
|
+
function getTranslatedMarkName(type, intl) {
|
|
5359
|
+
return intl.formatMessage(markMessages[type]);
|
|
4865
5360
|
}
|
|
4866
5361
|
function useMarkState(editor, type, disabled = false) {
|
|
5362
|
+
const intl = (0, import_react_intl16.useIntl)();
|
|
4867
5363
|
const markInSchema = (0, import_editor_utils7.isMarkInSchema)(type, editor);
|
|
4868
5364
|
const isDisabled = isMarkButtonDisabled(editor, type, disabled);
|
|
4869
5365
|
const isActive = isMarkActive(editor, type);
|
|
4870
5366
|
const Icon = markIcons[type];
|
|
4871
5367
|
const shortcutKey = markShortcutKeys[type];
|
|
4872
|
-
const formattedName =
|
|
5368
|
+
const formattedName = getTranslatedMarkName(type, intl);
|
|
4873
5369
|
return {
|
|
4874
5370
|
markInSchema,
|
|
4875
5371
|
isDisabled,
|
|
@@ -4930,7 +5426,7 @@ var MarkButton = ({
|
|
|
4930
5426
|
"data-active-state": isActive ? "on" : "off",
|
|
4931
5427
|
"data-disabled": isDisabled,
|
|
4932
5428
|
tabIndex: -1,
|
|
4933
|
-
"aria-label":
|
|
5429
|
+
"aria-label": formattedName,
|
|
4934
5430
|
"aria-pressed": isActive,
|
|
4935
5431
|
title: formattedName,
|
|
4936
5432
|
shortcutKeys: shortcutKey,
|
|
@@ -5091,8 +5587,10 @@ var import_icons11 = require("@kopexa/icons");
|
|
|
5091
5587
|
var import_input4 = require("@kopexa/input");
|
|
5092
5588
|
var import_menus2 = require("@tiptap/react/menus");
|
|
5093
5589
|
var import_react39 = require("react");
|
|
5590
|
+
var import_react_intl17 = require("react-intl");
|
|
5094
5591
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
5095
5592
|
function LinkBubble({ editor }) {
|
|
5593
|
+
const intl = (0, import_react_intl17.useIntl)();
|
|
5096
5594
|
const [isEditing, setIsEditing] = (0, import_react39.useState)(false);
|
|
5097
5595
|
const [url, setUrl] = (0, import_react39.useState)("");
|
|
5098
5596
|
const getCurrentUrl = (0, import_react39.useCallback)(() => {
|
|
@@ -5166,7 +5664,7 @@ function LinkBubble({ editor }) {
|
|
|
5166
5664
|
value: url,
|
|
5167
5665
|
onChange: (e) => setUrl(e.target.value),
|
|
5168
5666
|
onKeyDown: handleKeyDown,
|
|
5169
|
-
placeholder:
|
|
5667
|
+
placeholder: intl.formatMessage(messages7.link_placeholder),
|
|
5170
5668
|
className: "flex-1 h-8 text-sm",
|
|
5171
5669
|
autoFocus: true
|
|
5172
5670
|
}
|
|
@@ -5178,7 +5676,7 @@ function LinkBubble({ editor }) {
|
|
|
5178
5676
|
size: "sm",
|
|
5179
5677
|
variant: "ghost",
|
|
5180
5678
|
onClick: handleSave,
|
|
5181
|
-
"aria-label":
|
|
5679
|
+
"aria-label": intl.formatMessage(messages7.link_save),
|
|
5182
5680
|
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_icons11.EditIcon, { className: "size-4" })
|
|
5183
5681
|
}
|
|
5184
5682
|
)
|
|
@@ -5205,7 +5703,7 @@ function LinkBubble({ editor }) {
|
|
|
5205
5703
|
size: "sm",
|
|
5206
5704
|
variant: "ghost",
|
|
5207
5705
|
onClick: handleOpenLink,
|
|
5208
|
-
"aria-label":
|
|
5706
|
+
"aria-label": intl.formatMessage(messages7.link_open),
|
|
5209
5707
|
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_icons11.ExternalLinkIcon, { className: "size-4" })
|
|
5210
5708
|
}
|
|
5211
5709
|
),
|
|
@@ -5216,7 +5714,7 @@ function LinkBubble({ editor }) {
|
|
|
5216
5714
|
size: "sm",
|
|
5217
5715
|
variant: "ghost",
|
|
5218
5716
|
onClick: handleEdit,
|
|
5219
|
-
"aria-label":
|
|
5717
|
+
"aria-label": intl.formatMessage(messages7.link_edit),
|
|
5220
5718
|
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_icons11.EditIcon, { className: "size-4" })
|
|
5221
5719
|
}
|
|
5222
5720
|
),
|
|
@@ -5227,7 +5725,7 @@ function LinkBubble({ editor }) {
|
|
|
5227
5725
|
size: "sm",
|
|
5228
5726
|
variant: "ghost",
|
|
5229
5727
|
onClick: handleRemoveLink,
|
|
5230
|
-
"aria-label":
|
|
5728
|
+
"aria-label": intl.formatMessage(messages7.link_remove),
|
|
5231
5729
|
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_icons11.TrashIcon, { className: "size-4" })
|
|
5232
5730
|
}
|
|
5233
5731
|
)
|
|
@@ -5248,12 +5746,14 @@ var React11 = __toESM(require("react"));
|
|
|
5248
5746
|
var import_editor_utils10 = require("@kopexa/editor-utils");
|
|
5249
5747
|
var import_icons13 = require("@kopexa/icons");
|
|
5250
5748
|
var React10 = __toESM(require("react"));
|
|
5749
|
+
var import_react_intl19 = require("react-intl");
|
|
5251
5750
|
|
|
5252
5751
|
// src/ui/table-button/use-table.ts
|
|
5253
5752
|
var import_editor_utils9 = require("@kopexa/editor-utils");
|
|
5254
5753
|
var import_icons12 = require("@kopexa/icons");
|
|
5255
5754
|
var import_react40 = require("@tiptap/react");
|
|
5256
5755
|
var import_react41 = require("react");
|
|
5756
|
+
var import_react_intl18 = require("react-intl");
|
|
5257
5757
|
function canToggle(editor) {
|
|
5258
5758
|
if (!editor || !editor.isEditable) return false;
|
|
5259
5759
|
if (!(0, import_editor_utils9.isNodeInSchema)("table", editor) || (0, import_editor_utils9.isNodeTypeSelected)(editor, ["image"])) {
|
|
@@ -5296,6 +5796,7 @@ function useTableBlock(config) {
|
|
|
5296
5796
|
hideWhenUnavailable = false,
|
|
5297
5797
|
onToggled
|
|
5298
5798
|
} = config || {};
|
|
5799
|
+
const intl = (0, import_react_intl18.useIntl)();
|
|
5299
5800
|
const { editor } = (0, import_editor_utils9.useTiptapEditor)(providedEditor);
|
|
5300
5801
|
const [isVisible, setIsVisible] = (0, import_react41.useState)(true);
|
|
5301
5802
|
const canToggleState = canToggle(editor);
|
|
@@ -5324,174 +5825,162 @@ function useTableBlock(config) {
|
|
|
5324
5825
|
isActive,
|
|
5325
5826
|
handleToggle,
|
|
5326
5827
|
canToggle: canToggleState,
|
|
5327
|
-
label:
|
|
5828
|
+
label: intl.formatMessage(messages7.table_insert),
|
|
5328
5829
|
// shortcutKeys: CODE_BLOCK_SHORTCUT_KEY,
|
|
5329
5830
|
Icon: import_icons12.TableIcon
|
|
5330
5831
|
};
|
|
5331
5832
|
}
|
|
5332
5833
|
|
|
5333
5834
|
// src/ui/slash-dropdown-menu/use-slash-dropdown-menu.ts
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
"image",
|
|
5484
|
-
"imageUpload",
|
|
5485
|
-
"upload",
|
|
5486
|
-
"img",
|
|
5487
|
-
"picture",
|
|
5488
|
-
"media",
|
|
5489
|
-
"url"
|
|
5490
|
-
],
|
|
5491
|
-
badge: import_icons13.ImageIcon,
|
|
5492
|
-
group: "Upload"
|
|
5493
|
-
}
|
|
5494
|
-
};
|
|
5835
|
+
function createSlashMenuTexts(formatMessage) {
|
|
5836
|
+
return {
|
|
5837
|
+
// AI
|
|
5838
|
+
continue_writing: {
|
|
5839
|
+
title: formatMessage(messages7.slash_continue_writing),
|
|
5840
|
+
subtext: formatMessage(messages7.slash_continue_writing_subtext),
|
|
5841
|
+
keywords: ["continue", "write", "continue writing", "ai"],
|
|
5842
|
+
badge: import_icons13.AiSparklesIcon,
|
|
5843
|
+
group: formatMessage(messages7.group_ai)
|
|
5844
|
+
},
|
|
5845
|
+
ai_ask_button: {
|
|
5846
|
+
title: formatMessage(messages7.slash_ask_ai),
|
|
5847
|
+
subtext: formatMessage(messages7.slash_ask_ai_subtext),
|
|
5848
|
+
keywords: ["ai", "ask", "generate"],
|
|
5849
|
+
badge: import_icons13.AiSparklesIcon,
|
|
5850
|
+
group: formatMessage(messages7.group_ai)
|
|
5851
|
+
},
|
|
5852
|
+
// Style
|
|
5853
|
+
text: {
|
|
5854
|
+
title: formatMessage(messages7.slash_text),
|
|
5855
|
+
subtext: formatMessage(messages7.slash_text_subtext),
|
|
5856
|
+
keywords: ["p", "paragraph", "text"],
|
|
5857
|
+
badge: import_icons13.TypeIcon,
|
|
5858
|
+
group: formatMessage(messages7.group_style)
|
|
5859
|
+
},
|
|
5860
|
+
heading_1: {
|
|
5861
|
+
title: formatMessage(messages7.slash_heading_1),
|
|
5862
|
+
subtext: formatMessage(messages7.slash_heading_1_subtext),
|
|
5863
|
+
keywords: ["h", "heading1", "h1"],
|
|
5864
|
+
badge: import_icons13.HeadingOneIcon,
|
|
5865
|
+
group: formatMessage(messages7.group_style)
|
|
5866
|
+
},
|
|
5867
|
+
heading_2: {
|
|
5868
|
+
title: formatMessage(messages7.slash_heading_2),
|
|
5869
|
+
subtext: formatMessage(messages7.slash_heading_2_subtext),
|
|
5870
|
+
keywords: ["h2", "heading2", "subheading"],
|
|
5871
|
+
badge: import_icons13.HeadingTwoIcon,
|
|
5872
|
+
group: formatMessage(messages7.group_style)
|
|
5873
|
+
},
|
|
5874
|
+
heading_3: {
|
|
5875
|
+
title: formatMessage(messages7.slash_heading_3),
|
|
5876
|
+
subtext: formatMessage(messages7.slash_heading_3_subtext),
|
|
5877
|
+
keywords: ["h3", "heading3", "subheading"],
|
|
5878
|
+
badge: import_icons13.HeadingThreeIcon,
|
|
5879
|
+
group: formatMessage(messages7.group_style)
|
|
5880
|
+
},
|
|
5881
|
+
bullet_list: {
|
|
5882
|
+
title: formatMessage(messages7.slash_bullet_list),
|
|
5883
|
+
subtext: formatMessage(messages7.slash_bullet_list_subtext),
|
|
5884
|
+
keywords: ["ul", "li", "list", "bulletlist", "bullet list"],
|
|
5885
|
+
badge: import_icons13.ListIcon,
|
|
5886
|
+
group: formatMessage(messages7.group_style)
|
|
5887
|
+
},
|
|
5888
|
+
ordered_list: {
|
|
5889
|
+
title: formatMessage(messages7.slash_ordered_list),
|
|
5890
|
+
subtext: formatMessage(messages7.slash_ordered_list_subtext),
|
|
5891
|
+
keywords: ["ol", "li", "list", "numberedlist", "numbered list"],
|
|
5892
|
+
badge: import_icons13.ListOrderedIcon,
|
|
5893
|
+
group: formatMessage(messages7.group_style)
|
|
5894
|
+
},
|
|
5895
|
+
task_list: {
|
|
5896
|
+
title: formatMessage(messages7.slash_task_list),
|
|
5897
|
+
subtext: formatMessage(messages7.slash_task_list_subtext),
|
|
5898
|
+
keywords: ["tasklist", "task list", "todo", "checklist"],
|
|
5899
|
+
badge: import_icons13.ListTodoIcon,
|
|
5900
|
+
group: formatMessage(messages7.group_style)
|
|
5901
|
+
},
|
|
5902
|
+
quote: {
|
|
5903
|
+
title: formatMessage(messages7.slash_blockquote),
|
|
5904
|
+
subtext: formatMessage(messages7.slash_blockquote_subtext),
|
|
5905
|
+
keywords: ["quote", "blockquote"],
|
|
5906
|
+
badge: import_icons13.BlockquoteIcon,
|
|
5907
|
+
group: formatMessage(messages7.group_style)
|
|
5908
|
+
},
|
|
5909
|
+
code_block: {
|
|
5910
|
+
title: formatMessage(messages7.slash_code_block),
|
|
5911
|
+
subtext: formatMessage(messages7.slash_code_block_subtext),
|
|
5912
|
+
keywords: ["code", "pre"],
|
|
5913
|
+
badge: import_icons13.CodeBlockIcon,
|
|
5914
|
+
group: formatMessage(messages7.group_style)
|
|
5915
|
+
},
|
|
5916
|
+
// Insert
|
|
5917
|
+
control: {
|
|
5918
|
+
title: formatMessage(messages7.slash_control),
|
|
5919
|
+
subtext: formatMessage(messages7.slash_control_subtext),
|
|
5920
|
+
keywords: ["control"],
|
|
5921
|
+
badge: import_icons13.ControlsIcon,
|
|
5922
|
+
group: formatMessage(messages7.group_insert)
|
|
5923
|
+
},
|
|
5924
|
+
divider: {
|
|
5925
|
+
title: formatMessage(messages7.slash_separator),
|
|
5926
|
+
subtext: formatMessage(messages7.slash_separator_subtext),
|
|
5927
|
+
keywords: ["hr", "horizontalRule", "line", "separator"],
|
|
5928
|
+
badge: import_icons13.MinusIcon,
|
|
5929
|
+
group: formatMessage(messages7.group_insert)
|
|
5930
|
+
},
|
|
5931
|
+
table: {
|
|
5932
|
+
title: formatMessage(messages7.slash_table),
|
|
5933
|
+
subtext: formatMessage(messages7.slash_table_subtext),
|
|
5934
|
+
keywords: ["table", "grid", "spreadsheet"],
|
|
5935
|
+
badge: import_icons13.TableIcon,
|
|
5936
|
+
group: formatMessage(messages7.group_insert)
|
|
5937
|
+
},
|
|
5938
|
+
table_of_contents: {
|
|
5939
|
+
title: formatMessage(messages7.slash_toc),
|
|
5940
|
+
subtext: formatMessage(messages7.slash_toc_subtext),
|
|
5941
|
+
keywords: ["toc", "table of contents", "index", "navigation", "headings"],
|
|
5942
|
+
badge: import_icons13.TableOfContentsIcon,
|
|
5943
|
+
group: formatMessage(messages7.group_insert)
|
|
5944
|
+
},
|
|
5945
|
+
callout: {
|
|
5946
|
+
title: formatMessage(messages7.slash_callout),
|
|
5947
|
+
subtext: formatMessage(messages7.slash_callout_subtext),
|
|
5948
|
+
keywords: ["callout", "info", "warning", "alert", "note", "tip"],
|
|
5949
|
+
badge: import_icons13.InfoIcon,
|
|
5950
|
+
group: formatMessage(messages7.group_insert)
|
|
5951
|
+
},
|
|
5952
|
+
callout_warning: {
|
|
5953
|
+
title: formatMessage(messages7.slash_warning),
|
|
5954
|
+
subtext: formatMessage(messages7.slash_warning_subtext),
|
|
5955
|
+
keywords: ["warning", "caution", "attention"],
|
|
5956
|
+
badge: import_icons13.AlertIcon,
|
|
5957
|
+
group: formatMessage(messages7.group_insert)
|
|
5958
|
+
},
|
|
5959
|
+
math: {
|
|
5960
|
+
title: formatMessage(messages7.slash_formula),
|
|
5961
|
+
subtext: formatMessage(messages7.slash_formula_subtext),
|
|
5962
|
+
keywords: ["math", "latex", "formula", "equation", "katex"],
|
|
5963
|
+
badge: import_icons13.TypeIcon,
|
|
5964
|
+
group: formatMessage(messages7.group_insert)
|
|
5965
|
+
},
|
|
5966
|
+
// Upload
|
|
5967
|
+
image: {
|
|
5968
|
+
title: formatMessage(messages7.slash_image),
|
|
5969
|
+
subtext: formatMessage(messages7.slash_image_subtext),
|
|
5970
|
+
keywords: [
|
|
5971
|
+
"image",
|
|
5972
|
+
"imageUpload",
|
|
5973
|
+
"upload",
|
|
5974
|
+
"img",
|
|
5975
|
+
"picture",
|
|
5976
|
+
"media",
|
|
5977
|
+
"url"
|
|
5978
|
+
],
|
|
5979
|
+
badge: import_icons13.ImageIcon,
|
|
5980
|
+
group: formatMessage(messages7.group_upload)
|
|
5981
|
+
}
|
|
5982
|
+
};
|
|
5983
|
+
}
|
|
5495
5984
|
var getItemImplementations = () => {
|
|
5496
5985
|
return {
|
|
5497
5986
|
// AI
|
|
@@ -5675,11 +6164,34 @@ function organizeItemsByGroups(items, showGroups) {
|
|
|
5675
6164
|
});
|
|
5676
6165
|
return organizedItems;
|
|
5677
6166
|
}
|
|
6167
|
+
var ALL_SLASH_MENU_ITEMS = [
|
|
6168
|
+
"continue_writing",
|
|
6169
|
+
"ai_ask_button",
|
|
6170
|
+
"text",
|
|
6171
|
+
"heading_1",
|
|
6172
|
+
"heading_2",
|
|
6173
|
+
"heading_3",
|
|
6174
|
+
"bullet_list",
|
|
6175
|
+
"ordered_list",
|
|
6176
|
+
"task_list",
|
|
6177
|
+
"quote",
|
|
6178
|
+
"code_block",
|
|
6179
|
+
"control",
|
|
6180
|
+
"divider",
|
|
6181
|
+
"table",
|
|
6182
|
+
"table_of_contents",
|
|
6183
|
+
"callout",
|
|
6184
|
+
"callout_warning",
|
|
6185
|
+
"math",
|
|
6186
|
+
"image"
|
|
6187
|
+
];
|
|
5678
6188
|
function useSlashDropdownMenu(config) {
|
|
6189
|
+
const intl = (0, import_react_intl19.useIntl)();
|
|
5679
6190
|
const getSlashMenuItems = React10.useCallback(
|
|
5680
6191
|
(editor) => {
|
|
5681
6192
|
const items = [];
|
|
5682
|
-
const
|
|
6193
|
+
const texts = createSlashMenuTexts(intl.formatMessage);
|
|
6194
|
+
const enabledItems = (config == null ? void 0 : config.enabledItems) || ALL_SLASH_MENU_ITEMS;
|
|
5683
6195
|
const showGroups = (config == null ? void 0 : config.showGroups) !== false;
|
|
5684
6196
|
const itemImplementations = getItemImplementations();
|
|
5685
6197
|
enabledItems.forEach((itemType) => {
|
|
@@ -5704,7 +6216,7 @@ function useSlashDropdownMenu(config) {
|
|
|
5704
6216
|
}
|
|
5705
6217
|
return organizeItemsByGroups(items, showGroups);
|
|
5706
6218
|
},
|
|
5707
|
-
[config]
|
|
6219
|
+
[config, intl]
|
|
5708
6220
|
);
|
|
5709
6221
|
return {
|
|
5710
6222
|
getSlashMenuItems,
|
|
@@ -5863,6 +6375,7 @@ var import_popover3 = require("@kopexa/popover");
|
|
|
5863
6375
|
var import_toolbar10 = require("@kopexa/toolbar");
|
|
5864
6376
|
var import_use_is_mobile3 = require("@kopexa/use-is-mobile");
|
|
5865
6377
|
var import_react59 = require("react");
|
|
6378
|
+
var import_react_intl25 = require("react-intl");
|
|
5866
6379
|
|
|
5867
6380
|
// src/hooks/use-cursor-visibility.ts
|
|
5868
6381
|
var React13 = __toESM(require("react"));
|
|
@@ -5986,6 +6499,7 @@ var import_icons14 = require("@kopexa/icons");
|
|
|
5986
6499
|
var import_use_is_mobile = require("@kopexa/use-is-mobile");
|
|
5987
6500
|
var React14 = __toESM(require("react"));
|
|
5988
6501
|
var import_react_hotkeys_hook = require("react-hotkeys-hook");
|
|
6502
|
+
var import_react_intl20 = require("react-intl");
|
|
5989
6503
|
var COLOR_HIGHLIGHT_SHORTCUT_KEY = "mod+shift+h";
|
|
5990
6504
|
var HIGHLIGHT_COLORS = [
|
|
5991
6505
|
{
|
|
@@ -6077,6 +6591,7 @@ function useColorHighlight(config) {
|
|
|
6077
6591
|
hideWhenUnavailable = false,
|
|
6078
6592
|
onApplied
|
|
6079
6593
|
} = config;
|
|
6594
|
+
const intl = (0, import_react_intl20.useIntl)();
|
|
6080
6595
|
const { editor } = (0, import_editor_utils12.useTiptapEditor)(providedEditor);
|
|
6081
6596
|
const isMobile = (0, import_use_is_mobile.useIsMobile)();
|
|
6082
6597
|
const [isVisible, setIsVisible] = React14.useState(true);
|
|
@@ -6137,7 +6652,7 @@ function useColorHighlight(config) {
|
|
|
6137
6652
|
handleColorHighlight,
|
|
6138
6653
|
handleRemoveHighlight,
|
|
6139
6654
|
canColorHighlight: canColorHighlightState,
|
|
6140
|
-
label: label ||
|
|
6655
|
+
label: label || intl.formatMessage(messages7.highlight_color),
|
|
6141
6656
|
shortcutKeys: COLOR_HIGHLIGHT_SHORTCUT_KEY,
|
|
6142
6657
|
Icon: import_icons14.HighlighterIcon
|
|
6143
6658
|
};
|
|
@@ -6726,6 +7241,7 @@ var import_react50 = require("react");
|
|
|
6726
7241
|
var import_editor_utils18 = require("@kopexa/editor-utils");
|
|
6727
7242
|
var import_icons18 = require("@kopexa/icons");
|
|
6728
7243
|
var import_react49 = require("react");
|
|
7244
|
+
var import_react_intl21 = require("react-intl");
|
|
6729
7245
|
var TEXT_ALIGN_SHORTCUT_KEYS = {
|
|
6730
7246
|
left: "mod+shift+l",
|
|
6731
7247
|
center: "mod+shift+e",
|
|
@@ -6738,11 +7254,11 @@ var textAlignIcons = {
|
|
|
6738
7254
|
right: import_icons18.AlignRightIcon,
|
|
6739
7255
|
justify: import_icons18.AlignJustifyIcon
|
|
6740
7256
|
};
|
|
6741
|
-
var
|
|
6742
|
-
left:
|
|
6743
|
-
center:
|
|
6744
|
-
right:
|
|
6745
|
-
justify:
|
|
7257
|
+
var textAlignMessages = {
|
|
7258
|
+
left: messages7.align_left,
|
|
7259
|
+
center: messages7.align_center,
|
|
7260
|
+
right: messages7.align_right,
|
|
7261
|
+
justify: messages7.align_justify
|
|
6746
7262
|
};
|
|
6747
7263
|
function canSetTextAlign(editor, align) {
|
|
6748
7264
|
if (!editor || !editor.isEditable) return false;
|
|
@@ -6782,6 +7298,7 @@ function useTextAlign(config) {
|
|
|
6782
7298
|
hideWhenUnavailable = false,
|
|
6783
7299
|
onAligned
|
|
6784
7300
|
} = config;
|
|
7301
|
+
const intl = (0, import_react_intl21.useIntl)();
|
|
6785
7302
|
const { editor } = (0, import_editor_utils18.useTiptapEditor)(providedEditor);
|
|
6786
7303
|
const [isVisible, setIsVisible] = (0, import_react49.useState)(true);
|
|
6787
7304
|
const canAlign = canSetTextAlign(editor, align);
|
|
@@ -6810,7 +7327,7 @@ function useTextAlign(config) {
|
|
|
6810
7327
|
isActive,
|
|
6811
7328
|
handleTextAlign,
|
|
6812
7329
|
canAlign,
|
|
6813
|
-
label:
|
|
7330
|
+
label: intl.formatMessage(textAlignMessages[align]),
|
|
6814
7331
|
shortcutKeys: TEXT_ALIGN_SHORTCUT_KEYS[align],
|
|
6815
7332
|
Icon: textAlignIcons[align]
|
|
6816
7333
|
};
|
|
@@ -6859,11 +7376,11 @@ var TextAlignButton = ({
|
|
|
6859
7376
|
import_button14.IconButton,
|
|
6860
7377
|
{
|
|
6861
7378
|
type: "button",
|
|
6862
|
-
disabled: canAlign,
|
|
7379
|
+
disabled: !canAlign,
|
|
6863
7380
|
variant: "ghost",
|
|
6864
7381
|
color: "default",
|
|
6865
7382
|
"data-active-state": isActive ? "on" : "off",
|
|
6866
|
-
"data-disabled": canAlign,
|
|
7383
|
+
"data-disabled": !canAlign,
|
|
6867
7384
|
tabIndex: -1,
|
|
6868
7385
|
"aria-label": label,
|
|
6869
7386
|
"aria-pressed": isActive,
|
|
@@ -6881,6 +7398,7 @@ var import_button17 = require("@kopexa/button");
|
|
|
6881
7398
|
var import_dropdown_menu2 = require("@kopexa/dropdown-menu");
|
|
6882
7399
|
var import_editor_utils28 = require("@kopexa/editor-utils");
|
|
6883
7400
|
var import_react56 = require("react");
|
|
7401
|
+
var import_react_intl23 = require("react-intl");
|
|
6884
7402
|
|
|
6885
7403
|
// src/ui/blockquote-button/blockquote-button.tsx
|
|
6886
7404
|
var import_editor_utils21 = require("@kopexa/editor-utils");
|
|
@@ -7610,6 +8128,7 @@ var import_editor_utils27 = require("@kopexa/editor-utils");
|
|
|
7610
8128
|
var import_icons24 = require("@kopexa/icons");
|
|
7611
8129
|
var import_state10 = require("@tiptap/pm/state");
|
|
7612
8130
|
var import_react55 = require("react");
|
|
8131
|
+
var import_react_intl22 = require("react-intl");
|
|
7613
8132
|
var TURN_INTO_BLOCKS = [
|
|
7614
8133
|
"paragraph",
|
|
7615
8134
|
"heading",
|
|
@@ -7619,62 +8138,64 @@ var TURN_INTO_BLOCKS = [
|
|
|
7619
8138
|
"blockquote",
|
|
7620
8139
|
"codeBlock"
|
|
7621
8140
|
];
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
|
|
7632
|
-
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
|
|
7636
|
-
|
|
7637
|
-
|
|
7638
|
-
|
|
7639
|
-
|
|
7640
|
-
|
|
7641
|
-
|
|
7642
|
-
|
|
7643
|
-
|
|
7644
|
-
|
|
7645
|
-
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
-
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
|
|
7659
|
-
|
|
7660
|
-
|
|
7661
|
-
|
|
7662
|
-
|
|
7663
|
-
|
|
7664
|
-
|
|
7665
|
-
|
|
7666
|
-
|
|
7667
|
-
|
|
7668
|
-
|
|
7669
|
-
|
|
7670
|
-
|
|
7671
|
-
|
|
7672
|
-
|
|
7673
|
-
|
|
7674
|
-
|
|
7675
|
-
|
|
7676
|
-
|
|
7677
|
-
|
|
8141
|
+
function createBlockTypeOptions(formatMessage) {
|
|
8142
|
+
return [
|
|
8143
|
+
{
|
|
8144
|
+
type: "paragraph",
|
|
8145
|
+
label: formatMessage(messages7.block_text),
|
|
8146
|
+
isActive: (editor) => editor.isActive("paragraph") && !editor.isActive("heading") && !editor.isActive("bulletList") && !editor.isActive("orderedList") && !editor.isActive("taskList") && !editor.isActive("blockquote") && !editor.isActive("codeBlock")
|
|
8147
|
+
},
|
|
8148
|
+
{
|
|
8149
|
+
type: "heading",
|
|
8150
|
+
label: formatMessage(messages7.block_heading_1),
|
|
8151
|
+
level: 1,
|
|
8152
|
+
isActive: (editor) => editor.isActive("heading", { level: 1 })
|
|
8153
|
+
},
|
|
8154
|
+
{
|
|
8155
|
+
type: "heading",
|
|
8156
|
+
label: formatMessage(messages7.block_heading_2),
|
|
8157
|
+
level: 2,
|
|
8158
|
+
isActive: (editor) => editor.isActive("heading", { level: 2 })
|
|
8159
|
+
},
|
|
8160
|
+
{
|
|
8161
|
+
type: "heading",
|
|
8162
|
+
label: formatMessage(messages7.block_heading_3),
|
|
8163
|
+
level: 3,
|
|
8164
|
+
isActive: (editor) => editor.isActive("heading", { level: 3 })
|
|
8165
|
+
},
|
|
8166
|
+
{
|
|
8167
|
+
type: "heading",
|
|
8168
|
+
label: formatMessage(messages7.block_heading_4),
|
|
8169
|
+
level: 4,
|
|
8170
|
+
isActive: (editor) => editor.isActive("heading", { level: 4 })
|
|
8171
|
+
},
|
|
8172
|
+
{
|
|
8173
|
+
type: "bulletList",
|
|
8174
|
+
label: formatMessage(messages7.block_bullet_list),
|
|
8175
|
+
isActive: (editor) => editor.isActive("bulletList")
|
|
8176
|
+
},
|
|
8177
|
+
{
|
|
8178
|
+
type: "orderedList",
|
|
8179
|
+
label: formatMessage(messages7.block_ordered_list),
|
|
8180
|
+
isActive: (editor) => editor.isActive("orderedList")
|
|
8181
|
+
},
|
|
8182
|
+
{
|
|
8183
|
+
type: "taskList",
|
|
8184
|
+
label: formatMessage(messages7.block_task_list),
|
|
8185
|
+
isActive: (editor) => editor.isActive("taskList")
|
|
8186
|
+
},
|
|
8187
|
+
{
|
|
8188
|
+
type: "blockquote",
|
|
8189
|
+
label: formatMessage(messages7.block_blockquote),
|
|
8190
|
+
isActive: (editor) => editor.isActive("blockquote")
|
|
8191
|
+
},
|
|
8192
|
+
{
|
|
8193
|
+
type: "codeBlock",
|
|
8194
|
+
label: formatMessage(messages7.block_code_block),
|
|
8195
|
+
isActive: (editor) => editor.isActive("codeBlock")
|
|
8196
|
+
}
|
|
8197
|
+
];
|
|
8198
|
+
}
|
|
7678
8199
|
function canTurnInto(editor, allowedBlockTypes) {
|
|
7679
8200
|
if (!editor || !editor.isEditable) return false;
|
|
7680
8201
|
const blockTypes = allowedBlockTypes || TURN_INTO_BLOCKS;
|
|
@@ -7687,20 +8208,6 @@ function canTurnInto(editor, allowedBlockTypes) {
|
|
|
7687
8208
|
const nodeType = $anchor.parent.type.name;
|
|
7688
8209
|
return blockTypes.includes(nodeType);
|
|
7689
8210
|
}
|
|
7690
|
-
function getFilteredBlockTypeOptions(blockTypes) {
|
|
7691
|
-
if (!blockTypes) return blockTypeOptions;
|
|
7692
|
-
return blockTypeOptions.filter((option) => {
|
|
7693
|
-
return blockTypes.includes(option.type);
|
|
7694
|
-
});
|
|
7695
|
-
}
|
|
7696
|
-
function getActiveBlockType(editor, blockTypes) {
|
|
7697
|
-
if (!editor) return getFilteredBlockTypeOptions(blockTypes)[0];
|
|
7698
|
-
const filteredOptions = getFilteredBlockTypeOptions(blockTypes);
|
|
7699
|
-
const activeOption = filteredOptions.find(
|
|
7700
|
-
(option) => option.isActive(editor)
|
|
7701
|
-
);
|
|
7702
|
-
return activeOption || filteredOptions[0];
|
|
7703
|
-
}
|
|
7704
8211
|
function shouldShowTurnInto(params) {
|
|
7705
8212
|
const { editor, hideWhenUnavailable, blockTypes } = params;
|
|
7706
8213
|
if (!editor || !editor.isEditable) return false;
|
|
@@ -7716,11 +8223,31 @@ function useTurnIntoDropdown(config) {
|
|
|
7716
8223
|
blockTypes,
|
|
7717
8224
|
onOpenChange
|
|
7718
8225
|
} = config || {};
|
|
8226
|
+
const intl = (0, import_react_intl22.useIntl)();
|
|
7719
8227
|
const { editor } = (0, import_editor_utils27.useTiptapEditor)(providedEditor);
|
|
7720
8228
|
const [isOpen, setIsOpen] = (0, import_react55.useState)(false);
|
|
7721
8229
|
const [isVisible, setIsVisible] = (0, import_react55.useState)(true);
|
|
8230
|
+
const translatedBlockTypeOptions = (0, import_react55.useMemo)(
|
|
8231
|
+
() => createBlockTypeOptions(intl.formatMessage),
|
|
8232
|
+
[intl]
|
|
8233
|
+
);
|
|
7722
8234
|
const canToggle3 = canTurnInto(editor, blockTypes);
|
|
7723
|
-
const activeBlockType =
|
|
8235
|
+
const activeBlockType = (0, import_react55.useMemo)(() => {
|
|
8236
|
+
if (!editor) return translatedBlockTypeOptions[0];
|
|
8237
|
+
const filteredOptions2 = blockTypes ? translatedBlockTypeOptions.filter(
|
|
8238
|
+
(opt) => blockTypes.includes(opt.type)
|
|
8239
|
+
) : translatedBlockTypeOptions;
|
|
8240
|
+
const activeOption = filteredOptions2.find(
|
|
8241
|
+
(option) => option.isActive(editor)
|
|
8242
|
+
);
|
|
8243
|
+
return activeOption || filteredOptions2[0];
|
|
8244
|
+
}, [editor, blockTypes, translatedBlockTypeOptions]);
|
|
8245
|
+
const filteredOptions = (0, import_react55.useMemo)(() => {
|
|
8246
|
+
if (!blockTypes) return translatedBlockTypeOptions;
|
|
8247
|
+
return translatedBlockTypeOptions.filter(
|
|
8248
|
+
(opt) => blockTypes.includes(opt.type)
|
|
8249
|
+
);
|
|
8250
|
+
}, [blockTypes, translatedBlockTypeOptions]);
|
|
7724
8251
|
const handleOpenChange = (0, import_react55.useCallback)(
|
|
7725
8252
|
(open) => {
|
|
7726
8253
|
if (!editor || !canToggle3) return;
|
|
@@ -7746,6 +8273,8 @@ function useTurnIntoDropdown(config) {
|
|
|
7746
8273
|
editor.off("selectionUpdate", handleSelectionUpdate);
|
|
7747
8274
|
};
|
|
7748
8275
|
}, [editor, hideWhenUnavailable, blockTypes]);
|
|
8276
|
+
const turnIntoLabel = intl.formatMessage(messages7.turn_into);
|
|
8277
|
+
const textLabel = intl.formatMessage(messages7.block_text);
|
|
7749
8278
|
return {
|
|
7750
8279
|
isVisible,
|
|
7751
8280
|
canToggle: canToggle3,
|
|
@@ -7753,8 +8282,11 @@ function useTurnIntoDropdown(config) {
|
|
|
7753
8282
|
setIsOpen,
|
|
7754
8283
|
activeBlockType,
|
|
7755
8284
|
handleOpenChange,
|
|
7756
|
-
filteredOptions
|
|
7757
|
-
label:
|
|
8285
|
+
filteredOptions,
|
|
8286
|
+
label: intl.formatMessage(messages7.turn_into_current, {
|
|
8287
|
+
current: (activeBlockType == null ? void 0 : activeBlockType.label) || textLabel
|
|
8288
|
+
}),
|
|
8289
|
+
tooltip: turnIntoLabel,
|
|
7758
8290
|
Icon: import_icons24.ChevronDownIcon
|
|
7759
8291
|
};
|
|
7760
8292
|
}
|
|
@@ -7762,7 +8294,12 @@ function useTurnIntoDropdown(config) {
|
|
|
7762
8294
|
// src/ui/turn-into-dropdown/turn-into-dropdown.tsx
|
|
7763
8295
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
7764
8296
|
var TurnIntoDropdownContent = ({ blockTypes }) => {
|
|
7765
|
-
const
|
|
8297
|
+
const intl = (0, import_react_intl23.useIntl)();
|
|
8298
|
+
const filteredOptions = (0, import_react56.useMemo)(() => {
|
|
8299
|
+
const allOptions = createBlockTypeOptions(intl.formatMessage);
|
|
8300
|
+
if (!blockTypes) return allOptions;
|
|
8301
|
+
return allOptions.filter((opt) => blockTypes.includes(opt.type));
|
|
8302
|
+
}, [intl, blockTypes]);
|
|
7766
8303
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_dropdown_menu2.DropdownMenu.Group, { children: filteredOptions.map(
|
|
7767
8304
|
(option, index) => {
|
|
7768
8305
|
var _a;
|
|
@@ -7873,6 +8410,7 @@ var TurnIntoDropdown = (0, import_react56.forwardRef)(
|
|
|
7873
8410
|
activeBlockType,
|
|
7874
8411
|
handleOpenChange,
|
|
7875
8412
|
label,
|
|
8413
|
+
tooltip,
|
|
7876
8414
|
Icon
|
|
7877
8415
|
} = useTurnIntoDropdown({
|
|
7878
8416
|
editor,
|
|
@@ -7894,14 +8432,24 @@ var TurnIntoDropdown = (0, import_react56.forwardRef)(
|
|
|
7894
8432
|
"data-disabled": !canToggle3,
|
|
7895
8433
|
tabIndex: -1,
|
|
7896
8434
|
"aria-label": label,
|
|
7897
|
-
tooltip
|
|
8435
|
+
tooltip,
|
|
7898
8436
|
endContent: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Icon, {}),
|
|
7899
8437
|
...buttonProps,
|
|
7900
8438
|
ref,
|
|
7901
|
-
children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children:
|
|
8439
|
+
children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: activeBlockType == null ? void 0 : activeBlockType.label })
|
|
7902
8440
|
}
|
|
7903
8441
|
) }),
|
|
7904
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
8442
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
8443
|
+
import_dropdown_menu2.DropdownMenu.Content,
|
|
8444
|
+
{
|
|
8445
|
+
align: "start",
|
|
8446
|
+
onCloseAutoFocus: (e) => {
|
|
8447
|
+
e.preventDefault();
|
|
8448
|
+
editor == null ? void 0 : editor.commands.focus();
|
|
8449
|
+
},
|
|
8450
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TurnIntoDropdownContent, { blockTypes })
|
|
8451
|
+
}
|
|
8452
|
+
)
|
|
7905
8453
|
] });
|
|
7906
8454
|
}
|
|
7907
8455
|
);
|
|
@@ -7916,13 +8464,14 @@ var import_react58 = require("react");
|
|
|
7916
8464
|
var import_editor_utils29 = require("@kopexa/editor-utils");
|
|
7917
8465
|
var import_icons25 = require("@kopexa/icons");
|
|
7918
8466
|
var import_react57 = require("react");
|
|
8467
|
+
var import_react_intl24 = require("react-intl");
|
|
7919
8468
|
var UNDO_REDO_SHORTCUT_KEYS = {
|
|
7920
8469
|
undo: "mod+z",
|
|
7921
8470
|
redo: "mod+shift+z"
|
|
7922
8471
|
};
|
|
7923
|
-
var
|
|
7924
|
-
undo:
|
|
7925
|
-
redo:
|
|
8472
|
+
var historyActionMessages = {
|
|
8473
|
+
undo: messages7.undo,
|
|
8474
|
+
redo: messages7.redo
|
|
7926
8475
|
};
|
|
7927
8476
|
var historyIcons = {
|
|
7928
8477
|
undo: import_icons25.UndoIcon,
|
|
@@ -7954,6 +8503,7 @@ function useUndoRedo(config) {
|
|
|
7954
8503
|
hideWhenUnavailable = false,
|
|
7955
8504
|
onExecuted
|
|
7956
8505
|
} = config;
|
|
8506
|
+
const intl = (0, import_react_intl24.useIntl)();
|
|
7957
8507
|
const { editor } = (0, import_editor_utils29.useTiptapEditor)(providedEditor);
|
|
7958
8508
|
const [isVisible, setIsVisible] = (0, import_react57.useState)(true);
|
|
7959
8509
|
const canExecute = canExecuteUndoRedoAction(editor, action);
|
|
@@ -7980,7 +8530,7 @@ function useUndoRedo(config) {
|
|
|
7980
8530
|
isVisible,
|
|
7981
8531
|
handleAction,
|
|
7982
8532
|
canExecute,
|
|
7983
|
-
label:
|
|
8533
|
+
label: intl.formatMessage(historyActionMessages[action]),
|
|
7984
8534
|
shortcutKeys: UNDO_REDO_SHORTCUT_KEYS[action],
|
|
7985
8535
|
Icon: historyIcons[action]
|
|
7986
8536
|
};
|
|
@@ -8086,7 +8636,7 @@ var MainToolbarContent = () => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(im
|
|
|
8086
8636
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(MarkButton, { type: "code" }),
|
|
8087
8637
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(MarkButton, { type: "underline" }),
|
|
8088
8638
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ColorHighlightPopover, {}),
|
|
8089
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(LinkPopover, {})
|
|
8639
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(LinkPopover, { autoOpenOnLinkActive: false })
|
|
8090
8640
|
] }),
|
|
8091
8641
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_toolbar10.ToolbarSeparator, {}),
|
|
8092
8642
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_toolbar10.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TableButton, {}) }),
|
|
@@ -8101,7 +8651,7 @@ var CommentToolbarContent = () => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)
|
|
|
8101
8651
|
] }),
|
|
8102
8652
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_toolbar10.ToolbarSeparator, {}),
|
|
8103
8653
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_toolbar10.ToolbarGroup, { children: [
|
|
8104
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(LinkPopover, {}),
|
|
8654
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(LinkPopover, { autoOpenOnLinkActive: false }),
|
|
8105
8655
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ListDropdownMenu, { types: ["bulletList", "orderedList"] })
|
|
8106
8656
|
] })
|
|
8107
8657
|
] });
|
|
@@ -8109,15 +8659,17 @@ var FieldToolbarContent = () => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(i
|
|
|
8109
8659
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(MarkButton, { type: "bold" }),
|
|
8110
8660
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(MarkButton, { type: "italic" }),
|
|
8111
8661
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(MarkButton, { type: "strike" }),
|
|
8112
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(LinkPopover, {})
|
|
8662
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(LinkPopover, { autoOpenOnLinkActive: false })
|
|
8113
8663
|
] });
|
|
8114
8664
|
function MoreOptions({
|
|
8115
8665
|
editor: providedEditor,
|
|
8116
8666
|
hideWhenUnavailable = false,
|
|
8117
8667
|
...props
|
|
8118
8668
|
}) {
|
|
8669
|
+
const intl = (0, import_react_intl25.useIntl)();
|
|
8119
8670
|
const { editor } = (0, import_editor_utils31.useTiptapEditor)(providedEditor);
|
|
8120
8671
|
const [show, setShow] = (0, import_react59.useState)(false);
|
|
8672
|
+
const moreOptionsLabel = intl.formatMessage(messages7.more_options);
|
|
8121
8673
|
(0, import_react59.useEffect)(() => {
|
|
8122
8674
|
if (!editor) return;
|
|
8123
8675
|
const handleSelectionUpdate = () => {
|
|
@@ -8151,8 +8703,8 @@ function MoreOptions({
|
|
|
8151
8703
|
color: "default",
|
|
8152
8704
|
tabIndex: -1,
|
|
8153
8705
|
size: "md",
|
|
8154
|
-
"aria-label":
|
|
8155
|
-
title:
|
|
8706
|
+
"aria-label": moreOptionsLabel,
|
|
8707
|
+
title: moreOptionsLabel,
|
|
8156
8708
|
isIconOnly: true,
|
|
8157
8709
|
...props,
|
|
8158
8710
|
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_icons26.MoreVerticalIcon, {})
|
|
@@ -8217,13 +8769,17 @@ var BasicEditor = ({
|
|
|
8217
8769
|
variables,
|
|
8218
8770
|
variableValues,
|
|
8219
8771
|
showToolbar = true,
|
|
8772
|
+
slotOverlay,
|
|
8220
8773
|
pagesOptions,
|
|
8221
8774
|
...options
|
|
8222
8775
|
}) => {
|
|
8776
|
+
const intl = (0, import_react_intl26.useIntl)();
|
|
8777
|
+
const placeholder = intl.formatMessage(messages7.editor_placeholder);
|
|
8223
8778
|
const { editor, collabSyncing } = useCreateEditor({
|
|
8224
8779
|
content,
|
|
8225
8780
|
enableVariables: !!(variables == null ? void 0 : variables.length),
|
|
8226
8781
|
pagesOptions,
|
|
8782
|
+
placeholder,
|
|
8227
8783
|
...options
|
|
8228
8784
|
});
|
|
8229
8785
|
const styles = (0, import_theme9.editorBasic)({ variant, bordered });
|
|
@@ -8247,7 +8803,8 @@ var BasicEditor = ({
|
|
|
8247
8803
|
hasPagination
|
|
8248
8804
|
}
|
|
8249
8805
|
),
|
|
8250
|
-
showToolbar && isBottomToolbar && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(EditorHeader, { editor, variant })
|
|
8806
|
+
showToolbar && isBottomToolbar && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(EditorHeader, { editor, variant }),
|
|
8807
|
+
slotOverlay
|
|
8251
8808
|
] }) }) });
|
|
8252
8809
|
if (hasVariables) {
|
|
8253
8810
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(VariableProvider, { variables, resolveVariable, children: editorContent });
|
|
@@ -8473,6 +9030,7 @@ function EditorStaticView({
|
|
|
8473
9030
|
sanitizeUrl,
|
|
8474
9031
|
useCollaboration,
|
|
8475
9032
|
useCollaborationRequired,
|
|
9033
|
+
useCurrentEditor,
|
|
8476
9034
|
useDocumentVisibility,
|
|
8477
9035
|
useEditorFile,
|
|
8478
9036
|
useEditorFileRequired,
|