mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 09:26:54 -06:00
Add details to popup menu options.
This commit is contained in:
parent
95a58b80d7
commit
d4f03cc0e1
@ -1,11 +1,35 @@
|
||||
import { withPluginApi } from 'discourse/lib/plugin-api';
|
||||
|
||||
function initializeDetails(api) {
|
||||
api.decorateCooked($elem => $("details", $elem).details());
|
||||
|
||||
api.addToolbarPopupMenuOptionsCallback(() => {
|
||||
return {
|
||||
action: 'insertDetails',
|
||||
icon: 'caret-right',
|
||||
label: 'details.title'
|
||||
};
|
||||
});
|
||||
|
||||
const ComposerController = api.container.lookup("controller:composer");
|
||||
|
||||
ComposerController.reopen({
|
||||
actions: {
|
||||
insertDetails() {
|
||||
this.get("toolbarEvent").applySurround(
|
||||
"[details=",
|
||||
`]${I18n.t("composer.details_text")}[/details]`,
|
||||
"details_title")
|
||||
;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export default {
|
||||
name: "apply-details",
|
||||
|
||||
initialize() {
|
||||
withPluginApi('0.1', api => {
|
||||
api.decorateCooked($elem => $("details", $elem).details());
|
||||
});
|
||||
withPluginApi('0.1', initializeDetails);
|
||||
}
|
||||
};
|
||||
|
8
plugins/discourse-details/config/locales/client.en.yml
Normal file
8
plugins/discourse-details/config/locales/client.en.yml
Normal file
@ -0,0 +1,8 @@
|
||||
en:
|
||||
js:
|
||||
details:
|
||||
title: Insert Details
|
||||
composer:
|
||||
details_title: Summary
|
||||
details_text: "This text will be hidden"
|
||||
|
Loading…
Reference in New Issue
Block a user