@innovastudio/contentbuilder 1.4.69 → 1.4.70

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbuilder",
3
3
  "type": "module",
4
- "version": "1.4.69",
4
+ "version": "1.4.70",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -3932,6 +3932,70 @@ class Util {
3932
3932
  return s;
3933
3933
  }
3934
3934
  }
3935
+ showMessage(message) {
3936
+ const dom = this.dom;
3937
+ let html = '';
3938
+ html = `<div class="is-modal modalmessage" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
3939
+ <div class="is-modal-content" style="padding-top: 15px;padding-bottom: 20px;max-width: 450px;">
3940
+ <div style="margin: 20px 0 30px;font-size: 17px;">${message}</div>
3941
+ <button title="${this.out('Ok')}" class="input-ok classic focus-warning">${this.out('Ok')}</button>
3942
+ </div>
3943
+ </div>`;
3944
+ const builderStuff = this.builder.builderStuff;
3945
+ let modalMessage = builderStuff.querySelector('.modalmessage');
3946
+ if (!modalMessage) {
3947
+ dom.appendHtml(builderStuff, html);
3948
+ modalMessage = builderStuff.querySelector('.modalmessage');
3949
+ }
3950
+ this.showModal(modalMessage, true);
3951
+ let buttonok = modalMessage.querySelector('.is-confirm .input-ok');
3952
+ dom.addEventListener(buttonok, 'click', () => {
3953
+ this.hideModal(modalMessage);
3954
+ modalMessage.parentNode.removeChild(modalMessage); //remove modal
3955
+ });
3956
+ }
3957
+
3958
+ showChoice(message, yestext, callback) {
3959
+ const dom = this.dom;
3960
+ let html = '';
3961
+ html = `<div class="is-modal modalmessage" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
3962
+ <div class="is-modal-content" style="padding-top: 15px;padding-bottom: 20px;max-width: 450px;">
3963
+ <div style="margin: 20px 0 30px;font-size: 17px;">${message}</div>
3964
+
3965
+ <div style="display:flex;">
3966
+ <button title="${this.out('Cancel')}" class="input-cancel classic-secondary" style="width:100%;margin-right:4px;">${this.out('Cancel')}</button>
3967
+ <button title="${yestext}" class="input-ok classic-primary" style="width:100%">${yestext}</button>
3968
+ </div>
3969
+ </div>
3970
+ </div>`;
3971
+ const builderStuff = this.builder.builderStuff;
3972
+ let modalMessage = builderStuff.querySelector('.modalmessage');
3973
+ if (!modalMessage) {
3974
+ dom.appendHtml(builderStuff, html);
3975
+ modalMessage = builderStuff.querySelector('.modalmessage');
3976
+ }
3977
+ this.showModal(modalMessage, false, () => {
3978
+ //this function runs when overlay is clicked. Remove modal.
3979
+ modalMessage.parentNode.removeChild(modalMessage);
3980
+ callback(false);
3981
+ });
3982
+ let btnCancel = modalMessage.querySelector('.modalmessage .input-cancel');
3983
+ dom.addEventListener(btnCancel, 'click', () => {
3984
+ this.hideModal(modalMessage);
3985
+ modalMessage.parentNode.removeChild(modalMessage); //remove modal
3986
+
3987
+ callback(false);
3988
+ });
3989
+ btnCancel.focus();
3990
+ let btnOk = modalMessage.querySelector('.modalmessage .input-ok');
3991
+ dom.addEventListener(btnOk, 'click', () => {
3992
+ this.hideModal(modalMessage);
3993
+ modalMessage.parentNode.removeChild(modalMessage); //remove modal
3994
+
3995
+ //do task
3996
+ callback(true);
3997
+ });
3998
+ }
3935
3999
  confirm(message, callback, yesno, yestext) {
3936
4000
  if (!this.builder.deleteConfirm) {
3937
4001
  callback(true);