Skip to content

Commit

Permalink
Merge pull request #111 from 2sic/develop
Browse files Browse the repository at this point in the history
v13.10 LTS
  • Loading branch information
iJungleboy authored May 4, 2022
2 parents fbc5cfd + c875395 commit 77afd24
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 30 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "2sxc-ui",
"version": "13.06.00",
"version": "13.10.00",
"description": "2sxc UI - the JS UI of 2sxc",
"scripts": {
"release-all": "npm run js2sxc && npm run inpage && npm run snippets && npm run quickdialog && npm run turn-on",
Expand Down
5 changes: 3 additions & 2 deletions projects/$2sxc/src/sxc-instance/web-api/sxc-web-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,11 @@ export class SxcWebApi implements Public.SxcWebApi {
// Note: fetch was documented in v12.10 (December 2021) but will probably never be used externally
// So we rename it to fetchRaw and later will make fetch just be the json implementation.
// Renamed and added this warning in 13.04 (2022-03-14), will drop in v14 and probably make it do fetchJson by default
// Changed functionality in 13.10 (2022-05-04) to make it do fetchJson by default
// Important: Do not document, as it shouldn't be used
fetch(url: string, data?: string | Record<string, any>, method?: string): Promise<Response> {
console.warn(`You are calling 'fetch' on the sxc.webApi. This is deprecated will stop in 2sxc v14, please use fetchRaw(...) or fetchJson(...) instead.`)
return this.fetchRaw(url, data, method);
// console.warn(`You are calling 'fetch' on the sxc.webApi. This is deprecated will stop in 2sxc v14, please use fetchRaw(...) or fetchJson(...) instead.`)
return this.fetchJson(url, data, method);
}


Expand Down
54 changes: 28 additions & 26 deletions projects/inpage/src/manage/edit-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,34 +95,36 @@ export class EditManager implements SxcInstanceManage {
this.editContext.contentBlock.Guid = newGuid;
}

/**
* init this object
*/
init(): void {
const tag = SxcEdit.getTag(this.sxc);
// enhance UI in case there are known errors / issues
const isErrorState = this.editContext && this.editContext.error && this.editContext.error.type;
if (isErrorState)
handleErrors(this.editContext.error.type, tag);
}
// /**
// * init this object
// */
// init(): void {
// // const tag = SxcEdit.getTag(this.sxc);
// // enhance UI in case there are known errors / issues
// // const isErrorState = this.editContext && this.editContext.error && this.editContext.error.type;
// // 2022-05-02 2dm - not sure if this is actually needed any more...
// // it only handled a single error
// // if (isErrorState)
// // handleErrors(this.editContext.error.type, tag);
// }


}


/**
* private: show error when the app-data hasn't been installed yet for this imported-module
*/
function handleErrors(errType: string, cbTag: HTMLElement): void {
const errWrapper = NoJQ.domFromString('<div class="dnnFormMessage dnnFormWarning sc-element"></div>')[0];
let msg = '';
const toolbar = NoJQ.domFromString('<ul class="sc-menu"></ul>')[0];
if (errType === 'DataIsMissing') {
msg =
'Error: System.Exception: Data is missing - usually when a site is copied but the content / apps have not been imported yet - check 2sxc.org/help?tag=export-import';
toolbar.setAttribute('data-toolbar', '[{\"action\": \"zone\"}, {\"action\": \"more\"}]');
}
errWrapper.append(msg);
errWrapper.append(toolbar);
cbTag.append(errWrapper);
}
// /**
// * private: show error when the app-data hasn't been installed yet for this imported-module
// */
// function handleErrors(errType: string, cbTag: HTMLElement): void {
// const errWrapper = NoJQ.domFromString('<div class="dnnFormMessage dnnFormWarning sc-element"></div>')[0];
// let msg = '';
// const toolbar = NoJQ.domFromString('<ul class="sc-menu"></ul>')[0];
// if (errType === 'DataIsMissing') {
// msg =
// 'Error: System.Exception: Data is missing - usually when a site is copied but the content / apps have not been imported yet - check 2sxc.org/help?tag=export-import';
// toolbar.setAttribute('data-toolbar', '[{\"action\": \"zone\"}, {\"action\": \"more\"}]');
// }
// errWrapper.append(msg);
// errWrapper.append(toolbar);
// cbTag.append(errWrapper);
// }
4 changes: 3 additions & 1 deletion projects/inpage/src/manage/manage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ export class Manage {
return new Cms().run({ ...runParams, context: sxc });
};

editManager.init();
// Init to handle special errors
// 2022-05-02 2dm disabled, don't think we need it any more
// editManager.init();
return editManager;
} catch (e) {
console.error('error in 2sxc - will log but not throw', e);
Expand Down

0 comments on commit 77afd24

Please sign in to comment.