相対パスでコピーされるのを修正

This commit is contained in:
syuilo 2020-11-03 10:06:19 +09:00
parent 72b03e009c
commit 7a5a541a4e
5 changed files with 45 additions and 33 deletions

View file

@ -28,6 +28,7 @@ import XHeader from '@/ui/_common_/header.vue';
import { popout } from '@/scripts/popout'; import { popout } from '@/scripts/popout';
import copyToClipboard from '@/scripts/copy-to-clipboard'; import copyToClipboard from '@/scripts/copy-to-clipboard';
import { resolve } from '@/router'; import { resolve } from '@/router';
import { url } from '@/config';
export default defineComponent({ export default defineComponent({
components: { components: {
@ -43,14 +44,14 @@ export default defineComponent({
provide() { provide() {
return { return {
navHook: (url) => { navHook: (path) => {
this.navigate(url); this.navigate(path);
} }
}; };
}, },
props: { props: {
initialUrl: { initialPath: {
type: String, type: String,
required: true, required: true,
}, },
@ -70,7 +71,7 @@ export default defineComponent({
data() { data() {
return { return {
pageInfo: null, pageInfo: null,
url: this.initialUrl, path: this.initialPath,
component: this.initialComponent, component: this.initialComponent,
props: this.initialProps, props: this.initialProps,
history: [], history: [],
@ -79,10 +80,14 @@ export default defineComponent({
}, },
computed: { computed: {
url(): string {
return url + this.path;
},
contextmenu() { contextmenu() {
return [{ return [{
type: 'label', type: 'label',
text: this.url, text: this.path,
}, { }, {
icon: faExpandAlt, icon: faExpandAlt,
text: this.$t('showInPage'), text: this.$t('showInPage'),
@ -91,7 +96,7 @@ export default defineComponent({
icon: faColumns, icon: faColumns,
text: this.$t('openInSideView'), text: this.$t('openInSideView'),
action: () => { action: () => {
this.sideViewHook(this.url); this.sideViewHook(this.path);
this.$refs.window.close(); this.$refs.window.close();
} }
} : undefined, { } : undefined, {
@ -123,10 +128,10 @@ export default defineComponent({
} }
}, },
navigate(url, record = true) { navigate(path, record = true) {
if (record) this.history.push(this.url); if (record) this.history.push(this.path);
this.url = url; this.path = path;
const { component, props } = resolve(url); const { component, props } = resolve(path);
this.component = component; this.component = component;
this.props = props; this.props = props;
}, },
@ -136,12 +141,12 @@ export default defineComponent({
}, },
expand() { expand() {
this.$router.push(this.url); this.$router.push(this.path);
this.$refs.window.close(); this.$refs.window.close();
}, },
popout() { popout() {
popout(this.url, this.$el); popout(this.path, this.$el);
this.$refs.window.close(); this.$refs.window.close();
}, },
}, },

View file

@ -177,10 +177,10 @@ export function popup(component: Component | typeof import('*.vue'), props: Reco
}; };
} }
export function pageWindow(url: string) { export function pageWindow(path: string) {
const { component, props } = resolve(url); const { component, props } = resolve(path);
popup(defineAsyncComponent(() => import('@/components/page-window.vue')), { popup(defineAsyncComponent(() => import('@/components/page-window.vue')), {
initialUrl: url, initialPath: path,
initialComponent: markRaw(component), initialComponent: markRaw(component),
initialProps: props, initialProps: props,
}, {}, 'closed'); }, {}, 'closed');

View file

@ -311,20 +311,20 @@ const Component = defineComponent({
}, },
menu(ev) { menu(ev) {
const url = this.groupId ? `/my/messaging/group/${this.groupId}` : `/my/messaging/${this.userAcct}`; const path = this.groupId ? `/my/messaging/group/${this.groupId}` : `/my/messaging/${this.userAcct}`;
os.modalMenu([this.inWindow ? undefined : { os.modalMenu([this.inWindow ? undefined : {
text: this.$t('openInWindow'), text: this.$t('openInWindow'),
icon: faWindowMaximize, icon: faWindowMaximize,
action: () => { action: () => {
os.pageWindow(url); os.pageWindow(path);
this.$router.back(); this.$router.back();
}, },
}, this.inWindow ? undefined : { }, this.inWindow ? undefined : {
text: this.$t('popout'), text: this.$t('popout'),
icon: faExternalLinkAlt, icon: faExternalLinkAlt,
action: () => { action: () => {
popout(url); popout(path);
this.$router.back(); this.$router.back();
}, },
}], ev.currentTarget || ev.target); }], ev.currentTarget || ev.target);

View file

@ -19,6 +19,7 @@ import XHeader from './_common_/header.vue';
import * as os from '@/os'; import * as os from '@/os';
import copyToClipboard from '@/scripts/copy-to-clipboard'; import copyToClipboard from '@/scripts/copy-to-clipboard';
import { resolve } from '@/router'; import { resolve } from '@/router';
import { url } from '@/config';
export default defineComponent({ export default defineComponent({
components: { components: {
@ -27,15 +28,15 @@ export default defineComponent({
provide() { provide() {
return { return {
navHook: (url) => { navHook: (path) => {
this.navigate(url); this.navigate(path);
} }
}; };
}, },
data() { data() {
return { return {
url: null, path: null,
component: null, component: null,
props: {}, props: {},
pageInfo: null, pageInfo: null,
@ -44,6 +45,12 @@ export default defineComponent({
}; };
}, },
computed: {
url(): string {
return url + this.path;
}
},
methods: { methods: {
changePage(page) { changePage(page) {
if (page == null) return; if (page == null) return;
@ -52,10 +59,10 @@ export default defineComponent({
} }
}, },
navigate(url, record = true) { navigate(path, record = true) {
if (record && this.url) this.history.push(this.url); if (record && this.path) this.history.push(this.path);
this.url = url; this.path = path;
const { component, props } = resolve(url); const { component, props } = resolve(path);
this.component = component; this.component = component;
this.props = props; this.props = props;
}, },
@ -65,7 +72,7 @@ export default defineComponent({
}, },
close() { close() {
this.url = null; this.path = null;
this.component = null; this.component = null;
this.props = {}; this.props = {};
}, },
@ -73,19 +80,19 @@ export default defineComponent({
onContextmenu(e) { onContextmenu(e) {
os.contextMenu([{ os.contextMenu([{
type: 'label', type: 'label',
text: this.url, text: this.path,
}, { }, {
icon: faExpandAlt, icon: faExpandAlt,
text: this.$t('showInPage'), text: this.$t('showInPage'),
action: () => { action: () => {
this.$router.push(this.url); this.$router.push(this.path);
this.close(); this.close();
} }
}, { }, {
icon: faWindowMaximize, icon: faWindowMaximize,
text: this.$t('openInWindow'), text: this.$t('openInWindow'),
action: () => { action: () => {
os.pageWindow(this.url); os.pageWindow(this.path);
this.close(); this.close();
} }
}, null, { }, null, {

View file

@ -216,21 +216,21 @@ export default defineComponent({
}, },
onContextmenu(e) { onContextmenu(e) {
const url = this.$route.path; const path = this.$route.path;
os.contextMenu([{ os.contextMenu([{
type: 'label', type: 'label',
text: url, text: path,
}, { }, {
icon: faColumns, icon: faColumns,
text: this.$t('openInSideView'), text: this.$t('openInSideView'),
action: () => { action: () => {
this.$refs.side.navigate(url); this.$refs.side.navigate(path);
} }
}, { }, {
icon: faWindowMaximize, icon: faWindowMaximize,
text: this.$t('openInWindow'), text: this.$t('openInWindow'),
action: () => { action: () => {
os.pageWindow(url); os.pageWindow(path);
} }
}], e); }], e);
}, },