@lvce-editor/renderer-process 19.1.0 → 19.3.0
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/rendererProcessMain.js +14 -22
- package/package.json +1 -1
|
@@ -141,6 +141,9 @@ const addCssStyleSheet = async (id, text) => {
|
|
|
141
141
|
await sheet.replace(text);
|
|
142
142
|
document.adoptedStyleSheets.push(sheet);
|
|
143
143
|
};
|
|
144
|
+
const getSelectionText = () => {
|
|
145
|
+
return document.getSelection()?.toString() || '';
|
|
146
|
+
};
|
|
144
147
|
|
|
145
148
|
const warn$1 = (...args) => {
|
|
146
149
|
console.warn(...args);
|
|
@@ -505,11 +508,12 @@ const getOptions = fn => {
|
|
|
505
508
|
return undefined;
|
|
506
509
|
};
|
|
507
510
|
const attachEvent$1 = ($Node, eventMap, key, value, newEventMap) => {
|
|
511
|
+
const keyLower = key.toLowerCase();
|
|
508
512
|
if (newEventMap && newEventMap[value]) {
|
|
509
513
|
const fn = newEventMap[value];
|
|
510
514
|
const options = getOptions(fn);
|
|
511
515
|
// TODO support event listener options
|
|
512
|
-
$Node.addEventListener(
|
|
516
|
+
$Node.addEventListener(keyLower, newEventMap[value], options);
|
|
513
517
|
return;
|
|
514
518
|
}
|
|
515
519
|
const listener = eventMap[value];
|
|
@@ -519,7 +523,7 @@ const attachEvent$1 = ($Node, eventMap, key, value, newEventMap) => {
|
|
|
519
523
|
}
|
|
520
524
|
const options = getEventListenerOptions$1(key, value);
|
|
521
525
|
const wrapped = getWrappedListener$1(listener, eventMap.returnValue);
|
|
522
|
-
$Node.addEventListener(
|
|
526
|
+
$Node.addEventListener(keyLower, wrapped, options);
|
|
523
527
|
};
|
|
524
528
|
const setProp = ($Element, key, value, eventMap, newEventMap) => {
|
|
525
529
|
switch (key) {
|
|
@@ -601,6 +605,7 @@ const setProp = ($Element, key, value, eventMap, newEventMap) => {
|
|
|
601
605
|
case 'onPointerOut':
|
|
602
606
|
case 'onPointerOver':
|
|
603
607
|
case 'onScroll':
|
|
608
|
+
case 'onSelectionChange':
|
|
604
609
|
case 'onWheel':
|
|
605
610
|
const eventName = key.slice(2).toLowerCase();
|
|
606
611
|
if (!eventMap || !value) {
|
|
@@ -853,6 +858,12 @@ const getEventListenerArg = (param, event) => {
|
|
|
853
858
|
return event.target.dataset.name;
|
|
854
859
|
case 'event.target.dataset.index':
|
|
855
860
|
return event.target.dataset.index;
|
|
861
|
+
case 'event.target.nodeName':
|
|
862
|
+
return event.target.nodeName;
|
|
863
|
+
case 'event.target.selectionStart':
|
|
864
|
+
return event.target.selectionStart;
|
|
865
|
+
case 'event.target.selectionEnd':
|
|
866
|
+
return event.target.selectionEnd;
|
|
856
867
|
default:
|
|
857
868
|
return param;
|
|
858
869
|
}
|
|
@@ -9596,6 +9607,7 @@ const commandMap = {
|
|
|
9596
9607
|
'ClipBoard.writeText': writeText,
|
|
9597
9608
|
'ConfirmPrompt.prompt': prompt$1,
|
|
9598
9609
|
'Css.addCssStyleSheet': addCssStyleSheet,
|
|
9610
|
+
'Css.getSelectionText': getSelectionText,
|
|
9599
9611
|
'Developer.showState': showState,
|
|
9600
9612
|
'Download.downloadFile': downloadFile,
|
|
9601
9613
|
'FileHandles.get': get$8,
|
|
@@ -10153,26 +10165,6 @@ const isUint8Array = value => {
|
|
|
10153
10165
|
const CHAR_WIDTH = 12;
|
|
10154
10166
|
const CHAR_HEIGHT = 15;
|
|
10155
10167
|
|
|
10156
|
-
const supportsOffscreenCanvas = true;
|
|
10157
|
-
|
|
10158
|
-
(() => {
|
|
10159
|
-
try {
|
|
10160
|
-
supportsOffscreenCanvas ? (() => {
|
|
10161
|
-
const canvas = new OffscreenCanvas(CHAR_WIDTH, CHAR_HEIGHT);
|
|
10162
|
-
canvas.getContext("2d");
|
|
10163
|
-
canvas.transferToImageBitmap();
|
|
10164
|
-
})() : (() => {
|
|
10165
|
-
const canvas = document.createElement("canvas");
|
|
10166
|
-
canvas.width = CHAR_WIDTH;
|
|
10167
|
-
canvas.height = CHAR_HEIGHT;
|
|
10168
|
-
canvas.transferToImageBitmap();
|
|
10169
|
-
})();
|
|
10170
|
-
return true;
|
|
10171
|
-
} catch {
|
|
10172
|
-
return false;
|
|
10173
|
-
}
|
|
10174
|
-
})();
|
|
10175
|
-
|
|
10176
10168
|
const tmpCanvas = new OffscreenCanvas(CHAR_WIDTH, CHAR_HEIGHT) ;
|
|
10177
10169
|
tmpCanvas.getContext("2d", {
|
|
10178
10170
|
// desynchronized: true, // perf
|