Skip to content

Commit

Permalink
refactor: update for styles
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Dec 13, 2023
1 parent cb5f52e commit b743751
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
16 changes: 3 additions & 13 deletions web/core/lib/editor/extensions/diff/track-change-extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,9 @@
* based on: https://github.com/chenyuncai/tiptap-track-change-extension
*/
import { ReplaceStep, Step } from '@tiptap/pm/transform';
import { TextSelection, Plugin, PluginKey } from '@tiptap/pm/state';
import { Plugin, PluginKey, TextSelection } from '@tiptap/pm/state';
import { Slice } from '@tiptap/pm/model';
import {
Extension,
Mark,
getMarkRange,
getMarksBetween,
isMarkActive,
mergeAttributes,
Editor
} from '@tiptap/core';
import { Editor, Extension, getMarkRange, getMarksBetween, isMarkActive, Mark, mergeAttributes } from '@tiptap/core';
import { MarkRange } from '@tiptap/core/src/types.ts';
import { CommandProps } from '@tiptap/react';

Expand Down Expand Up @@ -327,13 +319,11 @@ export const TrackChangeExtension = Extension.create<{ enabled: boolean, onStatu
param.editor.state.doc.content.size,
param.editor.state.doc
);
console.log(markRanges);
const hasChange = markRanges.some(
return markRanges.some(
(markRange) =>
markRange.mark.type.name === MARK_DELETION ||
markRange.mark.type.name === MARK_INSERTION
);
return hasChange;
},
acceptChange: () => (param) => {
changeTrack('accept', param);
Expand Down
4 changes: 2 additions & 2 deletions web/core/lib/editor/menu/menu-bubble.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ export const MenuBubble = ({ editor } : {
return <BubbleMenu className={`bubble-menu-group w-64`} editor={editor} updateDelay={800}>
{isShowAccept && <div className={'change-buttons'}>
<button
className={'accept-change'}
className='rounded-md bg-red-500 px-2.5 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-white/20'
onClick={() => {
editor?.commands?.acceptChange();
}}
>Accept
</button>
<button
className={'reject-change'}
className='rounded-md bg-white/10 px-2.5 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-white/20'
onClick={() => {
editor?.commands?.rejectChange();
}}
Expand Down

0 comments on commit b743751

Please sign in to comment.