onlyoffice / document-editor-vue Goto Github PK
View Code? Open in Web Editor NEWVue component for ONLYOFFICE Document Server
License: Apache License 2.0
Vue component for ONLYOFFICE Document Server
License: Apache License 2.0
I want to save file with the js code, so I use next method:
editor.processSaveResult(true, 'Your document has been saved.');
but, it occure error. the document server log show this
[2023-07-30T06:20:57.754] [ERROR] [localhost] [862f4ea9442147168bdfa5a07d14dfc9] [22] nodeJS - clientLog: changesError: Error: Uncaught TypeError: this.api.asc_OnSaveEnd is not a function
Script: http://office.k8s-test.clps.com.cn/7.4.0-163/web-apps/apps/spreadsheeteditor/main/app.js
Line: 8:2463672
userAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
platform: Win32
isLoadFullApi: true
isDocumentLoadComplete: true
performance.memory: {"totalJSHeapSize":217741268,"usedJSHeapSize":204639936,"jsHeapSizeLimit":4294705152}
StackTrace: TypeError: this.api.asc_OnSaveEnd is not a function
at i.onProcessSaveResult (http://office.k8s-test.clps.com.cn/7.4.0-163/web-apps/apps/spreadsheeteditor/main/app.js:8:2463672)
at D (http://office.k8s-test.clps.com.cn/7.4.0-163/web-apps/apps/spreadsheeteditor/main/app.js:8:97744)
at Object.<anonymous> (http://office.k8s-test.clps.com.cn/7.4.0-163/web-apps/apps/spreadsheeteditor/main/app.js:8:97948)
at Object.<anonymous> (http://office.k8s-test.clps.com.cn/7.4.0-163/web-apps/apps/spreadsheeteditor/main/app.js:8:91123)
at Object.<anonymous> (http://office.k8s-test.clps.com.cn/7.4.0-163/web-apps/apps/spreadsheeteditor/main/app.js:8:177672)
at Object.dispatch (http://office.k8s-test.clps.com.cn/7.4.0-163/web-apps/apps/spreadsheeteditor/main/app.js:8:43421)
at b.handle (http://office.k8s-test.clps.com.cn/7.4.0-163/web-apps/apps/spreadsheeteditor/main/app.js:8:41416)
at Object.trigger (http://office.k8s-test.clps.com.cn/7.4.0-163/web-apps/apps/spreadsheeteditor/main/app.js:8:71941)
at Object.<anonymous> (http://office.k8s-test.clps.com.cn/7.4.0-163/web-apps/apps/spreadsheeteditor/main/app.js:8:72537)
at Function.each (http://office.k8s-test.clps.com.cn/7.4.0-163/web-apps/apps/spreadsheeteditor/main/app.js:8:2978)
<template>
<DocumentEditor
id="docEditor"
:config="config"
:documentServerUrl="serverUrl"
:events_on-app-ready="appReady"
height="1020px"
/>
</template>
<script setup>
import {defineExpose, defineProps, onMounted, ref} from 'vue';
import {DocumentEditor} from "@onlyoffice/document-editor-vue";
import pageApi from '../../assets/api/page.js'
const serverUrl = import.meta.env.VITE_OFFICE_SERVER + "";
const props = defineProps({
content: {
type: String,
required: true,
default: '',
}
});
let content;
let config;
let editor;
if (props.content) {
content = JSON.parse(props.content);
config = ref(content);
}
let appReady = (docEditor) => {
editor = docEditor
}
let save = () => {
editor.processSaveResult(true, 'Your document has been saved.');
}
onMounted(() => {
if (!content) {
return
}
pageApi.getOfficeToken(content).then((token) => {
config.value.token = token.data
});
});
defineExpose({save});
</script>
the moule version is 1.3.0
how can i fix it, hope help from somebody!
I changed config
props. But the document can not be changed.
Changed:
// example
{
url: '',
callback: ''
}
The document title have been changed, But content is old.
var connector = docEditor.createConnector()
connector.callCommand(function() {
var oDocument = Api.GetDocument();
var oParagraph = Api.CreateParagraph();
oParagraph.AddText(Asc.scope.text);
oDocument.InsertContent([oParagraph]);
}, function() { console.log("callback command"); });
Hello dear:
I tried this package in my old project,which is built with vue2.it Throwed an error, I found that this package is vue3 only, so,i'd like to ask for a version of vue2,is there any help?or how can I get more information for it?thanks.
How to use JWT? Thank you very much.
there are no method with name refreshHistory and setHistoryData in the vueEditor, but Official document say must use refreshHistory before onRequestHistory and setHistoryData before onRequestHistoryData
let url = this.documentServerUrl;
if (!url!.endsWith("/")) url += "/";
const docApiUrl = `${url}web-apps/apps/api/documents/api.js`;
loadScript(docApiUrl, "onlyoffice-api-script")
.then(() => this.onLoad())
.catch((err) => console.error(err)); // here
},
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.