mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 20:45:58 +01:00
fixing quoting that broke with the introduction of the new post window
This commit is contained in:
@@ -30,12 +30,6 @@ var socket,
|
|||||||
console.log(data);
|
console.log(data);
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('api:posts.getRawPost', function(data) {
|
|
||||||
var contentEl = document.getElementById('post_content');
|
|
||||||
|
|
||||||
contentEl.value = data.post;
|
|
||||||
});
|
|
||||||
|
|
||||||
socket.on('connect', function(data){
|
socket.on('connect', function(data){
|
||||||
if(reconnecting) {
|
if(reconnecting) {
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
|
|||||||
@@ -443,10 +443,15 @@
|
|||||||
if (thread_state.locked !== '1') {
|
if (thread_state.locked !== '1') {
|
||||||
var pid = $(this).parents('li').attr('data-pid');
|
var pid = $(this).parents('li').attr('data-pid');
|
||||||
|
|
||||||
|
socket.once('api:posts.getRawPost', function(data) {
|
||||||
|
quoted = '> ' + data.post.replace(/\n/g, '\n> ') + '\n\n';
|
||||||
require(['composer'], function(cmp) {
|
require(['composer'], function(cmp) {
|
||||||
cmp.push(tid);
|
cmp.push(tid, null, null, quoted);
|
||||||
$('.post-window textarea').val('> ' + $('#content_' + pid).html() + '\n');
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
socket.emit('api:posts.getRawPost', { pid: pid });
|
||||||
|
// $('.post-window textarea').val('> ' + $('#content_' + pid).html() + '\n');
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -28,12 +28,12 @@ define(function() {
|
|||||||
'<span class="btn btn-link" tabindex="-1"><i class="icon-link"></i></span>' +
|
'<span class="btn btn-link" tabindex="-1"><i class="icon-link"></i></span>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'<div class="btn-group action-bar" style="float: right; margin-right: -12px">' +
|
'<div class="btn-group action-bar" style="float: right; margin-right: -12px">' +
|
||||||
'<button data-action="post" class="btn" tabIndex="3"><i class="icon-ok"></i> Submit</button>' +
|
'<button data-action="post" class="btn" tabIndex="2"><i class="icon-ok"></i> Submit</button>' +
|
||||||
'<button data-action="minimize" class="btn" tabIndex="4"><i class="icon-download-alt"></i> Minimize</button>' +
|
'<button data-action="minimize" class="btn" tabIndex="3"><i class="icon-download-alt"></i> Minimize</button>' +
|
||||||
'<button class="btn" data-action="discard" tabIndex="5"><i class="icon-remove"></i> Discard</button>' +
|
'<button class="btn" data-action="discard" tabIndex="4"><i class="icon-remove"></i> Discard</button>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'<textarea></textarea>' +
|
'<textarea tabIndex="1"></textarea>' +
|
||||||
'</div>';
|
'</div>';
|
||||||
|
|
||||||
composer.listEl = composer.btnContainer.querySelector('ul');
|
composer.listEl = composer.btnContainer.querySelector('ul');
|
||||||
@@ -167,11 +167,12 @@ define(function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
composer.push = function(tid, cid, pid) {
|
composer.push = function(tid, cid, pid, text) {
|
||||||
socket.emit('api:composer.push', {
|
socket.emit('api:composer.push', {
|
||||||
tid: tid, // Replying
|
tid: tid, // Replying
|
||||||
cid: cid, // Posting
|
cid: cid, // Posting
|
||||||
pid: pid // Editing
|
pid: pid, // Editing
|
||||||
|
body: text // Predefined text
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,6 +203,8 @@ define(function() {
|
|||||||
// Direct user focus to the correct element
|
// Direct user focus to the correct element
|
||||||
if ((parseInt(post_data.tid) || parseInt(post_data.pid)) > 0) {
|
if ((parseInt(post_data.tid) || parseInt(post_data.pid)) > 0) {
|
||||||
bodyEl.focus();
|
bodyEl.focus();
|
||||||
|
bodyEl.selectionStart = bodyEl.value.length;
|
||||||
|
bodyEl.selectionEnd = bodyEl.value.length;
|
||||||
} else if (parseInt(post_data.cid) > 0) {
|
} else if (parseInt(post_data.cid) > 0) {
|
||||||
titleEl.focus();
|
titleEl.focus();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -316,6 +316,7 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }),
|
|||||||
if (parseInt(data.tid) > 0) {
|
if (parseInt(data.tid) > 0) {
|
||||||
topics.get_topic(data.tid, uid, function(topicData) {
|
topics.get_topic(data.tid, uid, function(topicData) {
|
||||||
topicData.tid = data.tid;
|
topicData.tid = data.tid;
|
||||||
|
if (data.body) topicData.body = data.body;
|
||||||
socket.emit('api:composer.push', topicData);
|
socket.emit('api:composer.push', topicData);
|
||||||
});
|
});
|
||||||
} else if (parseInt(data.cid) > 0) {
|
} else if (parseInt(data.cid) > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user