Skip to content

Commit d4da842

Browse files
committed
Update quick modify to support Ctrl+Enter
1 parent 8fb42ef commit d4da842

File tree

4 files changed

+147
-137
lines changed

4 files changed

+147
-137
lines changed

Sources/Actions/Display.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ public function prepareDisplayContext(): array|bool
225225
'label' => Lang::getTxt('quick_edit', file: 'General'),
226226
'class' => 'quick_edit',
227227
'id' => 'modify_button_' . $output['id'],
228-
'custom' => 'onclick="oQuickModify.modifyMsg(\'' . $output['id'] . '\', \'' . !empty(Config::$modSettings['toggle_subject']) . '\')"',
229228
'icon' => 'quick_edit_button',
230229
'show' => $output['can_modify'],
231230
],

Themes/default/Display.template.php

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ function template_main()
209209
// Show the topic information - icon, subject, etc.
210210
echo '
211211
<div id="forumposts">
212-
<form action="', Config::$scripturl, '?action=quickmod2;topic=', Utils::$context['current_topic'], '.', Utils::$context['start'], '" method="post" accept-charset="UTF-8" name="quickModForm" id="quickModForm" onsubmit="return oQuickModify.bInEditMode ? oQuickModify.modifySave(\'' . Utils::$context['session_id'] . '\', \'' . Utils::$context['session_var'] . '\') : false">';
212+
<form action="', Config::$scripturl, '?action=quickmod2;topic=', Utils::$context['current_topic'], '.', Utils::$context['start'], '" method="post" accept-charset="UTF-8" name="quickModForm" id="quickModForm">';
213213

214214
Utils::$context['ignoredMsgs'] = array();
215215
Utils::$context['removableMessageIDs'] = array();
@@ -327,30 +327,16 @@ function template_main()
327327
}
328328

329329
echo '
330-
var oQuickModify = new QuickModify({
330+
new QuickModify({
331331
sScriptUrl: smf_scripturl,
332+
sFormName: \'quickModForm\',
332333
sClassName: \'quick_edit\',
333334
bShowModify: ', Config::$modSettings['show_modify'] ? 'true' : 'false', ',
334335
iTopicId: ', Utils::$context['current_topic'], ',
335-
sTemplateBodyEdit: ', Utils::escapeJavaScript('
336-
<div id="quick_edit_body_container">
337-
<div id="error_box" class="error"></div>
338-
<textarea class="editor" name="message" rows="12">%body%</textarea><br>
339-
<input type="hidden" name="' . Utils::$context['session_var'] . '" value="' . Utils::$context['session_id'] . '">
340-
<input type="hidden" name="topic" value="' . Utils::$context['current_topic'] . '">
341-
<input type="hidden" name="msg" value="%msg_id%">
342-
<div class="righttext quickModifyMargin">
343-
<input type="submit" name="post" value="' . Lang::$txt['save'] . '" onclick="return oQuickModify.modifySave(\'' . Utils::$context['session_id'] . '\', \'' . Utils::$context['session_var'] . '\');" class="button">' . (Utils::$context['show_spellchecking'] ? ' <input type="button" value="' . Lang::$txt['spell_check'] . '" onclick="spellCheck(\'quickModForm\', \'message\');" class="button">' : '') . ' <input type="submit" name="cancel" value="' . Lang::$txt['modify_cancel'] . '" onclick="return oQuickModify.modifyCancel();" class="button">
344-
</div>
345-
</div>'), ',
346-
sTemplateSubjectEdit: ', Utils::escapeJavaScript('<input type="text" name="subject" value="%subject%" size="80" maxlength="80">'), ',
347-
sTemplateBodyNormal: ', Utils::escapeJavaScript('%body%'), ',
348-
sTemplateSubjectNormal: ', Utils::escapeJavaScript('<a href="' . Config::$scripturl . '?topic=' . Utils::$context['current_topic'] . '.msg%msg_id%#msg%msg_id%" rel="nofollow">%subject%</a>'), ',
349-
sTemplateTopSubject: ', Utils::escapeJavaScript('%subject%'), ',
350-
sTemplateReasonEdit: ', Utils::escapeJavaScript(Lang::$txt['reason_for_edit'] . ': <input type="text" name="modify_reason" value="%modify_reason%" size="80" maxlength="80" class="quickModifyMargin">'), ',
351-
sTemplateReasonNormal: ', Utils::escapeJavaScript('%modify_text'), ',
352-
sErrorBorderStyle: ', Utils::escapeJavaScript('1px solid red'), (Utils::$context['can_reply']) ? ',
353-
sFormRemoveAccessKeys: \'postmodify\'' : '', '
336+
sSaveButtonText: ', Utils::escapeJavaScript(Lang::getTxt('save', file: 'General')), ',
337+
sCancelButtonText: ', Utils::escapeJavaScript(Lang::getTxt('modify_cancel', file: 'General')), ',
338+
sEditReasonText: ', Utils::escapeJavaScript(Lang::getTxt('reason_for_edit', file: 'General')) . ',
339+
sErrorBorderStyle: ', Utils::escapeJavaScript('1px solid red'), '
354340
});
355341
356342
new JumpTo({

Themes/default/scripts/script.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,15 @@ function submitThisOnce(oControl)
551551

552552
return !smf_formSubmitted;
553553
}
554+
function reActivateThis(oControl)
555+
{
556+
// oControl might also be a form.
557+
var oForm = 'form' in oControl ? oControl.form : oControl;
558+
559+
var aTextareas = oForm.getElementsByTagName('textarea');
560+
for (var i = 0, n = aTextareas.length; i < n; i++)
561+
aTextareas[i].readOnly = false;
562+
}
554563

555564
// Deprecated, as innerHTML is supported everywhere.
556565
function setInnerHTML(oElement, sToValue)

0 commit comments

Comments
 (0)