@prosekit/lit 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_tsup-dts-rollup.d.ts +3 -0
- package/dist/{chunk-I2VPMW75.js → chunk-CUH6G34Q.js} +1 -1
- package/dist/prosekit-lit-autocomplete-popover.js +1 -1
- package/dist/prosekit-lit-combo-box.js +1 -1
- package/dist/prosekit-lit-inline-popover.js +10 -2
- package/dist/prosekit-lit-popover.js +1 -1
- package/package.json +4 -5
@@ -9,6 +9,7 @@ import { Options } from 'tsup';
|
|
9
9
|
import { PropertyValues } from 'lit';
|
10
10
|
import { ReactiveController } from 'lit';
|
11
11
|
import { ReactiveControllerHost } from 'lit';
|
12
|
+
import type { Selection as Selection_2 } from '@prosekit/pm/state';
|
12
13
|
import { TemplateResult } from 'lit';
|
13
14
|
import { VirtualElement } from '@floating-ui/dom';
|
14
15
|
|
@@ -473,6 +474,8 @@ export declare function isComboBoxItem(element?: Element | null): element is Com
|
|
473
474
|
|
474
475
|
export declare function isComboBoxList(element?: Element | null): element is ComboBoxList;
|
475
476
|
|
477
|
+
export declare function isInCodeBlock(selection: Selection_2): boolean | undefined;
|
478
|
+
|
476
479
|
export declare class LightElement extends LitElement {
|
477
480
|
/**
|
478
481
|
* @hidden
|
@@ -37,7 +37,7 @@ var defaultDetectOverflowOptions = {
|
|
37
37
|
var defaultPopoverOptions = {
|
38
38
|
placement: "bottom",
|
39
39
|
middleware: [
|
40
|
-
offset({ mainAxis:
|
40
|
+
offset({ mainAxis: 2, crossAxis: 0 }),
|
41
41
|
shift({ ...defaultDetectOverflowOptions }),
|
42
42
|
size({
|
43
43
|
apply: ({ availableWidth, availableHeight, elements }) => {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import {
|
2
2
|
Popover
|
3
|
-
} from "./chunk-
|
3
|
+
} from "./chunk-CUH6G34Q.js";
|
4
4
|
import {
|
5
5
|
defineCustomElement
|
6
6
|
} from "./chunk-S32IZIQF.js";
|
@@ -14,12 +14,20 @@ import "lit";
|
|
14
14
|
|
15
15
|
// src/components/inline-popover/helpers.ts
|
16
16
|
import { isNodeSelection, isTextSelection } from "@prosekit/core";
|
17
|
+
|
18
|
+
// src/utils/is-in-code-block.ts
|
19
|
+
function isInCodeBlock(selection) {
|
20
|
+
const type = selection.$from.parent.type;
|
21
|
+
return type.spec.code && type.isBlock;
|
22
|
+
}
|
23
|
+
|
24
|
+
// src/components/inline-popover/helpers.ts
|
17
25
|
function getVirtualSelectionElement(view) {
|
18
26
|
if (typeof window === "undefined" || view.isDestroyed) {
|
19
27
|
return;
|
20
28
|
}
|
21
29
|
const selection = view.state.selection;
|
22
|
-
if (!selection.empty && (isTextSelection(selection) || isNodeSelection(selection))) {
|
30
|
+
if (!selection.empty && !isInCodeBlock(selection) && (isTextSelection(selection) || isNodeSelection(selection))) {
|
23
31
|
return getDomRange();
|
24
32
|
}
|
25
33
|
}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prosekit/lit",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.1.
|
4
|
+
"version": "0.1.7",
|
5
5
|
"private": false,
|
6
6
|
"author": {
|
7
7
|
"name": "ocavue",
|
@@ -87,8 +87,8 @@
|
|
87
87
|
"dependencies": {
|
88
88
|
"@floating-ui/dom": "^1.5.3",
|
89
89
|
"@lit/context": "^1.1.0",
|
90
|
-
"@prosekit/core": "^0.
|
91
|
-
"@prosekit/extensions": "^0.1
|
90
|
+
"@prosekit/core": "^0.2.2",
|
91
|
+
"@prosekit/extensions": "^0.2.1",
|
92
92
|
"@prosekit/pm": "^0.1.1",
|
93
93
|
"@superhuman/command-score": "^0.5.0",
|
94
94
|
"lit": "^3.1.0"
|
@@ -98,8 +98,7 @@
|
|
98
98
|
"minify-literals": "^1.0.8",
|
99
99
|
"tsup": "^8.0.1",
|
100
100
|
"typescript": "^5.3.3",
|
101
|
-
"vitest": "^1.
|
102
|
-
"vue": "^3.3.12"
|
101
|
+
"vitest": "^1.1.1"
|
103
102
|
},
|
104
103
|
"scripts": {
|
105
104
|
"build:tsup": "tsup",
|