Skip to content

Commit

Permalink
Open bookmark labels when creating bookmark (Closes #1105)
Browse files Browse the repository at this point in the history
  • Loading branch information
tuomas2 committed Jul 8, 2021
1 parent e9806bb commit cd421cf
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
6 changes: 5 additions & 1 deletion app/bibleview-js/src/components/LabelList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,13 @@ export default {
}
}

function openActions() {
actions.value.showActions()
}

return {
labelStyle, assignLabels, actions, labelClicked, labels, isPrimary,
isAssigned, ...common
isAssigned, openActions, ...common
}
}
}
Expand Down
13 changes: 9 additions & 4 deletions app/bibleview-js/src/components/modals/BookmarkModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<div class="bookmark-title" style="width: calc(100% - 80px);">
<div class="overlay"/>
<div style="overflow-x: auto">
<LabelList single-line handle-touch in-bookmark :bookmark-id="bookmark.id"/>
<LabelList single-line handle-touch in-bookmark :bookmark-id="bookmark.id" ref="labelList"/>
</div>
<div class="title-text">
{{ bookmark.verseRangeAbbreviated }} <q v-if="bookmark.text"><i>{{ abbreviated(bookmark.text, 25)}}</i></q>
Expand Down Expand Up @@ -91,7 +91,7 @@ import Modal from "@/components/modals/Modal";
import {Events, setupEventBusListener} from "@/eventbus";
import {computed, ref} from "@vue/reactivity";
import {useCommon} from "@/composables";
import {inject} from "@vue/runtime-core";
import {inject, nextTick} from "@vue/runtime-core";
import {FontAwesomeIcon} from "@fortawesome/vue-fontawesome";
import EditableText from "@/components/EditableText";
import LabelList from "@/components/LabelList";
Expand All @@ -109,6 +109,7 @@ export default {
const areYouSure = ref(null);
const infoShown = ref(false);
const bookmarkId = ref(null);
const labelList = ref(null);

const {bookmarkMap, bookmarkLabels} = inject("globalBookmarks");

Expand All @@ -125,12 +126,16 @@ export default {
const bookmarkNotes = computed(() => bookmark.value.notes);
let originalNotes = null;

setupEventBusListener(Events.BOOKMARK_CLICKED, (bookmarkId_, {openInfo = false, openNotes = false} = {}) => {
setupEventBusListener(Events.BOOKMARK_CLICKED, async (bookmarkId_, {openLabels = false, openInfo = false, openNotes = false} = {}) => {
bookmarkId.value = bookmarkId_;
originalNotes = bookmarkNotes.value;
infoShown.value = !openNotes && (openInfo || !bookmarkNotes.value);
editDirectly.value = !infoShown.value && !bookmarkNotes.value;
showBookmark.value = true;
if(openLabels) {
await nextTick();
labelList.value.openActions();
}
});

function closeBookmark() {
Expand Down Expand Up @@ -166,7 +171,7 @@ export default {

return {
showBookmark, closeBookmark, areYouSure, infoShown, bookmarkNotes, bookmark, labelColor,
changeNote, labels, originalBookLink, strings, adjustedColor, editDirectly, toggleInfo, ...common
changeNote, labels, originalBookLink, strings, adjustedColor, editDirectly, toggleInfo, labelList, ...common
};
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,11 @@ class BibleView(val mainBibleActivity: MainBibleActivity,
val initialLabels = workspaceSettings.autoAssignLabels
bookmark.primaryLabelId = workspaceSettings.autoAssignPrimaryLabel
bookmarkControl.addOrUpdateBookmark(bookmark, initialLabels)
if(initialLabels.isEmpty()) {
executeJavascriptOnUiThread(
"bibleView.emit('bookmark_clicked', ${bookmark.id}, {openLabels: true});"
)
}
}

private fun compareSelection() {
Expand Down

0 comments on commit cd421cf

Please sign in to comment.