@dejwcake/craftable 0.0.1 → 0.0.3
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.
- package/dist/admin/Admin.js +33 -35
- package/dist/auth/Form.js +6 -13
- package/dist/base-components/Form/BaseForm.js +56 -88
- package/dist/base-components/Form/BaseUpload.js +112 -84
- package/dist/base-components/Form/bootstrap.js +11 -15
- package/dist/base-components/Listing/BaseListing.js +438 -425
- package/dist/base-components/Listing/components/Pagination.js +90 -95
- package/dist/base-components/Listing/components/Sortable.js +34 -41
- package/dist/base-components/Listing/components/UserDetailTooltip.js +49 -50
- package/dist/index.js +23 -38
- package/dist/overrides/trumbowyg.edit-embed-template.js +63 -67
- package/dist/overrides/trumbowyg.reupload.js +123 -141
- package/dist/overrides/trumbowyg.template.js +56 -59
- package/dist/translation/Form.js +6 -13
- package/dist/translation/Listing.js +255 -266
- package/dist/ui/index.js +27 -28
- package/package.json +7 -7
|
@@ -1,146 +1,128 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
3
|
(function ($) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var options = {
|
|
39
|
-
url: {
|
|
40
|
-
label: 'URL',
|
|
41
|
-
value: src,
|
|
42
|
-
required: true
|
|
43
|
-
},
|
|
44
|
-
reupload: {
|
|
45
|
-
label: trumbowyg.lang.reuploadImage,
|
|
46
|
-
value: src,
|
|
47
|
-
type: 'file',
|
|
48
|
-
attributes: {
|
|
49
|
-
accept: 'image/*'
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
alt: {
|
|
53
|
-
label: t.lang.description,
|
|
54
|
-
value: $img.attr('alt')
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
if (t.o.imageWidthModalEdit) {
|
|
59
|
-
options.width = {
|
|
60
|
-
value: $img.attr('width') ? $img.attr('width') : ''
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
var $modal = t.openModalInsert(t.lang.insertImage, options, function (v) {
|
|
65
|
-
$img.attr({
|
|
66
|
-
alt: v.alt
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
if (t.o.imageWidthModalEdit) {
|
|
70
|
-
if (parseInt(v.width) > 0) {
|
|
71
|
-
$img.attr({
|
|
72
|
-
width: v.width
|
|
73
|
-
});
|
|
74
|
-
} else {
|
|
75
|
-
$img.removeAttr('width');
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (v.src !== base64 && !v.reupload) {
|
|
80
|
-
$img.attr({
|
|
81
|
-
src: v.url
|
|
82
|
-
});
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (v.reupload) {
|
|
87
|
-
var prefix = trumbowyg.o.prefix;
|
|
88
|
-
var data = new FormData();
|
|
89
|
-
data.append(trumbowyg.o.plugins.upload.fileFieldName, $('.trumbowyg-modal input[type=file]').get(0).files[0]);
|
|
90
|
-
|
|
91
|
-
trumbowyg.o.plugins.upload.data.map(function (cur) {
|
|
92
|
-
data.append(cur.name, cur.value);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
$.map(v, function (curr, key) {
|
|
96
|
-
if (key !== 'file') {
|
|
97
|
-
data.append(key, curr);
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
if ($('.' + prefix + 'progress', $modal).length === 0) {
|
|
102
|
-
$('.' + prefix + 'modal-title', $modal).after($('<div/>', {
|
|
103
|
-
'class': prefix + 'progress'
|
|
104
|
-
}).append($('<div/>', {
|
|
105
|
-
'class': prefix + 'progress-bar'
|
|
106
|
-
})));
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
$.ajax({
|
|
110
|
-
url: trumbowyg.o.plugins.upload.serverPath,
|
|
111
|
-
headers: trumbowyg.o.plugins.upload.headers,
|
|
112
|
-
xhrFields: trumbowyg.o.plugins.upload.xhrFields,
|
|
113
|
-
type: 'POST',
|
|
114
|
-
data: data,
|
|
115
|
-
cache: false,
|
|
116
|
-
dataType: 'json',
|
|
117
|
-
processData: false,
|
|
118
|
-
contentType: false,
|
|
119
|
-
|
|
120
|
-
progressUpload: function progressUpload(e) {
|
|
121
|
-
$('.' + prefix + 'progress-bar').css('width', Math.round(e.loaded * 100 / e.total) + '%');
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
success: function success(data) {
|
|
125
|
-
trumbowyg.o.plugins.reupload.success(data, trumbowyg, $modal, v, $img);
|
|
126
|
-
},
|
|
127
|
-
|
|
128
|
-
error: trumbowyg.o.plugins.upload.error || function () {
|
|
129
|
-
trumbowyg.addErrorOnModalField($('input[type=file]', $modal), trumbowyg.lang.uploadError);
|
|
130
|
-
trumbowyg.$c.trigger('tbwuploaderror', [trumbowyg]);
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
return false;
|
|
136
|
-
};
|
|
137
|
-
}();
|
|
4
|
+
'use strict';
|
|
5
|
+
|
|
6
|
+
// My plugin default options
|
|
7
|
+
var defaultOptions = {};
|
|
8
|
+
$.extend(true, $.trumbowyg, {
|
|
9
|
+
// Add some translations
|
|
10
|
+
langs: {
|
|
11
|
+
en: {
|
|
12
|
+
reupload: 'Reupload',
|
|
13
|
+
reuploadImage: 'Reupload Image',
|
|
14
|
+
description: 'Alt Text'
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
// Add our plugin to Trumbowyg registred plugins
|
|
18
|
+
plugins: {
|
|
19
|
+
reupload: {
|
|
20
|
+
init: function init(trumbowyg) {
|
|
21
|
+
// Fill current Trumbowyg instance with my plugin default options
|
|
22
|
+
trumbowyg.o.plugins.reupload = $.extend(true, {}, defaultOptions, trumbowyg.o.plugins.reupload || {});
|
|
23
|
+
trumbowyg.o.imgDblClickHandler = function () {
|
|
24
|
+
var t = trumbowyg;
|
|
25
|
+
return function () {
|
|
26
|
+
var $img = $(this),
|
|
27
|
+
src = $img.attr('src'),
|
|
28
|
+
base64 = '(Base64)';
|
|
29
|
+
if (src.indexOf('data:image') === 0) {
|
|
30
|
+
src = base64;
|
|
31
|
+
}
|
|
32
|
+
var options = {
|
|
33
|
+
url: {
|
|
34
|
+
label: 'URL',
|
|
35
|
+
value: src,
|
|
36
|
+
required: true
|
|
138
37
|
},
|
|
139
|
-
|
|
140
|
-
|
|
38
|
+
reupload: {
|
|
39
|
+
label: trumbowyg.lang.reuploadImage,
|
|
40
|
+
value: src,
|
|
41
|
+
type: 'file',
|
|
42
|
+
attributes: {
|
|
43
|
+
accept: 'image/*'
|
|
44
|
+
}
|
|
141
45
|
},
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
46
|
+
alt: {
|
|
47
|
+
label: t.lang.description,
|
|
48
|
+
value: $img.attr('alt')
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
if (t.o.imageWidthModalEdit) {
|
|
52
|
+
options.width = {
|
|
53
|
+
value: $img.attr('width') ? $img.attr('width') : ''
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
var $modal = t.openModalInsert(t.lang.insertImage, options, function (v) {
|
|
57
|
+
$img.attr({
|
|
58
|
+
alt: v.alt
|
|
59
|
+
});
|
|
60
|
+
if (t.o.imageWidthModalEdit) {
|
|
61
|
+
if (parseInt(v.width) > 0) {
|
|
62
|
+
$img.attr({
|
|
63
|
+
width: v.width
|
|
64
|
+
});
|
|
65
|
+
} else {
|
|
66
|
+
$img.removeAttr('width');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (v.src !== base64 && !v.reupload) {
|
|
70
|
+
$img.attr({
|
|
71
|
+
src: v.url
|
|
72
|
+
});
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
if (v.reupload) {
|
|
76
|
+
var prefix = trumbowyg.o.prefix;
|
|
77
|
+
var data = new FormData();
|
|
78
|
+
data.append(trumbowyg.o.plugins.upload.fileFieldName, $('.trumbowyg-modal input[type=file]').get(0).files[0]);
|
|
79
|
+
trumbowyg.o.plugins.upload.data.map(function (cur) {
|
|
80
|
+
data.append(cur.name, cur.value);
|
|
81
|
+
});
|
|
82
|
+
$.map(v, function (curr, key) {
|
|
83
|
+
if (key !== 'file') {
|
|
84
|
+
data.append(key, curr);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
if ($('.' + prefix + 'progress', $modal).length === 0) {
|
|
88
|
+
$('.' + prefix + 'modal-title', $modal).after($('<div/>', {
|
|
89
|
+
'class': prefix + 'progress'
|
|
90
|
+
}).append($('<div/>', {
|
|
91
|
+
'class': prefix + 'progress-bar'
|
|
92
|
+
})));
|
|
93
|
+
}
|
|
94
|
+
$.ajax({
|
|
95
|
+
url: trumbowyg.o.plugins.upload.serverPath,
|
|
96
|
+
headers: trumbowyg.o.plugins.upload.headers,
|
|
97
|
+
xhrFields: trumbowyg.o.plugins.upload.xhrFields,
|
|
98
|
+
type: 'POST',
|
|
99
|
+
data: data,
|
|
100
|
+
cache: false,
|
|
101
|
+
dataType: 'json',
|
|
102
|
+
processData: false,
|
|
103
|
+
contentType: false,
|
|
104
|
+
progressUpload: function progressUpload(e) {
|
|
105
|
+
$('.' + prefix + 'progress-bar').css('width', Math.round(e.loaded * 100 / e.total) + '%');
|
|
106
|
+
},
|
|
107
|
+
success: function success(data) {
|
|
108
|
+
trumbowyg.o.plugins.reupload.success(data, trumbowyg, $modal, v, $img);
|
|
109
|
+
},
|
|
110
|
+
error: trumbowyg.o.plugins.upload.error || function () {
|
|
111
|
+
trumbowyg.addErrorOnModalField($('input[type=file]', $modal), trumbowyg.lang.uploadError);
|
|
112
|
+
trumbowyg.$c.trigger('tbwuploaderror', [trumbowyg]);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
return false;
|
|
118
|
+
};
|
|
119
|
+
}();
|
|
120
|
+
},
|
|
121
|
+
tagHandler: function tagHandler(element, trumbowyg) {
|
|
122
|
+
return [];
|
|
123
|
+
},
|
|
124
|
+
destroy: function destroy() {}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
});
|
|
146
128
|
})(jQuery);
|
|
@@ -1,67 +1,64 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
3
|
(function ($) {
|
|
4
|
-
|
|
4
|
+
'use strict';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// Adds the language variables
|
|
7
|
+
$.extend(true, $.trumbowyg, {
|
|
8
|
+
langs: {
|
|
9
|
+
en: {
|
|
10
|
+
template: 'Template'
|
|
11
|
+
},
|
|
12
|
+
fr: {
|
|
13
|
+
template: 'Patron'
|
|
14
|
+
},
|
|
15
|
+
nl: {
|
|
16
|
+
template: 'Sjabloon'
|
|
17
|
+
},
|
|
18
|
+
ru: {
|
|
19
|
+
template: 'Шаблон'
|
|
20
|
+
},
|
|
21
|
+
ja: {
|
|
22
|
+
template: 'テンプレート'
|
|
23
|
+
},
|
|
24
|
+
tr: {
|
|
25
|
+
template: 'Şablon'
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
7
29
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
ja: {
|
|
23
|
-
template: 'テンプレート'
|
|
24
|
-
},
|
|
25
|
-
tr: {
|
|
26
|
-
template: 'Şablon'
|
|
27
|
-
}
|
|
30
|
+
// Adds the extra button definition
|
|
31
|
+
$.extend(true, $.trumbowyg, {
|
|
32
|
+
plugins: {
|
|
33
|
+
template: {
|
|
34
|
+
shouldInit: function shouldInit(trumbowyg) {
|
|
35
|
+
return trumbowyg.o.plugins.hasOwnProperty('templates');
|
|
36
|
+
},
|
|
37
|
+
init: function init(trumbowyg) {
|
|
38
|
+
trumbowyg.addBtnDef('template', {
|
|
39
|
+
dropdown: templateSelector(trumbowyg),
|
|
40
|
+
hasIcon: false,
|
|
41
|
+
text: trumbowyg.lang.template
|
|
42
|
+
});
|
|
28
43
|
}
|
|
29
|
-
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
30
47
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
48
|
+
// Creates the template-selector dropdown.
|
|
49
|
+
function templateSelector(trumbowyg) {
|
|
50
|
+
var available = trumbowyg.o.plugins.templates;
|
|
51
|
+
var templates = [];
|
|
52
|
+
$.each(available, function (index, template) {
|
|
53
|
+
trumbowyg.addBtnDef('template_' + index, {
|
|
54
|
+
fn: function fn() {
|
|
55
|
+
trumbowyg.execCmd('insertHTML', template.html + '<br>');
|
|
56
|
+
},
|
|
57
|
+
hasIcon: false,
|
|
58
|
+
title: template.name
|
|
59
|
+
});
|
|
60
|
+
templates.push('template_' + index);
|
|
47
61
|
});
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
function templateSelector(trumbowyg) {
|
|
51
|
-
var available = trumbowyg.o.plugins.templates;
|
|
52
|
-
var templates = [];
|
|
53
|
-
|
|
54
|
-
$.each(available, function (index, template) {
|
|
55
|
-
trumbowyg.addBtnDef('template_' + index, {
|
|
56
|
-
fn: function fn() {
|
|
57
|
-
trumbowyg.execCmd('insertHTML', template.html + '<br>');
|
|
58
|
-
},
|
|
59
|
-
hasIcon: false,
|
|
60
|
-
title: template.name
|
|
61
|
-
});
|
|
62
|
-
templates.push('template_' + index);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
return templates;
|
|
66
|
-
}
|
|
62
|
+
return templates;
|
|
63
|
+
}
|
|
67
64
|
})(jQuery);
|
package/dist/translation/Form.js
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
var _vue = require(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _BaseForm2 = _interopRequireDefault(_BaseForm);
|
|
10
|
-
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
|
-
_vue2.default.component('translation-form', {
|
|
14
|
-
mixins: [_BaseForm2.default]
|
|
3
|
+
var _vue = _interopRequireDefault(require("vue"));
|
|
4
|
+
var _BaseForm = _interopRequireDefault(require("../base-components/Form/BaseForm"));
|
|
5
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
6
|
+
_vue["default"].component('translation-form', {
|
|
7
|
+
mixins: [_BaseForm["default"]]
|
|
15
8
|
});
|