@lvce-editor/renderer-process 30.76.0 → 30.77.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.
@@ -2012,6 +2012,41 @@ const initialize = () => {
2012
2012
  }
2013
2013
  };
2014
2014
 
2015
+ // Measuring a prefix in isolation changes Arabic joining and ligatures. Use a
2016
+ // native Range within the full directional run to retain the shaping context.
2017
+ const measurePrefix = (text, offset, fontWeight, fontSize, fontFamily, letterSpacing, direction) => {
2018
+ string(text);
2019
+ number(offset);
2020
+ number(fontWeight);
2021
+ number(fontSize);
2022
+ string(fontFamily);
2023
+ number(letterSpacing);
2024
+ const element = document.createElement('span');
2025
+ element.style.position = 'fixed';
2026
+ element.style.visibility = 'hidden';
2027
+ element.style.whiteSpace = 'pre';
2028
+ element.style.fontWeight = String(fontWeight);
2029
+ element.style.fontSize = `${fontSize}px`;
2030
+ element.style.fontFamily = fontFamily;
2031
+ element.style.letterSpacing = `${letterSpacing}px`;
2032
+ element.style.direction = direction;
2033
+ element.style.unicodeBidi = 'bidi-override';
2034
+ element.textContent = text;
2035
+ document.body.append(element);
2036
+ try {
2037
+ if (!element.firstChild) {
2038
+ return 0;
2039
+ }
2040
+ const range = document.createRange();
2041
+ range.setStart(element.firstChild, 0);
2042
+ const end = Math.max(0, Math.min(text.length, Math.trunc(offset)));
2043
+ range.setEnd(element.firstChild, end);
2044
+ return range.getBoundingClientRect().width;
2045
+ } finally {
2046
+ element.remove();
2047
+ }
2048
+ };
2049
+
2015
2050
  const pendingInputs = new Set();
2016
2051
  const state$k = {
2017
2052
  shortcut: undefined
@@ -5383,7 +5418,8 @@ const sendKeyBinding = identifier => {
5383
5418
  send$1('KeyBindings.handleKeyBinding', identifier);
5384
5419
  return;
5385
5420
  }
5386
- void runShortcut(() => invoke$1('KeyBindings.handleKeyBinding', identifier)).catch(handleError$5);
5421
+ const args = getRpcId(uid) === 'Editor' ? [identifier, uid] : [identifier];
5422
+ void runShortcut(() => invoke$1('KeyBindings.handleKeyBinding', ...args)).catch(handleError$5);
5387
5423
  };
5388
5424
  const send = (method, uid, ...args) => {
5389
5425
  if (method === executeViewletCommand$1) {
@@ -12338,6 +12374,7 @@ const forwardRendererWorkerCommand = (method, ...params) => {
12338
12374
  const handleMessagePort = async (port, rpcId) => {
12339
12375
  const rpc = await create$A({
12340
12376
  commandMap: {
12377
+ 'MeasureBidi.measurePrefix': measurePrefix,
12341
12378
  'Viewlet.forwardRendererWorkerCommand': forwardRendererWorkerCommand,
12342
12379
  'Viewlet.queueCommands': queueCommands
12343
12380
  },
@@ -12715,6 +12752,7 @@ const commandMap = {
12715
12752
  'Location.setPathName': setPathName,
12716
12753
  'Location.setWorkspaceUri': setWorkspaceUri,
12717
12754
  'Main.openUri': openUri,
12755
+ 'MeasureBidi.measurePrefix': measurePrefix,
12718
12756
  'MeasureTextBlockHeight.measureTextBlockHeight': measureTextBlockHeight,
12719
12757
  'MeasureTextHeight.measureTextHeight': measureTextHeight,
12720
12758
  'Menu.focusIndex': focusIndex,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "30.76.0",
3
+ "version": "30.77.0",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"