Skip to content

Commit

Permalink
chore: release to 0.8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Nov 1, 2024
1 parent f0f24d4 commit 2fcdea5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion web/core/lib/editor/extensions/advice/advice-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Editor } from "@tiptap/core"
import React, { useEffect, useRef, useState } from "react";
import { AdviceManager } from "@/editor/extensions/advice/advice-manager";
import { Advice } from "@/editor/extensions/advice/advice";
import { MarkdownParser } from '@/../node_modules/tiptap-markdown/src/parse/MarkdownParser';

export interface AdviceViewProps {
editor: Editor
Expand Down Expand Up @@ -78,7 +79,17 @@ export const AdviceView = ({ editor }: AdviceViewProps) => {
<button
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?.replaceRange(advice.content)
const originalSelection = editor.state.selection;
const markdownParser = new MarkdownParser(editor, {});
const markdownNode = markdownParser.parse(advice.content)

editor.chain().focus()?.deleteRange({
from: originalSelection.from,
to: editor.state.selection.to
}).run();

editor.chain().insertContentAt(editor.state.selection, markdownNode).run();

setActiveId(null)
editor.commands.unsetAdvice(advice.id)
AdviceManager.getInstance().removeAdvice(advice.id)
Expand Down
2 changes: 1 addition & 1 deletion web/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@studio-b3/web-core",
"version": "0.8.6",
"version": "0.8.7",
"type": "module",
"main": "dist/main.js",
"types": "dist-types/main.d.ts",
Expand Down

0 comments on commit 2fcdea5

Please sign in to comment.