ts-glitter 13.4.6 → 13.4.8

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.
@@ -77,7 +77,7 @@ export class ArrayItems {
77
77
  const dialog = new ShareDialog(gvc.glitter);
78
78
  dialog.dataLoading({ visible: true });
79
79
  view.push(yield new Promise((resolve, reject) => {
80
- gvc.glitter.getModule(new URL('./official_view_component/official/form.js', location.href).href, (res) => {
80
+ gvc.glitter.getModule(new URL('./official_view_component/official/form.js', gvc.glitter.root_path).href, (res) => {
81
81
  resolve(res.editorView({
82
82
  gvc: gvc,
83
83
  array: widget.bundle.form_config['form_array'] || [],
@@ -80,7 +80,7 @@ const gvc=cf.gvc;
80
80
  const dialog=new ShareDialog(gvc.glitter)
81
81
  dialog.dataLoading({visible:true})
82
82
  view.push(await new Promise((resolve, reject) => {
83
- gvc.glitter.getModule(new URL('./official_view_component/official/form.js', location.href).href, (res:any) => {
83
+ gvc.glitter.getModule(new URL('./official_view_component/official/form.js', gvc.glitter.root_path).href, (res:any) => {
84
84
  resolve(res.editorView({
85
85
  gvc: gvc,
86
86
  array: widget.bundle.form_config['form_array'] || [],
@@ -8,6 +8,7 @@ import {EditorElem} from "../../glitterBundle/plugins/editor-elem.js";
8
8
  const html = String.raw;
9
9
 
10
10
  export class ColorSelector {
11
+
11
12
  public static main(cf: { gvc: GVC; formData: any; widget: any; key: string; callback: (data: any) => void }) {
12
13
  const globalValue = cf.gvc.glitter.share.editorViewModel.appConfig;
13
14
  globalValue.color_theme = globalValue.color_theme ?? [];
@@ -26,5 +27,4 @@ export class ColorSelector {
26
27
 
27
28
 
28
29
  }
29
-
30
30
  (window as any).glitter.setModule(import.meta.url, ColorSelector);
@@ -830,7 +830,13 @@ ${(!error.message) ? `` : `錯誤訊息:${error.message}`}${(!error.lineNumber)
830
830
  success();
831
831
  return;
832
832
  }
833
- var scritem = urlArray[index];
833
+ let scritem = urlArray[index];
834
+ if (typeof scritem === 'string') {
835
+ scritem = new URL(scritem, glitter.root_path).href;
836
+ }
837
+ else {
838
+ scritem.src = new URL(scritem.src, glitter.root_path).href;
839
+ }
834
840
  if (Glitter.glitter.share.scriptMemory.indexOf(((_a = scritem.src) !== null && _a !== void 0 ? _a : scritem)) !== -1) {
835
841
  index++;
836
842
  addScript();
@@ -1014,6 +1020,7 @@ ${(!error.message) ? `` : `錯誤訊息:${error.message}`}${(!error.lineNumber)
1014
1020
  const head = document.head || document;
1015
1021
  function add(filePath) {
1016
1022
  return __awaiter(this, void 0, void 0, function* () {
1023
+ filePath = new URL(filePath, glitter.root_path).href;
1017
1024
  return new Promise((resolve, reject) => {
1018
1025
  const id = glitter.getUUID();
1019
1026
  let allLinks = document.querySelectorAll("link");
@@ -1102,7 +1109,7 @@ ${(!error.message) ? `` : `錯誤訊息:${error.message}`}${(!error.lineNumber)
1102
1109
  });
1103
1110
  glitter.addMtScript([{
1104
1111
  type: 'module',
1105
- src: js
1112
+ src: new URL(js, this.root_path).href
1106
1113
  }], () => {
1107
1114
  }, () => {
1108
1115
  }, [
@@ -393,7 +393,13 @@ ${(!error.message) ? `` : `錯誤訊息:${error.message}`}${(!error.lineNumber)
393
393
  success()
394
394
  return
395
395
  }
396
- var scritem: any = urlArray[index]
396
+ let scritem: any = urlArray[index]
397
+ if(typeof scritem==='string'){
398
+ scritem=new URL(scritem,glitter.root_path).href
399
+ }else{
400
+ scritem.src=new URL(scritem.src,glitter.root_path).href
401
+ }
402
+
397
403
  if (Glitter.glitter.share.scriptMemory.indexOf((scritem.src ?? scritem)) !== -1) {
398
404
  index++
399
405
  addScript()
@@ -603,6 +609,7 @@ ${(!error.message) ? `` : `錯誤訊息:${error.message}`}${(!error.lineNumber)
603
609
  const head = document.head || document;
604
610
 
605
611
  async function add(filePath: string) {
612
+ filePath=new URL(filePath,glitter.root_path).href
606
613
  return new Promise((resolve, reject) => {
607
614
  const id = glitter.getUUID()
608
615
  // 获取所有<a>标签
@@ -1158,7 +1165,7 @@ ${(!error.message) ? `` : `錯誤訊息:${error.message}`}${(!error.lineNumber)
1158
1165
  glitter.addMtScript(
1159
1166
  [{
1160
1167
  type: 'module',
1161
- src: js
1168
+ src: new URL(js, this.root_path).href
1162
1169
  }],
1163
1170
  () => {
1164
1171
  },