Revert "DEV: Switch theme to use new `addComposerToolbarPopupMenuOpti… (#62)
This reverts commit d59dc7caf4
.
We have compatibility problems with themes and core right now: https://meta.discourse.org/t/-/282315/7
This commit is contained in:
parent
d59dc7caf4
commit
04577e0b90
|
@ -1,4 +1,3 @@
|
||||||
< 3.2.0.beta2-dev: 566d79fa39eacfa299a7e60afe5b8d75020f7f7c
|
|
||||||
3.1.999: 323bd485b08889360edcae826d6272fd8e77d180
|
3.1.999: 323bd485b08889360edcae826d6272fd8e77d180
|
||||||
2.7.13: 5b2f5a455e1adf8ce5e8c1cfb7fbc3c388d3d82a
|
2.7.13: 5b2f5a455e1adf8ce5e8c1cfb7fbc3c388d3d82a
|
||||||
2.6.0.beta3: 68d40fe9f5b625cf465adc31b502a54e16d02cc6
|
2.6.0.beta3: 68d40fe9f5b625cf465adc31b502a54e16d02cc6
|
||||||
|
|
|
@ -5,7 +5,7 @@ export default {
|
||||||
name: "disco-toc-composer",
|
name: "disco-toc-composer",
|
||||||
|
|
||||||
initialize() {
|
initialize() {
|
||||||
withPluginApi("1.14.0", (api) => {
|
withPluginApi("1.0.0", (api) => {
|
||||||
const currentUser = api.getCurrentUser();
|
const currentUser = api.getCurrentUser();
|
||||||
if (!currentUser) {
|
if (!currentUser) {
|
||||||
return;
|
return;
|
||||||
|
@ -19,20 +19,28 @@ export default {
|
||||||
}
|
}
|
||||||
I18n.translations[I18n.currentLocale()].js.composer.contains_dtoc = " ";
|
I18n.translations[I18n.currentLocale()].js.composer.contains_dtoc = " ";
|
||||||
|
|
||||||
api.addComposerToolbarPopupMenuOption({
|
api.modifyClass("controller:composer", {
|
||||||
action: (toolbarEvent) => {
|
pluginId: "DiscoTOC",
|
||||||
toolbarEvent.applySurround(
|
|
||||||
`<div data-theme-toc="true">`,
|
actions: {
|
||||||
`</div>`,
|
insertDtoc() {
|
||||||
"contains_dtoc"
|
this.get("toolbarEvent").applySurround(
|
||||||
);
|
`<div data-theme-toc="true">`,
|
||||||
},
|
`</div>`,
|
||||||
icon: "align-left",
|
"contains_dtoc"
|
||||||
label: themePrefix("insert_table_of_contents"),
|
);
|
||||||
condition: (composer) => {
|
},
|
||||||
return composer.model.topicFirstPost;
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
api.addToolbarPopupMenuOptionsCallback((controller) => {
|
||||||
|
return {
|
||||||
|
action: "insertDtoc",
|
||||||
|
icon: "align-left",
|
||||||
|
label: themePrefix("insert_table_of_contents"),
|
||||||
|
condition: controller.get("model.topicFirstPost"),
|
||||||
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import I18n from "I18n";
|
|
||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
exists,
|
exists,
|
||||||
|
@ -20,10 +19,7 @@ acceptance("DiscoTOC - Composer", function (needs) {
|
||||||
await click("#create-topic");
|
await click("#create-topic");
|
||||||
const toolbarPopupMenu = selectKit(".toolbar-popup-menu-options");
|
const toolbarPopupMenu = selectKit(".toolbar-popup-menu-options");
|
||||||
await toolbarPopupMenu.expand();
|
await toolbarPopupMenu.expand();
|
||||||
|
await toolbarPopupMenu.selectRowByValue("insertDtoc");
|
||||||
await toolbarPopupMenu.selectRowByName(
|
|
||||||
I18n.t(themePrefix("insert_table_of_contents"))
|
|
||||||
);
|
|
||||||
|
|
||||||
assert.ok(query(".d-editor-input").value.includes('data-theme-toc="true"'));
|
assert.ok(query(".d-editor-input").value.includes('data-theme-toc="true"'));
|
||||||
});
|
});
|
||||||
|
@ -37,10 +33,7 @@ acceptance("DiscoTOC - Composer", function (needs) {
|
||||||
|
|
||||||
const toolbarPopupMenu = selectKit(".toolbar-popup-menu-options");
|
const toolbarPopupMenu = selectKit(".toolbar-popup-menu-options");
|
||||||
await toolbarPopupMenu.expand();
|
await toolbarPopupMenu.expand();
|
||||||
|
await toolbarPopupMenu.selectRowByValue("insertDtoc");
|
||||||
await toolbarPopupMenu.selectRowByName(
|
|
||||||
I18n.t(themePrefix("insert_table_of_contents"))
|
|
||||||
);
|
|
||||||
|
|
||||||
assert.ok(query(".d-editor-input").value.includes('data-theme-toc="true"'));
|
assert.ok(query(".d-editor-input").value.includes('data-theme-toc="true"'));
|
||||||
});
|
});
|
||||||
|
@ -51,10 +44,6 @@ acceptance("DiscoTOC - Composer", function (needs) {
|
||||||
const toolbarPopupMenu = selectKit(".toolbar-popup-menu-options");
|
const toolbarPopupMenu = selectKit(".toolbar-popup-menu-options");
|
||||||
await toolbarPopupMenu.expand();
|
await toolbarPopupMenu.expand();
|
||||||
|
|
||||||
assert.notOk(
|
assert.notOk(toolbarPopupMenu.rowByValue("insertDtoc").exists());
|
||||||
toolbarPopupMenu
|
|
||||||
.rowByName(I18n.t(themePrefix("insert_table_of_contents")))
|
|
||||||
.exists()
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue