forked from FoundKeyGang/FoundKey
ページのソースを見れるように
This commit is contained in:
parent
76c538ad25
commit
79c49bc926
7 changed files with 113 additions and 27 deletions
|
@ -1848,7 +1848,10 @@ pages:
|
||||||
are-you-sure-delete: "このページを削除しますか?"
|
are-you-sure-delete: "このページを削除しますか?"
|
||||||
page-deleted: "ページを削除しました"
|
page-deleted: "ページを削除しました"
|
||||||
edit-this-page: "このページを編集"
|
edit-this-page: "このページを編集"
|
||||||
|
view-source: "ソースを表示"
|
||||||
view-page: "ページを見る"
|
view-page: "ページを見る"
|
||||||
|
inspector: "インスペクター"
|
||||||
|
content: "ページブロック"
|
||||||
variables: "変数"
|
variables: "変数"
|
||||||
variables-info: "変数を使うことで動的なページを作成できます。テキスト内で <b>{ 変数名 }</b> と書くとそこに変数の値を埋め込めます。例えば <b>Hello { thing } world!</b> というテキストで、変数(thing)の値が <b>ai</b> だった場合、テキストは <b>Hello ai world!</b> になります。"
|
variables-info: "変数を使うことで動的なページを作成できます。テキスト内で <b>{ 変数名 }</b> と書くとそこに変数の値を埋め込めます。例えば <b>Hello { thing } world!</b> というテキストで、変数(thing)の値が <b>ai</b> だった場合、テキストは <b>Hello ai world!</b> になります。"
|
||||||
variables-info2: "変数の評価(値を算出すること)は上から下に行われるので、ある変数の中で自分より下の変数を参照することはできません。例えば上から <b>A、B、C</b> と3つの変数を定義したとき、<b>C</b>の中で<b>A</b>や<b>B</b>を参照することはできますが、<b>A</b>の中で<b>B</b>や<b>C</b>を参照することはできません。"
|
variables-info2: "変数の評価(値を算出すること)は上から下に行われるので、ある変数の中で自分より下の変数を参照することはできません。例えば上から <b>A、B、C</b> と3つの変数を定義したとき、<b>C</b>の中で<b>A</b>や<b>B</b>を参照することはできますが、<b>A</b>の中で<b>B</b>や<b>C</b>を参照することはできません。"
|
||||||
|
|
|
@ -36,10 +36,10 @@
|
||||||
</ui-select>
|
</ui-select>
|
||||||
|
|
||||||
<div class="eyeCatch">
|
<div class="eyeCatch">
|
||||||
<ui-button v-if="eyeCatchingImageId == null" @click="setEyeCatchingImage()"><fa :icon="faPlus"/> {{ $t('set-eye-catchig-image') }}</ui-button>
|
<ui-button v-if="eyeCatchingImageId == null && !readonly" @click="setEyeCatchingImage()"><fa :icon="faPlus"/> {{ $t('set-eye-catchig-image') }}</ui-button>
|
||||||
<div v-else-if="eyeCatchingImage">
|
<div v-else-if="eyeCatchingImage">
|
||||||
<img :src="eyeCatchingImage.url" :alt="eyeCatchingImage.name"/>
|
<img :src="eyeCatchingImage.url" :alt="eyeCatchingImage.name"/>
|
||||||
<ui-button @click="removeEyeCatchingImage()"><fa :icon="faTrashAlt"/> {{ $t('remove-eye-catchig-image') }}</ui-button>
|
<ui-button @click="removeEyeCatchingImage()" v-if="!readonly"><fa :icon="faTrashAlt"/> {{ $t('remove-eye-catchig-image') }}</ui-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -81,14 +81,22 @@
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</ui-container>
|
</ui-container>
|
||||||
|
|
||||||
|
<ui-container :body-togglable="true" :expanded="false">
|
||||||
|
<template #header><fa :icon="faCode"/> {{ $t('inspector') }}</template>
|
||||||
|
<div style="padding:0 32px 32px 32px;">
|
||||||
|
<ui-textarea :value="JSON.stringify(content, null, 2)" readonly tall>{{ $t('content') }}</ui-textarea>
|
||||||
|
<ui-textarea :value="JSON.stringify(variables, null, 2)" readonly tall>{{ $t('variables') }}</ui-textarea>
|
||||||
|
</div>
|
||||||
|
</ui-container>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import i18n from '../../../../i18n';
|
import { faICursor, faPlus, faMagic, faCog, faCode, faExternalLinkSquareAlt } from '@fortawesome/free-solid-svg-icons';
|
||||||
import { faICursor, faPlus, faMagic, faCog, faExternalLinkSquareAlt } from '@fortawesome/free-solid-svg-icons';
|
|
||||||
import { faSave, faStickyNote, faTrashAlt } from '@fortawesome/free-regular-svg-icons';
|
import { faSave, faStickyNote, faTrashAlt } from '@fortawesome/free-regular-svg-icons';
|
||||||
|
import i18n from '../../../../i18n';
|
||||||
import XVariable from './page-editor.script-block.vue';
|
import XVariable from './page-editor.script-block.vue';
|
||||||
import XBlock from './page-editor.block.vue';
|
import XBlock from './page-editor.block.vue';
|
||||||
import * as uuid from 'uuid';
|
import * as uuid from 'uuid';
|
||||||
|
@ -106,7 +114,7 @@ export default Vue.extend({
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
page: {
|
page: {
|
||||||
type: String,
|
type: Object,
|
||||||
required: false
|
required: false
|
||||||
},
|
},
|
||||||
readonly: {
|
readonly: {
|
||||||
|
@ -134,7 +142,7 @@ export default Vue.extend({
|
||||||
showOptions: false,
|
showOptions: false,
|
||||||
moreDetails: false,
|
moreDetails: false,
|
||||||
url,
|
url,
|
||||||
faPlus, faICursor, faSave, faStickyNote, faMagic, faCog, faTrashAlt, faExternalLinkSquareAlt
|
faPlus, faICursor, faSave, faStickyNote, faMagic, faCog, faTrashAlt, faExternalLinkSquareAlt, faCode
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -162,21 +170,17 @@ export default Vue.extend({
|
||||||
}, { deep: true });
|
}, { deep: true });
|
||||||
|
|
||||||
if (this.page) {
|
if (this.page) {
|
||||||
this.$root.api('pages/show', {
|
this.author = this.page.user;
|
||||||
pageId: this.page,
|
this.pageId = this.page.id;
|
||||||
}).then(page => {
|
this.title = this.page.title;
|
||||||
this.author = page.user;
|
this.name = this.page.name;
|
||||||
this.pageId = page.id;
|
this.currentName = this.page.name;
|
||||||
this.title = page.title;
|
this.summary = this.page.summary;
|
||||||
this.name = page.name;
|
this.font = this.page.font;
|
||||||
this.currentName = page.name;
|
this.alignCenter = this.page.alignCenter;
|
||||||
this.summary = page.summary;
|
this.content = this.page.content;
|
||||||
this.font = page.font;
|
this.variables = this.page.variables;
|
||||||
this.alignCenter = page.alignCenter;
|
this.eyeCatchingImageId = this.page.eyeCatchingImageId;
|
||||||
this.content = page.content;
|
|
||||||
this.variables = page.variables;
|
|
||||||
this.eyeCatchingImageId = page.eyeCatchingImageId;
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
const id = uuid.v4();
|
const id = uuid.v4();
|
||||||
this.content = [{
|
this.content = [{
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
<footer>
|
<footer>
|
||||||
<small>@{{ page.user.username }}</small>
|
<small>@{{ page.user.username }}</small>
|
||||||
<router-link v-if="$store.getters.isSignedIn && $store.state.i.id === page.userId" :to="`/i/pages/edit/${page.id}`">{{ $t('edit-this-page') }}</router-link>
|
<router-link v-if="$store.getters.isSignedIn && $store.state.i.id === page.userId" :to="`/i/pages/edit/${page.id}`">{{ $t('edit-this-page') }}</router-link>
|
||||||
|
<router-link :to="`./${page.name}/view-source`">{{ $t('view-source') }}</router-link>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -154,4 +155,10 @@ export default Vue.extend({
|
||||||
display block
|
display block
|
||||||
opacity 0.5
|
opacity 0.5
|
||||||
|
|
||||||
|
> a
|
||||||
|
font-size 14px
|
||||||
|
|
||||||
|
> a + a
|
||||||
|
margin-left 8px
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -159,8 +159,9 @@ init(async (launch, os) => {
|
||||||
{ path: '/i/pages', component: () => import('./views/home/pages.vue').then(m => m.default) },
|
{ path: '/i/pages', component: () => import('./views/home/pages.vue').then(m => m.default) },
|
||||||
]},
|
]},
|
||||||
{ path: '/@:user/pages/:page', props: true, component: () => import('./views/pages/page.vue').then(m => m.default) },
|
{ path: '/@:user/pages/:page', props: true, component: () => import('./views/pages/page.vue').then(m => m.default) },
|
||||||
|
{ path: '/@:user/pages/:pageName/view-source', props: true, component: () => import('./views/pages/page-editor.vue').then(m => m.default) },
|
||||||
{ path: '/i/pages/new', component: () => import('./views/pages/page-editor.vue').then(m => m.default) },
|
{ path: '/i/pages/new', component: () => import('./views/pages/page-editor.vue').then(m => m.default) },
|
||||||
{ path: '/i/pages/edit/:page', props: true, component: () => import('./views/pages/page-editor.vue').then(m => m.default) },
|
{ path: '/i/pages/edit/:pageId', props: true, component: () => import('./views/pages/page-editor.vue').then(m => m.default) },
|
||||||
{ path: '/i/messaging/:user', component: MkMessagingRoom },
|
{ path: '/i/messaging/:user', component: MkMessagingRoom },
|
||||||
{ path: '/i/drive', component: MkDrive },
|
{ path: '/i/drive', component: MkDrive },
|
||||||
{ path: '/i/drive/folder/:folder', component: MkDrive },
|
{ path: '/i/drive/folder/:folder', component: MkDrive },
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<mk-ui>
|
<mk-ui>
|
||||||
<main>
|
<main>
|
||||||
<x-page-editor :page="page"/>
|
<x-page-editor v-if="page !== undefined" :page="page" :readonly="readonly"/>
|
||||||
</main>
|
</main>
|
||||||
</mk-ui>
|
</mk-ui>
|
||||||
</template>
|
</template>
|
||||||
|
@ -15,9 +15,44 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
page: {
|
pageId: {
|
||||||
type: String,
|
type: String,
|
||||||
required: false
|
required: false
|
||||||
|
},
|
||||||
|
pageName: {
|
||||||
|
type: String,
|
||||||
|
required: false
|
||||||
|
},
|
||||||
|
user: {
|
||||||
|
type: String,
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
page: undefined,
|
||||||
|
readonly: false
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
if (this.pageId) {
|
||||||
|
this.$root.api('pages/show', {
|
||||||
|
pageId: this.pageId,
|
||||||
|
}).then(page => {
|
||||||
|
this.page = page;
|
||||||
|
});
|
||||||
|
} else if (this.pageName && this.user) {
|
||||||
|
this.$root.api('pages/show', {
|
||||||
|
name: this.pageName,
|
||||||
|
username: this.user,
|
||||||
|
}).then(page => {
|
||||||
|
this.readonly = true;
|
||||||
|
this.page = page;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.page = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -146,7 +146,7 @@ init((launch, os) => {
|
||||||
{ path: '/i/drive/folder/:folder', component: MkDrive },
|
{ path: '/i/drive/folder/:folder', component: MkDrive },
|
||||||
{ path: '/i/drive/file/:file', component: MkDrive },
|
{ path: '/i/drive/file/:file', component: MkDrive },
|
||||||
{ path: '/i/pages/new', component: () => import('./views/pages/page-editor.vue').then(m => m.default) },
|
{ path: '/i/pages/new', component: () => import('./views/pages/page-editor.vue').then(m => m.default) },
|
||||||
{ path: '/i/pages/edit/:page', props: true, component: () => import('./views/pages/page-editor.vue').then(m => m.default) },
|
{ path: '/i/pages/edit/:pageId', props: true, component: () => import('./views/pages/page-editor.vue').then(m => m.default) },
|
||||||
{ path: '/selectdrive', component: MkSelectDrive },
|
{ path: '/selectdrive', component: MkSelectDrive },
|
||||||
{ path: '/search', component: MkSearch },
|
{ path: '/search', component: MkSearch },
|
||||||
{ path: '/tags/:tag', component: MkTag },
|
{ path: '/tags/:tag', component: MkTag },
|
||||||
|
@ -160,6 +160,7 @@ init((launch, os) => {
|
||||||
{ path: 'followers', component: () => import('../common/views/pages/followers.vue').then(m => m.default) },
|
{ path: 'followers', component: () => import('../common/views/pages/followers.vue').then(m => m.default) },
|
||||||
]},
|
]},
|
||||||
{ path: '/@:user/pages/:page', props: true, component: () => import('./views/pages/page.vue').then(m => m.default) },
|
{ path: '/@:user/pages/:page', props: true, component: () => import('./views/pages/page.vue').then(m => m.default) },
|
||||||
|
{ path: '/@:user/pages/:pageName/view-source', props: true, component: () => import('./views/pages/page-editor.vue').then(m => m.default) },
|
||||||
{ path: '/notes/:note', component: MkNote },
|
{ path: '/notes/:note', component: MkNote },
|
||||||
{ path: '/authorize-follow', component: MkFollow },
|
{ path: '/authorize-follow', component: MkFollow },
|
||||||
{ path: '*', component: MkNotFound }
|
{ path: '*', component: MkNotFound }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<mk-ui>
|
<mk-ui>
|
||||||
<main>
|
<main>
|
||||||
<x-page-editor :page="page"/>
|
<x-page-editor v-if="page !== undefined" :page="page" :readonly="readonly"/>
|
||||||
</main>
|
</main>
|
||||||
</mk-ui>
|
</mk-ui>
|
||||||
</template>
|
</template>
|
||||||
|
@ -15,9 +15,44 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
page: {
|
pageId: {
|
||||||
type: String,
|
type: String,
|
||||||
required: false
|
required: false
|
||||||
|
},
|
||||||
|
pageName: {
|
||||||
|
type: String,
|
||||||
|
required: false
|
||||||
|
},
|
||||||
|
user: {
|
||||||
|
type: String,
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
page: undefined,
|
||||||
|
readonly: false
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
if (this.pageId) {
|
||||||
|
this.$root.api('pages/show', {
|
||||||
|
pageId: this.pageId,
|
||||||
|
}).then(page => {
|
||||||
|
this.page = page;
|
||||||
|
});
|
||||||
|
} else if (this.pageName && this.user) {
|
||||||
|
this.$root.api('pages/show', {
|
||||||
|
name: this.pageName,
|
||||||
|
username: this.user,
|
||||||
|
}).then(page => {
|
||||||
|
this.readonly = true;
|
||||||
|
this.page = page;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.page = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue