TickTackk
Well-known member
From my understanding, at this moment add-on developers will have to do weird hacks to make different editor rows have their own preview url if the parent form already has a
From my quick testing changing:
to
and
to
In
This will allow developers to have this:
And both editors should (theoretically) get preview from the
data-preview-url
set.From my quick testing changing:
JavaScript:
isPreviewAvailable: function($textarea)
{
if (!$textarea.closest('form').data('preview-url'))
{
return false;
}
if ($textarea.data('preview') === false)
{
return false;
}
return true;
},
JavaScript:
isPreviewAvailable: function($textarea)
{
if (!$textarea.data('preview-url') && !$textarea.closest('form').data('preview-url'))
{
return false;
}
if ($textarea.data('preview') === false)
{
return false;
}
return true;
},
and
JavaScript:
var $form = ed.$oel.closest('form'),
href = $form.data('preview-url'),
formData = XF.getDefaultFormData($form);
JavaScript:
var $form = ed.$oel.closest('form'),
href = ed.$oel.data('preview-url') ? ed.$oel.data('preview-url') : $form.data('preview-url'),
formData = XF.getDefaultFormData($form);
js/xf/editor.js
.This will allow developers to have this:
HTML:
<xf:editorrow name="first_editor" data-min-height="200"
label="{{ phrase('xy_first_editor') }}"
data-preview-url="{{ link_type('public', 'my-route/get-preview-for-first-editor') }}" />
<xf:editorrow name="other_editor" data-min-height="200"
label="{{ phrase('xy_other_editor') }}"
data-preview-url="{{ link_type('public', 'my-route/get-preview-for-other-editor') }}" />
data-preview-url
argument.
Upvote
7