mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-12 05:22:35 +09:00
Clean up editable preview handling code
This commit is contained in:
parent
d6da245166
commit
b229738808
1 changed files with 6 additions and 5 deletions
|
|
@ -999,21 +999,22 @@ $(function() {
|
||||||
/**
|
/**
|
||||||
* Editor preview replacement
|
* Editor preview replacement
|
||||||
*/
|
*/
|
||||||
$('.editable_preview').addClass('rhymix_content xe_content').attr('tabindex', 0);
|
const editable_previews = $('.editable_preview');
|
||||||
$('.editable_preview').on('click', function() {
|
editable_previews.addClass('rhymix_content xe_content').attr('tabindex', 0);
|
||||||
var input = $(this).siblings('.editable_preview_content');
|
editable_previews.on('click', function() {
|
||||||
|
let input = $(this).siblings('.editable_preview_content');
|
||||||
if (input.size()) {
|
if (input.size()) {
|
||||||
$(this).off('click').off('focus').hide();
|
$(this).off('click').off('focus').hide();
|
||||||
input = input.first();
|
input = input.first();
|
||||||
if (input.attr('type') !== 'hidden') {
|
if (input.attr('type') !== 'hidden') {
|
||||||
input.hide();
|
input.hide();
|
||||||
}
|
}
|
||||||
var iframe = $('<iframe class="editable_preview_iframe"></iframe>');
|
let iframe = $('<iframe class="editable_preview_iframe"></iframe>');
|
||||||
iframe.attr('src', current_url.setQuery('module', 'editor').setQuery('act', 'dispEditorFrame').setQuery('parent_input_id', input.attr('id')).replace(/^https?:/, ''));
|
iframe.attr('src', current_url.setQuery('module', 'editor').setQuery('act', 'dispEditorFrame').setQuery('parent_input_id', input.attr('id')).replace(/^https?:/, ''));
|
||||||
iframe.insertAfter(input);
|
iframe.insertAfter(input);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('.editable_preview').on('focus', function() {
|
editable_previews.on('focus', function() {
|
||||||
$(this).triggerHandler('click');
|
$(this).triggerHandler('click');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue