Skip to content

Commit

Permalink
fix: fix examples for title
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Nov 23, 2023
1 parent 61847c9 commit 6aabed8
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 37 deletions.
75 changes: 39 additions & 36 deletions components/editor/intelli/menu/menu-bubble.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,51 @@ export const MenuBubble = ({ editor }) => {
const selection = editor.commands.getSelectedText()
let selectLength = selection?.length ? selection.length : 0


// 根据长度优化
return <BubbleMenu className={'ToggleGroup'} editor={editor} tippyOptions={{ duration: 100 }}>
{selectLength < 64 && <div className={'BubbleMenuGroup'}>
<button
<div className={'BubbleMenuGroup'}>
{editor.isActive('heading', { level: 1 }) && <button
value="left" aria-label="Left aligned"
className={editor.isActive('bold') ? 'is-active BubbleMenuItem' : 'BubbleMenuItem'}
>扩写</button>
</div>
}
{selectLength > 64 && <div className={'BubbleMenuGroup'}>
<button
onClick={() => {
editor.commands.setTrackChangeStatus(true)

const selection = editor.state.selection
editor.chain().focus().insertContentAt({
from: selection.from,
to: selection.to
}, '永和九年,岁在癸丑,暮春之初,会于会稽山阴之兰亭,修禊事也。群贤毕至,少长咸集。此地有崇山峻岭,茂林修竹;又有清流激湍,映带左右').run()


let content1 = '永和九年,岁在癸丑,暮春之初,会于会稽山阴之兰亭,修禊事也。群贤毕至,少长咸集。此地有崇山峻岭,茂林修竹;又有清流激湍,映带左右'
let content2 = '岁在癸丑,暮春之初,会于会稽山阴之兰亭,修禊事也。群贤毕至,少长咸集。此地有崇山峻岭,茂林修竹;又有清流激湍,映带左右'
let diff = []
let output = computeDiff(content1, content2, diff)
console.log(output)

editor.commands.setTrackChangeStatus(false)
}}
>优化标题</button>
}
{selectLength < 64 && <button
value="left" aria-label="Left aligned"
className={editor.isActive('bold') ? 'is-active BubbleMenuItem' : 'BubbleMenuItem'}
>
<MagicWandIcon/> 优化表达
</button>
<button
value="right" aria-label="Left aligned"
className={editor.isActive('bold') ? 'is-active BubbleMenuItem' : 'BubbleMenuItem'}
>
精炼内容
</button>
>扩写</button>
}
{selectLength > 64 && <>
<button
onClick={() => {
editor.commands.setTrackChangeStatus(true)

const selection = editor.state.selection
editor.chain().focus().insertContentAt({
from: selection.from,
to: selection.to
}, '永和九年,岁在癸丑,暮春之初,会于会稽山阴之兰亭,修禊事也。群贤毕至,少长咸集。此地有崇山峻岭,茂林修竹;又有清流激湍,映带左右').run()

let content1 = '永和九年,岁在癸丑,暮春之初,会于会稽山阴之兰亭,修禊事也。群贤毕至,少长咸集。此地有崇山峻岭,茂林修竹;又有清流激湍,映带左右'
let content2 = '岁在癸丑,暮春之初,会于会稽山阴之兰亭,修禊事也。群贤毕至,少长咸集。此地有崇山峻岭,茂林修竹;又有清流激湍,映带左右'
let diff = []
let output = computeDiff(content1, content2, diff)
console.log(output)

editor.commands.setTrackChangeStatus(false)
}}
value="left" aria-label="Left aligned"
className={editor.isActive('bold') ? 'is-active BubbleMenuItem' : 'BubbleMenuItem'}
>
<MagicWandIcon/> 优化表达
</button>
<button
value="right" aria-label="Left aligned"
className={editor.isActive('bold') ? 'is-active BubbleMenuItem' : 'BubbleMenuItem'}
>
精炼内容
</button>
</>
}
</div>
}
</BubbleMenu>
}
4 changes: 3 additions & 1 deletion components/editor/live-editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,16 @@ const extensions = [
]

const content = `
## 3B editor
# 3B editor
Hi there, 3B is editor for Unit Mesh architecture paradigms, the next-gen software architecture.
1. use \`/\` to trigger AI commands.
2. use \`Alt\` + \`/\` or \`Command\` + \`/\` to show custom input box.
3. select text and right click to see the context menu.
## Inline AI
Chinese text for testing grammar and spellings, select long text to see the menu.
永和九年,岁在癸丑,暮春之初,会于会稽山阴之兰亭,修禊事也。群贤毕至,少长咸集。此地有崇山峻岭,茂林修竹;又有清流激湍,映带左右,引以为流觞曲水,
Expand Down

0 comments on commit 6aabed8

Please sign in to comment.