@dejwcake/craftable 0.0.2 → 0.0.4

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.
@@ -1,105 +1,100 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
- value: true
4
+ value: true
5
5
  });
6
+ exports["default"] = void 0;
6
7
  var Pagination = {
7
- template: '<nav>\n <ul class="pagination sizeClass" v-if="pagination.last_page > 1">\n <li v-if="showPrevious()" :class="{ \'disabled\' : pagination.current_page <= 1, \'page-item\': true }">\n <span v-if="pagination.current_page <= 1" class="page-link">\n <span aria-hidden="true">{{ config.previousText }}</span>\n </span>\n\n <a href="#" v-if="pagination.current_page > 1 " :aria-label="config.ariaPrevioius" @click.prevent="changePage(pagination.current_page - 1)" class="page-link">\n <span aria-hidden="true">{{ config.previousText }}</span>\n </a>\n </li>\n\n <li v-for="num in array" :class="{ \'active\': num === pagination.current_page, \'page-item\': true }">\n <a href="#" @click.prevent="changePage(num)" class="page-link">{{ num }}</a>\n </li>\n\n <li v-if="showNext()" :class="{ \'disabled\' : pagination.current_page === pagination.last_page || pagination.last_page === 0, \'page-item\': true }">\n <span v-if="pagination.current_page === pagination.last_page || pagination.last_page === 0" class="page-link">\n <span aria-hidden="true">{{ config.nextText }}</span>\n </span>\n\n <a href="#" v-if="pagination.current_page < pagination.last_page" :aria-label="config.ariaNext" @click.prevent="changePage(pagination.current_page + 1)" class="page-link">\n <span aria-hidden="true">{{ config.nextText }}</span>\n </a>\n </li>\n </ul>\n </nav>',
8
- props: {
9
- pagination: {
10
- type: Object,
11
- default: function _default() {
12
- return this.$parent.pagination.state;
13
- }
14
- },
15
- callback: {
16
- type: Function,
17
- default: function _default() {
18
- return this.$parent.loadData();
19
- }
20
- },
21
- options: {
22
- type: Object,
23
- default: function _default() {
24
- if (!!this.$parent.pagination.options) {
25
- return this.$parent.pagination.options;
26
- } else {
27
- return {};
28
- }
29
- }
30
- },
31
- size: {
32
- type: String
33
- }
8
+ template: "<nav>\n <ul class=\"pagination sizeClass\" v-if=\"pagination.last_page > 1\">\n <li v-if=\"showPrevious()\" :class=\"{ 'disabled' : pagination.current_page <= 1, 'page-item': true }\">\n <span v-if=\"pagination.current_page <= 1\" class=\"page-link\">\n <span aria-hidden=\"true\">{{ config.previousText }}</span>\n </span>\n\n <a href=\"#\" v-if=\"pagination.current_page > 1 \" :aria-label=\"config.ariaPrevioius\" @click.prevent=\"changePage(pagination.current_page - 1)\" class=\"page-link\">\n <span aria-hidden=\"true\">{{ config.previousText }}</span>\n </a>\n </li>\n\n <li v-for=\"num in array\" :class=\"{ 'active': num === pagination.current_page, 'page-item': true }\">\n <a href=\"#\" @click.prevent=\"changePage(num)\" class=\"page-link\">{{ num }}</a>\n </li>\n\n <li v-if=\"showNext()\" :class=\"{ 'disabled' : pagination.current_page === pagination.last_page || pagination.last_page === 0, 'page-item': true }\">\n <span v-if=\"pagination.current_page === pagination.last_page || pagination.last_page === 0\" class=\"page-link\">\n <span aria-hidden=\"true\">{{ config.nextText }}</span>\n </span>\n\n <a href=\"#\" v-if=\"pagination.current_page < pagination.last_page\" :aria-label=\"config.ariaNext\" @click.prevent=\"changePage(pagination.current_page + 1)\" class=\"page-link\">\n <span aria-hidden=\"true\">{{ config.nextText }}</span>\n </a>\n </li>\n </ul>\n </nav>",
9
+ props: {
10
+ pagination: {
11
+ type: Object,
12
+ "default": function _default() {
13
+ return this.$parent.pagination.state;
14
+ }
34
15
  },
35
- computed: {
36
- array: function array() {
37
- if (this.pagination.last_page <= 0) {
38
- return [];
39
- }
40
-
41
- var from = this.pagination.current_page - this.config.offset;
42
- if (from < 1) {
43
- from = 1;
44
- }
45
-
46
- var to = from + this.config.offset * 2;
47
- if (to >= this.pagination.last_page) {
48
- to = this.pagination.last_page;
49
- }
50
-
51
- var arr = [];
52
- while (from <= to) {
53
- arr.push(from);
54
- from++;
55
- }
56
-
57
- return arr;
58
- },
59
- config: function config() {
60
- return Object.assign({
61
- offset: 3,
62
- ariaPrevious: 'Previous',
63
- ariaNext: 'Next',
64
- previousText: '«',
65
- nextText: '»',
66
- alwaysShowPrevNext: false
67
- }, this.options);
68
- },
69
- sizeClass: function sizeClass() {
70
- if (this.size === 'large') {
71
- return 'pagination-lg';
72
- } else if (this.size === 'small') {
73
- return 'pagination-sm';
74
- } else {
75
- return '';
76
- }
77
- }
16
+ callback: {
17
+ type: Function,
18
+ "default": function _default() {
19
+ return this.$parent.loadData();
20
+ }
78
21
  },
79
- watch: {
80
- 'pagination.per_page': function paginationPer_page(newVal, oldVal) {
81
- if (+newVal !== +oldVal) {
82
- this.$cookie.set('per_page', newVal);
83
- this.callback();
84
- }
22
+ options: {
23
+ type: Object,
24
+ "default": function _default() {
25
+ if (!!this.$parent.pagination.options) {
26
+ return this.$parent.pagination.options;
27
+ } else {
28
+ return {};
85
29
  }
30
+ }
86
31
  },
87
- methods: {
88
- showPrevious: function showPrevious() {
89
- return this.config.alwaysShowPrevNext || this.pagination.current_page > 1;
90
- },
91
- showNext: function showNext() {
92
- return this.config.alwaysShowPrevNext || this.pagination.current_page < this.pagination.last_page;
93
- },
94
- changePage: function changePage(page) {
95
- if (this.pagination.current_page === page) {
96
- return;
97
- }
98
-
99
- this.$set(this.pagination, 'current_page', page);
100
- this.callback();
101
- }
32
+ size: {
33
+ type: String
102
34
  }
35
+ },
36
+ computed: {
37
+ array: function array() {
38
+ if (this.pagination.last_page <= 0) {
39
+ return [];
40
+ }
41
+ var from = this.pagination.current_page - this.config.offset;
42
+ if (from < 1) {
43
+ from = 1;
44
+ }
45
+ var to = from + this.config.offset * 2;
46
+ if (to >= this.pagination.last_page) {
47
+ to = this.pagination.last_page;
48
+ }
49
+ var arr = [];
50
+ while (from <= to) {
51
+ arr.push(from);
52
+ from++;
53
+ }
54
+ return arr;
55
+ },
56
+ config: function config() {
57
+ return Object.assign({
58
+ offset: 3,
59
+ ariaPrevious: 'Previous',
60
+ ariaNext: 'Next',
61
+ previousText: '«',
62
+ nextText: '»',
63
+ alwaysShowPrevNext: false
64
+ }, this.options);
65
+ },
66
+ sizeClass: function sizeClass() {
67
+ if (this.size === 'large') {
68
+ return 'pagination-lg';
69
+ } else if (this.size === 'small') {
70
+ return 'pagination-sm';
71
+ } else {
72
+ return '';
73
+ }
74
+ }
75
+ },
76
+ watch: {
77
+ 'pagination.per_page': function paginationPer_page(newVal, oldVal) {
78
+ if (+newVal !== +oldVal) {
79
+ this.$cookie.set('per_page', newVal);
80
+ this.callback();
81
+ }
82
+ }
83
+ },
84
+ methods: {
85
+ showPrevious: function showPrevious() {
86
+ return this.config.alwaysShowPrevNext || this.pagination.current_page > 1;
87
+ },
88
+ showNext: function showNext() {
89
+ return this.config.alwaysShowPrevNext || this.pagination.current_page < this.pagination.last_page;
90
+ },
91
+ changePage: function changePage(page) {
92
+ if (this.pagination.current_page === page) {
93
+ return;
94
+ }
95
+ this.$set(this.pagination, 'current_page', page);
96
+ this.callback();
97
+ }
98
+ }
103
99
  };
104
-
105
- exports.default = Pagination;
100
+ var _default2 = exports["default"] = Pagination;
@@ -1,48 +1,41 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
- value: true
4
+ value: true
5
5
  });
6
+ exports["default"] = void 0;
6
7
  var Sortable = {
7
- props: {
8
- 'column': {
9
- type: String,
10
- required: true
11
- },
12
-
13
- 'orderBy': {
14
- type: Object,
15
- default: function _default() {
16
- return this.$parent.orderBy;
17
- }
18
- },
19
-
20
- 'callback': {
21
- type: Function,
22
- default: function _default() {
23
- return this.$parent.loadData();
24
- }
25
- }
8
+ props: {
9
+ 'column': {
10
+ type: String,
11
+ required: true
26
12
  },
27
-
28
- methods: {
29
-
30
- sort: function sort(column) {
31
- if (this.orderBy.column == column) {
32
- this.orderBy.direction = this.orderBy.direction == 'asc' ? 'desc' : 'asc';
33
- } else {
34
- this.orderBy.column = column;
35
- this.orderBy.direction = 'asc'; // I guess we do want to reset direction when changing column, but I'm not sure :)
36
- }
37
-
38
- this.callback();
39
-
40
- // FIXME callback should have return a Promise which can success or end with an error
41
- }
42
-
13
+ 'orderBy': {
14
+ type: Object,
15
+ "default": function _default() {
16
+ return this.$parent.orderBy;
17
+ }
43
18
  },
44
-
45
- template: '<th>' + '<a @click.stop="sort(column)"><span class="fa" :class="{\'fa-sort-amount-asc\': orderBy.column == column && orderBy.direction == \'asc\', \'fa-sort-amount-desc\': orderBy.column == column && orderBy.direction == \'desc\' }"></span> <slot></slot></a>' + '</th>'
19
+ 'callback': {
20
+ type: Function,
21
+ "default": function _default() {
22
+ return this.$parent.loadData();
23
+ }
24
+ }
25
+ },
26
+ methods: {
27
+ sort: function sort(column) {
28
+ if (this.orderBy.column == column) {
29
+ this.orderBy.direction = this.orderBy.direction == 'asc' ? 'desc' : 'asc';
30
+ } else {
31
+ this.orderBy.column = column;
32
+ this.orderBy.direction = 'asc'; // I guess we do want to reset direction when changing column, but I'm not sure :)
33
+ }
34
+ this.callback();
35
+
36
+ // FIXME callback should have return a Promise which can success or end with an error
37
+ }
38
+ },
39
+ template: '<th>' + '<a @click.stop="sort(column)"><span class="fa" :class="{\'fa-sort-amount-asc\': orderBy.column == column && orderBy.direction == \'asc\', \'fa-sort-amount-desc\': orderBy.column == column && orderBy.direction == \'desc\' }"></span> <slot></slot></a>' + '</th>'
46
40
  };
47
-
48
- exports.default = Sortable;
41
+ var _default2 = exports["default"] = Sortable;
@@ -1,55 +1,54 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
- value: true
4
+ value: true
5
5
  });
6
+ exports["default"] = void 0;
6
7
  var UserDetailTooltip = {
7
- template: '\n\t<v-popover class="avatar-tooltip-trigger"\n\t\ttrigger="click" \n :placement="placement"\n\t\toffset="5"\n\t\tcontainer="body"\n\t\t:auto-hide="true"\n\t>\n\n <img :src="user.avatar_thumb_url" class="avatar-photo" :alt="user.full_name" v-if="user.avatar_thumb_url">\n <div class="avatar-initials" v-if="!user.avatar_thumb_url">\n\t\t\t{{ abbr }}\n\t\t</div>\n\n\t\t<div class="avatar-full-name" v-if="options.showFullNameLabel">\n\t\t\t{{ user.full_name }}\n\t\t\t<span v-if="edit && datetime != \'\'">\n\t\t\t <br>\n\t\t\t <span class="user-info-span">{{datetime}}</span>\n\t\t\t</span>\n\t\t</div>\n\n\t\t<template slot="popover">\n\t\t\t<div class="user-avatar">\n\t\t\t\t<img :src="user.avatar_thumb_url" class="avatar-photo" :alt="user.full_name" v-if="user.avatar_thumb_url">\n\t\t\t\t<div class="avatar-initials" v-else>\n\t\t\t\t\t{{ abbr }}\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<div class="user-info">\n\t\t\t\t<h3>{{ user.full_name }} <small v-if="userText">| <strong style="text-transform: uppercase">{{ userText }}</strong></small></h3>\n\t\t\t\t<a v-if="user.email" v-bind:href="[\'mailto:\' + user.email]">{{ user.email }}</a>\n\n\t\t\t\t<slot></slot>\n\t\t\t</div>\n\t\t</template>\n </v-popover>\n',
8
-
9
- props: {
10
- user: {
11
- type: Object,
12
- required: true
13
- },
14
- userText: {
15
- type: String,
16
- default: function _default() {
17
- return '';
18
- }
19
- },
20
- text: {
21
- type: String,
22
- default: function _default() {
23
- return '';
24
- }
25
- },
26
- options: {
27
- type: Object,
28
- default: function _default() {
29
- return {
30
- showFullNameLabel: true
31
- };
32
- }
33
- },
34
- placement: {
35
- type: String,
36
- default: function _default() {
37
- return 'top';
38
- }
39
- },
40
- edit: {
41
- type: Boolean,
42
- default: function _default() {
43
- return false;
44
- }
45
- },
46
- datetime: ''
47
- },
48
- computed: {
49
- abbr: function abbr() {
50
- return '' + this.user.first_name.slice(0, 1) + this.user.last_name.slice(0, 1);
51
- }
52
- }
8
+ template: "\n\t<v-popover class=\"avatar-tooltip-trigger\"\n\t\ttrigger=\"click\" \n :placement=\"placement\"\n\t\toffset=\"5\"\n\t\tcontainer=\"body\"\n\t\t:auto-hide=\"true\"\n\t>\n\n <img :src=\"user.avatar_thumb_url\" class=\"avatar-photo\" :alt=\"user.full_name\" v-if=\"user.avatar_thumb_url\">\n <div class=\"avatar-initials\" v-if=\"!user.avatar_thumb_url\">\n\t\t\t{{ abbr }}\n\t\t</div>\n\n\t\t<div class=\"avatar-full-name\" v-if=\"options.showFullNameLabel\">\n\t\t\t{{ user.full_name }}\n\t\t\t<span v-if=\"edit && datetime != ''\">\n\t\t\t <br>\n\t\t\t <span class=\"user-info-span\">{{datetime}}</span>\n\t\t\t</span>\n\t\t</div>\n\n\t\t<template slot=\"popover\">\n\t\t\t<div class=\"user-avatar\">\n\t\t\t\t<img :src=\"user.avatar_thumb_url\" class=\"avatar-photo\" :alt=\"user.full_name\" v-if=\"user.avatar_thumb_url\">\n\t\t\t\t<div class=\"avatar-initials\" v-else>\n\t\t\t\t\t{{ abbr }}\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<div class=\"user-info\">\n\t\t\t\t<h3>{{ user.full_name }} <small v-if=\"userText\">| <strong style=\"text-transform: uppercase\">{{ userText }}</strong></small></h3>\n\t\t\t\t<a v-if=\"user.email\" v-bind:href=\"['mailto:' + user.email]\">{{ user.email }}</a>\n\n\t\t\t\t<slot></slot>\n\t\t\t</div>\n\t\t</template>\n </v-popover>\n",
9
+ props: {
10
+ user: {
11
+ type: Object,
12
+ required: true
13
+ },
14
+ userText: {
15
+ type: String,
16
+ "default": function _default() {
17
+ return '';
18
+ }
19
+ },
20
+ text: {
21
+ type: String,
22
+ "default": function _default() {
23
+ return '';
24
+ }
25
+ },
26
+ options: {
27
+ type: Object,
28
+ "default": function _default() {
29
+ return {
30
+ showFullNameLabel: true
31
+ };
32
+ }
33
+ },
34
+ placement: {
35
+ type: String,
36
+ "default": function _default() {
37
+ return 'top';
38
+ }
39
+ },
40
+ edit: {
41
+ type: Boolean,
42
+ "default": function _default() {
43
+ return false;
44
+ }
45
+ },
46
+ datetime: ''
47
+ },
48
+ computed: {
49
+ abbr: function abbr() {
50
+ return "".concat(this.user.first_name.slice(0, 1)).concat(this.user.last_name.slice(0, 1));
51
+ }
52
+ }
53
53
  };
54
-
55
- exports.default = UserDetailTooltip;
54
+ var _default2 = exports["default"] = UserDetailTooltip;
package/dist/index.js CHANGED
@@ -1,70 +1,55 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
- var _BaseForm = require('./base-components/Form/BaseForm');
8
-
9
- Object.defineProperty(exports, 'BaseForm', {
6
+ Object.defineProperty(exports, "Admin", {
10
7
  enumerable: true,
11
8
  get: function get() {
12
- return _interopRequireDefault(_BaseForm).default;
9
+ return _Admin["default"];
13
10
  }
14
11
  });
15
-
16
- var _BaseUpload = require('./base-components/Form/BaseUpload');
17
-
18
- Object.defineProperty(exports, 'BaseUpload', {
12
+ Object.defineProperty(exports, "Auth", {
19
13
  enumerable: true,
20
14
  get: function get() {
21
- return _interopRequireDefault(_BaseUpload).default;
15
+ return _Form["default"];
22
16
  }
23
17
  });
24
-
25
- var _BaseListing = require('./base-components/Listing/BaseListing');
26
-
27
- Object.defineProperty(exports, 'BaseListing', {
18
+ Object.defineProperty(exports, "BaseForm", {
28
19
  enumerable: true,
29
20
  get: function get() {
30
- return _interopRequireDefault(_BaseListing).default;
21
+ return _BaseForm["default"];
31
22
  }
32
23
  });
33
-
34
- var _Admin = require('./admin/Admin');
35
-
36
- Object.defineProperty(exports, 'Admin', {
24
+ Object.defineProperty(exports, "BaseListing", {
37
25
  enumerable: true,
38
26
  get: function get() {
39
- return _interopRequireDefault(_Admin).default;
27
+ return _BaseListing["default"];
40
28
  }
41
29
  });
42
-
43
- var _Form = require('./auth/Form');
44
-
45
- Object.defineProperty(exports, 'Auth', {
30
+ Object.defineProperty(exports, "BaseUpload", {
46
31
  enumerable: true,
47
32
  get: function get() {
48
- return _interopRequireDefault(_Form).default;
33
+ return _BaseUpload["default"];
49
34
  }
50
35
  });
51
-
52
- var _Form2 = require('./translation/Form');
53
-
54
- Object.defineProperty(exports, 'TranslationForm', {
36
+ Object.defineProperty(exports, "TranslationForm", {
55
37
  enumerable: true,
56
38
  get: function get() {
57
- return _interopRequireDefault(_Form2).default;
39
+ return _Form2["default"];
58
40
  }
59
41
  });
60
-
61
- var _Listing = require('./translation/Listing');
62
-
63
- Object.defineProperty(exports, 'TranslationListing', {
42
+ Object.defineProperty(exports, "TranslationListing", {
64
43
  enumerable: true,
65
44
  get: function get() {
66
- return _interopRequireDefault(_Listing).default;
45
+ return _Listing["default"];
67
46
  }
68
47
  });
69
-
70
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
48
+ var _BaseForm = _interopRequireDefault(require("./base-components/Form/BaseForm"));
49
+ var _BaseUpload = _interopRequireDefault(require("./base-components/Form/BaseUpload"));
50
+ var _BaseListing = _interopRequireDefault(require("./base-components/Listing/BaseListing"));
51
+ var _Admin = _interopRequireDefault(require("./admin/Admin"));
52
+ var _Form = _interopRequireDefault(require("./auth/Form"));
53
+ var _Form2 = _interopRequireDefault(require("./translation/Form"));
54
+ var _Listing = _interopRequireDefault(require("./translation/Listing"));
55
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
@@ -1,72 +1,68 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  (function ($) {
4
- 'use strict';
4
+ 'use strict';
5
5
 
6
- // My plugin default options
7
-
8
- var defaultOptions = {
9
- noEmbedEndpoint: 'https://noembed.com/embed?nowrap=on'
10
- };
11
-
12
- $.extend(true, $.trumbowyg, {
13
- // Add some translations
14
- langs: {
15
- en: {
16
- editNoEmbedTemplate: 'Edit embed'
17
- }
6
+ // My plugin default options
7
+ var defaultOptions = {
8
+ noEmbedEndpoint: 'https://noembed.com/embed?nowrap=on'
9
+ };
10
+ $.extend(true, $.trumbowyg, {
11
+ // Add some translations
12
+ langs: {
13
+ en: {
14
+ editNoEmbedTemplate: 'Edit embed'
15
+ }
16
+ },
17
+ // Add our plugin to Trumbowyg registred plugins
18
+ plugins: {
19
+ editNoEmbedTemplate: {
20
+ init: function init(trumbowyg) {
21
+ // Fill current Trumbowyg instance with my plugin default options
22
+ trumbowyg.o.plugins.editNoEmbedTemplate = $.extend(true, {}, defaultOptions, trumbowyg.o.plugins.editNoEmbedTemplate || {});
23
+ setTimeout(function () {
24
+ trumbowyg.$ed.on('dblclick', '.wysiwyg-noembed', function () {
25
+ var $iframe = $(this).find('iframe');
26
+ var $editor = $iframe.closest('.trumbowyg-editor');
27
+ var options = {
28
+ url: {
29
+ label: 'URL',
30
+ value: $iframe.attr('src'),
31
+ required: true
32
+ }
33
+ };
34
+ trumbowyg.openModalInsert(trumbowyg.lang.editNoEmbedTemplate, options, function (value) {
35
+ $.ajax({
36
+ url: trumbowyg.o.plugins.editNoEmbedTemplate.noEmbedEndpoint,
37
+ type: 'GET',
38
+ data: value,
39
+ cache: false,
40
+ dataType: 'jsonp',
41
+ crossOrigin: true,
42
+ success: trumbowyg.o.plugins.editNoEmbedTemplate.success || function (data) {
43
+ if (data.html) {
44
+ $iframe.replaceWith($(data.html));
45
+ trumbowyg.html($editor.html());
46
+ setTimeout(function () {
47
+ trumbowyg.closeModal();
48
+ }, 250);
49
+ } else {
50
+ trumbowyg.addErrorOnModalField($('input[type=text]', $modal), data.error);
51
+ }
52
+ },
53
+ error: trumbowyg.o.plugins.editNoEmbedTemplate.error || function () {
54
+ trumbowyg.addErrorOnModalField($('input[type=text]', $modal), trumbowyg.lang.noembedError);
55
+ }
56
+ });
57
+ });
58
+ });
59
+ }, 300);
18
60
  },
19
- // Add our plugin to Trumbowyg registred plugins
20
- plugins: {
21
- editNoEmbedTemplate: {
22
- init: function init(trumbowyg) {
23
- // Fill current Trumbowyg instance with my plugin default options
24
- trumbowyg.o.plugins.editNoEmbedTemplate = $.extend(true, {}, defaultOptions, trumbowyg.o.plugins.editNoEmbedTemplate || {});
25
-
26
- setTimeout(function () {
27
- trumbowyg.$ed.on('dblclick', '.wysiwyg-noembed', function () {
28
- var $iframe = $(this).find('iframe');
29
- var $editor = $iframe.closest('.trumbowyg-editor');
30
- var options = {
31
- url: {
32
- label: 'URL',
33
- value: $iframe.attr('src'),
34
- required: true
35
- }
36
- };
37
-
38
- trumbowyg.openModalInsert(trumbowyg.lang.editNoEmbedTemplate, options, function (value) {
39
- $.ajax({
40
- url: trumbowyg.o.plugins.editNoEmbedTemplate.noEmbedEndpoint,
41
- type: 'GET',
42
- data: value,
43
- cache: false,
44
- dataType: 'jsonp',
45
- crossOrigin: true,
46
- success: trumbowyg.o.plugins.editNoEmbedTemplate.success || function (data) {
47
- if (data.html) {
48
- $iframe.replaceWith($(data.html));
49
- trumbowyg.html($editor.html());
50
- setTimeout(function () {
51
- trumbowyg.closeModal();
52
- }, 250);
53
- } else {
54
- trumbowyg.addErrorOnModalField($('input[type=text]', $modal), data.error);
55
- }
56
- },
57
- error: trumbowyg.o.plugins.editNoEmbedTemplate.error || function () {
58
- trumbowyg.addErrorOnModalField($('input[type=text]', $modal), trumbowyg.lang.noembedError);
59
- }
60
- });
61
- });
62
- });
63
- }, 300);
64
- },
65
- tagHandler: function tagHandler(element, trumbowyg) {
66
- return [];
67
- },
68
- destroy: function destroy() {}
69
- }
70
- }
71
- });
61
+ tagHandler: function tagHandler(element, trumbowyg) {
62
+ return [];
63
+ },
64
+ destroy: function destroy() {}
65
+ }
66
+ }
67
+ });
72
68
  })(jQuery);