컴포저 툴바에 밑줄을 추가하는 테마 컴포넌트를 만들려고 합니다.
기능 자체는 작동하며 버튼 라벨도 정상적으로 표시되지만, 버튼을 사용할 때 다음과 같은 결과가 반환됩니다.
[en.composer.underline_text]
예상했던 결과는 다음과 같아야 합니다.
Example Text
여러 가지 방법을 시도해 보았지만 원인을 파악하지 못했습니다. 제가 놓치고 있는 부분이 무엇인지 아시는 분 있으신가요?
감사합니다
api-setup.js
import { apiInitializer } from "discourse/lib/api";
import I18n from "I18n";
import { iconNode } from "discourse-common/lib/icon-library";
export default apiInitializer("0.11.1", (api) => {
const currentLocale = I18n.currentLocale();
I18n.translations[currentLocale].js.underline_button_title = settings.underline_button;
I18n.translations[currentLocale].js.underline_text = settings.underline_text;
api.onToolbarCreate((toolbar) => {
const buttons = [
{
id: "underline_button",
group: "fontStyles",
icon: "underline",
shortcut: "U",
title: "underline_button_title",
perform: (e) => e.applySurround("[u]", "[/u]", "underline_text"),
},
];
buttons.forEach((button) => toolbar.addButton(button));
});
api.decorateCookedElement(
async (elem, helper) => {
const id = helper ? `post_${helper.getModel().id}` : "composer";
applyHighlight(elem, id);
},
{ id: "wrap-mark" }
);
});
settings.yml
underline_button:
default: "Underline"
description:
en: Enter the text for the title of the button in the composer.
underline_text:
default: "Example Text"
description:
en: Enter the placeholder text that appears in the composer after the user clicks the button.
Svg_icons:
type: 'list'
list_type: 'compact'
default: 'underline'
description:
en: "Include FontAwesome 6 icon classes for each icon used in the list."
en.yml
en:
js:
underline_button_title: settings.underline_button
underline_text: settings.underline_text