Merge pull request '[PR]: Add an option to toggle opening post on click' (#10242) from Freeplay/calckey:note-click into develop

Reviewed-on: https://codeberg.org/calckey/calckey/pulls/10242
This commit is contained in:
Kainoa Kanter 2023-06-01 20:44:56 +00:00
commit caa6408e03
6 changed files with 23 additions and 9 deletions

View file

@ -598,6 +598,8 @@ scratchpadDescription: "The scratchpad provides an environment for AiScript expe
output: "Output" output: "Output"
script: "Script" script: "Script"
disablePagesScript: "Disable AiScript on Pages" disablePagesScript: "Disable AiScript on Pages"
expandOnNoteClick: "Open post on click"
expandOnNoteClickDesc: "If disabled, you can still open posts in the right-click menu or by clicking the timestamp."
updateRemoteUser: "Update remote user information" updateRemoteUser: "Update remote user information"
deleteAllFiles: "Delete all files" deleteAllFiles: "Delete all files"
deleteAllFilesConfirm: "Are you sure that you want to delete all files?" deleteAllFilesConfirm: "Are you sure that you want to delete all files?"

View file

@ -68,6 +68,7 @@
class="article" class="article"
@contextmenu.stop="onContextmenu" @contextmenu.stop="onContextmenu"
@click="noteClick" @click="noteClick"
:style="{ cursor: expandOnNoteClick && !detailedView ? 'pointer' : '' }"
> >
<div class="main"> <div class="main">
<div class="header-container"> <div class="header-container">
@ -313,6 +314,7 @@ const muted = ref(getWordSoftMute(note, $i, defaultStore.state.mutedWords));
const translation = ref(null); const translation = ref(null);
const translating = ref(false); const translating = ref(false);
const enableEmojiReactions = defaultStore.state.enableEmojiReactions; const enableEmojiReactions = defaultStore.state.enableEmojiReactions;
const expandOnNoteClick = defaultStore.state.expandOnNoteClick;
const keymap = { const keymap = {
r: () => reply(true), r: () => reply(true),
@ -501,7 +503,7 @@ function scrollIntoView() {
} }
function noteClick(e) { function noteClick(e) {
if (document.getSelection().type === "Range" || props.detailedView) { if (document.getSelection().type === "Range" || props.detailedView || !expandOnNoteClick) {
e.stopPropagation(); e.stopPropagation();
} else { } else {
router.push(notePage(appearNote)); router.push(notePage(appearNote));
@ -704,7 +706,6 @@ defineExpose({
position: relative; position: relative;
overflow: clip; overflow: clip;
padding: 4px 32px 10px; padding: 4px 32px 10px;
cursor: pointer;
&:first-child, &:first-child,
&:nth-child(2) { &:nth-child(2) {

View file

@ -534,12 +534,8 @@ onUnmounted(() => {
> .reply { > .reply {
border-top: solid 0.5px var(--divider); border-top: solid 0.5px var(--divider);
cursor: pointer;
padding-top: 24px; padding-top: 24px;
padding-bottom: 10px; padding-bottom: 10px;
@media (pointer: coarse) {
cursor: default;
}
} }
// Hover // Hover

View file

@ -14,7 +14,10 @@
@contextmenu.stop="onContextmenu" @contextmenu.stop="onContextmenu"
> >
<div v-if="conversation && depth > 1" class="line"></div> <div v-if="conversation && depth > 1" class="line"></div>
<div class="main" @click="noteClick"> <div class="main"
@click="noteClick"
:style="{ cursor: expandOnNoteClick ? 'pointer' : '' }"
>
<div class="avatar-container"> <div class="avatar-container">
<MkAvatar class="avatar" :user="appearNote.user" /> <MkAvatar class="avatar" :user="appearNote.user" />
<div <div
@ -258,6 +261,7 @@ const replies: misskey.entities.Note[] =
) )
.reverse() ?? []; .reverse() ?? [];
const enableEmojiReactions = defaultStore.state.enableEmojiReactions; const enableEmojiReactions = defaultStore.state.enableEmojiReactions;
const expandOnNoteClick = defaultStore.state.expandOnNoteClick;
useNoteCapture({ useNoteCapture({
rootEl: el, rootEl: el,
@ -397,7 +401,7 @@ function blur() {
} }
function noteClick(e) { function noteClick(e) {
if (document.getSelection().type === "Range") { if (document.getSelection().type === "Range" || !expandOnNoteClick) {
e.stopPropagation(); e.stopPropagation();
} else { } else {
router.push(notePage(props.note)); router.push(notePage(props.note));
@ -422,7 +426,6 @@ function noteClick(e) {
> .main { > .main {
display: flex; display: flex;
cursor: pointer;
> .avatar-container { > .avatar-container {
margin-right: 8px; margin-right: 8px;

View file

@ -54,6 +54,10 @@
<FormSwitch v-model="disablePagesScript" class="_formBlock">{{ <FormSwitch v-model="disablePagesScript" class="_formBlock">{{
i18n.ts.disablePagesScript i18n.ts.disablePagesScript
}}</FormSwitch> }}</FormSwitch>
<FormSwitch v-model="expandOnNoteClick" class="_formBlock">{{
i18n.ts.expandOnNoteClick
}}<template #caption>{{ i18n.ts.expandOnNoteClickDesc }}</template>
</FormSwitch>
<FormSwitch v-model="profile.showTimelineReplies" class="_formBlock" <FormSwitch v-model="profile.showTimelineReplies" class="_formBlock"
>{{ i18n.ts.flagShowTimelineReplies >{{ i18n.ts.flagShowTimelineReplies
}}<template #caption }}<template #caption
@ -299,6 +303,9 @@ const nsfw = computed(defaultStore.makeGetterSetter("nsfw"));
const disablePagesScript = computed( const disablePagesScript = computed(
defaultStore.makeGetterSetter("disablePagesScript") defaultStore.makeGetterSetter("disablePagesScript")
); );
const expandOnNoteClick = computed(
defaultStore.makeGetterSetter("expandOnNoteClick")
);
const showFixedPostForm = computed( const showFixedPostForm = computed(
defaultStore.makeGetterSetter("showFixedPostForm") defaultStore.makeGetterSetter("showFixedPostForm")
); );
@ -366,6 +373,7 @@ watch(
seperateRenoteQuote, seperateRenoteQuote,
showAdminUpdates, showAdminUpdates,
autoplayMfm, autoplayMfm,
expandOnNoteClick,
], ],
async () => { async () => {
await reloadAsk(); await reloadAsk();

View file

@ -162,6 +162,10 @@ export const defaultStore = markRaw(
where: "device", where: "device",
default: true, default: true,
}, },
expandOnNoteClick: {
where: "device",
default: true,
},
nsfw: { nsfw: {
where: "device", where: "device",
default: "respect" as "respect" | "force" | "ignore", default: "respect" as "respect" | "force" | "ignore",