microboard-temp 0.1.21 → 0.1.22
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/cjs/browser.js +36 -139
- package/dist/cjs/index.js +36 -58
- package/dist/cjs/node.js +36 -58
- package/dist/esm/browser.js +36 -139
- package/dist/esm/index.js +36 -58
- package/dist/esm/node.js +36 -58
- package/dist/types/api/initDefaultI18N.d.ts +11 -0
- package/dist/types/api/initI18N.d.ts +6 -11
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/dist/types/api/initI18NBrowser.d.ts +0 -2
package/dist/cjs/browser.js
CHANGED
|
@@ -2140,6 +2140,7 @@ __export(exports_browser, {
|
|
|
2140
2140
|
isHotkeyPushed: () => isHotkeyPushed,
|
|
2141
2141
|
isFiniteNumber: () => isFiniteNumber,
|
|
2142
2142
|
isControlCharacter: () => isControlCharacter,
|
|
2143
|
+
initI18N: () => initI18N,
|
|
2143
2144
|
getYouTubeVideoPreview: () => getYouTubeVideoPreview,
|
|
2144
2145
|
getYouTubeThumbnail: () => getYouTubeThumbnail,
|
|
2145
2146
|
getVideoMetadata: () => getVideoMetadata,
|
|
@@ -8150,7 +8151,7 @@ var Browser = /* @__PURE__ */ function() {
|
|
|
8150
8151
|
}();
|
|
8151
8152
|
Browser.type = "languageDetector";
|
|
8152
8153
|
|
|
8153
|
-
// src/api/
|
|
8154
|
+
// src/api/initDefaultI18N.ts
|
|
8154
8155
|
var defaultNS = "default";
|
|
8155
8156
|
var resources = {
|
|
8156
8157
|
en: {
|
|
@@ -8160,7 +8161,7 @@ var resources = {
|
|
|
8160
8161
|
default: {}
|
|
8161
8162
|
}
|
|
8162
8163
|
};
|
|
8163
|
-
function
|
|
8164
|
+
function initDefaultI18N() {
|
|
8164
8165
|
instance.use(Browser).init({
|
|
8165
8166
|
debug: conf2.debug,
|
|
8166
8167
|
detection: {
|
|
@@ -8517,7 +8518,7 @@ var conf2 = {
|
|
|
8517
8518
|
FALLBACK_LNG: "en",
|
|
8518
8519
|
cursorsMap
|
|
8519
8520
|
};
|
|
8520
|
-
|
|
8521
|
+
initDefaultI18N();
|
|
8521
8522
|
|
|
8522
8523
|
// src/Items/Transformation/Matrix.ts
|
|
8523
8524
|
class Matrix2 {
|
|
@@ -26827,8 +26828,6 @@ function setNodeStyles({
|
|
|
26827
26828
|
}
|
|
26828
26829
|
|
|
26829
26830
|
// src/Items/RichText/editorHelpers/markdown/markdownProcessor.ts
|
|
26830
|
-
var { i18n: i18n2 } = conf2;
|
|
26831
|
-
|
|
26832
26831
|
class MarkdownProcessor {
|
|
26833
26832
|
chunksQueue = [];
|
|
26834
26833
|
isProcessingChunk = false;
|
|
@@ -26859,7 +26858,7 @@ class MarkdownProcessor {
|
|
|
26859
26858
|
this.subject.publish(this);
|
|
26860
26859
|
return true;
|
|
26861
26860
|
}
|
|
26862
|
-
if (
|
|
26861
|
+
if (text3.startsWith(conf2.i18n.t("AIInput.generatingResponse"))) {
|
|
26863
26862
|
return true;
|
|
26864
26863
|
}
|
|
26865
26864
|
const isPrevTextEmpty = isTextEmpty(this.editor.children);
|
|
@@ -26917,7 +26916,7 @@ class MarkdownProcessor {
|
|
|
26917
26916
|
return;
|
|
26918
26917
|
}
|
|
26919
26918
|
const prevText = this.getText()?.[this.getText().length - 1]?.children[0]?.text;
|
|
26920
|
-
if (
|
|
26919
|
+
if (prevText?.startsWith(conf2.i18n.t("AIInput.generatingResponse"))) {
|
|
26921
26920
|
clearText(this.editor);
|
|
26922
26921
|
}
|
|
26923
26922
|
if (chunk.includes(`
|
|
@@ -29202,7 +29201,6 @@ class BaseItem extends Mbr {
|
|
|
29202
29201
|
}
|
|
29203
29202
|
|
|
29204
29203
|
// src/Items/RichText/RichText.ts
|
|
29205
|
-
var { i18n: i18n3 } = conf2;
|
|
29206
29204
|
var isEditInProcessValue = false;
|
|
29207
29205
|
var counter = 0;
|
|
29208
29206
|
|
|
@@ -29238,7 +29236,7 @@ class RichText extends BaseItem {
|
|
|
29238
29236
|
shrinkWidth = false;
|
|
29239
29237
|
prevMbr = null;
|
|
29240
29238
|
rtCounter = 0;
|
|
29241
|
-
constructor(board, container, id = "", transformation = new Transformation(id, board.events), linkTo, placeholderText =
|
|
29239
|
+
constructor(board, container, id = "", transformation = new Transformation(id, board.events), linkTo, placeholderText = conf2.i18n?.t("board.textPlaceholder"), isInShape = false, autoSize = false, insideOf, initialTextStyles = conf2.DEFAULT_TEXT_STYLES) {
|
|
29242
29240
|
super(board, id);
|
|
29243
29241
|
this.container = container;
|
|
29244
29242
|
this.transformation = transformation;
|
|
@@ -44374,7 +44372,6 @@ function getLine(lineStyle, start2, end2, middle) {
|
|
|
44374
44372
|
}
|
|
44375
44373
|
}
|
|
44376
44374
|
// src/Items/Connector/Connector.ts
|
|
44377
|
-
var { i18n: i18n4 } = conf2;
|
|
44378
44375
|
var ConnectionLineWidths = [1, 2, 3, 4, 5, 6, 7, 8, 12];
|
|
44379
44376
|
var CONNECTOR_COLOR = "rgb(20, 21, 26)";
|
|
44380
44377
|
var CONNECTOR_LINE_WIDTH = 1;
|
|
@@ -44429,7 +44426,7 @@ class Connector2 extends BaseItem {
|
|
|
44429
44426
|
this.lineColor = lineColor ?? CONNECTOR_COLOR;
|
|
44430
44427
|
this.lineWidth = lineWidth ?? CONNECTOR_LINE_WIDTH;
|
|
44431
44428
|
this.borderStyle = strokeStyle ?? CONNECTOR_BORDER_STYLE;
|
|
44432
|
-
this.text = new RichText(board, this.getMbr(), this.id, new Transformation, this.linkTo,
|
|
44429
|
+
this.text = new RichText(board, this.getMbr(), this.id, new Transformation, this.linkTo, conf2.i18n.t("connector.textPlaceholder", {
|
|
44433
44430
|
ns: "default"
|
|
44434
44431
|
}), true, false, "Connector", {
|
|
44435
44432
|
...conf2.DEFAULT_TEXT_STYLES,
|
|
@@ -64163,54 +64160,26 @@ function handleChatChunk(chunk, board) {
|
|
|
64163
64160
|
const item = board.items.getById(itemId);
|
|
64164
64161
|
switch (chunk.type) {
|
|
64165
64162
|
case "chunk":
|
|
64166
|
-
if (!
|
|
64163
|
+
if (!item2 || item2.itemType !== "AINode") {
|
|
64167
64164
|
return;
|
|
64168
64165
|
}
|
|
64169
|
-
|
|
64166
|
+
item2.getRichText()?.editor.markdownProcessor.processMarkdown(chunk.content || "");
|
|
64170
64167
|
break;
|
|
64171
64168
|
case "done":
|
|
64172
|
-
if (!
|
|
64169
|
+
if (!item2 || item2.itemType !== "AINode") {
|
|
64173
64170
|
board.aiGeneratingOnItem = undefined;
|
|
64174
64171
|
return;
|
|
64175
64172
|
}
|
|
64176
|
-
|
|
64173
|
+
item2.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
|
|
64177
64174
|
break;
|
|
64178
64175
|
case "end":
|
|
64179
|
-
if (!
|
|
64176
|
+
if (!item2 || item2.itemType !== "AINode") {
|
|
64180
64177
|
board.aiGeneratingOnItem = undefined;
|
|
64181
64178
|
return;
|
|
64182
64179
|
}
|
|
64183
|
-
|
|
64180
|
+
item2.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
|
|
64184
64181
|
break;
|
|
64185
64182
|
case "error":
|
|
64186
|
-
board.camera.unsubscribeFromItem();
|
|
64187
|
-
if (board.aiGeneratingOnItem) {
|
|
64188
|
-
const item2 = board.items.getById(board.aiGeneratingOnItem);
|
|
64189
|
-
if (item2) {
|
|
64190
|
-
board.selection.removeAll();
|
|
64191
|
-
board.selection.add(item2);
|
|
64192
|
-
if (item2.itemType === "AINode") {
|
|
64193
|
-
item2.getRichText().editor.markdownProcessor.setStopProcessingMarkDownCb(null);
|
|
64194
|
-
if (chunk.isExternalApiError) {
|
|
64195
|
-
const editor = item2.getRichText().editor;
|
|
64196
|
-
editor.clearText();
|
|
64197
|
-
editor.insertCopiedText(conf2.i18n.t("AIInput.nodeErrorText"));
|
|
64198
|
-
}
|
|
64199
|
-
}
|
|
64200
|
-
board.camera.zoomToFit(item2.getMbr(), 20);
|
|
64201
|
-
}
|
|
64202
|
-
}
|
|
64203
|
-
console.log("Error AI generate", chunk.error);
|
|
64204
|
-
if (!chunk.isExternalApiError) {
|
|
64205
|
-
conf2.notify({
|
|
64206
|
-
header: conf2.i18n.t("AIInput.textGenerationError.header"),
|
|
64207
|
-
body: conf2.i18n.t("AIInput.textGenerationError.body"),
|
|
64208
|
-
variant: "error",
|
|
64209
|
-
duration: 4000
|
|
64210
|
-
});
|
|
64211
|
-
}
|
|
64212
|
-
board.aiGeneratingOnItem = undefined;
|
|
64213
|
-
break;
|
|
64214
64183
|
default:
|
|
64215
64184
|
board.camera.unsubscribeFromItem();
|
|
64216
64185
|
if (!chunk.isExternalApiError) {
|
|
@@ -64221,23 +64190,23 @@ function handleChatChunk(chunk, board) {
|
|
|
64221
64190
|
duration: 4000
|
|
64222
64191
|
});
|
|
64223
64192
|
}
|
|
64224
|
-
|
|
64225
|
-
|
|
64226
|
-
|
|
64227
|
-
|
|
64228
|
-
|
|
64229
|
-
|
|
64230
|
-
|
|
64231
|
-
|
|
64232
|
-
|
|
64233
|
-
|
|
64234
|
-
|
|
64235
|
-
}
|
|
64193
|
+
const item2 = board.items.getById(board.aiGeneratingOnItem || "");
|
|
64194
|
+
if (board.aiGeneratingOnItem && item2) {
|
|
64195
|
+
board.selection.removeAll();
|
|
64196
|
+
board.selection.add(item2);
|
|
64197
|
+
const rt = item2?.getRichText();
|
|
64198
|
+
if (item2.itemType === "AINode" && rt) {
|
|
64199
|
+
const editor = rt.editor;
|
|
64200
|
+
editor.markdownProcessor.setStopProcessingMarkDownCb(null);
|
|
64201
|
+
if (chunk.isExternalApiError) {
|
|
64202
|
+
editor.clearText();
|
|
64203
|
+
editor.insertCopiedText(conf2.i18n.t("AIInput.nodeErrorText"));
|
|
64236
64204
|
}
|
|
64237
|
-
board.camera.zoomToFit(item2.getMbr(), 20);
|
|
64238
64205
|
}
|
|
64206
|
+
board.camera.zoomToFit(item2.getMbr(), 20);
|
|
64239
64207
|
}
|
|
64240
64208
|
board.aiGeneratingOnItem = undefined;
|
|
64209
|
+
break;
|
|
64241
64210
|
}
|
|
64242
64211
|
}
|
|
64243
64212
|
function handleAudioGenerate(response, board) {
|
|
@@ -64628,6 +64597,15 @@ messageRouter.addHandler("AiChat", handleAiChatMassage);
|
|
|
64628
64597
|
messageRouter.addHandler("Mode", handleModeMessage);
|
|
64629
64598
|
messageRouter.addHandler("PresenceEvent", handlePresenceEventMessage);
|
|
64630
64599
|
messageRouter.addHandler("UserJoin", handleUserJoinMessage);
|
|
64600
|
+
// src/api/initI18N.ts
|
|
64601
|
+
function initI18N(i18nInstance) {
|
|
64602
|
+
conf2.i18n = i18nInstance;
|
|
64603
|
+
conf2.planNames = {
|
|
64604
|
+
basic: i18nInstance.t("userPlan.plans.basic.name"),
|
|
64605
|
+
plus: i18nInstance.t("userPlan.plans.plus.name")
|
|
64606
|
+
};
|
|
64607
|
+
return i18nInstance;
|
|
64608
|
+
}
|
|
64631
64609
|
// src/api/getMeasureCtx.ts
|
|
64632
64610
|
function getMeasureCtx() {
|
|
64633
64611
|
if (typeof document !== "undefined") {
|
|
@@ -64692,86 +64670,6 @@ function initPaths(path2D) {
|
|
|
64692
64670
|
};
|
|
64693
64671
|
}
|
|
64694
64672
|
|
|
64695
|
-
// node_modules/react-i18next/dist/es/unescape.js
|
|
64696
|
-
var matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
|
|
64697
|
-
var htmlEntities = {
|
|
64698
|
-
"&": "&",
|
|
64699
|
-
"&": "&",
|
|
64700
|
-
"<": "<",
|
|
64701
|
-
"<": "<",
|
|
64702
|
-
">": ">",
|
|
64703
|
-
">": ">",
|
|
64704
|
-
"'": "'",
|
|
64705
|
-
"'": "'",
|
|
64706
|
-
""": '"',
|
|
64707
|
-
""": '"',
|
|
64708
|
-
" ": " ",
|
|
64709
|
-
" ": " ",
|
|
64710
|
-
"©": "©",
|
|
64711
|
-
"©": "©",
|
|
64712
|
-
"®": "®",
|
|
64713
|
-
"®": "®",
|
|
64714
|
-
"…": "…",
|
|
64715
|
-
"…": "…",
|
|
64716
|
-
"/": "/",
|
|
64717
|
-
"/": "/"
|
|
64718
|
-
};
|
|
64719
|
-
var unescapeHtmlEntity = (m) => htmlEntities[m];
|
|
64720
|
-
var unescape = (text5) => text5.replace(matchHtmlEntity, unescapeHtmlEntity);
|
|
64721
|
-
|
|
64722
|
-
// node_modules/react-i18next/dist/es/defaults.js
|
|
64723
|
-
var defaultOptions = {
|
|
64724
|
-
bindI18n: "languageChanged",
|
|
64725
|
-
bindI18nStore: "",
|
|
64726
|
-
transEmptyNodeValue: "",
|
|
64727
|
-
transSupportBasicHtmlNodes: true,
|
|
64728
|
-
transWrapTextNodes: "",
|
|
64729
|
-
transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
|
|
64730
|
-
useSuspense: true,
|
|
64731
|
-
unescape
|
|
64732
|
-
};
|
|
64733
|
-
function setDefaults() {
|
|
64734
|
-
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
64735
|
-
defaultOptions = {
|
|
64736
|
-
...defaultOptions,
|
|
64737
|
-
...options
|
|
64738
|
-
};
|
|
64739
|
-
}
|
|
64740
|
-
|
|
64741
|
-
// node_modules/react-i18next/dist/es/i18nInstance.js
|
|
64742
|
-
var i18nInstance;
|
|
64743
|
-
function setI18n(instance2) {
|
|
64744
|
-
i18nInstance = instance2;
|
|
64745
|
-
}
|
|
64746
|
-
|
|
64747
|
-
// node_modules/react-i18next/dist/es/initReactI18next.js
|
|
64748
|
-
var initReactI18next = {
|
|
64749
|
-
type: "3rdParty",
|
|
64750
|
-
init(instance2) {
|
|
64751
|
-
setDefaults(instance2.options.react);
|
|
64752
|
-
setI18n(instance2);
|
|
64753
|
-
}
|
|
64754
|
-
};
|
|
64755
|
-
// src/api/initI18NBrowser.ts
|
|
64756
|
-
function initI18NReact(isNode = false) {
|
|
64757
|
-
const i18nBrowser = createInstance();
|
|
64758
|
-
i18nBrowser.use(initReactI18next).use(Browser).init({
|
|
64759
|
-
debug: conf2.debug,
|
|
64760
|
-
detection: {
|
|
64761
|
-
order: ["navigator"]
|
|
64762
|
-
},
|
|
64763
|
-
supportedLngs: ["en", "ru"],
|
|
64764
|
-
defaultNS,
|
|
64765
|
-
resources,
|
|
64766
|
-
fallbackLng: conf2.FALLBACK_LNG,
|
|
64767
|
-
interpolation: {
|
|
64768
|
-
escapeValue: false
|
|
64769
|
-
}
|
|
64770
|
-
});
|
|
64771
|
-
conf2.i18n = i18nBrowser;
|
|
64772
|
-
return i18nBrowser;
|
|
64773
|
-
}
|
|
64774
|
-
|
|
64775
64673
|
// src/api/initBrowserSettings.ts
|
|
64776
64674
|
function initBrowserSettings() {
|
|
64777
64675
|
conf2.documentFactory = new BrowserDocumentFactory;
|
|
@@ -64781,7 +64679,6 @@ function initBrowserSettings() {
|
|
|
64781
64679
|
conf2.getDocumentHeight = () => document.documentElement.clientHeight;
|
|
64782
64680
|
conf2.getDPI = () => window.devicePixelRatio;
|
|
64783
64681
|
conf2.getDOMParser = getBrowserDOMParser;
|
|
64784
|
-
initI18NReact();
|
|
64785
64682
|
initPaths(BrowserPath2D);
|
|
64786
64683
|
conf2.reactEditorFocus = (editor) => {
|
|
64787
64684
|
try {
|
package/dist/cjs/index.js
CHANGED
|
@@ -2140,6 +2140,7 @@ __export(exports_src, {
|
|
|
2140
2140
|
isHotkeyPushed: () => isHotkeyPushed,
|
|
2141
2141
|
isFiniteNumber: () => isFiniteNumber,
|
|
2142
2142
|
isControlCharacter: () => isControlCharacter,
|
|
2143
|
+
initI18N: () => initI18N,
|
|
2143
2144
|
getYouTubeVideoPreview: () => getYouTubeVideoPreview,
|
|
2144
2145
|
getYouTubeThumbnail: () => getYouTubeThumbnail,
|
|
2145
2146
|
getVideoMetadata: () => getVideoMetadata,
|
|
@@ -8150,7 +8151,7 @@ var Browser = /* @__PURE__ */ function() {
|
|
|
8150
8151
|
}();
|
|
8151
8152
|
Browser.type = "languageDetector";
|
|
8152
8153
|
|
|
8153
|
-
// src/api/
|
|
8154
|
+
// src/api/initDefaultI18N.ts
|
|
8154
8155
|
var defaultNS = "default";
|
|
8155
8156
|
var resources = {
|
|
8156
8157
|
en: {
|
|
@@ -8160,7 +8161,7 @@ var resources = {
|
|
|
8160
8161
|
default: {}
|
|
8161
8162
|
}
|
|
8162
8163
|
};
|
|
8163
|
-
function
|
|
8164
|
+
function initDefaultI18N() {
|
|
8164
8165
|
instance.use(Browser).init({
|
|
8165
8166
|
debug: conf2.debug,
|
|
8166
8167
|
detection: {
|
|
@@ -8517,7 +8518,7 @@ var conf2 = {
|
|
|
8517
8518
|
FALLBACK_LNG: "en",
|
|
8518
8519
|
cursorsMap
|
|
8519
8520
|
};
|
|
8520
|
-
|
|
8521
|
+
initDefaultI18N();
|
|
8521
8522
|
|
|
8522
8523
|
// src/Items/Transformation/Matrix.ts
|
|
8523
8524
|
class Matrix2 {
|
|
@@ -26827,8 +26828,6 @@ function setNodeStyles({
|
|
|
26827
26828
|
}
|
|
26828
26829
|
|
|
26829
26830
|
// src/Items/RichText/editorHelpers/markdown/markdownProcessor.ts
|
|
26830
|
-
var { i18n: i18n2 } = conf2;
|
|
26831
|
-
|
|
26832
26831
|
class MarkdownProcessor {
|
|
26833
26832
|
chunksQueue = [];
|
|
26834
26833
|
isProcessingChunk = false;
|
|
@@ -26859,7 +26858,7 @@ class MarkdownProcessor {
|
|
|
26859
26858
|
this.subject.publish(this);
|
|
26860
26859
|
return true;
|
|
26861
26860
|
}
|
|
26862
|
-
if (
|
|
26861
|
+
if (text3.startsWith(conf2.i18n.t("AIInput.generatingResponse"))) {
|
|
26863
26862
|
return true;
|
|
26864
26863
|
}
|
|
26865
26864
|
const isPrevTextEmpty = isTextEmpty(this.editor.children);
|
|
@@ -26917,7 +26916,7 @@ class MarkdownProcessor {
|
|
|
26917
26916
|
return;
|
|
26918
26917
|
}
|
|
26919
26918
|
const prevText = this.getText()?.[this.getText().length - 1]?.children[0]?.text;
|
|
26920
|
-
if (
|
|
26919
|
+
if (prevText?.startsWith(conf2.i18n.t("AIInput.generatingResponse"))) {
|
|
26921
26920
|
clearText(this.editor);
|
|
26922
26921
|
}
|
|
26923
26922
|
if (chunk.includes(`
|
|
@@ -29202,7 +29201,6 @@ class BaseItem extends Mbr {
|
|
|
29202
29201
|
}
|
|
29203
29202
|
|
|
29204
29203
|
// src/Items/RichText/RichText.ts
|
|
29205
|
-
var { i18n: i18n3 } = conf2;
|
|
29206
29204
|
var isEditInProcessValue = false;
|
|
29207
29205
|
var counter = 0;
|
|
29208
29206
|
|
|
@@ -29238,7 +29236,7 @@ class RichText extends BaseItem {
|
|
|
29238
29236
|
shrinkWidth = false;
|
|
29239
29237
|
prevMbr = null;
|
|
29240
29238
|
rtCounter = 0;
|
|
29241
|
-
constructor(board, container, id = "", transformation = new Transformation(id, board.events), linkTo, placeholderText =
|
|
29239
|
+
constructor(board, container, id = "", transformation = new Transformation(id, board.events), linkTo, placeholderText = conf2.i18n?.t("board.textPlaceholder"), isInShape = false, autoSize = false, insideOf, initialTextStyles = conf2.DEFAULT_TEXT_STYLES) {
|
|
29242
29240
|
super(board, id);
|
|
29243
29241
|
this.container = container;
|
|
29244
29242
|
this.transformation = transformation;
|
|
@@ -44374,7 +44372,6 @@ function getLine(lineStyle, start2, end2, middle) {
|
|
|
44374
44372
|
}
|
|
44375
44373
|
}
|
|
44376
44374
|
// src/Items/Connector/Connector.ts
|
|
44377
|
-
var { i18n: i18n4 } = conf2;
|
|
44378
44375
|
var ConnectionLineWidths = [1, 2, 3, 4, 5, 6, 7, 8, 12];
|
|
44379
44376
|
var CONNECTOR_COLOR = "rgb(20, 21, 26)";
|
|
44380
44377
|
var CONNECTOR_LINE_WIDTH = 1;
|
|
@@ -44429,7 +44426,7 @@ class Connector2 extends BaseItem {
|
|
|
44429
44426
|
this.lineColor = lineColor ?? CONNECTOR_COLOR;
|
|
44430
44427
|
this.lineWidth = lineWidth ?? CONNECTOR_LINE_WIDTH;
|
|
44431
44428
|
this.borderStyle = strokeStyle ?? CONNECTOR_BORDER_STYLE;
|
|
44432
|
-
this.text = new RichText(board, this.getMbr(), this.id, new Transformation, this.linkTo,
|
|
44429
|
+
this.text = new RichText(board, this.getMbr(), this.id, new Transformation, this.linkTo, conf2.i18n.t("connector.textPlaceholder", {
|
|
44433
44430
|
ns: "default"
|
|
44434
44431
|
}), true, false, "Connector", {
|
|
44435
44432
|
...conf2.DEFAULT_TEXT_STYLES,
|
|
@@ -64163,54 +64160,26 @@ function handleChatChunk(chunk, board) {
|
|
|
64163
64160
|
const item = board.items.getById(itemId);
|
|
64164
64161
|
switch (chunk.type) {
|
|
64165
64162
|
case "chunk":
|
|
64166
|
-
if (!
|
|
64163
|
+
if (!item2 || item2.itemType !== "AINode") {
|
|
64167
64164
|
return;
|
|
64168
64165
|
}
|
|
64169
|
-
|
|
64166
|
+
item2.getRichText()?.editor.markdownProcessor.processMarkdown(chunk.content || "");
|
|
64170
64167
|
break;
|
|
64171
64168
|
case "done":
|
|
64172
|
-
if (!
|
|
64169
|
+
if (!item2 || item2.itemType !== "AINode") {
|
|
64173
64170
|
board.aiGeneratingOnItem = undefined;
|
|
64174
64171
|
return;
|
|
64175
64172
|
}
|
|
64176
|
-
|
|
64173
|
+
item2.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
|
|
64177
64174
|
break;
|
|
64178
64175
|
case "end":
|
|
64179
|
-
if (!
|
|
64176
|
+
if (!item2 || item2.itemType !== "AINode") {
|
|
64180
64177
|
board.aiGeneratingOnItem = undefined;
|
|
64181
64178
|
return;
|
|
64182
64179
|
}
|
|
64183
|
-
|
|
64180
|
+
item2.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
|
|
64184
64181
|
break;
|
|
64185
64182
|
case "error":
|
|
64186
|
-
board.camera.unsubscribeFromItem();
|
|
64187
|
-
if (board.aiGeneratingOnItem) {
|
|
64188
|
-
const item2 = board.items.getById(board.aiGeneratingOnItem);
|
|
64189
|
-
if (item2) {
|
|
64190
|
-
board.selection.removeAll();
|
|
64191
|
-
board.selection.add(item2);
|
|
64192
|
-
if (item2.itemType === "AINode") {
|
|
64193
|
-
item2.getRichText().editor.markdownProcessor.setStopProcessingMarkDownCb(null);
|
|
64194
|
-
if (chunk.isExternalApiError) {
|
|
64195
|
-
const editor = item2.getRichText().editor;
|
|
64196
|
-
editor.clearText();
|
|
64197
|
-
editor.insertCopiedText(conf2.i18n.t("AIInput.nodeErrorText"));
|
|
64198
|
-
}
|
|
64199
|
-
}
|
|
64200
|
-
board.camera.zoomToFit(item2.getMbr(), 20);
|
|
64201
|
-
}
|
|
64202
|
-
}
|
|
64203
|
-
console.log("Error AI generate", chunk.error);
|
|
64204
|
-
if (!chunk.isExternalApiError) {
|
|
64205
|
-
conf2.notify({
|
|
64206
|
-
header: conf2.i18n.t("AIInput.textGenerationError.header"),
|
|
64207
|
-
body: conf2.i18n.t("AIInput.textGenerationError.body"),
|
|
64208
|
-
variant: "error",
|
|
64209
|
-
duration: 4000
|
|
64210
|
-
});
|
|
64211
|
-
}
|
|
64212
|
-
board.aiGeneratingOnItem = undefined;
|
|
64213
|
-
break;
|
|
64214
64183
|
default:
|
|
64215
64184
|
board.camera.unsubscribeFromItem();
|
|
64216
64185
|
if (!chunk.isExternalApiError) {
|
|
@@ -64221,23 +64190,23 @@ function handleChatChunk(chunk, board) {
|
|
|
64221
64190
|
duration: 4000
|
|
64222
64191
|
});
|
|
64223
64192
|
}
|
|
64224
|
-
|
|
64225
|
-
|
|
64226
|
-
|
|
64227
|
-
|
|
64228
|
-
|
|
64229
|
-
|
|
64230
|
-
|
|
64231
|
-
|
|
64232
|
-
|
|
64233
|
-
|
|
64234
|
-
|
|
64235
|
-
}
|
|
64193
|
+
const item2 = board.items.getById(board.aiGeneratingOnItem || "");
|
|
64194
|
+
if (board.aiGeneratingOnItem && item2) {
|
|
64195
|
+
board.selection.removeAll();
|
|
64196
|
+
board.selection.add(item2);
|
|
64197
|
+
const rt = item2?.getRichText();
|
|
64198
|
+
if (item2.itemType === "AINode" && rt) {
|
|
64199
|
+
const editor = rt.editor;
|
|
64200
|
+
editor.markdownProcessor.setStopProcessingMarkDownCb(null);
|
|
64201
|
+
if (chunk.isExternalApiError) {
|
|
64202
|
+
editor.clearText();
|
|
64203
|
+
editor.insertCopiedText(conf2.i18n.t("AIInput.nodeErrorText"));
|
|
64236
64204
|
}
|
|
64237
|
-
board.camera.zoomToFit(item2.getMbr(), 20);
|
|
64238
64205
|
}
|
|
64206
|
+
board.camera.zoomToFit(item2.getMbr(), 20);
|
|
64239
64207
|
}
|
|
64240
64208
|
board.aiGeneratingOnItem = undefined;
|
|
64209
|
+
break;
|
|
64241
64210
|
}
|
|
64242
64211
|
}
|
|
64243
64212
|
function handleAudioGenerate(response, board) {
|
|
@@ -64628,3 +64597,12 @@ messageRouter.addHandler("AiChat", handleAiChatMassage);
|
|
|
64628
64597
|
messageRouter.addHandler("Mode", handleModeMessage);
|
|
64629
64598
|
messageRouter.addHandler("PresenceEvent", handlePresenceEventMessage);
|
|
64630
64599
|
messageRouter.addHandler("UserJoin", handleUserJoinMessage);
|
|
64600
|
+
// src/api/initI18N.ts
|
|
64601
|
+
function initI18N(i18nInstance) {
|
|
64602
|
+
conf2.i18n = i18nInstance;
|
|
64603
|
+
conf2.planNames = {
|
|
64604
|
+
basic: i18nInstance.t("userPlan.plans.basic.name"),
|
|
64605
|
+
plus: i18nInstance.t("userPlan.plans.plus.name")
|
|
64606
|
+
};
|
|
64607
|
+
return i18nInstance;
|
|
64608
|
+
}
|