mirror of
https://hk.gh-proxy.com/https://github.com/NodeBB/nodebb-plugin-composer-default.git
synced 2025-10-03 04:31:23 +08:00
fix: handle post editing of remote posts, nodebb/nodebb#12732
This commit is contained in:
parent
179c280fe7
commit
afd6c9b7ac
1 changed files with 14 additions and 1 deletions
|
@ -411,6 +411,9 @@ define('composer', [
|
|||
preview.matchScroll(postContainer);
|
||||
});
|
||||
|
||||
if (!utils.isNumber(postData.pid)) {
|
||||
handleRemotePid(postContainer);
|
||||
}
|
||||
handleHelp(postContainer);
|
||||
handleSearch(postContainer);
|
||||
focusElements(postContainer);
|
||||
|
@ -579,6 +582,16 @@ define('composer', [
|
|||
}, path, `${config.relative_path}/${returnPath}`);
|
||||
}
|
||||
|
||||
function handleRemotePid(postContainer) {
|
||||
alerts.alert({
|
||||
title: '[[modules:composer.remote-pid-editing]]',
|
||||
message: '[[modules:composer.remote-pid-content-immutable]]',
|
||||
timeout: 15000,
|
||||
});
|
||||
var container = postContainer.find('.write-container');
|
||||
container.addClass('hidden');
|
||||
}
|
||||
|
||||
function handleHelp(postContainer) {
|
||||
const helpBtn = postContainer.find('[data-action="help"]');
|
||||
helpBtn.on('click', async function () {
|
||||
|
@ -731,7 +744,7 @@ define('composer', [
|
|||
};
|
||||
} else if (action === 'posts.edit') {
|
||||
method = 'put';
|
||||
route = `/posts/${postData.pid}`;
|
||||
route = `/posts/${encodeURIComponent(postData.pid)}`;
|
||||
composerData = {
|
||||
...composerData,
|
||||
pid: postData.pid,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue