Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: provide find and replace functionality for the default rich text editor #5206

Merged
merged 6 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions console/packages/editor/src/components/EditorHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function getToolboxItemsFromExtensions() {
>
<div class="inline-flex items-center justify-center">
<VMenu>
<button class="p-1 rounded-sm hover:bg-gray-100">
<button class="p-1 rounded-sm hover:bg-gray-100" tabindex="-1">
<MdiPlusCircle class="text-[#4CCBA0]" />
</button>
<template #popper>
Expand All @@ -75,6 +75,7 @@ function getToolboxItemsFromExtensions() {
v-for="(toolboxItem, index) in getToolboxItemsFromExtensions()"
v-bind="toolboxItem.props"
:key="index"
tabindex="-1"
/>
</div>
</template>
Expand All @@ -90,9 +91,10 @@ function getToolboxItemsFromExtensions() {
:is="item.component"
v-if="!item.children?.length"
v-bind="item.props"
tabindex="-1"
/>
<VMenu v-else class="inline-flex">
<component :is="item.component" v-bind="item.props" />
<VMenu v-else class="inline-flex" tabindex="-1">
<component :is="item.component" v-bind="item.props" tabindex="-1" />
<template #popper>
<div
class="relative rounded-md bg-white overflow-hidden drop-shadow w-48 p-1 max-h-72 overflow-y-auto"
Expand All @@ -102,6 +104,7 @@ function getToolboxItemsFromExtensions() {
:is="child.component"
v-for="(child, childIndex) in item.children"
:key="childIndex"
tabindex="-1"
/>
</div>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ withDefaults(
]"
class="p-1 rounded-sm"
:disabled="disabled"
tabindex="-1"
@click="action"
>
<component :is="icon" />
Expand Down
2 changes: 2 additions & 0 deletions console/packages/editor/src/dev/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
ExtensionNodeSelected,
ExtensionTrailingNode,
ExtensionListKeymap,
ExtensionSearchAndReplace,
} from "../index";

const content = useLocalStorage("content", "");
Expand Down Expand Up @@ -109,6 +110,7 @@ const editor = useEditor({
ExtensionNodeSelected,
ExtensionTrailingNode,
ExtensionListKeymap,
ExtensionSearchAndReplace,
],
onUpdate: () => {
content.value = editor.value?.getHTML() + "";
Expand Down
3 changes: 3 additions & 0 deletions console/packages/editor/src/extensions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import ExtensionText from "./text";
import ExtensionDraggable from "./draggable";
import ExtensionNodeSelected from "./node-selected";
import ExtensionTrailingNode from "./trailing-node";
import ExtensionSearchAndReplace from "./search-and-replace";

const allExtensions = [
ExtensionBlockquote,
Expand Down Expand Up @@ -98,6 +99,7 @@ const allExtensions = [
ExtensionColumn,
ExtensionNodeSelected,
ExtensionTrailingNode,
ExtensionSearchAndReplace,
];

export {
Expand Down Expand Up @@ -144,4 +146,5 @@ export {
ExtensionNodeSelected,
ExtensionTrailingNode,
ExtensionListKeymap,
ExtensionSearchAndReplace,
};
Loading
Loading