mirror of
https://github.com/MultiMote/niimblue
synced 2026-01-19 19:37:11 +03:00
Add text edit button in cases where double-tapping does not work (#32)
This commit is contained in:
@@ -66,6 +66,14 @@
|
||||
commit();
|
||||
};
|
||||
|
||||
const editInPopup = () => {
|
||||
const text = prompt($tr("params.text.edit.title"), selectedText!.text);
|
||||
if (text !== null) {
|
||||
selectedText!.set({ text });
|
||||
commit();
|
||||
}
|
||||
};
|
||||
|
||||
const getFonts = async () => {
|
||||
try {
|
||||
const fonts = await queryLocalFonts();
|
||||
@@ -101,11 +109,7 @@
|
||||
class="btn btn-sm {selectedText.textAlign === 'right' ? 'btn-secondary' : ''}"
|
||||
on:click={() => setXAlign("right")}><MdIcon icon="format_align_right" /></button>
|
||||
<div class="dropdown">
|
||||
<button
|
||||
class="btn btn-sm dropdown-toggle"
|
||||
type="button"
|
||||
data-bs-toggle="dropdown"
|
||||
title={$tr("params.text.vorigin")}>
|
||||
<button class="btn btn-sm dropdown-toggle" type="button" data-bs-toggle="dropdown" title={$tr("params.text.vorigin")}>
|
||||
{#if selectedText.originY === "top"}
|
||||
<MdIcon icon="vertical_align_top" />
|
||||
{:else if selectedText.originY === "center"}
|
||||
@@ -159,13 +163,11 @@
|
||||
class="form-control"
|
||||
bind:value={selectedText.fontSize}
|
||||
on:input={commit} />
|
||||
<button
|
||||
class="btn btn-secondary"
|
||||
on:click={fontSizeDown}
|
||||
title={$tr("params.text.font_size.down")}><MdIcon icon="text_decrease" /></button>
|
||||
<button class="btn btn-secondary" on:click={fontSizeUp} title={$tr("params.text.font_size.up")}>
|
||||
<MdIcon icon="text_increase" />
|
||||
</button>
|
||||
<button class="btn btn-secondary" on:click={fontSizeDown} title={$tr("params.text.font_size.down")}
|
||||
><MdIcon icon="text_decrease" /></button>
|
||||
</div>
|
||||
|
||||
<div class="input-group flex-nowrap input-group-sm">
|
||||
@@ -200,7 +202,10 @@
|
||||
<input type="text" class="form-control" bind:value={selectedText.fontFamily} on:input={commit} />
|
||||
{/if}
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
|
||||
<button class="btn btn-sm btn-secondary" on:click={editInPopup} title={$tr("params.text.edit")}>
|
||||
<MdIcon icon="edit" />
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
|
||||
@@ -73,6 +73,8 @@ export const translation_en = {
|
||||
"params.text.vorigin.center": "Center",
|
||||
"params.text.vorigin.top": "Top",
|
||||
"params.text.vorigin": "Vertical Origin",
|
||||
"params.text.edit": "Edit in popup",
|
||||
"params.text.edit.title": "Editing text",
|
||||
"params.variables.insert.date": "Date",
|
||||
"params.variables.insert.datetime": "Datetime",
|
||||
"params.variables.insert.time": "Time",
|
||||
|
||||
@@ -100,6 +100,8 @@ export const translation_ru: Record<TranslationKey, string> = {
|
||||
"params.text.line_height": "Межстрочный интервал",
|
||||
"params.text.font_family": "Шрифт",
|
||||
"params.text.invert_colors": "Инвертировать цвета",
|
||||
"params.text.edit": "Редактировать во всплывающем диалоге",
|
||||
"params.text.edit.title": "Редактирование текста",
|
||||
"params.variables.insert": "Вставить переменную",
|
||||
"params.variables.insert.datetime": "Дата и время",
|
||||
"params.variables.insert.date": "Дата",
|
||||
|
||||
Reference in New Issue
Block a user