您好,我想知道是否可以在默认情况下不显示手机上的红色边框区域?
我应该更改哪个文件/部分?
谢谢。
1 个赞
虽然 OP 中的屏幕截图是一个主题编辑,但主题标题、类别和标签框也比回复占用了更多的空间。
2 个赞
回复是可以的,但新主题太小了。
2 个赞
还有一个现有的 UX 主题,其中有更多讨论,如果您想在其中添加您的想法:
3 个赞
您可以通过点击右上角的汉堡包图标(3条水平线)来隐藏格式工具栏(您红色框中的区域)。
1 个赞
您可以尝试使用这个小程序。将其添加到您的主题或新组件的 Head 选项卡中的 HTML 中。
它会在以下条件下隐藏工具栏:
- 仅针对新主题/编辑主题首帖/主题草稿
- 移动视图
- 如果用户没有保存的偏好设置。 [1]
该代码不会干扰用户的偏好设置。
<script type="text/discourse-plugin" version="0.8">
const { on, observes } = require("discourse-common/utils/decorators");
const serviceComposer = api.container.lookup("service:composer");
function canUpdateToolbar(context) {
return (
// New topic / Editing first post / Topic draft
context._isNewTopic &&
// Toolbar is not hidden
context.showToolbar &&
// Mobile view only
context.site.mobileView &&
// Do not override user's preference
context.keyValueStore.get("toolbar-enabled") === undefined
);
}
function updateShowToolBar(value) {
serviceComposer._wasToolbarEnabled = !value;
// Hides the toolbar without remembering the state in the user's browser.
serviceComposer._toolbarEnabled = value;
// Refresh computed getter
serviceComposer.notifyPropertyChange("showToolbar");
}
api.modifyClass("component:composer-editor", {
pluginId: "composer-editor-toolbar",
@observes("composer.action")
_composerSwitchAction() {
// Handles the situation when switching from a reply to a new topic
// without closing the composer.
if (canUpdateToolbar(this)) {
updateShowToolBar(false);
}
},
@on("didInsertElement")
_composerEditorInit() {
this.appEvents.one(`${this.composerEventPrefix}:will-open`, () => {
if (canUpdateToolbar(this)) {
updateShowToolBar(false);
}
});
this._super(...arguments);
},
@on("willDestroyElement")
_composerClosed() {
this._super(...arguments);
// Restores the toolbar if it is manually hidden.
if (serviceComposer._wasToolbarEnabled) {
updateShowToolBar(true);
}
},
});
</script>
用户单击切换按钮后,浏览器会记住该状态 ↩︎
2 个赞
你好 Arkshine,谢谢你的回复,
我把它添加到了我的主题的 head 选项卡中,但它不起作用。
我是不是做错了?
1 个赞
我认为我们正在讨论大量重复信息,来自 Such a tiny window to edit here on a cell phone
让我们关闭这个,并将对话集中在那里。
4 个赞




