@peers-app/peers-ui 0.27.3 → 0.27.5
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/screens/network-viewer/group-details-modal.d.ts +4 -0
- package/dist/screens/network-viewer/group-details-modal.js +6 -46
- package/dist/screens/network-viewer/network-viewer-ipc.d.ts +3 -2
- package/dist/screens/network-viewer/network-viewer-ipc.js +6 -0
- package/dist/screens/network-viewer/sync-recovery.js +103 -1
- package/dist/screens/variables/variable-details.js +2 -1
- package/dist/tabs-layout/network-status-indicator.js +26 -12
- package/dist/tabs-layout/use-network-status.d.ts +6 -1
- package/dist/tabs-layout/use-network-status.js +27 -4
- package/package.json +9 -3
- package/.claude/settings.local.json +0 -34
- package/.github/README.md +0 -52
- package/.github/workflows/delete-all-artifacts.yml +0 -49
- package/.github/workflows/publish.yml +0 -51
- package/babel.config.js +0 -7
- package/biome.json +0 -198
- package/dist/app-updates/app-updates-consumer.test.d.ts +0 -1
- package/dist/app-updates/app-updates-consumer.test.js +0 -56
- package/dist/app-updates/app-updates-settings.test.d.ts +0 -1
- package/dist/app-updates/app-updates-settings.test.js +0 -93
- package/dist/app-updates/remote-app-update-panel.test.d.ts +0 -1
- package/dist/app-updates/remote-app-update-panel.test.js +0 -165
- package/dist/components/access-level-field.test.d.ts +0 -1
- package/dist/components/access-level-field.test.js +0 -28
- package/dist/components/message-logs/tool-access-approval-card.test.d.ts +0 -1
- package/dist/components/message-logs/tool-access-approval-card.test.js +0 -102
- package/dist/components/responsive-section-nav.test.d.ts +0 -1
- package/dist/components/responsive-section-nav.test.js +0 -45
- package/dist/globals-hash.test.d.ts +0 -1
- package/dist/globals-hash.test.js +0 -16
- package/dist/hooks/use-observable-state.test.d.ts +0 -1
- package/dist/hooks/use-observable-state.test.js +0 -64
- package/dist/hooks/use-observable.test.d.ts +0 -1
- package/dist/hooks/use-observable.test.js +0 -191
- package/dist/hooks/use-rows.test.d.ts +0 -1
- package/dist/hooks/use-rows.test.js +0 -175
- package/dist/hooks/use-tool.test.d.ts +0 -1
- package/dist/hooks/use-tool.test.js +0 -190
- package/dist/host-shell/host-shell-consumer.test.d.ts +0 -1
- package/dist/host-shell/host-shell-consumer.test.js +0 -28
- package/dist/root-layout/root-layout-host.test.d.ts +0 -1
- package/dist/root-layout/root-layout-host.test.js +0 -86
- package/dist/screens/account/account-screen.test.d.ts +0 -1
- package/dist/screens/account/account-screen.test.js +0 -51
- package/dist/screens/assistants/assistant-config.test.d.ts +0 -1
- package/dist/screens/assistants/assistant-config.test.js +0 -57
- package/dist/screens/contacts/contact-list.test.d.ts +0 -1
- package/dist/screens/contacts/contact-list.test.js +0 -48
- package/dist/screens/device-pairing/device-pairing.test.d.ts +0 -1
- package/dist/screens/device-pairing/device-pairing.test.js +0 -119
- package/dist/screens/devices/devices-list.test.d.ts +0 -1
- package/dist/screens/devices/devices-list.test.js +0 -53
- package/dist/screens/groups/group-list.test.d.ts +0 -1
- package/dist/screens/groups/group-list.test.js +0 -38
- package/dist/screens/identity/identity-routes.test.d.ts +0 -1
- package/dist/screens/identity/identity-routes.test.js +0 -51
- package/dist/screens/identity/identity-screen.test.d.ts +0 -1
- package/dist/screens/identity/identity-screen.test.js +0 -103
- package/dist/screens/invites/accept-invite.test.d.ts +0 -1
- package/dist/screens/invites/accept-invite.test.js +0 -103
- package/dist/screens/invites/activity-view.test.d.ts +0 -1
- package/dist/screens/invites/activity-view.test.js +0 -108
- package/dist/screens/invites/invite-classify.test.d.ts +0 -1
- package/dist/screens/invites/invite-classify.test.js +0 -115
- package/dist/screens/network-viewer/network-viewer-ipc.test.d.ts +0 -1
- package/dist/screens/network-viewer/network-viewer-ipc.test.js +0 -61
- package/dist/screens/network-viewer/network-viewer.section.test.d.ts +0 -1
- package/dist/screens/network-viewer/network-viewer.section.test.js +0 -63
- package/dist/screens/network-viewer/sync-recovery.test.d.ts +0 -1
- package/dist/screens/network-viewer/sync-recovery.test.js +0 -104
- package/dist/screens/packages/package-helpers.test.d.ts +0 -1
- package/dist/screens/packages/package-helpers.test.js +0 -53
- package/dist/screens/packages/package-runtime-status.test.d.ts +0 -1
- package/dist/screens/packages/package-runtime-status.test.js +0 -50
- package/dist/screens/packages/packages-ipc.test.d.ts +0 -1
- package/dist/screens/packages/packages-ipc.test.js +0 -43
- package/dist/screens/settings/settings-page.test.d.ts +0 -1
- package/dist/screens/settings/settings-page.test.js +0 -19
- package/dist/screens/tools/tool-access-ipc.test.d.ts +0 -1
- package/dist/screens/tools/tool-access-ipc.test.js +0 -40
- package/dist/screens/tools/tool-catalog-ipc.test.d.ts +0 -1
- package/dist/screens/tools/tool-catalog-ipc.test.js +0 -52
- package/dist/tabs-layout/network-status-indicator.test.d.ts +0 -1
- package/dist/tabs-layout/network-status-indicator.test.js +0 -665
- package/dist/tabs-layout/tabs-state.test.d.ts +0 -1
- package/dist/tabs-layout/tabs-state.test.js +0 -110
- package/dist/tabs-layout/use-network-status.test.d.ts +0 -1
- package/dist/tabs-layout/use-network-status.test.js +0 -45
- package/dist/ui-router/ui-loader.test.d.ts +0 -1
- package/dist/ui-router/ui-loader.test.js +0 -91
- package/jest.config.js +0 -25
- package/release-guard.js +0 -10
- package/src/app-updates/app-update-controls.tsx +0 -73
- package/src/app-updates/app-updates-consumer.test.ts +0 -83
- package/src/app-updates/app-updates-consumer.ts +0 -121
- package/src/app-updates/app-updates-settings.test.tsx +0 -109
- package/src/app-updates/app-updates-settings.tsx +0 -136
- package/src/app-updates/remote-app-update-panel.test.tsx +0 -205
- package/src/app-updates/remote-app-update-panel.tsx +0 -210
- package/src/app-updates/use-app-update-status.ts +0 -16
- package/src/command-palette/command-palette-ui.tsx +0 -564
- package/src/command-palette/command-palette.ts +0 -242
- package/src/components/access-level-field.test.tsx +0 -32
- package/src/components/access-level-field.tsx +0 -68
- package/src/components/checkbox.tsx +0 -25
- package/src/components/group-switcher.tsx +0 -526
- package/src/components/input-date.tsx +0 -29
- package/src/components/input-number.tsx +0 -83
- package/src/components/input.tsx +0 -25
- package/src/components/inverse-lazy-list.tsx +0 -107
- package/src/components/io-schema-values.tsx +0 -103
- package/src/components/io-schema.tsx +0 -259
- package/src/components/lazy-list.tsx +0 -115
- package/src/components/list-screen.tsx +0 -126
- package/src/components/loading-indicator.tsx +0 -7
- package/src/components/markdown-editor/autolink-plugin.tsx +0 -29
- package/src/components/markdown-editor/editor-inline.tsx +0 -9
- package/src/components/markdown-editor/editor.tsx +0 -158
- package/src/components/markdown-editor/markdown-plugin.tsx +0 -202
- package/src/components/markdown-editor/mention-node.ts +0 -204
- package/src/components/markdown-editor/mentions-plugin.tsx +0 -354
- package/src/components/markdown-editor/move-line-plugin.tsx +0 -186
- package/src/components/markdown-editor/select-line-boundary-plugin.tsx +0 -95
- package/src/components/markdown-editor/theme.ts +0 -46
- package/src/components/markdown-editor/toolbar.tsx +0 -269
- package/src/components/markdown-with-mentions.tsx +0 -198
- package/src/components/message-logs/message-logs.tsx +0 -523
- package/src/components/message-logs/tool-access-approval-card.test.tsx +0 -127
- package/src/components/message-logs/tool-access-approval-card.tsx +0 -178
- package/src/components/messages/avatar.tsx +0 -171
- package/src/components/messages/channel-message-list.tsx +0 -189
- package/src/components/messages/channel-view.tsx +0 -92
- package/src/components/messages/message-compose.tsx +0 -192
- package/src/components/messages/message-display.tsx +0 -231
- package/src/components/messages/thread-message-list.tsx +0 -135
- package/src/components/qr-scanner.tsx +0 -180
- package/src/components/responsive-section-nav.test.tsx +0 -88
- package/src/components/responsive-section-nav.tsx +0 -92
- package/src/components/router.tsx +0 -175
- package/src/components/save-button.tsx +0 -134
- package/src/components/sortable-list.tsx +0 -130
- package/src/components/tabs.tsx +0 -76
- package/src/components/tooltip.tsx +0 -43
- package/src/components/trust-level-badge.tsx +0 -44
- package/src/components/trust-level-dropdown.tsx +0 -136
- package/src/components/typeahead.tsx +0 -357
- package/src/globals-hash.test.ts +0 -19
- package/src/globals.tsx +0 -226
- package/src/hooks/index.ts +0 -8
- package/src/hooks/use-host-contract.ts +0 -75
- package/src/hooks/use-observable-state.test.tsx +0 -101
- package/src/hooks/use-observable-state.ts +0 -29
- package/src/hooks/use-observable.test.tsx +0 -258
- package/src/hooks/use-observable.ts +0 -67
- package/src/hooks/use-on-screen.ts +0 -24
- package/src/hooks/use-promise.ts +0 -34
- package/src/hooks/use-rows.test.tsx +0 -196
- package/src/hooks/use-rows.ts +0 -120
- package/src/hooks/use-subscription.ts +0 -24
- package/src/hooks/use-tool.test.tsx +0 -225
- package/src/hooks/use-tool.ts +0 -116
- package/src/host-shell/host-shell-consumer.test.ts +0 -32
- package/src/host-shell/host-shell-consumer.ts +0 -53
- package/src/index.tsx +0 -42
- package/src/mention-configs.ts +0 -185
- package/src/operator-console/operator-console-state.ts +0 -119
- package/src/operator-console/operator-console.tsx +0 -233
- package/src/peers-services-registration.ts +0 -6
- package/src/root-layout/global-overlays.ts +0 -50
- package/src/root-layout/layout-picker.tsx +0 -47
- package/src/root-layout/layouts/full-screen-layout.tsx +0 -144
- package/src/root-layout/layouts/tabs-with-console-layout.tsx +0 -260
- package/src/root-layout/root-layout-host.test.tsx +0 -108
- package/src/root-layout/root-layout-host.tsx +0 -147
- package/src/root-layout/root-layout-registry.ts +0 -51
- package/src/root-layout/root-layout-state.ts +0 -55
- package/src/root-layout/root-layout.ts +0 -32
- package/src/screens/account/account-screen.test.tsx +0 -65
- package/src/screens/account/account-screen.tsx +0 -942
- package/src/screens/assistants/assistant-config.test.tsx +0 -54
- package/src/screens/assistants/assistant-config.tsx +0 -121
- package/src/screens/assistants/assistant-details.tsx +0 -89
- package/src/screens/assistants/assistant-info.tsx +0 -66
- package/src/screens/assistants/assistant-list.tsx +0 -145
- package/src/screens/assistants/assistant-tools.tsx +0 -82
- package/src/screens/console-logs/console-logs-list.tsx +0 -374
- package/src/screens/console-logs/log-display.tsx +0 -137
- package/src/screens/console-logs/log-filters.tsx +0 -64
- package/src/screens/console-logs/mobile-log-card.tsx +0 -161
- package/src/screens/console-logs/resizable-table-header.tsx +0 -110
- package/src/screens/contacts/contact-details.tsx +0 -123
- package/src/screens/contacts/contact-list.test.tsx +0 -59
- package/src/screens/contacts/contact-list.tsx +0 -286
- package/src/screens/contacts/index.ts +0 -2
- package/src/screens/data-explorer/data-explorer.tsx +0 -633
- package/src/screens/data-explorer/index.ts +0 -6
- package/src/screens/data-explorer/query-executor.tsx +0 -520
- package/src/screens/device-pairing/device-pairing.test.tsx +0 -143
- package/src/screens/device-pairing/device-pairing.tsx +0 -461
- package/src/screens/device-pairing/identity-ipc.ts +0 -25
- package/src/screens/device-pairing/index.ts +0 -2
- package/src/screens/device-pairing/use-device-pairing-state.ts +0 -15
- package/src/screens/devices/devices-list.test.tsx +0 -68
- package/src/screens/devices/devices-list.tsx +0 -365
- package/src/screens/devices/index.ts +0 -1
- package/src/screens/groups/group-details.tsx +0 -160
- package/src/screens/groups/group-invite-panel.tsx +0 -311
- package/src/screens/groups/group-list.test.tsx +0 -44
- package/src/screens/groups/group-list.tsx +0 -317
- package/src/screens/groups/group-members.tsx +0 -343
- package/src/screens/groups/index.ts +0 -3
- package/src/screens/identity/identity-routes.test.ts +0 -70
- package/src/screens/identity/identity-routes.ts +0 -301
- package/src/screens/identity/identity-screen.test.tsx +0 -138
- package/src/screens/identity/identity-screen.tsx +0 -282
- package/src/screens/identity/index.ts +0 -2
- package/src/screens/identity/invite-contact-panel.tsx +0 -45
- package/src/screens/identity/profile-invite.tsx +0 -93
- package/src/screens/invites/accept-invite.test.tsx +0 -115
- package/src/screens/invites/accept-invite.tsx +0 -318
- package/src/screens/invites/activity-view.test.tsx +0 -127
- package/src/screens/invites/activity-view.tsx +0 -162
- package/src/screens/invites/index.ts +0 -6
- package/src/screens/invites/invite-capture.ts +0 -104
- package/src/screens/invites/invite-classify.test.ts +0 -129
- package/src/screens/invites/invite-share.tsx +0 -104
- package/src/screens/invites/invites-ipc.ts +0 -25
- package/src/screens/invites/pending-invites-list.tsx +0 -256
- package/src/screens/network-viewer/connection-troubleshooter.tsx +0 -395
- package/src/screens/network-viewer/cpu-usage-graph.tsx +0 -294
- package/src/screens/network-viewer/device-details-modal.tsx +0 -339
- package/src/screens/network-viewer/group-details-modal.tsx +0 -421
- package/src/screens/network-viewer/index.ts +0 -8
- package/src/screens/network-viewer/network-viewer-ipc.test.ts +0 -72
- package/src/screens/network-viewer/network-viewer-ipc.ts +0 -39
- package/src/screens/network-viewer/network-viewer-section.ts +0 -12
- package/src/screens/network-viewer/network-viewer.section.test.tsx +0 -68
- package/src/screens/network-viewer/network-viewer.tsx +0 -708
- package/src/screens/network-viewer/remote-logs-panel.tsx +0 -190
- package/src/screens/network-viewer/sync-recovery.test.tsx +0 -114
- package/src/screens/network-viewer/sync-recovery.tsx +0 -461
- package/src/screens/network-viewer/usage-graph.tsx +0 -455
- package/src/screens/packages/local-folder-grants-panel.tsx +0 -290
- package/src/screens/packages/local-folders-ipc.ts +0 -28
- package/src/screens/packages/package-details.tsx +0 -166
- package/src/screens/packages/package-helpers.test.ts +0 -57
- package/src/screens/packages/package-helpers.ts +0 -137
- package/src/screens/packages/package-info.tsx +0 -354
- package/src/screens/packages/package-list.tsx +0 -519
- package/src/screens/packages/package-network-panel.tsx +0 -82
- package/src/screens/packages/package-new-local.tsx +0 -100
- package/src/screens/packages/package-runtime-status.test.tsx +0 -58
- package/src/screens/packages/package-runtime-status.tsx +0 -68
- package/src/screens/packages/package-versions.tsx +0 -298
- package/src/screens/packages/packages-ipc.test.ts +0 -47
- package/src/screens/packages/packages-ipc.ts +0 -125
- package/src/screens/peer-types/peer-type-details.tsx +0 -172
- package/src/screens/peer-types/peer-type-list.tsx +0 -64
- package/src/screens/search/global-search.tsx +0 -406
- package/src/screens/settings/color-mode-dropdown.tsx +0 -82
- package/src/screens/settings/settings-page.test.tsx +0 -24
- package/src/screens/settings/settings-page.tsx +0 -426
- package/src/screens/setup-user.tsx +0 -355
- package/src/screens/tools/tool-access-ipc.test.ts +0 -55
- package/src/screens/tools/tool-access-ipc.ts +0 -27
- package/src/screens/tools/tool-catalog-ipc.test.ts +0 -52
- package/src/screens/tools/tool-catalog-ipc.ts +0 -51
- package/src/screens/tools/tool-details.tsx +0 -52
- package/src/screens/tools/tool-info.tsx +0 -45
- package/src/screens/tools/tool-list.tsx +0 -106
- package/src/screens/tools/tool-schema.tsx +0 -44
- package/src/screens/tools/tool-test-details.tsx +0 -89
- package/src/screens/tools/tool-test-list.tsx +0 -73
- package/src/screens/variables/variable-details.tsx +0 -289
- package/src/screens/variables/variable-list.tsx +0 -110
- package/src/screens/welcome-modal.tsx +0 -294
- package/src/screens/workflows/workflow-details.tsx +0 -115
- package/src/screens/workflows/workflow-info.tsx +0 -22
- package/src/screens/workflows/workflow-instructions.tsx +0 -134
- package/src/screens/workflows/workflow-list.tsx +0 -117
- package/src/setupTests.ts +0 -38
- package/src/system-apps/assistants.app.ts +0 -7
- package/src/system-apps/console-logs.app.ts +0 -7
- package/src/system-apps/data-explorer.app.ts +0 -8
- package/src/system-apps/identity.app.ts +0 -9
- package/src/system-apps/index.ts +0 -77
- package/src/system-apps/mobile-settings.app.ts +0 -7
- package/src/system-apps/network-viewer.app.ts +0 -8
- package/src/system-apps/packages.app.ts +0 -7
- package/src/system-apps/search.app.ts +0 -8
- package/src/system-apps/settings.app.ts +0 -7
- package/src/system-apps/threads.app.ts +0 -7
- package/src/system-apps/tools.app.ts +0 -7
- package/src/system-apps/types.app.ts +0 -7
- package/src/system-apps/variables.app.ts +0 -7
- package/src/system-apps/workflows.app.ts +0 -7
- package/src/tabs-layout/network-status-indicator.test.tsx +0 -799
- package/src/tabs-layout/network-status-indicator.tsx +0 -756
- package/src/tabs-layout/tabs-layout.tsx +0 -857
- package/src/tabs-layout/tabs-state.test.ts +0 -152
- package/src/tabs-layout/tabs-state.ts +0 -587
- package/src/tabs-layout/use-network-status.test.tsx +0 -58
- package/src/tabs-layout/use-network-status.ts +0 -68
- package/src/ui-defaults/index.ts +0 -2
- package/src/ui-defaults/list-screen.tsx +0 -94
- package/src/ui-defaults/markdown-field.tsx +0 -87
- package/src/ui-router/routes-loader.ts +0 -193
- package/src/ui-router/ui-loader.test.tsx +0 -108
- package/src/ui-router/ui-loader.tsx +0 -606
- package/src/utils.ts +0 -95
- package/tsconfig.json +0 -18
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import { $isListItemNode, $isListNode } from "@lexical/list";
|
|
2
|
-
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
3
|
-
import type { Observable } from "@peers-app/peers-sdk";
|
|
4
|
-
import {
|
|
5
|
-
$createRangeSelection,
|
|
6
|
-
$getNodeByKey,
|
|
7
|
-
$getSelection,
|
|
8
|
-
$isElementNode,
|
|
9
|
-
$isRangeSelection,
|
|
10
|
-
$isRootOrShadowRoot,
|
|
11
|
-
$setSelection,
|
|
12
|
-
COMMAND_PRIORITY_HIGH,
|
|
13
|
-
KEY_DOWN_COMMAND,
|
|
14
|
-
type LexicalNode,
|
|
15
|
-
} from "lexical";
|
|
16
|
-
import { useEffect } from "react";
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Walks up from `node` to find the reorderable block for keyboard shortcuts that
|
|
20
|
-
* operate on "lines" (blocks). Returns a list item when inside a list, or the
|
|
21
|
-
* top-level block directly under the root.
|
|
22
|
-
*/
|
|
23
|
-
export function $getMovableBlock(node: LexicalNode): LexicalNode | null {
|
|
24
|
-
let n: LexicalNode | null = node;
|
|
25
|
-
while (n !== null) {
|
|
26
|
-
const parent: LexicalNode | null = n.getParent();
|
|
27
|
-
if (parent === null) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
if ($isListNode(parent) && $isListItemNode(n)) {
|
|
31
|
-
return n;
|
|
32
|
-
}
|
|
33
|
-
if ($isRootOrShadowRoot(parent)) {
|
|
34
|
-
return n;
|
|
35
|
-
}
|
|
36
|
-
n = parent;
|
|
37
|
-
}
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Returns true when `node` sits at the absolute start of `block` — i.e. it is
|
|
43
|
-
* the block itself or lies along the first-child path from block down to node.
|
|
44
|
-
* Used to detect a selection endpoint that bled into the next block at offset 0.
|
|
45
|
-
*/
|
|
46
|
-
function $isFirstPositionInBlock(node: LexicalNode, block: LexicalNode): boolean {
|
|
47
|
-
let n: LexicalNode | null = node;
|
|
48
|
-
while (n !== null && n !== block) {
|
|
49
|
-
if (n.getPreviousSibling() !== null) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
n = n.getParent();
|
|
53
|
-
}
|
|
54
|
-
return n === block;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Registers Alt/Option + ArrowUp/ArrowDown to move the selected block(s) — or the
|
|
59
|
-
* block at the caret — past an adjacent sibling. Supports both collapsed cursors and
|
|
60
|
-
* multi-block selections: the single neighbor block is relocated to the other side of
|
|
61
|
-
* the selection range, which effectively shifts the selected blocks up or down by one.
|
|
62
|
-
* @param props.mentionsOpen — when true, the plugin defers so mention typeahead keeps keyboard focus.
|
|
63
|
-
*/
|
|
64
|
-
export function MoveLineWithAltArrowsPlugin(props: { mentionsOpen: Observable<boolean> }) {
|
|
65
|
-
const [editor] = useLexicalComposerContext();
|
|
66
|
-
|
|
67
|
-
useEffect(() => {
|
|
68
|
-
return editor.registerCommand(
|
|
69
|
-
KEY_DOWN_COMMAND,
|
|
70
|
-
(event: KeyboardEvent) => {
|
|
71
|
-
if (props.mentionsOpen()) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
if (!event.altKey || event.metaKey || event.ctrlKey) {
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
|
-
const code = event.code;
|
|
78
|
-
if (code !== "ArrowUp" && code !== "ArrowDown") {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// KEY_DOWN_COMMAND runs inside Lexical's updateEditorSync; do not call
|
|
83
|
-
// editor.update() here — it would queue and run after this handler returns,
|
|
84
|
-
// so handled would stay false, preventDefault would never run, and the
|
|
85
|
-
// built-in arrow handler + browser would move the caret on top of our swap.
|
|
86
|
-
|
|
87
|
-
const selection = $getSelection();
|
|
88
|
-
if (!$isRangeSelection(selection)) {
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const anchorBlock = $getMovableBlock(selection.anchor.getNode());
|
|
93
|
-
const focusBlock = $getMovableBlock(selection.focus.getNode());
|
|
94
|
-
if (anchorBlock === null || focusBlock === null) {
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Both endpoints must share the same parent (same nesting level).
|
|
99
|
-
if (anchorBlock.getParent()?.getKey() !== focusBlock.getParent()?.getKey()) {
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const anchorIdx = anchorBlock.getIndexWithinParent();
|
|
104
|
-
const focusIdx = focusBlock.getIndexWithinParent();
|
|
105
|
-
const firstBlock = anchorIdx <= focusIdx ? anchorBlock : focusBlock;
|
|
106
|
-
let lastBlock = anchorIdx <= focusIdx ? focusBlock : anchorBlock;
|
|
107
|
-
|
|
108
|
-
let anchorKey = selection.anchor.key;
|
|
109
|
-
let anchorOffset = selection.anchor.offset;
|
|
110
|
-
let anchorType = selection.anchor.type;
|
|
111
|
-
let focusKey = selection.focus.key;
|
|
112
|
-
let focusOffset = selection.focus.offset;
|
|
113
|
-
let focusType = selection.focus.type;
|
|
114
|
-
|
|
115
|
-
// When a selection extends to offset 0 of the next block (common when
|
|
116
|
-
// selecting to "end of line"), that trailing block has no selected
|
|
117
|
-
// content — exclude it so it isn't dragged along. Also clamp the
|
|
118
|
-
// trailing selection endpoint to the end of the new lastBlock so the
|
|
119
|
-
// restored highlight doesn't overextend into the excluded block.
|
|
120
|
-
if (lastBlock !== firstBlock) {
|
|
121
|
-
const lastPoint = anchorIdx > focusIdx ? selection.anchor : selection.focus;
|
|
122
|
-
if (lastPoint.offset === 0 && $isFirstPositionInBlock(lastPoint.getNode(), lastBlock)) {
|
|
123
|
-
const stepped = lastBlock.getPreviousSibling();
|
|
124
|
-
if (stepped === null) {
|
|
125
|
-
return false;
|
|
126
|
-
}
|
|
127
|
-
lastBlock = stepped;
|
|
128
|
-
|
|
129
|
-
const lastDesc = $isElementNode(lastBlock) ? lastBlock.getLastDescendant() : null;
|
|
130
|
-
const clampKey = lastDesc ? lastDesc.getKey() : lastBlock.getKey();
|
|
131
|
-
const clampOffset = lastDesc
|
|
132
|
-
? lastDesc.getTextContentSize()
|
|
133
|
-
: $isElementNode(lastBlock)
|
|
134
|
-
? lastBlock.getChildrenSize()
|
|
135
|
-
: lastBlock.getTextContentSize();
|
|
136
|
-
const clampType: "text" | "element" = lastDesc
|
|
137
|
-
? "text"
|
|
138
|
-
: $isElementNode(lastBlock)
|
|
139
|
-
? "element"
|
|
140
|
-
: "text";
|
|
141
|
-
if (anchorIdx > focusIdx) {
|
|
142
|
-
anchorKey = clampKey;
|
|
143
|
-
anchorOffset = clampOffset;
|
|
144
|
-
anchorType = clampType;
|
|
145
|
-
} else {
|
|
146
|
-
focusKey = clampKey;
|
|
147
|
-
focusOffset = clampOffset;
|
|
148
|
-
focusType = clampType;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (code === "ArrowUp") {
|
|
154
|
-
const prev = firstBlock.getPreviousSibling();
|
|
155
|
-
if (prev === null) {
|
|
156
|
-
return false;
|
|
157
|
-
}
|
|
158
|
-
lastBlock.insertAfter(prev, false);
|
|
159
|
-
} else {
|
|
160
|
-
const next = lastBlock.getNextSibling();
|
|
161
|
-
if (next === null) {
|
|
162
|
-
return false;
|
|
163
|
-
}
|
|
164
|
-
firstBlock.insertBefore(next, false);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if ($getNodeByKey(anchorKey) !== null) {
|
|
168
|
-
const restored = $createRangeSelection();
|
|
169
|
-
restored.format = selection.format;
|
|
170
|
-
restored.style = selection.style;
|
|
171
|
-
restored.anchor.set(anchorKey, anchorOffset, anchorType);
|
|
172
|
-
restored.focus.set(focusKey, focusOffset, focusType);
|
|
173
|
-
$setSelection(restored);
|
|
174
|
-
} else {
|
|
175
|
-
lastBlock.selectEnd();
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
event.preventDefault();
|
|
179
|
-
return true;
|
|
180
|
-
},
|
|
181
|
-
COMMAND_PRIORITY_HIGH,
|
|
182
|
-
);
|
|
183
|
-
}, [editor]);
|
|
184
|
-
|
|
185
|
-
return null;
|
|
186
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
2
|
-
import {
|
|
3
|
-
$createRangeSelection,
|
|
4
|
-
$getNearestNodeFromDOMNode,
|
|
5
|
-
$getSelection,
|
|
6
|
-
$isRangeSelection,
|
|
7
|
-
$isTextNode,
|
|
8
|
-
$setSelection,
|
|
9
|
-
COMMAND_PRIORITY_HIGH,
|
|
10
|
-
KEY_DOWN_COMMAND,
|
|
11
|
-
} from "lexical";
|
|
12
|
-
import { useEffect } from "react";
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Intercepts Cmd+Shift+ArrowLeft/Right (Mac line-boundary selection) and explicitly
|
|
16
|
-
* sets anchor/focus so that Lexical's reconciliation cannot flip the selection direction.
|
|
17
|
-
* Uses the browser's native `Selection.modify` with `'lineboundary'` granularity to
|
|
18
|
-
* find the correct **visual** line boundary (respecting text wrapping), then converts
|
|
19
|
-
* the result back to Lexical coordinates.
|
|
20
|
-
*/
|
|
21
|
-
export function SelectToLineBoundaryPlugin() {
|
|
22
|
-
const [editor] = useLexicalComposerContext();
|
|
23
|
-
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
return editor.registerCommand(
|
|
26
|
-
KEY_DOWN_COMMAND,
|
|
27
|
-
(event: KeyboardEvent) => {
|
|
28
|
-
if (!event.shiftKey || !event.metaKey || event.altKey || event.ctrlKey) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
const code = event.code;
|
|
32
|
-
if (code !== "ArrowLeft" && code !== "ArrowRight") {
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const selection = $getSelection();
|
|
37
|
-
if (!$isRangeSelection(selection)) {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const savedAnchorKey = selection.anchor.key;
|
|
42
|
-
const savedAnchorOffset = selection.anchor.offset;
|
|
43
|
-
const savedAnchorType = selection.anchor.type;
|
|
44
|
-
|
|
45
|
-
const focusElement = editor.getElementByKey(selection.focus.key);
|
|
46
|
-
if (!focusElement) {
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
const focusDomNode =
|
|
50
|
-
selection.focus.type === "text" ? focusElement.firstChild : focusElement;
|
|
51
|
-
if (!focusDomNode) {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const domSelection = window.getSelection();
|
|
56
|
-
if (!domSelection) {
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
domSelection.collapse(focusDomNode, selection.focus.offset);
|
|
61
|
-
domSelection.modify("move", code === "ArrowLeft" ? "left" : "right", "lineboundary");
|
|
62
|
-
|
|
63
|
-
const boundaryDomNode = domSelection.anchorNode;
|
|
64
|
-
const boundaryDomOffset = domSelection.anchorOffset;
|
|
65
|
-
if (!boundaryDomNode) {
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const boundaryLexicalNode = $getNearestNodeFromDOMNode(boundaryDomNode);
|
|
70
|
-
if (!boundaryLexicalNode) {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const newFocusKey = boundaryLexicalNode.getKey();
|
|
75
|
-
const newFocusOffset = boundaryDomOffset;
|
|
76
|
-
const newFocusType: "text" | "element" = $isTextNode(boundaryLexicalNode)
|
|
77
|
-
? "text"
|
|
78
|
-
: "element";
|
|
79
|
-
|
|
80
|
-
const restored = $createRangeSelection();
|
|
81
|
-
restored.format = selection.format;
|
|
82
|
-
restored.style = selection.style;
|
|
83
|
-
restored.anchor.set(savedAnchorKey, savedAnchorOffset, savedAnchorType);
|
|
84
|
-
restored.focus.set(newFocusKey, newFocusOffset, newFocusType);
|
|
85
|
-
$setSelection(restored);
|
|
86
|
-
|
|
87
|
-
event.preventDefault();
|
|
88
|
-
return true;
|
|
89
|
-
},
|
|
90
|
-
COMMAND_PRIORITY_HIGH,
|
|
91
|
-
);
|
|
92
|
-
}, [editor]);
|
|
93
|
-
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
@@ -1,46 +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
|
-
export default {
|
|
9
|
-
code: "editor-code",
|
|
10
|
-
heading: {
|
|
11
|
-
h1: "editor-heading-h1",
|
|
12
|
-
h2: "editor-heading-h2",
|
|
13
|
-
h3: "editor-heading-h3",
|
|
14
|
-
h4: "editor-heading-h4",
|
|
15
|
-
h5: "editor-heading-h5",
|
|
16
|
-
},
|
|
17
|
-
image: "editor-image",
|
|
18
|
-
link: "editor-link",
|
|
19
|
-
list: {
|
|
20
|
-
listitem: "editor-listitem",
|
|
21
|
-
nested: {
|
|
22
|
-
// listitem: 'editor-nested-listitem',
|
|
23
|
-
listitem: "PlaygroundEditorTheme__nestedListItem",
|
|
24
|
-
},
|
|
25
|
-
ol: "editor-list-ol",
|
|
26
|
-
ul: "editor-list-ul",
|
|
27
|
-
checklist: "PlaygroundEditorTheme__checklist",
|
|
28
|
-
listitemChecked: "PlaygroundEditorTheme__listItemChecked",
|
|
29
|
-
listitemUnchecked: "PlaygroundEditorTheme__listItemUnchecked",
|
|
30
|
-
},
|
|
31
|
-
ltr: "ltr",
|
|
32
|
-
paragraph: "editor-paragraph",
|
|
33
|
-
placeholder: "editor-placeholder",
|
|
34
|
-
quote: "editor-quote",
|
|
35
|
-
rtl: "rtl",
|
|
36
|
-
text: {
|
|
37
|
-
bold: "editor-text-bold",
|
|
38
|
-
code: "editor-text-code",
|
|
39
|
-
hashtag: "editor-text-hashtag",
|
|
40
|
-
italic: "editor-text-italic",
|
|
41
|
-
overflowed: "editor-text-overflowed",
|
|
42
|
-
strikethrough: "editor-text-strikethrough",
|
|
43
|
-
underline: "editor-text-underline",
|
|
44
|
-
underlineStrikethrough: "editor-text-underlineStrikethrough",
|
|
45
|
-
},
|
|
46
|
-
};
|
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
INSERT_CHECK_LIST_COMMAND,
|
|
3
|
-
INSERT_ORDERED_LIST_COMMAND,
|
|
4
|
-
INSERT_UNORDERED_LIST_COMMAND,
|
|
5
|
-
REMOVE_LIST_COMMAND,
|
|
6
|
-
} from "@lexical/list";
|
|
7
|
-
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
8
|
-
import { mergeRegister } from "@lexical/utils";
|
|
9
|
-
import {
|
|
10
|
-
$getSelection,
|
|
11
|
-
$isRangeSelection,
|
|
12
|
-
CAN_REDO_COMMAND,
|
|
13
|
-
CAN_UNDO_COMMAND,
|
|
14
|
-
FORMAT_TEXT_COMMAND,
|
|
15
|
-
SELECTION_CHANGE_COMMAND,
|
|
16
|
-
} from "lexical";
|
|
17
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
18
|
-
|
|
19
|
-
const LowPriority = 1;
|
|
20
|
-
|
|
21
|
-
function Divider() {
|
|
22
|
-
return <span className="tool-bar-divider"></span>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface IToolbarControl {
|
|
26
|
-
iconClass: string;
|
|
27
|
-
onClick: () => void;
|
|
28
|
-
title?: string;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface IToolbarProps {
|
|
32
|
-
topRightControls?: IToolbarControl[];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function ToolbarPlugin(props: IToolbarProps) {
|
|
36
|
-
const [editor] = useLexicalComposerContext();
|
|
37
|
-
const toolbarRef = useRef(null);
|
|
38
|
-
const [_canUndo, setCanUndo] = useState(false);
|
|
39
|
-
const [_canRedo, setCanRedo] = useState(false);
|
|
40
|
-
const [isBold, setIsBold] = useState(false);
|
|
41
|
-
const [isItalic, setIsItalic] = useState(false);
|
|
42
|
-
const [_isUnderline, setIsUnderline] = useState(false);
|
|
43
|
-
const [isStrikethrough, setIsStrikethrough] = useState(false);
|
|
44
|
-
// New state for list types
|
|
45
|
-
const [isUnorderedList, setIsUnorderedList] = useState(false);
|
|
46
|
-
const [isOrderedList, setIsOrderedList] = useState(false);
|
|
47
|
-
const [isCheckList, setIsCheckList] = useState(false);
|
|
48
|
-
|
|
49
|
-
const $updateToolbar = useCallback(() => {
|
|
50
|
-
const selection = $getSelection();
|
|
51
|
-
if ($isRangeSelection(selection)) {
|
|
52
|
-
// Update text format
|
|
53
|
-
setIsBold(selection.hasFormat("bold"));
|
|
54
|
-
setIsItalic(selection.hasFormat("italic"));
|
|
55
|
-
setIsUnderline(selection.hasFormat("underline"));
|
|
56
|
-
setIsStrikethrough(selection.hasFormat("strikethrough"));
|
|
57
|
-
|
|
58
|
-
// Update list format
|
|
59
|
-
const anchorNode = selection.anchor.getNode();
|
|
60
|
-
const element =
|
|
61
|
-
anchorNode.getKey() === "root" ? anchorNode : anchorNode.getTopLevelElementOrThrow();
|
|
62
|
-
const elementKey = element.getKey();
|
|
63
|
-
const elementDOM = editor.getElementByKey(elementKey);
|
|
64
|
-
if (elementDOM !== null) {
|
|
65
|
-
setIsUnorderedList(elementDOM.tagName === "UL");
|
|
66
|
-
setIsOrderedList(elementDOM.tagName === "OL");
|
|
67
|
-
setIsCheckList(
|
|
68
|
-
elementDOM.tagName === "UL" &&
|
|
69
|
-
elementDOM.classList.contains("PlaygroundEditorTheme__checklist"),
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}, [editor]);
|
|
74
|
-
|
|
75
|
-
useEffect(() => {
|
|
76
|
-
return mergeRegister(
|
|
77
|
-
editor.registerUpdateListener(({ editorState }) => {
|
|
78
|
-
editorState.read(() => {
|
|
79
|
-
$updateToolbar();
|
|
80
|
-
});
|
|
81
|
-
}),
|
|
82
|
-
editor.registerCommand(
|
|
83
|
-
SELECTION_CHANGE_COMMAND,
|
|
84
|
-
(_payload, _newEditor) => {
|
|
85
|
-
$updateToolbar();
|
|
86
|
-
return false;
|
|
87
|
-
},
|
|
88
|
-
LowPriority,
|
|
89
|
-
),
|
|
90
|
-
editor.registerCommand(
|
|
91
|
-
CAN_UNDO_COMMAND,
|
|
92
|
-
(payload) => {
|
|
93
|
-
setCanUndo(payload);
|
|
94
|
-
return false;
|
|
95
|
-
},
|
|
96
|
-
LowPriority,
|
|
97
|
-
),
|
|
98
|
-
editor.registerCommand(
|
|
99
|
-
CAN_REDO_COMMAND,
|
|
100
|
-
(payload) => {
|
|
101
|
-
setCanRedo(payload);
|
|
102
|
-
return false;
|
|
103
|
-
},
|
|
104
|
-
LowPriority,
|
|
105
|
-
),
|
|
106
|
-
);
|
|
107
|
-
}, [editor, $updateToolbar]);
|
|
108
|
-
|
|
109
|
-
const insertUnorderedList = () => {
|
|
110
|
-
if (isUnorderedList) {
|
|
111
|
-
editor.dispatchCommand(REMOVE_LIST_COMMAND, undefined);
|
|
112
|
-
} else {
|
|
113
|
-
editor.dispatchCommand(INSERT_UNORDERED_LIST_COMMAND, undefined);
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
const insertOrderedList = () => {
|
|
118
|
-
if (isOrderedList) {
|
|
119
|
-
editor.dispatchCommand(REMOVE_LIST_COMMAND, undefined);
|
|
120
|
-
} else {
|
|
121
|
-
editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, undefined);
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
const insertCheckList = () => {
|
|
126
|
-
if (isCheckList) {
|
|
127
|
-
editor.dispatchCommand(REMOVE_LIST_COMMAND, undefined);
|
|
128
|
-
} else {
|
|
129
|
-
editor.dispatchCommand(INSERT_CHECK_LIST_COMMAND, undefined);
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
return (
|
|
134
|
-
<div className="toolbar" ref={toolbarRef}>
|
|
135
|
-
{/* <button
|
|
136
|
-
disabled={!canUndo}
|
|
137
|
-
onClick={() => {
|
|
138
|
-
editor.dispatchCommand(UNDO_COMMAND, undefined);
|
|
139
|
-
}}
|
|
140
|
-
className="toolbar-item spaced"
|
|
141
|
-
aria-label="Undo">
|
|
142
|
-
<i className="bi bi-arrow-counterclockwise" />
|
|
143
|
-
</button>
|
|
144
|
-
<button
|
|
145
|
-
disabled={!canRedo}
|
|
146
|
-
onClick={() => {
|
|
147
|
-
editor.dispatchCommand(REDO_COMMAND, undefined);
|
|
148
|
-
}}
|
|
149
|
-
className="toolbar-item"
|
|
150
|
-
aria-label="Redo">
|
|
151
|
-
<i className="bi bi-arrow-clockwise" />
|
|
152
|
-
</button>
|
|
153
|
-
<Divider /> */}
|
|
154
|
-
<button
|
|
155
|
-
onClick={() => {
|
|
156
|
-
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "bold");
|
|
157
|
-
}}
|
|
158
|
-
tabIndex={-1}
|
|
159
|
-
className={`toolbar-item spaced ${isBold ? "active" : ""}`}
|
|
160
|
-
aria-label="Format Bold"
|
|
161
|
-
>
|
|
162
|
-
<i className="bi bi-type-bold" />
|
|
163
|
-
</button>
|
|
164
|
-
<button
|
|
165
|
-
tabIndex={-1}
|
|
166
|
-
onClick={() => {
|
|
167
|
-
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "italic");
|
|
168
|
-
}}
|
|
169
|
-
className={`toolbar-item spaced ${isItalic ? "active" : ""}`}
|
|
170
|
-
aria-label="Format Italics"
|
|
171
|
-
>
|
|
172
|
-
<i className="bi bi-type-italic" />
|
|
173
|
-
</button>
|
|
174
|
-
{/* <button
|
|
175
|
-
onClick={() => {
|
|
176
|
-
editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'underline');
|
|
177
|
-
}}
|
|
178
|
-
className={'toolbar-item spaced ' + (isUnderline ? 'active' : '')}
|
|
179
|
-
aria-label="Format Underline">
|
|
180
|
-
<i className="bi bi-type-underline" />
|
|
181
|
-
</button> */}
|
|
182
|
-
<button
|
|
183
|
-
tabIndex={-1}
|
|
184
|
-
onClick={() => {
|
|
185
|
-
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "strikethrough");
|
|
186
|
-
}}
|
|
187
|
-
className={`toolbar-item spaced ${isStrikethrough ? "active" : ""}`}
|
|
188
|
-
aria-label="Format Strikethrough"
|
|
189
|
-
>
|
|
190
|
-
<i className="bi bi-type-strikethrough" />
|
|
191
|
-
</button>
|
|
192
|
-
<Divider />
|
|
193
|
-
{/* <button
|
|
194
|
-
onClick={() => {
|
|
195
|
-
editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'left');
|
|
196
|
-
}}
|
|
197
|
-
className="toolbar-item spaced"
|
|
198
|
-
aria-label="Left Align">
|
|
199
|
-
<i className="bi bi-text-left" />
|
|
200
|
-
</button>
|
|
201
|
-
<button
|
|
202
|
-
onClick={() => {
|
|
203
|
-
editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'center');
|
|
204
|
-
}}
|
|
205
|
-
className="toolbar-item spaced"
|
|
206
|
-
aria-label="Center Align">
|
|
207
|
-
<i className="bi bi-text-center" />
|
|
208
|
-
</button>
|
|
209
|
-
<button
|
|
210
|
-
onClick={() => {
|
|
211
|
-
editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'right');
|
|
212
|
-
}}
|
|
213
|
-
className="toolbar-item spaced"
|
|
214
|
-
aria-label="Right Align">
|
|
215
|
-
<i className="bi bi-text-right" />
|
|
216
|
-
</button>
|
|
217
|
-
<button
|
|
218
|
-
onClick={() => {
|
|
219
|
-
editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'justify');
|
|
220
|
-
}}
|
|
221
|
-
className="toolbar-item"
|
|
222
|
-
aria-label="Justify Align">
|
|
223
|
-
<i className="bi bi-justify" />
|
|
224
|
-
</button>{' '} */}
|
|
225
|
-
{/* <Divider /> */}
|
|
226
|
-
<button
|
|
227
|
-
tabIndex={-1}
|
|
228
|
-
onClick={insertUnorderedList}
|
|
229
|
-
className={`toolbar-item spaced ${isUnorderedList ? "active" : ""}`}
|
|
230
|
-
aria-label="Insert Unordered List"
|
|
231
|
-
>
|
|
232
|
-
<i className="bi bi-list-ul" />
|
|
233
|
-
</button>
|
|
234
|
-
<button
|
|
235
|
-
tabIndex={-1}
|
|
236
|
-
onClick={insertOrderedList}
|
|
237
|
-
className={`toolbar-item spaced ${isOrderedList ? "active" : ""}`}
|
|
238
|
-
aria-label="Insert Ordered List"
|
|
239
|
-
>
|
|
240
|
-
<i className="bi bi-list-ol" />
|
|
241
|
-
</button>
|
|
242
|
-
<button
|
|
243
|
-
tabIndex={-1}
|
|
244
|
-
onClick={insertCheckList}
|
|
245
|
-
className={`toolbar-item spaced ${isCheckList ? "active" : ""}`}
|
|
246
|
-
aria-label="Insert Check List"
|
|
247
|
-
>
|
|
248
|
-
<i className="bi bi-list-check" />
|
|
249
|
-
</button>
|
|
250
|
-
|
|
251
|
-
{(props.topRightControls?.length ?? 0) > 0 && (
|
|
252
|
-
<div className="float-end">
|
|
253
|
-
{props.topRightControls?.map((control) => (
|
|
254
|
-
<button
|
|
255
|
-
key={control.title}
|
|
256
|
-
tabIndex={-1}
|
|
257
|
-
onClick={control.onClick}
|
|
258
|
-
className={"toolbar-item spaced active"}
|
|
259
|
-
aria-label="Insert Check List"
|
|
260
|
-
title={control.title}
|
|
261
|
-
>
|
|
262
|
-
<i className={control.iconClass} />
|
|
263
|
-
</button>
|
|
264
|
-
))}
|
|
265
|
-
</div>
|
|
266
|
-
)}
|
|
267
|
-
</div>
|
|
268
|
-
);
|
|
269
|
-
}
|