fix markup

This commit is contained in:
Anton Ignatov 2019-03-22 13:42:12 +01:00
parent 65521533b4
commit fc7400bec9

View file

@ -71,7 +71,7 @@
$('.mce-image-loader') $('.mce-image-loader')
.change(e => { .change(e => {
$(e.target).next().find('input[type=text]')[0].value = e.target.value.split(/(\\|\/)/g).pop() $(e.target).next().find('input[type=text]')[0].value = e.target.value.split(/(\\|\/)/g).pop();
}) })
.parent().find('label') .parent().find('label')
.css('line-height', '32px') .css('line-height', '32px')
@ -86,8 +86,10 @@
iframe = win.find('iframe')[0]; iframe = win.find('iframe')[0];
form = createElement('form', { form = createElement('form', {
action: editor.getParam('customimageuploader_form_url', action: editor.getParam(
'/tinymce_assets'), 'customimageuploader_form_url',
'/tinymce_assets'
),
target: iframe._id, target: iframe._id,
method: 'POST', method: 'POST',
enctype: 'multipart/form-data', enctype: 'multipart/form-data',
@ -97,36 +99,56 @@
iframe.getEl().name = iframe._id; iframe.getEl().name = iframe._id;
// Create some needed hidden inputs // Create some needed hidden inputs
form.appendChild(createElement('input', form.appendChild(
{ createElement(
type: 'hidden', 'input',
name: 'utf8', {
value: '✓' type: 'hidden',
})); name: 'utf8',
form.appendChild(createElement('input', value: '✓'
{ }
type: 'hidden', )
name: 'authenticity_token', );
value: getMetaContents('csrf-token') form.appendChild(
})); createElement(
form.appendChild(createElement('input', 'input',
{ {
type: 'hidden', type: 'hidden',
name: 'object_type', name: 'authenticity_token',
value: $(editor.getElement()).data('object-type') value: getMetaContents('csrf-token')
})); }
form.appendChild(createElement('input', )
{ );
type: 'hidden', form.appendChild(
name: 'object_id', createElement(
value: $(editor.getElement()).data('object-id') 'input',
})); {
form.appendChild(createElement('input', type: 'hidden',
{ name: 'object_type',
type: 'hidden', value: $(editor.getElement()).data('object-type')
name: 'hint', }
value: editor.getParam('uploadimage_hint', '') )
})); );
form.appendChild(
createElement(
'input',
{
type: 'hidden',
name: 'object_id',
value: $(editor.getElement()).data('object-id')
}
)
);
form.appendChild(
createElement(
'input',
{
type: 'hidden',
name: 'hint',
value: editor.getParam('uploadimage_hint', '')
}
)
);
for (cycle = 0; cycle < containers.length; cycle += 1) { for (cycle = 0; cycle < containers.length; cycle += 1) {
form.appendChild(containers[cycle]); form.appendChild(containers[cycle]);
} }
@ -308,6 +330,8 @@
}); });
tinymce.PluginManager.add('customimageuploader', tinymce.PluginManager.add(
tinymce.plugins.CustomImageUploader); 'customimageuploader',
tinymce.plugins.CustomImageUploader
);
})(); })();