@osovitny/anatoly 1.2.0 → 1.2.2

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 (31) hide show
  1. package/bundles/osovitny-anatoly.umd.js +93 -51
  2. package/bundles/osovitny-anatoly.umd.js.map +1 -1
  3. package/bundles/osovitny-anatoly.umd.min.js +1 -1
  4. package/bundles/osovitny-anatoly.umd.min.js.map +1 -1
  5. package/esm2015/lib/ui/components/base-edit.component.js +4 -1
  6. package/esm2015/lib/ui/components/html-editor/base-html-editor.component.js +86 -0
  7. package/esm2015/lib/ui/components/html-editor/forms-html-editor.component.js +37 -0
  8. package/esm2015/lib/ui/components/html-editor/html-editor.component.js +6 -78
  9. package/esm2015/lib/ui/components/html-editor/html-editor.defaultoptions.js +38 -0
  10. package/esm2015/lib/ui/index.js +2 -1
  11. package/esm2015/lib/ui/ui.module.js +8 -5
  12. package/esm5/lib/ui/components/base-edit.component.js +4 -1
  13. package/esm5/lib/ui/components/html-editor/base-html-editor.component.js +90 -0
  14. package/esm5/lib/ui/components/html-editor/forms-html-editor.component.js +40 -0
  15. package/esm5/lib/ui/components/html-editor/html-editor.component.js +6 -79
  16. package/esm5/lib/ui/components/html-editor/html-editor.defaultoptions.js +38 -0
  17. package/esm5/lib/ui/index.js +2 -1
  18. package/esm5/lib/ui/ui.module.js +8 -5
  19. package/fesm2015/osovitny-anatoly.js +83 -47
  20. package/fesm2015/osovitny-anatoly.js.map +1 -1
  21. package/fesm5/osovitny-anatoly.js +93 -52
  22. package/fesm5/osovitny-anatoly.js.map +1 -1
  23. package/lib/ui/components/html-editor/base-html-editor.component.d.ts +16 -0
  24. package/lib/ui/components/html-editor/forms-html-editor.component.d.ts +6 -0
  25. package/lib/ui/components/html-editor/html-editor.component.d.ts +3 -16
  26. package/lib/ui/index.d.ts +1 -0
  27. package/osovitny-anatoly.metadata.json +1 -1
  28. package/package.json +1 -1
  29. package/esm2015/lib/ui/components/html-editor/html-editor.consts.js +0 -47
  30. package/esm5/lib/ui/components/html-editor/html-editor.consts.js +0 -47
  31. /package/lib/ui/components/html-editor/{html-editor.consts.d.ts → html-editor.defaultoptions.d.ts} +0 -0
@@ -991,6 +991,9 @@
991
991
  if (typeof name === 'undefined' || name == '') {
992
992
  return false;
993
993
  }
994
+ if (!this.formGroup) {
995
+ return false;
996
+ }
994
997
  if (this.formGroup.get(name)) {
995
998
  return (this.formSubmitted && this.formGroup.get(name).invalid) ||
996
999
  (this.formGroup.get(name).touched && this.formGroup.get(name).invalid);
@@ -1185,12 +1188,6 @@
1185
1188
  }(ValidationSummaryComponent));
1186
1189
 
1187
1190
  var ɵ0 = function (images) {
1188
- //let editor = this;
1189
- //alert("image.beforeUpload uploadType: " + editor.opts.imageUploadParams.uploadType + "_" + editor.opts.imageUploadParams.uploadParentId)
1190
- }, ɵ1 = function () {
1191
- }, ɵ2 = function () {
1192
- var editor = this;
1193
- //alert('contentChanged');
1194
1191
  };
1195
1192
  var DefaultEditorOptions = {
1196
1193
  placeholderText: 'Edit Your Content Here',
@@ -1222,11 +1219,8 @@
1222
1219
  imageUploadURL: '/api/HtmlEditor/UploadImage',
1223
1220
  imageAllowedTypes: ['jpeg', 'jpg', 'png'],
1224
1221
  imageUploadParams: { uploadType: '', uploadParentId: '' },
1225
- //Events
1226
1222
  events: {
1227
- 'image.beforeUpload': ɵ0,
1228
- 'initialized': ɵ1,
1229
- 'contentChanged': ɵ2
1223
+ 'image.beforeUpload': ɵ0
1230
1224
  }
1231
1225
  };
1232
1226
 
@@ -1245,21 +1239,18 @@
1245
1239
  Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
1246
1240
  </file>
1247
1241
  */
1248
- var HtmlEditorComponent = /** @class */ (function (_super) {
1249
- __extends(HtmlEditorComponent, _super);
1250
- function HtmlEditorComponent() {
1251
- var _this = _super !== null && _super.apply(this, arguments) || this;
1252
- _this._editorInitialized = false;
1242
+ var BaseHtmlEditorComponent = /** @class */ (function (_super) {
1243
+ __extends(BaseHtmlEditorComponent, _super);
1244
+ function BaseHtmlEditorComponent() {
1245
+ var _this = _super.call(this) || this;
1246
+ _this.editorInitialized = false;
1253
1247
  //General params
1254
1248
  _this.editorId = '';
1255
1249
  _this.editorLabelText = 'Html';
1256
1250
  _this.editorOptions = {};
1257
- //Form based params
1258
- _this.isFormBased = '1';
1259
- _this.editorFormKey = 'html';
1260
1251
  return _this;
1261
1252
  }
1262
- HtmlEditorComponent.prototype.ngOnInit = function () {
1253
+ BaseHtmlEditorComponent.prototype.ngOnInit = function () {
1263
1254
  var opt = this.editorOptions;
1264
1255
  if (typeof this.editorOptions == "string") {
1265
1256
  opt = JSON.parse(this.editorOptions);
@@ -1267,30 +1258,33 @@
1267
1258
  var newOptions = $.extend({}, DefaultEditorOptions, opt);
1268
1259
  var key = window.__froalaEditor_Key;
1269
1260
  if (key) {
1270
- newOptions = $.extend({}, JSON.parse('{ "key": "' + key + '" }'), newOptions);
1261
+ newOptions = $.extend({}, newOptions, JSON.parse('{ "key": "' + key + '" }'));
1262
+ }
1263
+ if (newOptions.events && newOptions.events.initialized) {
1264
+ newOptions.events.initialized.overridden = false;
1271
1265
  }
1272
1266
  this.options = newOptions;
1273
1267
  };
1274
- HtmlEditorComponent.prototype.doAfterEditorInitialized = function (action) {
1268
+ BaseHtmlEditorComponent.prototype.doAfterEditorInitialized = function (action) {
1275
1269
  var that = this;
1276
1270
  var timeOut = 500;
1277
- if (this._editorInitialized) {
1271
+ if (this.editorInitialized) {
1278
1272
  timeOut = 100;
1279
1273
  }
1280
1274
  setTimeout(function () { action(that); }, timeOut);
1281
1275
  };
1282
- HtmlEditorComponent.prototype.getEditor = function () {
1276
+ BaseHtmlEditorComponent.prototype.getEditor = function () {
1283
1277
  if (this._control)
1284
1278
  return this._control.getEditor();
1285
1279
  return null;
1286
1280
  };
1287
1281
  //Public Funcs
1288
- HtmlEditorComponent.prototype.initializeControl = function (control) {
1282
+ BaseHtmlEditorComponent.prototype.initializeControl = function (control) {
1289
1283
  this._control = control;
1290
1284
  this._control.initialize();
1291
- this._editorInitialized = true;
1285
+ this.editorInitialized = true;
1292
1286
  };
1293
- HtmlEditorComponent.prototype.setUploadParams = function (uploadType, uploadParentId) {
1287
+ BaseHtmlEditorComponent.prototype.setUploadParams = function (uploadType, uploadParentId) {
1294
1288
  this.doAfterEditorInitialized(function (that) {
1295
1289
  var editor = that.getEditor();
1296
1290
  if (typeof (editor) == "undefined" || editor == null) {
@@ -1300,10 +1294,39 @@
1300
1294
  editor.opts.imageUploadParams.uploadParentId = uploadParentId;
1301
1295
  });
1302
1296
  };
1297
+ __decorate([
1298
+ core.Input()
1299
+ ], BaseHtmlEditorComponent.prototype, "editorId", void 0);
1300
+ __decorate([
1301
+ core.Input()
1302
+ ], BaseHtmlEditorComponent.prototype, "editorLabelText", void 0);
1303
+ __decorate([
1304
+ core.Input()
1305
+ ], BaseHtmlEditorComponent.prototype, "editorOptions", void 0);
1306
+ return BaseHtmlEditorComponent;
1307
+ }(BaseEditComponent));
1308
+
1309
+ /*
1310
+ <file>
1311
+ Authors:
1312
+ Anatoly Osovitny
1313
+ Vadim Osovitny
1314
+
1315
+ Created:
1316
+ 12 Dec 2017
1317
+
1318
+ Version:
1319
+ 1.0
1320
+
1321
+ Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
1322
+ </file>
1323
+ */
1324
+ var HtmlEditorComponent = /** @class */ (function (_super) {
1325
+ __extends(HtmlEditorComponent, _super);
1326
+ function HtmlEditorComponent() {
1327
+ return _super.call(this) || this;
1328
+ }
1303
1329
  HtmlEditorComponent.prototype.setHtml = function (content) {
1304
- if (this.isFormBased == "1") {
1305
- return;
1306
- }
1307
1330
  this.doAfterEditorInitialized(function (that) {
1308
1331
  var editor = that.getEditor();
1309
1332
  if (typeof (editor) == "undefined" || editor == null) {
@@ -1313,38 +1336,54 @@
1313
1336
  });
1314
1337
  };
1315
1338
  HtmlEditorComponent.prototype.getHtml = function () {
1316
- if (this.isFormBased == "1") {
1317
- return null;
1318
- }
1319
1339
  var editor = this.getEditor();
1320
1340
  if (typeof (editor) == "undefined" || editor == null) {
1321
1341
  return;
1322
1342
  }
1323
1343
  return editor.html.get(false);
1324
1344
  };
1325
- __decorate([
1326
- core.Input()
1327
- ], HtmlEditorComponent.prototype, "editorId", void 0);
1328
- __decorate([
1329
- core.Input()
1330
- ], HtmlEditorComponent.prototype, "editorLabelText", void 0);
1331
- __decorate([
1332
- core.Input()
1333
- ], HtmlEditorComponent.prototype, "editorOptions", void 0);
1334
- __decorate([
1335
- core.Input()
1336
- ], HtmlEditorComponent.prototype, "isFormBased", void 0);
1337
- __decorate([
1338
- core.Input()
1339
- ], HtmlEditorComponent.prototype, "editorFormKey", void 0);
1340
1345
  HtmlEditorComponent = __decorate([
1341
1346
  core.Component({
1342
1347
  selector: 'anatoly-html-editor',
1343
- template: "<div [ngSwitch]=\"isFormBased\">\r\n <ng-template ngSwitchCase=\"0\">\r\n <label>{{ editorLabelText }}</label>\r\n <textarea id=\"htmleditor-{{editorId}}\" class=\"htmleditor-{{editorId}}\" \r\n [froalaEditor]=\"options\" (froalaInit)=\"initializeControl($event)\">\r\n </textarea>\r\n </ng-template>\r\n\r\n <ng-template ngSwitchCase=\"1\">\r\n <div [formGroup]=\"formGroup\">\r\n <div class=\"form-group\" [ngClass]=\"{'has-error': isItemInvalid(editorFormKey) }\">\r\n <label class=\"control-label\">{{ editorLabelText }}</label>\r\n <textarea id=\"htmleditor-{{editorId}}\" class=\"htmleditor-{{editorId}}\"\r\n [formControlName]=\"editorFormKey\"\r\n [froalaEditor]=\"options\" (froalaInit)=\"initializeControl($event)\">\r\n </textarea>\r\n <anatoly-item-validation-summary [formGroup]=\"formGroup\"\r\n [formSubmitted]=\"formSubmitted\"\r\n [key]=\"editorFormKey\"\r\n [title]=\"editorLabelText\">\r\n </anatoly-item-validation-summary>\r\n </div>\r\n </div>\r\n </ng-template>\r\n</div>\r\n"
1348
+ template: "<div>\r\n <label>{{ editorLabelText }}</label>\r\n <textarea id=\"htmleditor-{{editorId}}\" class=\"htmleditor-{{editorId}}\" \r\n [froalaEditor]=\"options\" (froalaInit)=\"initializeControl($event)\">\r\n </textarea>\r\n</div>"
1344
1349
  })
1345
1350
  ], HtmlEditorComponent);
1346
1351
  return HtmlEditorComponent;
1347
- }(BaseEditComponent));
1352
+ }(BaseHtmlEditorComponent));
1353
+
1354
+ /*
1355
+ <file>
1356
+ Authors:
1357
+ Anatoly Osovitny
1358
+ Vadim Osovitny
1359
+
1360
+ Created:
1361
+ 12 Dec 2017
1362
+
1363
+ Version:
1364
+ 1.0
1365
+
1366
+ Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
1367
+ </file>
1368
+ */
1369
+ var FormsHtmlEditorComponent = /** @class */ (function (_super) {
1370
+ __extends(FormsHtmlEditorComponent, _super);
1371
+ function FormsHtmlEditorComponent() {
1372
+ var _this = _super.call(this) || this;
1373
+ _this.editorFormKey = 'html';
1374
+ return _this;
1375
+ }
1376
+ __decorate([
1377
+ core.Input()
1378
+ ], FormsHtmlEditorComponent.prototype, "editorFormKey", void 0);
1379
+ FormsHtmlEditorComponent = __decorate([
1380
+ core.Component({
1381
+ selector: 'anatoly-forms-html-editor',
1382
+ template: "<div [formGroup]=\"formGroup\">\r\n <div class=\"form-group\" [ngClass]=\"{'has-error': isItemInvalid(editorFormKey) }\">\r\n <label class=\"control-label\">{{ editorLabelText }}</label>\r\n <textarea id=\"htmleditor-{{editorId}}\" class=\"htmleditor-{{editorId}}\"\r\n [formControlName]=\"editorFormKey\"\r\n [froalaEditor]=\"options\" (froalaInit)=\"initializeControl($event)\">\r\n </textarea>\r\n <anatoly-item-validation-summary [formGroup]=\"formGroup\"\r\n [formSubmitted]=\"formSubmitted\"\r\n [key]=\"editorFormKey\"\r\n [title]=\"editorLabelText\">\r\n </anatoly-item-validation-summary>\r\n </div>\r\n</div>\r\n"
1383
+ })
1384
+ ], FormsHtmlEditorComponent);
1385
+ return FormsHtmlEditorComponent;
1386
+ }(BaseHtmlEditorComponent));
1348
1387
 
1349
1388
  /*
1350
1389
  <file>
@@ -1386,14 +1425,16 @@
1386
1425
  http.HttpClientJsonpModule,
1387
1426
  ItemValidationSummaryComponent,
1388
1427
  FormValidationSummaryComponent,
1428
+ ContentHeaderComponent,
1389
1429
  HtmlEditorComponent,
1390
- ContentHeaderComponent
1430
+ FormsHtmlEditorComponent
1391
1431
  ],
1392
1432
  declarations: [
1393
1433
  ItemValidationSummaryComponent,
1394
1434
  FormValidationSummaryComponent,
1435
+ ContentHeaderComponent,
1395
1436
  HtmlEditorComponent,
1396
- ContentHeaderComponent
1437
+ FormsHtmlEditorComponent
1397
1438
  ],
1398
1439
  providers: [],
1399
1440
  schemas: [
@@ -1419,6 +1460,7 @@
1419
1460
  exports.BuyAccessButtonComponent = BuyAccessButtonComponent;
1420
1461
  exports.ContentHeaderComponent = ContentHeaderComponent;
1421
1462
  exports.FormValidationSummaryComponent = FormValidationSummaryComponent;
1463
+ exports.FormsHtmlEditorComponent = FormsHtmlEditorComponent;
1422
1464
  exports.HtmlEditorComponent = HtmlEditorComponent;
1423
1465
  exports.ItemValidationSummaryComponent = ItemValidationSummaryComponent;
1424
1466
  exports.SignInButtonComponent = SignInButtonComponent;