Skip to content

Commit

Permalink
Merge branch 'main' of github.com:sveltor/nextlint
Browse files Browse the repository at this point in the history
  • Loading branch information
lynhan318 committed Apr 2, 2024
2 parents 2c43319 + 2d84060 commit 3b57805
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 22 deletions.
5 changes: 5 additions & 0 deletions .changeset/angry-jars-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@nextlint/svelte': patch
---

fix: hide preview link when cursor out'
5 changes: 0 additions & 5 deletions .changeset/cuddly-bats-admire.md

This file was deleted.

6 changes: 6 additions & 0 deletions .changeset/slimy-melons-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@nextlint/svelte': patch
'@nextlint/core': patch
---

remove log
4 changes: 1 addition & 3 deletions packages/core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ export const nodeIdDecorator = (plugin: TiptapNode) => {
return plugin;
};
export const extractTOC = (root: HTMLElement) => {
root.childNodes.forEach(child => {
console.log('childNOde', child);
});
root.childNodes.forEach(child => {});
};

export const getRootNode = (editor: Editor) => {
Expand Down
6 changes: 6 additions & 0 deletions packages/svelte/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @nextlint/editor

## 3.0.1

### Patch Changes

- [`7da1e24`](https://github.com/sveltor/nextlint/commit/7da1e243a5f43c1316a0c205cb08be9b82e6569a) Thanks [@lynhan318](https://github.com/lynhan318)! - replace shikijs with shiki, add more support languages

## 3.0.0

### Major Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nextlint/svelte",
"version": "3.0.0",
"version": "3.0.1",
"scripts": {
"playground": "vite dev",
"dev": "pnpm dev:package",
Expand Down
1 change: 0 additions & 1 deletion packages/svelte/src/lib/plugins/image/EmbedTab.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
const {editor, getPos, deleteNode} = $props;
if (typeof getPos === 'function') {
console.log('deleteNode');
const pos = getPos();
deleteNode();
editor
Expand Down
31 changes: 20 additions & 11 deletions packages/svelte/src/lib/plugins/link/tiptap-link-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,33 @@ export const LinkExtension = TiptapLinkExtension.extend<NextLinkOptions>({
new Plugin({
key: new PluginKey('LinkPreview'),
view: () => {
return {destroy: floatingRenderer.destroy};
},
props: {
handleDOMEvents: {
mouseup: (view: EditorView, event: MouseEvent) => {
if (!view.state.selection.empty) {
return {
destroy: floatingRenderer.destroy,
update(view: EditorView) {
const posOfCursor = view.state.selection.anchor;
const {node} = view.domAtPos(posOfCursor);

if (!node.parentNode) {
floatingRenderer.unmount();
if (floatingRenderer.mounted) {
floatingRenderer.unmount();
}
return;
}
const pos = view.posAtDOM(event.target as unknown as Node, 0);
if (!pos) {

if (node.parentNode?.nodeName !== 'A') {
floatingRenderer.unmount();
return;
}

if (!view.state.selection.empty) {
floatingRenderer.unmount();
return;
}
}
};
},
props: {
handleDOMEvents: {
mouseup: (view: EditorView, event: MouseEvent) => {
const pos = view.posAtDOM(event.target as unknown as Node, 0);
const node = view.state.doc.nodeAt(pos);
if (node && hasLinkMark(node.marks || [])) {
const mark = node.marks.find(
Expand Down
1 change: 0 additions & 1 deletion packages/svelte/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ This is NOT a component library. It's a collection of re-usable components that
let html;
const toHtml = async () => {
html = await svelteEditorToHtml($editor);
console.log('html', html);
};
const handleUpload = async (file: File) => {
Expand Down

0 comments on commit 3b57805

Please sign in to comment.