Skip to content

Commit

Permalink
Update: 辞書ダイヤログを閉じてから再度開いた際に前回選択していた項目に選択した状態とする
Browse files Browse the repository at this point in the history
ついでに品詞設定をアクセントの上に持ってきた
  • Loading branch information
tsukumijima committed Jan 12, 2025
1 parent 3653df1 commit f4737e9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
34 changes: 17 additions & 17 deletions src/components/Dialog/DictionaryEditWordDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,29 @@
/>
</QInput>
</div>
<div class="row no-wrap q-px-md q-mb-lg desc-row" style="align-items: center; margin-top: 24px; white-space: normal;">
<div class="row no-wrap q-px-md q-mb-md desc-row" style="align-items: center; margin-top: 24px; white-space: normal;">
<QIcon name="sym_r_warning" color="warning-light" size="19px" class="q-mr-sm" />
<div>
英単語・数字・記号を含む単語は、辞書に反映されないことがあります。<br>
英単語はカタカナ表記にすると反映される場合もありますが、必ずしも反映されるとは限りません。
</div>
</div>
<div class="row q-px-md q-mt-md text-h6">品詞</div>
<div class="row q-px-md q-mt-sm q-mb-md desc-row" style="white-space: normal;">
登録する単語の品詞を選択してください。適切に設定すると、ユーザー辞書の適用精度が向上します。
</div>
<div class="row q-px-md q-pr-md">
<QSelect
v-model="wordType"
class="word-input"
outlined
:options="Object.entries(wordTypeLabels).map(([value, label]) => ({ value, label }))"
:disable="uiLocked"
dense
emitValue
mapOptions
/>
</div>
<div class="row q-px-md q-mt-lg text-h6">アクセント調整</div>
<div class="row q-px-md q-mt-sm q-mb-md desc-row">
語尾のアクセントを考慮して調整できるように、自動的に「が」が挿入されます。
Expand Down Expand Up @@ -117,22 +133,6 @@
</div>
</div>
</div>
<div class="row q-px-md q-mt-lg text-h6">品詞</div>
<div class="row q-px-md q-mt-sm q-mb-md desc-row" style="white-space: normal;">
登録する単語の品詞を選択してください。適切に設定すると、ユーザー辞書の適用精度が向上します。
</div>
<div class="row q-px-md q-pr-md">
<QSelect
v-model="wordType"
class="word-input"
outlined
:options="Object.entries(wordTypeLabels).map(([value, label]) => ({ value, label }))"
:disable="uiLocked"
dense
emitValue
mapOptions
/>
</div>
<div class="row q-px-md q-mt-lg text-h6">単語優先度</div>
<div class="row q-px-md q-mt-sm q-mb-lg desc-row">
単語を登録しても反映されないときは、単語優先度を徐々に上げてみてください。
Expand Down
10 changes: 8 additions & 2 deletions src/components/Dialog/DictionaryManageDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ watch(dictionaryManageDialogOpenedComputed, async (newValue) => {
const wordEditing = ref(false);
const surfaceInput = ref<QInput>();
const selectedId = ref("");
const lastSelectedId = ref("");
const surface = ref("");
const yomi = ref("");
Expand Down Expand Up @@ -455,13 +456,18 @@ const toInitialState = () => {
// 辞書の最初の項目を選択する
if (Object.keys(userDict.value).length > 0) {
const firstKey = Object.keys(userDict.value)[0];
selectWord(firstKey);
// 前回選択していた項目があればそれを選択、なければ最初の項目を選択
const targetKey = lastSelectedId.value && userDict.value[lastSelectedId.value]
? lastSelectedId.value
: Object.keys(userDict.value)[0];
selectWord(targetKey);
}
};
// 単語が選択されているだけの状態
const toWordSelectedState = () => {
wordEditing.value = false;
// 選択された項目を記憶
lastSelectedId.value = selectedId.value;
};
// 単語が編集されている状態
const toWordEditingState = () => {
Expand Down

0 comments on commit f4737e9

Please sign in to comment.