Skip to content

Commit 37497ef

Browse files
committed
refactor: rename slashMenu to contextMenu across codebase (SD-1824)
Rename all slashMenu references to contextMenu for consistency: - Rename extension dir/files: slash-menu/ → context-menu/ - Rename component dir/files: SlashMenu.vue → ContextMenu.vue - Update config keys: slashMenuConfig → contextMenuConfig - Update events: slashMenu:open/close → contextMenu:open/close - Update CSS classes: .slash-menu-* → .context-menu-* - Update exports, types, docs, and tests - Add backward-compat aliases with deprecation warnings
1 parent db46bf8 commit 37497ef

35 files changed

Lines changed: 460 additions & 425 deletions

apps/docs/docs.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@
153153
"extensions/search",
154154
"extensions/shape-container",
155155
"extensions/shape-textbox",
156-
"extensions/slash-menu",
156+
"extensions/context-menu",
157157
"extensions/strike",
158158
"extensions/structured-content",
159159
"extensions/tab",
@@ -382,6 +382,10 @@
382382
"source": "/modules/collaboration/self-hosted/overview",
383383
"destination": "/guides/collaboration/self-hosted-overview"
384384
},
385+
{
386+
"source": "/extensions/slash-menu",
387+
"destination": "/extensions/context-menu"
388+
},
385389
{
386390
"source": "/guides/breaking-changes-v1",
387391
"destination": "/guides/migration/breaking-changes-v1"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
title: ContextMenu extension
3+
sidebarTitle: "Context Menu"
4+
keywords: "ContextMenu extension, superdoc ContextMenu, word ContextMenu, document ContextMenu, docx ContextMenu"
5+
---
6+
7+
import Description from '/snippets/extensions/context-menu.mdx'
8+
9+
<Description />
10+
11+
12+
## Source code
13+
14+
import { SourceCodeLink } from '/snippets/components/source-code-link.jsx'
15+
16+
<SourceCodeLink path="packages/super-editor/src/extensions/context-menu/context-menu.js" />

apps/docs/extensions/slash-menu.mdx

Lines changed: 0 additions & 16 deletions
This file was deleted.

apps/docs/modules/context-menu.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ new SuperDoc({
2424
new SuperDoc({
2525
selector: '#editor',
2626
modules: {
27-
slashMenu: {
27+
contextMenu: {
2828
includeDefaultItems: true,
2929
customItems: [],
3030
menuProvider: null
@@ -37,15 +37,15 @@ new SuperDoc({
3737
Top-level option to disable the context menu entirely
3838
</ParamField>
3939

40-
<ParamField path="modules.slashMenu.includeDefaultItems" type="boolean" default="true">
40+
<ParamField path="modules.contextMenu.includeDefaultItems" type="boolean" default="true">
4141
Whether to include the built-in menu items
4242
</ParamField>
4343

44-
<ParamField path="modules.slashMenu.customItems" type="Array" default="[]">
44+
<ParamField path="modules.contextMenu.customItems" type="Array" default="[]">
4545
Custom menu sections to add or merge. See [Custom Items](#custom-items).
4646
</ParamField>
4747

48-
<ParamField path="modules.slashMenu.menuProvider" type="function">
48+
<ParamField path="modules.contextMenu.menuProvider" type="function">
4949
Advanced: function to fully control menu contents. See [Menu Provider](#menu-provider).
5050
</ParamField>
5151

@@ -72,7 +72,7 @@ Add custom items by defining sections in `customItems`. Each section has an `id`
7272

7373
```javascript
7474
modules: {
75-
slashMenu: {
75+
contextMenu: {
7676
customItems: [{
7777
id: 'my-actions',
7878
items: [
@@ -129,7 +129,7 @@ If a custom section has the same `id` as a default section, the items are merged
129129

130130
```javascript
131131
modules: {
132-
slashMenu: {
132+
contextMenu: {
133133
customItems: [{
134134
// Adds items to the existing 'general' section
135135
id: 'general',
@@ -151,7 +151,7 @@ For full control over menu contents, use `menuProvider`. It receives the context
151151

152152
```javascript
153153
modules: {
154-
slashMenu: {
154+
contextMenu: {
155155
menuProvider: (context, sections) => {
156156
// Filter out clipboard section in editing mode
157157
if (context.documentMode === 'editing') {

apps/docs/modules/overview.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const superdoc = new SuperDoc({
1414
toolbar: { selector: '#toolbar' },
1515
comments: { allowResolve: true },
1616
collaboration: { ydoc, provider },
17-
slashMenu: { includeDefaultItems: true }
17+
contextMenu: { includeDefaultItems: true }
1818
}
1919
});
2020
```

apps/docs/scripts/sync-sdk-docs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const SUPPORTED = [
4040
'search',
4141
'shape-container',
4242
'shape-textbox',
43-
'slash-menu',
43+
'context-menu',
4444
'strike',
4545
'structured-content', // contains document-section
4646
'tab',
File renamed without changes.

packages/super-editor/src/components/SuperEditor.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ vi.mock('./cursor-helpers.js', () => ({
4343
checkNodeSpecificClicks: checkNodeSpecificClicksMock,
4444
}));
4545

46-
vi.mock('./slash-menu/SlashMenu.vue', () => ({
47-
default: { name: 'SlashMenu', render: () => null },
46+
vi.mock('./context-menu/ContextMenu.vue', () => ({
47+
default: { name: 'ContextMenu', render: () => null },
4848
}));
4949

5050
vi.mock('./rulers/Ruler.vue', () => ({

packages/super-editor/src/components/SuperEditor.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ref, onMounted, onBeforeUnmount, shallowRef, reactive, markRaw, compute
55
import { Editor } from '@superdoc/super-editor';
66
import { PresentationEditor } from '@core/presentation-editor/index.js';
77
import { getStarterExtensions } from '@extensions/index.js';
8-
import SlashMenu from './slash-menu/SlashMenu.vue';
8+
import ContextMenu from './context-menu/ContextMenu.vue';
99
import { onMarginClickCursorChange } from './cursor-helpers.js';
1010
import Ruler from './rulers/Ruler.vue';
1111
import GenericPopover from './popovers/GenericPopover.vue';
@@ -987,7 +987,7 @@ const handleMarginClick = (event) => {
987987
if (target?.classList?.contains('ProseMirror')) return;
988988
989989
// Causes issues with node selection.
990-
if (target?.closest?.('.presentation-editor, .superdoc-layout, .slash-menu')) {
990+
if (target?.closest?.('.presentation-editor, .superdoc-layout, .context-menu')) {
991991
return;
992992
}
993993
@@ -1075,8 +1075,8 @@ onBeforeUnmount(() => {
10751075
@mouseleave="handleOverlayHide"
10761076
>
10771077
<div ref="editorElem" class="editor-element super-editor__element" role="presentation"></div>
1078-
<!-- Single SlashMenu component, no Teleport needed -->
1079-
<SlashMenu
1078+
<!-- Single ContextMenu component, no Teleport needed -->
1079+
<ContextMenu
10801080
v-if="!contextMenuDisabled && editorReady && activeEditor"
10811081
:editor="activeEditor"
10821082
:popoverControls="popoverControls"

0 commit comments

Comments
 (0)