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(examples): fix the broken uniscript demo

白熱70c2a5cc6049
diff --git a/common/shared/vite/auto-externalize-dependency-plugin.js b/common/shared/vite/auto-externalize-dependency-plugin.js
index 5d5cb971e6..91bbbeefe1 100644
--- a/common/shared/vite/auto-externalize-dependency-plugin.js
+++ b/common/shared/vite/auto-externalize-dependency-plugin.js
@@ -37,11 +37,6 @@ exports.autoExternalizeDependency = function autoExternalizeDependency() {
globals[source] = convertLibNameFromPackageName(source);
- return { id: source, external: true };
- } else if (source.includes('monaco-editor')) {
- externals.add('monaco-editor');
- globals['monaco-editor'] = externalMap['monaco-editor'];
-
return { id: source, external: true };
}
diff --git a/examples/src/uniscript/change-font-style.js b/examples/src/uniscript/change-font-style.js
index 810672c3ea..ff07d41510 100644
--- a/examples/src/uniscript/change-font-style.js
+++ b/examples/src/uniscript/change-font-style.js
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-const activeSheet = univerAPI.getCurrentSheet().getActiveSheet();
+const activeSheet = univerAPI.getActiveWorkbook().getActiveSheet();
// Set A1:B2 to bold
activeSheet.getRange(0, 0, 2, 2).setFontWeight('bold');
diff --git a/examples/src/uniscript/china-id-validation.js b/examples/src/uniscript/china-id-validation.js
index 820569ec3b..333744ba4c 100644
--- a/examples/src/uniscript/china-id-validation.js
+++ b/examples/src/uniscript/china-id-validation.js
@@ -57,7 +57,7 @@ function validIDNum(szID) {
const redColor = 'rgb(240, 55, 31)';
-const activeSheet = univerAPI.getCurrentSheet().getActiveSheet();
+const activeSheet = univerAPI.getActiveWorkbook().getActiveSheet();
const range = activeSheet.getRange(1, 1, 50, 1);
const row = range.getRow();
const col = range.getColumn();
diff --git a/examples/src/uniscript/draw-univer-logo.js b/examples/src/uniscript/draw-univer-logo.js
index 6316d317bb..c4c0b4b1f3 100644
--- a/examples/src/uniscript/draw-univer-logo.js
+++ b/examples/src/uniscript/draw-univer-logo.js
@@ -16,7 +16,7 @@
/* eslint-disable */
-const newSheet = univerAPI.getCurrentSheet().create('Draw Univer Logo', 80, 80);
+const newSheet = univerAPI.getActiveWorkbook().create("Draw Univer Logo", 80, 80);
newSheet.setRowHeights(0, 80, 6);
newSheet.setColumnWidths(0, 80, 6);
diff --git a/packages/uniscript/vite.config.ts b/packages/uniscript/vite.config.ts
index e7698fc5fd..4cbcfe231b 100644
--- a/packages/uniscript/vite.config.ts
+++ b/packages/uniscript/vite.config.ts
@@ -2,7 +2,7 @@ import createViteConfig from '@univerjs/shared/vite';
import pkg from './package.json';
export default ({ mode }) => createViteConfig({
- resolve: {
+ test: {
alias: [
{
find: /^monaco-editor$/,