xmind-sdk-javascript icon indicating copy to clipboard operation
xmind-sdk-javascript copied to clipboard

浏览器中能否用open打开xmind获取内容

Open xlzy520 opened this issue 6 years ago • 4 comments

我用jszip是可以解压出来的,但是你这个插件可能没有更新jszip的用法,导致open方法报错了

xlzy520 avatar Nov 06 '18 02:11 xlzy520

After translating this, I have the same issue with XMind.open or Workbook.load not working.

Using it from a browser, it can't find the XML file within the ZIP file. Doesn't seem to be a issue with file processing in browser (vs node) since I get the error invalid xmind file. Looking at @leungwensen code, that means it can't find the XML doc after unpacking the .xmind ZIP contents.

Digging a little deeper, it appear the code assumes the file name is contents.xml, however XMind app uses the actual file name in a "real" XMind file. See https://github.com/leungwensen/xmind-sdk-javascript/blob/a4cb1d798e9d7edbef5dd6c7116a80053dd04857/lib/workbook.js#L177

The JSZip contents have some XML but not named contents.xml:

xmindZip = Object {
  files: Object {
  Downloads/observable-and-shafdog-generated-2.xmind: Object {
  name: "Downloads/observable-and-shafdog-generated-2.xmind"
  dir: false
  date: 2018-12-13T01:16:08
  comment: null
  unixPermissions: 33188
  dosPermissions: null
  _data: Object {compressedSize: 590, uncompressedSize: 1700, crc32: 491341145, compression: Object, compressedContent: Uint8Array(590)}
  _dataBinary: true
  options: Object {
  compression: null
  compressionOptions: null
}
}
...

shafdog avatar Dec 13 '18 19:12 shafdog

@shafdog you can view my project kityminder that forked from baidu nantu, removed the baidu verification,support preview 、edit、online, not support local export xmind file but it is not difficult.

xlzy520 avatar Dec 14 '18 00:12 xlzy520

@shafdog in https://github.com/zhibikanmohuakai/kityminder/blob/dev/src/protocol/xmind.js line 97, use the zip.HttpReader,so i can read the xmind from local and remote。 I use the url query and sessionStorage to get the xmind file's url and info.

xlzy520 avatar Dec 14 '18 00:12 xlzy520

@shafdog also you can only extract the fearture read the xmind file. 3q

xlzy520 avatar Dec 14 '18 00:12 xlzy520