@huawei-ide/codearts 1.0.68 → 1.0.69

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.
Files changed (2) hide show
  1. package/index.js +11 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -35,12 +35,6 @@ function ideLoading() {
35
35
  return;
36
36
  }
37
37
  if (event.data === 'ide-loaded') {
38
- // Post location message to ide.
39
- postMessage({
40
- type: 'documentLink',
41
- data: `${window.location.origin}${window.location.pathname}`
42
- });
43
-
44
38
  resolve();
45
39
  window.removeEventListener('message', handleMessage);
46
40
  }
@@ -84,6 +78,14 @@ function onDidRecieveMessage(event) {
84
78
  }
85
79
  }
86
80
 
81
+ function setDocumentLink() {
82
+ // Post location message to ide.
83
+ postMessage({
84
+ type: 'documentLink',
85
+ data: `${window.location.origin}${window.location.pathname}`
86
+ });
87
+ }
88
+
87
89
  export function preload() {
88
90
  iframe.width = '1px';
89
91
  iframe.height = '1px';
@@ -107,6 +109,9 @@ export function show(id, style) {
107
109
 
108
110
  // file: { content: string, path: string, name: string, customW3cFragmentTextHash?: string }
109
111
  export function openFile(file) {
112
+ // need set document link before open file.
113
+ setDocumentLink();
114
+
110
115
  const message = {
111
116
  type: 'openFile',
112
117
  data: { ...file, customW3cFragmentTextHash: window.location.hash.startsWith(CUSTOM_W3C_FRAGMENT_TEXT_FLAG) ? window.location.hash : undefined }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huawei-ide/codearts",
3
- "version": "1.0.68",
3
+ "version": "1.0.69",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {