Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(thread-comment): fix RTL rendering and localization (#7548)

白熱c0906a3a4cf7
diff --git a/packages/engine-formula/src/locale/function-list/engineering/ko-KR.ts b/packages/engine-formula/src/locale/function-list/engineering/ko-KR.ts
index 5fa58d38de..09778d75b2 100644
--- a/packages/engine-formula/src/locale/function-list/engineering/ko-KR.ts
+++ b/packages/engine-formula/src/locale/function-list/engineering/ko-KR.ts
@@ -115,8 +115,8 @@ const locale: typeof enUS = {
},
},
BITAND: {
- description: 'Returns a \'Bitwise And\' of two numbers',
- abstract: 'Returns a \'Bitwise And\' of two numbers',
+ description: '두 숫자의 비트 단위 \'AND\'를 반환합니다.',
+ abstract: '두 숫자의 비트 단위 \'AND\'를 반환합니다.',
links: [
{
title: 'Instruction',
@@ -124,8 +124,8 @@ const locale: typeof enUS = {
},
],
functionParameter: {
- number1: { name: 'number1', detail: 'Must be in decimal form and greater than or equal to 0.' },
- number2: { name: 'number2', detail: 'Must be in decimal form and greater than or equal to 0.' },
+ number1: { name: '번호1', detail: '0보다 크거나 같은 10진수 형식이어야 합니다.' },
+ number2: { name: '번호2', detail: '0보다 크거나 같은 10진수 형식이어야 합니다.' },
},
},
BITLSHIFT: {
@@ -209,9 +209,9 @@ const locale: typeof enUS = {
},
],
functionParameter: {
- number: { name: 'number', detail: 'is the value in from_units to convert.' },
- fromUnit: { name: 'from_unit', detail: 'is the units for number.' },
- toUnit: { name: 'to_unit', detail: 'is the units for the result.' },
+ number: { name: '숫자', detail: '변환할 from_unit 단위의 값입니다.' },
+ fromUnit: { name: 'from_unit', detail: '숫자의 단위입니다.' },
+ toUnit: { name: 'to_unit', detail: '결과의 단위입니다.' },
},
},
DEC2BIN: {
@@ -509,8 +509,8 @@ const locale: typeof enUS = {
},
},
IMDIV: {
- description: 'Returns the quotient of two complex numbers',
- abstract: 'Returns the quotient of two complex numbers',
+ description: 'x + yi 또는 x + yj 텍스트 형식인 두 복소수의 나눗셈 몫을 반환합니다.',
+ abstract: '두 복소수의 나눗셈 몫을 반환합니다.',
links: [
{
title: 'Instruction',
@@ -518,8 +518,8 @@ const locale: typeof enUS = {
},
],
functionParameter: {
- inumber1: { name: 'inumber1', detail: 'The complex numerator or dividend.' },
- inumber2: { name: 'inumber2', detail: 'The complex denominator or divisor.' },
+ inumber1: { name: 'inumber1', detail: '분자 또는 피제수인 복소수입니다.' },
+ inumber2: { name: 'inumber2', detail: '분모 또는 제수인 복소수입니다.' },
},
},
IMEXP: {
diff --git a/packages/engine-formula/src/locale/function-list/financial/ca-ES.ts b/packages/engine-formula/src/locale/function-list/financial/ca-ES.ts
index e91667b0f4..4a620ef95a 100644
--- a/packages/engine-formula/src/locale/function-list/financial/ca-ES.ts
+++ b/packages/engine-formula/src/locale/function-list/financial/ca-ES.ts
@@ -322,17 +322,17 @@ const locale: typeof enUS = {
},
},
EFFECT: {
- description: 'Returns the effective annual interest rate',
- abstract: 'Returns the effective annual interest rate',
+ description: 'Devuelve la tasa de interés anual efectiva',
+ abstract: 'Devuelve la tasa de interés anual efectiva',
links: [
{
- title: 'Instruction',
+ title: 'Instrucciones',
url: 'https://support.microsoft.com/ca-es/excel/functions/effect-function',
},
],
functionParameter: {
- nominalRate: { name: 'nominal_rate', detail: 'The nominal interest rate.' },
- npery: { name: 'npery', detail: 'The number of compounding periods per year.' },
+ nominalRate: { name: 'tasa_nominal', detail: 'La tasa de interés nominal.' },
+ npery: { name: 'núm_per_año', detail: 'El número de periodos de composición por año.' },
},
},
FV: {
@@ -367,38 +367,38 @@ const locale: typeof enUS = {
},
},
INTRATE: {
- description: 'Returns the interest rate for a fully invested security',
- abstract: 'Returns the interest rate for a fully invested security',
+ description: 'Devuelve la tasa de interés para la inversión total en un valor bursátil.',
+ abstract: 'Devuelve la tasa de interés para la inversión total en un valor bursátil.',
links: [
{
- title: 'Instruction',
+ title: 'Instrucciones',
url: 'https://support.microsoft.com/ca-es/excel/functions/intrate-function',
},
],
functionParameter: {
- settlement: { name: 'settlement', detail: "The security's settlement date." },
- maturity: { name: 'maturity', detail: "The security's maturity date." },
- investment: { name: 'investment', detail: 'The amount invested in the security.' },
- redemption: { name: 'redemption', detail: 'The amount to be received at maturity.' },
- basis: { name: 'basis', detail: 'The type of day count basis to use.' },
+ settlement: { name: 'liquidación', detail: 'Obligatorio. La fecha de liquidación del valor bursátil. La fecha de liquidación del valor bursátil es la fecha posterior a la fecha de emisión en la que el comprador adquiere el valor bursátil.' },
+ maturity: { name: 'vencimiento', detail: 'Obligatorio. La fecha de vencimiento del valor bursátil. La fecha de vencimiento es aquella en la que expira el valor bursátil.' },
+ investment: { name: 'inversión', detail: 'Obligatorio. Es la cantidad de dinero invertido en el valor bursátil.' },
+ redemption: { name: 'rescate', detail: 'Obligatorio. Es el valor que se recibirá en la fecha de vencimiento.' },
+ basis: { name: 'base', detail: 'Opcional. Determina en qué tipo de base deben contarse los días.' },
},
},
IPMT: {
- description: 'Returns the interest payment for an investment for a given period',
- abstract: 'Returns the interest payment for an investment for a given period',
+ description: 'Devuelve el pago de intereses de una inversión durante un periodo determinado',
+ abstract: 'Devuelve el pago de intereses de una inversión durante un periodo determinado',
links: [
{
- title: 'Instruction',
+ title: 'Instrucciones',
url: 'https://support.microsoft.com/ca-es/excel/functions/ipmt-function',
},
],
functionParameter: {
- rate: { name: 'rate', detail: 'The interest rate per period.' },
- per: { name: 'per', detail: 'The period for which you want to find the interest and must be in the range 1 to nper.' },
- nper: { name: 'nper', detail: 'The total number of payment periods in an annuity.' },
- pv: { name: 'pv', detail: 'The present value, or the lump-sum amount that a series of future payments is worth right now.' },
- fv: { name: 'fv', detail: 'The future value, or a cash balance you want to attain after the last payment is made.' },
- type: { name: 'type', detail: 'The number 0 or 1 and indicates when payments are due.' },
+ rate: { name: 'tasa', detail: 'La tasa de interés por periodo.' },
+ per: { name: 'periodo', detail: 'El periodo para el cual desea buscar el interés y debe estar en el rango de 1 a núm_pagos.' },
+ nper: { name: 'núm_pagos', detail: 'El número total de periodos de pago en una anualidad.' },
+ pv: { name: 'va', detail: 'El valor actual, o la cantidad total que vale ahora una serie de pagos futuros.' },
+ fv: { name: 'vf', detail: 'El valor futuro, o un saldo en efectivo que desea lograr después de realizar el último pago.' },
+ type: { name: 'tipo', detail: 'El número 0 o 1 e indica cuándo vencen los pagos.' },
},
},
IRR: {
diff --git a/packages/engine-formula/src/locale/function-list/financial/fr-FR.ts b/packages/engine-formula/src/locale/function-list/financial/fr-FR.ts
index 08b4234275..0a1877bbc2 100644
--- a/packages/engine-formula/src/locale/function-list/financial/fr-FR.ts
+++ b/packages/engine-formula/src/locale/function-list/financial/fr-FR.ts
@@ -322,8 +322,8 @@ const locale: typeof enUS = {
},
},
EFFECT: {
- description: 'Returns the effective annual interest rate',
- abstract: 'Returns the effective annual interest rate',
+ description: 'Cette fonction renvoie le taux d’intérêt annuel effectif.',
+ abstract: 'Taux d’intérêt annuel effectif.',
links: [
{
title: 'Instruction',
@@ -331,8 +331,8 @@ const locale: typeof enUS = {
},
],
functionParameter: {
- nominalRate: { name: 'nominal_rate', detail: 'The nominal interest rate.' },
- npery: { name: 'npery', detail: 'The number of compounding periods per year.' },
+ nominalRate: { name: 'taux_nominal', detail: 'Représente le taux d’intérêt nominal.' },
+ npery: { name: 'nb_périodes', detail: 'Nombre de périodes annuelles pour le calcul des intérêts composés.' },
},
},
FV: {
diff --git a/packages/engine-formula/src/locale/function-list/logical/ko-KR.ts b/packages/engine-formula/src/locale/function-list/logical/ko-KR.ts
index 08228d0356..1fbc11967d 100644
--- a/packages/engine-formula/src/locale/function-list/logical/ko-KR.ts
+++ b/packages/engine-formula/src/locale/function-list/logical/ko-KR.ts
@@ -175,7 +175,7 @@ const locale: typeof enUS = {
number2: { name: 'cols', detail: '배열의 열 수입니다. 0보다 커야 합니다.' },
value3: {
name: 'lambda',
- detail: ' A LAMBDA that is called to create the array. The LAMBDA takes two parameters: row (The row index of the array), col (The column index of the array).',
+ detail: '배열을 만들기 위해 호출되는 LAMBDA입니다. LAMBDA는 행 인덱스와 열 인덱스 두 매개 변수를 사용합니다.',
},
},
},
diff --git a/packages/engine-formula/src/locale/function-list/lookup/fr-FR.ts b/packages/engine-formula/src/locale/function-list/lookup/fr-FR.ts
index b68e8c7e51..e7ca6164e9 100644
--- a/packages/engine-formula/src/locale/function-list/lookup/fr-FR.ts
+++ b/packages/engine-formula/src/locale/function-list/lookup/fr-FR.ts
@@ -187,10 +187,10 @@ const locale: typeof enUS = {
},
],
functionParameter: {
- dataField: { name: 'dataField', detail: '' },
- pivotTable: { name: 'pivotTable', detail: '' },
- field1: { name: 'field1', detail: '' },
- item1: { name: 'item1', detail: '' },
+ dataField: { name: 'champ_données', detail: 'Nom du champ du tableau croisé dynamique contenant les données à récupérer. Il doit être placé entre guillemets.' },
+ pivotTable: { name: 'tableau_croisé_dyn', detail: 'Référence à une cellule, une plage ou une plage nommée du tableau croisé dynamique contenant les données.' },
+ field1: { name: 'champ1', detail: 'Paire facultative de noms de champ et d’élément décrivant les données à récupérer.' },
+ item1: { name: 'élément1', detail: 'Paire facultative de noms de champ et d’élément décrivant les données à récupérer.' },
},
},
HLOOKUP: {
diff --git a/packages/engine-formula/src/locale/function-list/lookup/sk-SK.ts b/packages/engine-formula/src/locale/function-list/lookup/sk-SK.ts
index 3b9eed1cdf..b948667a95 100644
--- a/packages/engine-formula/src/locale/function-list/lookup/sk-SK.ts
+++ b/packages/engine-formula/src/locale/function-list/lookup/sk-SK.ts
@@ -202,10 +202,10 @@ const locale: typeof enUS = {
},
],
functionParameter: {
- dataField: { name: 'dataField', detail: '' },
- pivotTable: { name: 'pivotTable', detail: '' },
- field1: { name: 'field1', detail: '' },
- item1: { name: 'item1', detail: '' },
+ dataField: { name: 'údajové_pole', detail: 'Názov poľa kontingenčnej tabuľky obsahujúce údaje, ktoré chcete načítať. Musí byť v úvodzovkách.' },
+ pivotTable: { name: 'kontingenčná_tabuľka', detail: 'Odkaz na bunku, rozsah buniek alebo pomenovaný rozsah v kontingenčnej tabuľke obsahujúcej požadované údaje.' },
+ field1: { name: 'pole1', detail: 'Voliteľná dvojica názvu poľa a položky opisujúca údaje, ktoré chcete načítať.' },
+ item1: { name: 'položka1', detail: 'Voliteľná dvojica názvu poľa a položky opisujúca údaje, ktoré chcete načítať.' },
},
},
HLOOKUP: {
diff --git a/packages/engine-formula/src/locale/function-list/math/vi-VN.ts b/packages/engine-formula/src/locale/function-list/math/vi-VN.ts
index 971b98548f..49da083ff7 100644
--- a/packages/engine-formula/src/locale/function-list/math/vi-VN.ts
+++ b/packages/engine-formula/src/locale/function-list/math/vi-VN.ts
@@ -99,8 +99,8 @@ const locale: typeof enUS = {
},
},
ARABIC: {
- description: 'Converts a Roman number to Arabic, as a number',
- abstract: 'Converts a Roman number to Arabic, as a number',
+ description: 'Chuyển đổi một chữ số La Mã sang một chữ số Ả-rập.',
+ abstract: 'Chuyển đổi một chữ số La Mã sang một chữ số Ả-rập.',
links: [
{
title: 'Hướng dẫn',
diff --git a/packages/engine-formula/src/locale/function-list/statistical/ko-KR.ts b/packages/engine-formula/src/locale/function-list/statistical/ko-KR.ts
index 71967f90c1..aea3615bb1 100644
--- a/packages/engine-formula/src/locale/function-list/statistical/ko-KR.ts
+++ b/packages/engine-formula/src/locale/function-list/statistical/ko-KR.ts
@@ -908,7 +908,7 @@ const locale: typeof enUS = {
],
functionParameter: {
range: { name: 'range', detail: 'MARGINOFERROR(A1:C3, 0.99)' },
- confidence: { name: 'confidence', detail: 'The desired confidence level between (0, 1).' },
+ confidence: { name: '신뢰도', detail: '(0, 1) 범위에서 원하는 신뢰 수준입니다.' },
},
},
MAX: {
diff --git a/packages/sheets-formula-ui/src/locale/ru-RU.ts b/packages/sheets-formula-ui/src/locale/ru-RU.ts
index ac8e0fe65f..8a14503b73 100644
--- a/packages/sheets-formula-ui/src/locale/ru-RU.ts
+++ b/packages/sheets-formula-ui/src/locale/ru-RU.ts
@@ -65,7 +65,7 @@ const locale: typeof enUS = {
array: 'Массив',
univer: 'Универсальные',
user: 'Пользовательские',
- definedname: 'Defined Name',
+ definedname: 'Определенное имя',
},
moreFunctions: {
confirm: 'Подтвердить',
diff --git a/packages/sheets-table-ui/src/locale/fa-IR.ts b/packages/sheets-table-ui/src/locale/fa-IR.ts
index c640f7bb87..5d5ec8b0af 100644
--- a/packages/sheets-table-ui/src/locale/fa-IR.ts
+++ b/packages/sheets-table-ui/src/locale/fa-IR.ts
@@ -39,7 +39,7 @@ const locale: typeof enUS = {
footer: 'پاورقی',
firstLine: 'خط اول',
secondLine: 'خط دوم',
- tableNameError: 'لا يمكن أن يحتوي اسم الجدول على مسافات، ولا يمكن أن يبدأ برقم، ولا يمكن أن يتكرر مع أسماء الجداول الموجودة',
+ tableNameError: 'نام جدول نمی‌تواند شامل فاصله باشد، نمی‌تواند با عدد شروع شود و نمی‌تواند با نام جدول‌های موجود تکراری باشد',
columnMenu: {
'insert-left': 'درج ۱ ستون جدول در سمت چپ',
'insert-right': 'درج ۱ ستون جدول در سمت راست',
diff --git a/packages/sheets-table/src/locale/fa-IR.ts b/packages/sheets-table/src/locale/fa-IR.ts
index ec64d90d1d..aaa04bc234 100644
--- a/packages/sheets-table/src/locale/fa-IR.ts
+++ b/packages/sheets-table/src/locale/fa-IR.ts
@@ -20,7 +20,7 @@ const locale: typeof enUS = {
'sheets-table': {
columnPrefix: 'ستون',
tablePrefix: 'جدول',
- tableNameError: 'لا يمكن أن يحتوي اسم الجدول على مسافات، ولا يمكن أن يبدأ برقم، ولا يمكن أن يتكرر مع أسماء الجداول الموجودة',
+ tableNameError: 'نام جدول نمی‌تواند شامل فاصله باشد، نمی‌تواند با عدد شروع شود و نمی‌تواند با نام جدول‌های موجود تکراری باشد',
},
};
diff --git a/packages/sheets-ui/src/locale/ca-ES.ts b/packages/sheets-ui/src/locale/ca-ES.ts
index 162b5c3d3b..649b149773 100644
--- a/packages/sheets-ui/src/locale/ca-ES.ts
+++ b/packages/sheets-ui/src/locale/ca-ES.ts
@@ -337,8 +337,8 @@ const locale: typeof enUS = {
allowedPermissionType: 'Tipus de permisos permesos',
alert: 'Alerta',
search: 'Cercar',
- ownerInherit: 'Propietario del documento, herencia de permisos habilitada',
- ownerWithoutInherit: 'Propietario del documento, herencia de permisos no habilitada',
+ ownerInherit: 'Propietari del document, herència de permisos activada',
+ ownerWithoutInherit: 'Propietari del document, herència de permisos desactivada',
alertContent: 'Aquest interval està protegit i actualment no hi ha permisos d\'edició disponibles. Si necessiteu editar, contacteu amb el creador.',
userEmpty: 'cap persona designada, compartiu l\'enllaç per convidar persones específiques.',
listEmpty: 'No heu configurat cap interval o full com a protegit.',
diff --git a/packages/sheets-ui/src/locale/sk-SK.ts b/packages/sheets-ui/src/locale/sk-SK.ts
index 305e29b75a..5000a200dc 100644
--- a/packages/sheets-ui/src/locale/sk-SK.ts
+++ b/packages/sheets-ui/src/locale/sk-SK.ts
@@ -337,8 +337,8 @@ const locale: typeof enUS = {
allowedPermissionType: 'Povolené typy oprávnení',
alert: 'Upozornenie',
search: 'Hľadať',
- ownerInherit: 'Vlastník dokumentu, dědičnost oprávnění povolena',
- ownerWithoutInherit: 'Vlastník dokumentu, dědičnost oprávnění není povolena',
+ ownerInherit: 'Vlastník dokumentu, dedenie oprávnení je povolené',
+ ownerWithoutInherit: 'Vlastník dokumentu, dedenie oprávnení nie je povolené',
alertContent: 'Tento rozsah je chránený a momentálne nemáte povolenie na úpravy. Ak potrebujete upravovať, kontaktujte autora.',
userEmpty: 'žiadna určená osoba, zdieľajte odkaz na pozvanie konkrétnych ľudí.',
listEmpty: 'Nenastavili ste žiadne rozsahy ani hárky ako chránené.',
diff --git a/packages/sheets/src/locale/ca-ES.ts b/packages/sheets/src/locale/ca-ES.ts
index 601559dc83..d96c7400dc 100644
--- a/packages/sheets/src/locale/ca-ES.ts
+++ b/packages/sheets/src/locale/ca-ES.ts
@@ -43,11 +43,11 @@ const locale: typeof enUS = {
editErr: 'L\'interval està protegit i no teniu permís d\'edició. Per editar, contacteu amb el creador.',
formulaErr: 'L\'interval o l\'interval referenciat està protegit, i no teniu permís d\'edició. Per editar, contacteu amb el creador.',
insertOrDeleteMoveRangeErr: 'L\'interval inserit o suprimit s\'interseca amb l\'interval protegit, i aquesta operació no és compatible per ara.',
- insertRowColErr: 'L\'interval está protegido y no tienes permiso para insertar filas y columnas. Para insertar filas y columnas, contacta con el creador.',
+ insertRowColErr: 'L\'interval està protegit i no teniu permís per inserir files i columnes. Per inserir files i columnes, contacteu amb el creador.',
moveRangeErr: 'L\'interval està protegit i no teniu permís per moure la selecció. Per moure la selecció, contacteu amb el creador.',
moveRowColErr: 'L\'interval està protegit i no teniu permís per moure files i columnes. Per moure files i columnes, contacteu amb el creador.',
operatorSheetErr: 'El full de càlcul està protegit i no teniu permís per operar-hi. Per operar al full de càlcul, contacteu amb el creador.',
- removeRowColErr: 'L\'interval está protegido y no tienes permiso para eliminar filas y columnas. Para eliminar filas y columnas, contacta con el creador.',
+ removeRowColErr: 'L\'interval està protegit i no teniu permís per suprimir files i columnes. Per suprimir files i columnes, contacteu amb el creador.',
setRowColStyleErr: 'L\'interval està protegit i no teniu permís per establir estils de fila i columna. Per establir estils de fila i columna, contacteu amb el creador.',
setStyleErr: 'L\'interval està protegit i no teniu permís per establir estils. Per establir estils, contacteu amb el creador.',
},
diff --git a/packages/sheets/src/locale/sk-SK.ts b/packages/sheets/src/locale/sk-SK.ts
index 544111b56f..3e4dddb327 100644
--- a/packages/sheets/src/locale/sk-SK.ts
+++ b/packages/sheets/src/locale/sk-SK.ts
@@ -43,11 +43,11 @@ const locale: typeof enUS = {
editErr: 'Rozsah je chránený a nemáte oprávnenie na úpravy. Ak chcete upravovať, kontaktujte autora.',
formulaErr: 'Rozsah alebo referenčný rozsah je chránený a nemáte oprávnenie na úpravu. Ak chcete upravovať, kontaktujte autora.',
insertOrDeleteMoveRangeErr: 'Vložený alebo odstránený rozsah sa prekrýva s chráneným rozsahom a táto operácia zatiaľ nie je podporovaná.',
- insertRowColErr: 'Rozsah je chránený a nemáte oprávnění pro vkládání řádků a sloupců. Pokud chcete vkládat řádky a sloupce, kontaktujte autora.',
+ insertRowColErr: 'Rozsah je chránený a nemáte oprávnenie vkladať riadky a stĺpce. Ak chcete vložiť riadky a stĺpce, kontaktujte autora.',
moveRangeErr: 'Rozsah je chránený a nemáte oprávnenie presúvať výber. Ak chcete presúvať výber, kontaktujte autora.',
moveRowColErr: 'Rozsah je chránený a nemáte oprávnenie presúvať riadky a stĺpce. Ak chcete presúvať riadky a stĺpce, kontaktujte autora.',
operatorSheetErr: 'Hárok je chránený a nemáte oprávnenie pracovať s hárkom. Ak chcete pracovať s hárkom, kontaktujte autora.',
- removeRowColErr: 'Rozsah je chránený a nemáte oprávnění pro odstraňování řádků a sloupců. Pokud chcete odstraňovat řádky a sloupce, kontaktujte autora.',
+ removeRowColErr: 'Rozsah je chránený a nemáte oprávnenie odstraňovať riadky a stĺpce. Ak chcete odstrániť riadky a stĺpce, kontaktujte autora.',
setRowColStyleErr: 'Rozsah je chránený a nemáte oprávnenie nastavovať štýly riadkov a stĺpcov. Ak chcete nastavovať štýly riadkov a stĺpcov, kontaktujte autora.',
setStyleErr: 'Rozsah je chránený a nemáte oprávnenie nastavovať štýly. Ak chcete nastavovať štýly, kontaktujte autora.',
},
diff --git a/packages/thread-comment-ui/src/views/ThreadCommentTree.tsx b/packages/thread-comment-ui/src/views/ThreadCommentTree.tsx
index e1842b8654..560c9cf610 100644
--- a/packages/thread-comment-ui/src/views/ThreadCommentTree.tsx
+++ b/packages/thread-comment-ui/src/views/ThreadCommentTree.tsx
@@ -39,7 +39,7 @@ import {
ThreadCommentModel,
UpdateCommentCommand,
} from '@univerjs/thread-comment';
-import { UI_PLUGIN_CONFIG_KEY, useConfigValue, useDependency, useObservable } from '@univerjs/ui';
+import { UI_PLUGIN_CONFIG_KEY, useConfigValue, useDependency, useEvent, useObservable } from '@univerjs/ui';
import { useEffect, useMemo, useRef, useState } from 'react';
import { debounceTime, map, of, startWith } from 'rxjs';
import { SetActiveCommentOperation } from '../commands/operations/comment.operations';
@@ -259,14 +259,13 @@ const ThreadCommentItem = (props: IThreadCommentItemProps) => {
: null}
{dateText && (
<time
- dir="ltr"
className={`
univer-mb-1 univer-block univer-text-xs/normal univer-text-gray-600
rtl:univer-text-right
dark:!univer-text-gray-200
`}
>
- {dateText}
+ <bdo dir="ltr">{dateText}</bdo>
</time>
)}
{editing
@@ -304,23 +303,33 @@ const ThreadCommentItem = (props: IThreadCommentItemProps) => {
dark:!univer-text-gray-0
`}
>
- {transformDocument2TextNodes(item.text).map((paragraph, i) => (
- <div key={i} className="univer-break-words">
- {paragraph.map((item, i) => {
- switch (item.type) {
- case 'mention':
- return (
- <a className="univer-text-primary-600" key={i}>
- {item.content.label}
- {' '}
- </a>
- );
- default:
- return item.content;
- }
- })}
- </div>
- ))}
+ {transformDocument2TextNodes(item.text).map((paragraph, paragraphIndex) => {
+ let offset = 0;
+
+ return (
+ <div
+ key={item.text.paragraphs?.[paragraphIndex]?.paragraphId}
+ className="univer-break-words"
+ >
+ {paragraph.map((node) => {
+ const key = offset;
+ offset += node.type === 'mention' ? node.content.label.length : node.content.length;
+
+ switch (node.type) {
+ case 'mention':
+ return (
+ <a className="univer-text-primary-600" key={key}>
+ {node.content.label}
+ {' '}
+ </a>
+ );
+ default:
+ return node.content;
+ }
+ })}
+ </div>
+ );
+ })}
</div>
)}
</div>
@@ -388,7 +397,8 @@ export const ThreadCommentTree = (props: IThreadCommentTreeProps) => {
}],
...(comments?.children ?? []) as IThreadComment[],
];
- const scroller = useRef<HTMLDivElement>(null);
+ const scrollerRef = useRef<HTMLDivElement>(null);
+ const handleMouseLeave = useEvent(onMouseLeave);
const handleResolve: React.MouseEventHandler<HTMLDivElement> = (e) => {
e.stopPropagation();
if (!resolved) {
@@ -430,8 +440,8 @@ export const ThreadCommentTree = (props: IThreadCommentTreeProps) => {
};
useEffect(() => {
- return onMouseLeave?.();
- }, []);
+ return handleMouseLeave;
+ }, [handleMouseLeave]);
const subUnitName = getSubUnitName(comments?.root.subUnitId ?? subUnitId);
const editorVisible = showEdit && !editingId && !resolved;
@@ -532,7 +542,7 @@ export const ThreadCommentTree = (props: IThreadCommentTreeProps) => {
)}
</div>
<div
- ref={scroller}
+ ref={scrollerRef}
className={clsx(
'univer-max-h-80 univer-overflow-y-auto univer-overflow-x-hidden',
scrollbarClassName,
@@ -620,8 +630,8 @@ export const ThreadCommentTree = (props: IThreadCommentTreeProps) => {
comment,
} as IAddCommentCommandParams
);
- if (scroller.current) {
- scroller.current.scrollTop = scroller.current.scrollHeight;
+ if (scrollerRef.current) {
+ scrollerRef.current.scrollTop = scrollerRef.current.scrollHeight;
}
}}
autoFocus={autoFocus || (!comments)}
diff --git a/packages/thread-comment-ui/src/views/__tests__/ThreadCommentTree.spec.tsx b/packages/thread-comment-ui/src/views/__tests__/ThreadCommentTree.spec.tsx
index 8ac242595c..a55bde5883 100644
--- a/packages/thread-comment-ui/src/views/__tests__/ThreadCommentTree.spec.tsx
+++ b/packages/thread-comment-ui/src/views/__tests__/ThreadCommentTree.spec.tsx
@@ -568,7 +568,7 @@ describe('ThreadCommentTree', () => {
const item = getRootCommentItem(container, 'root-thread');
const time = item.querySelector('time');
- expect(time?.getAttribute('dir')).toBe('ltr');
+ expect(time?.querySelector('bdo')?.getAttribute('dir')).toBe('ltr');
});
it('right-aligns the comment action menu in RTL', () => {