mirror of
https://github.com/hotomoe/hotomoe
synced 2024-12-25 12:08:07 +09:00
Merge branch 'develop'
This commit is contained in:
commit
85ce00adc0
@ -9,6 +9,14 @@
|
|||||||
You should also include the user name that made the change.
|
You should also include the user name that made the change.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
## 12.117.0 (2022/07/18)
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
- Client: ウィンドウを最大化できるように @syuilo
|
||||||
|
- Client: Shiftキーを押した状態でリンクをクリックするとアプリ内ウィンドウで開くように @syuilo
|
||||||
|
- Client: デッキを使用している際、Ctrlキーを押した状態でリンクをクリックするとページ遷移を強制できるように @syuilo
|
||||||
|
- Client: UIのブラッシュアップ @syuilo
|
||||||
|
|
||||||
## 12.116.1 (2022/07/17)
|
## 12.116.1 (2022/07/17)
|
||||||
|
|
||||||
### Bugfixes
|
### Bugfixes
|
||||||
|
@ -1645,6 +1645,7 @@ _deck:
|
|||||||
alwaysShowMainColumn: "সর্বদা মেইন কলাম দেখান"
|
alwaysShowMainColumn: "সর্বদা মেইন কলাম দেখান"
|
||||||
columnAlign: "কলাম সাজান"
|
columnAlign: "কলাম সাজান"
|
||||||
addColumn: "কলাম যুক্ত করুন"
|
addColumn: "কলাম যুক্ত করুন"
|
||||||
|
configureColumn: "কলাম সেটিংস"
|
||||||
swapLeft: "বামে সরান"
|
swapLeft: "বামে সরান"
|
||||||
swapRight: "ডানে সরান"
|
swapRight: "ডানে সরান"
|
||||||
swapUp: "উপরে উঠান"
|
swapUp: "উপরে উঠান"
|
||||||
|
@ -890,6 +890,7 @@ activeEmailValidationDescription: "Aktivert strengere Überprüfung von E-Mail-A
|
|||||||
navbar: "Navigationsleiste"
|
navbar: "Navigationsleiste"
|
||||||
shuffle: "Mischen"
|
shuffle: "Mischen"
|
||||||
account: "Benutzerkonto"
|
account: "Benutzerkonto"
|
||||||
|
move: "Verschieben"
|
||||||
_sensitiveMediaDetection:
|
_sensitiveMediaDetection:
|
||||||
description: "Ermöglicht eine Erleichterung der Servermoderation durch die automatische Erkennungen von NSFW-Medien unter Verwendung von Machine Learning. Hierdurch wird die Serverlast etwas erhöht."
|
description: "Ermöglicht eine Erleichterung der Servermoderation durch die automatische Erkennungen von NSFW-Medien unter Verwendung von Machine Learning. Hierdurch wird die Serverlast etwas erhöht."
|
||||||
sensitivity: "Erkennungssensitivität"
|
sensitivity: "Erkennungssensitivität"
|
||||||
@ -1696,6 +1697,7 @@ _deck:
|
|||||||
alwaysShowMainColumn: "Hauptspalte immer zeigen"
|
alwaysShowMainColumn: "Hauptspalte immer zeigen"
|
||||||
columnAlign: "Spaltenausrichtung"
|
columnAlign: "Spaltenausrichtung"
|
||||||
addColumn: "Spalte hinzufügen"
|
addColumn: "Spalte hinzufügen"
|
||||||
|
configureColumn: "Spalteneinstellungen"
|
||||||
swapLeft: "Mit linker Spalte tauschen"
|
swapLeft: "Mit linker Spalte tauschen"
|
||||||
swapRight: "Mit rechter Spalte tauschen"
|
swapRight: "Mit rechter Spalte tauschen"
|
||||||
swapUp: "Mit oberer Spalte tauschen"
|
swapUp: "Mit oberer Spalte tauschen"
|
||||||
|
@ -890,6 +890,7 @@ activeEmailValidationDescription: "Enables stricter validation of email addresse
|
|||||||
navbar: "Navigation bar"
|
navbar: "Navigation bar"
|
||||||
shuffle: "Shuffle"
|
shuffle: "Shuffle"
|
||||||
account: "Account"
|
account: "Account"
|
||||||
|
move: "Move"
|
||||||
_sensitiveMediaDetection:
|
_sensitiveMediaDetection:
|
||||||
description: "Reduces the effort of server moderation through automatically recognizing NSFW media via Machine Learning. This will slightly increase the load on the server."
|
description: "Reduces the effort of server moderation through automatically recognizing NSFW media via Machine Learning. This will slightly increase the load on the server."
|
||||||
sensitivity: "Detection sensitivity"
|
sensitivity: "Detection sensitivity"
|
||||||
@ -1696,6 +1697,7 @@ _deck:
|
|||||||
alwaysShowMainColumn: "Always show main column"
|
alwaysShowMainColumn: "Always show main column"
|
||||||
columnAlign: "Align columns"
|
columnAlign: "Align columns"
|
||||||
addColumn: "Add column"
|
addColumn: "Add column"
|
||||||
|
configureColumn: "Column settings"
|
||||||
swapLeft: "Swap with the left column"
|
swapLeft: "Swap with the left column"
|
||||||
swapRight: "Swap with the right column"
|
swapRight: "Swap with the right column"
|
||||||
swapUp: "Swap with the above column"
|
swapUp: "Swap with the above column"
|
||||||
|
@ -890,6 +890,7 @@ activeEmailValidationDescription: "ユーザーのメールアドレスのバリ
|
|||||||
navbar: "ナビゲーションバー"
|
navbar: "ナビゲーションバー"
|
||||||
shuffle: "シャッフル"
|
shuffle: "シャッフル"
|
||||||
account: "アカウント"
|
account: "アカウント"
|
||||||
|
move: "移動"
|
||||||
|
|
||||||
_sensitiveMediaDetection:
|
_sensitiveMediaDetection:
|
||||||
description: "機械学習を使って自動でセンシティブなメディアを検出し、モデレーションに役立てることができます。サーバーの負荷が少し増えます。"
|
description: "機械学習を使って自動でセンシティブなメディアを検出し、モデレーションに役立てることができます。サーバーの負荷が少し増えます。"
|
||||||
|
@ -886,6 +886,8 @@ beta: "베타"
|
|||||||
enableAutoSensitive: "자동 NSFW 탐지"
|
enableAutoSensitive: "자동 NSFW 탐지"
|
||||||
enableAutoSensitiveDescription: "이용 가능할 경우 기계학습을 통해 자동으로 미디어 NSFW를 설정합니다. 이 기능을 해제하더라도, 인스턴스 정책에 따라 자동으로 설정될 수 있습니다."
|
enableAutoSensitiveDescription: "이용 가능할 경우 기계학습을 통해 자동으로 미디어 NSFW를 설정합니다. 이 기능을 해제하더라도, 인스턴스 정책에 따라 자동으로 설정될 수 있습니다."
|
||||||
activeEmailValidationDescription: "유저가 입력한 메일 주소가 일회용 메일인지, 실제로 통신할 수 있는 지 엄격하게 검사합니다. 해제할 경우 이메일 형식에 대해서만 검사합니다."
|
activeEmailValidationDescription: "유저가 입력한 메일 주소가 일회용 메일인지, 실제로 통신할 수 있는 지 엄격하게 검사합니다. 해제할 경우 이메일 형식에 대해서만 검사합니다."
|
||||||
|
navbar: "네비게이션 바"
|
||||||
|
shuffle: "셔플"
|
||||||
account: "계정"
|
account: "계정"
|
||||||
_sensitiveMediaDetection:
|
_sensitiveMediaDetection:
|
||||||
description: "기계학습을 통해 자동으로 민감한 미디어를 탐지하여, 모더레이션에 참고할 수 있도록 합니다. 서버의 부하를 약간 증가시킵니다."
|
description: "기계학습을 통해 자동으로 민감한 미디어를 탐지하여, 모더레이션에 참고할 수 있도록 합니다. 서버의 부하를 약간 증가시킵니다."
|
||||||
@ -1692,6 +1694,7 @@ _deck:
|
|||||||
alwaysShowMainColumn: "메인 칼럼 항상 표시"
|
alwaysShowMainColumn: "메인 칼럼 항상 표시"
|
||||||
columnAlign: "칼럼 정렬"
|
columnAlign: "칼럼 정렬"
|
||||||
addColumn: "칼럼 추가"
|
addColumn: "칼럼 추가"
|
||||||
|
configureColumn: "칼럼 설정"
|
||||||
swapLeft: "왼쪽으로 이동"
|
swapLeft: "왼쪽으로 이동"
|
||||||
swapRight: "오른쪽으로 이동"
|
swapRight: "오른쪽으로 이동"
|
||||||
swapUp: "위로 이동"
|
swapUp: "위로 이동"
|
||||||
@ -1699,6 +1702,8 @@ _deck:
|
|||||||
stackLeft: "왼쪽에 쌓기"
|
stackLeft: "왼쪽에 쌓기"
|
||||||
popRight: "오른쪽으로 빼기"
|
popRight: "오른쪽으로 빼기"
|
||||||
profile: "프로파일"
|
profile: "프로파일"
|
||||||
|
newProfile: "새 프로파일"
|
||||||
|
deleteProfile: "프로파일 삭제"
|
||||||
introduction: "칼럼을 조합해서 나만의 인터페이스를 구성해 보아요!"
|
introduction: "칼럼을 조합해서 나만의 인터페이스를 구성해 보아요!"
|
||||||
introduction2: "나중에라도 화면 우측의 + 버튼을 눌러 새 칼럼을 추가할 수 있습니다."
|
introduction2: "나중에라도 화면 우측의 + 버튼을 눌러 새 칼럼을 추가할 수 있습니다."
|
||||||
widgetsIntroduction: "칼럼 메뉴의 \"위젯 편집\"에서 위젯을 추가해 주세요"
|
widgetsIntroduction: "칼럼 메뉴의 \"위젯 편집\"에서 위젯을 추가해 주세요"
|
||||||
|
@ -1637,6 +1637,7 @@ _deck:
|
|||||||
alwaysShowMainColumn: "Всегда показывать главную колонку"
|
alwaysShowMainColumn: "Всегда показывать главную колонку"
|
||||||
columnAlign: "Выравнивание колонок"
|
columnAlign: "Выравнивание колонок"
|
||||||
addColumn: "Добавить колонку"
|
addColumn: "Добавить колонку"
|
||||||
|
configureColumn: "Настройки колонок"
|
||||||
swapLeft: "Переставить левее"
|
swapLeft: "Переставить левее"
|
||||||
swapRight: "Переставить правее"
|
swapRight: "Переставить правее"
|
||||||
swapUp: "Переставить выше"
|
swapUp: "Переставить выше"
|
||||||
|
@ -1696,6 +1696,7 @@ _deck:
|
|||||||
alwaysShowMainColumn: "Luôn hiện cột chính"
|
alwaysShowMainColumn: "Luôn hiện cột chính"
|
||||||
columnAlign: "Căn cột"
|
columnAlign: "Căn cột"
|
||||||
addColumn: "Thêm cột"
|
addColumn: "Thêm cột"
|
||||||
|
configureColumn: "Cài đặt cột"
|
||||||
swapLeft: "Hoán đổi với cột bên trái"
|
swapLeft: "Hoán đổi với cột bên trái"
|
||||||
swapRight: "Hoán đổi với cột bên phải"
|
swapRight: "Hoán đổi với cột bên phải"
|
||||||
swapUp: "Hoán đổi với cột trên"
|
swapUp: "Hoán đổi với cột trên"
|
||||||
|
@ -862,7 +862,7 @@ typeToConfirm: "输入 {x} 以确认操作。"
|
|||||||
deleteAccount: "删除账户"
|
deleteAccount: "删除账户"
|
||||||
document: "文档"
|
document: "文档"
|
||||||
numberOfPageCache: "缓存页数"
|
numberOfPageCache: "缓存页数"
|
||||||
numberOfPageCacheDescription: "设置较高的值会更方便用户,但服务器负载和内存使用量会增加。"
|
numberOfPageCacheDescription: "设置较高的值会更方便用户,但设备的负载和内存使用量会增加。"
|
||||||
logoutConfirm: "是否确认登出?"
|
logoutConfirm: "是否确认登出?"
|
||||||
lastActiveDate: "最后活跃时间"
|
lastActiveDate: "最后活跃时间"
|
||||||
statusbar: "状态栏"
|
statusbar: "状态栏"
|
||||||
@ -1691,13 +1691,16 @@ _deck:
|
|||||||
alwaysShowMainColumn: "总是显示主列"
|
alwaysShowMainColumn: "总是显示主列"
|
||||||
columnAlign: "列对齐"
|
columnAlign: "列对齐"
|
||||||
addColumn: "添加列"
|
addColumn: "添加列"
|
||||||
|
configureColumn: "列设置"
|
||||||
swapLeft: "向左移动"
|
swapLeft: "向左移动"
|
||||||
swapRight: "向右移动"
|
swapRight: "向右移动"
|
||||||
swapUp: "向上移动"
|
swapUp: "向上移动"
|
||||||
swapDown: "向下移动"
|
swapDown: "向下移动"
|
||||||
stackLeft: "向左折叠"
|
stackLeft: "向左折叠"
|
||||||
popRight: "向右弹出"
|
popRight: "向右弹出"
|
||||||
profile: "个人资料"
|
profile: "配置文件"
|
||||||
|
newProfile: "新建配置文件"
|
||||||
|
deleteProfile: "删除配置文件"
|
||||||
_columns:
|
_columns:
|
||||||
main: "主列"
|
main: "主列"
|
||||||
widgets: "小工具"
|
widgets: "小工具"
|
||||||
|
@ -155,7 +155,7 @@ searchWith: "搜尋: {q}"
|
|||||||
youHaveNoLists: "你沒有任何清單"
|
youHaveNoLists: "你沒有任何清單"
|
||||||
followConfirm: "你真的要追隨{name}嗎?"
|
followConfirm: "你真的要追隨{name}嗎?"
|
||||||
proxyAccount: "代理帳戶"
|
proxyAccount: "代理帳戶"
|
||||||
proxyAccountDescription: "代理帳戶是在某些情況下充當其他伺服器用戶的帳戶。例如,當使用者將一個來自其他伺服器的帳戶放在列表中時,由於沒有其他使用者關注該帳戶,該指令不會傳送到該伺服器上,因此會由代理帳戶關注。"
|
proxyAccountDescription: "代理帳戶是在某些情況下充當其他伺服器用戶的帳戶。例如,當使用者將一個來自其他伺服器的帳戶放在列表中時,由於沒有其他使用者追蹤該帳戶,該指令不會傳送到該伺服器上,因此會由代理帳戶追蹤。"
|
||||||
host: "主機"
|
host: "主機"
|
||||||
selectUser: "選取使用者"
|
selectUser: "選取使用者"
|
||||||
recipient: "收件人"
|
recipient: "收件人"
|
||||||
@ -1695,6 +1695,7 @@ _deck:
|
|||||||
alwaysShowMainColumn: "總是顯示主欄"
|
alwaysShowMainColumn: "總是顯示主欄"
|
||||||
columnAlign: "對齊欄位"
|
columnAlign: "對齊欄位"
|
||||||
addColumn: "新增欄位"
|
addColumn: "新增欄位"
|
||||||
|
configureColumn: "欄位的設定"
|
||||||
swapLeft: "向左移動"
|
swapLeft: "向左移動"
|
||||||
swapRight: "向右移動"
|
swapRight: "向右移動"
|
||||||
swapUp: "往上移動"
|
swapUp: "往上移動"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "misskey",
|
"name": "misskey",
|
||||||
"version": "12.116.1",
|
"version": "12.117.0",
|
||||||
"codename": "indigo",
|
"codename": "indigo",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -206,17 +206,16 @@ export async function openAccountMenu(opts: {
|
|||||||
to: `/@${ $i.username }`,
|
to: `/@${ $i.username }`,
|
||||||
avatar: $i,
|
avatar: $i,
|
||||||
}, null, ...(opts.includeCurrentAccount ? [createItem($i)] : []), ...accountItemPromises, {
|
}, null, ...(opts.includeCurrentAccount ? [createItem($i)] : []), ...accountItemPromises, {
|
||||||
|
type: 'parent',
|
||||||
icon: 'fas fa-plus',
|
icon: 'fas fa-plus',
|
||||||
text: i18n.ts.addAccount,
|
text: i18n.ts.addAccount,
|
||||||
action: () => {
|
children: [{
|
||||||
popupMenu([{
|
|
||||||
text: i18n.ts.existingAccount,
|
text: i18n.ts.existingAccount,
|
||||||
action: () => { showSigninDialog(); },
|
action: () => { showSigninDialog(); },
|
||||||
}, {
|
}, {
|
||||||
text: i18n.ts.createAccount,
|
text: i18n.ts.createAccount,
|
||||||
action: () => { createAccount(); },
|
action: () => { createAccount(); },
|
||||||
}], ev.currentTarget ?? ev.target);
|
}],
|
||||||
},
|
|
||||||
}, {
|
}, {
|
||||||
type: 'link',
|
type: 'link',
|
||||||
icon: 'fas fa-users',
|
icon: 'fas fa-users',
|
||||||
|
@ -50,7 +50,7 @@ function onContextmenu(ev) {
|
|||||||
icon: 'fas fa-expand-alt',
|
icon: 'fas fa-expand-alt',
|
||||||
text: i18n.ts.showInPage,
|
text: i18n.ts.showInPage,
|
||||||
action: () => {
|
action: () => {
|
||||||
router.push(props.to);
|
router.push(props.to, 'forcePage');
|
||||||
},
|
},
|
||||||
}, null, {
|
}, null, {
|
||||||
icon: 'fas fa-external-link-alt',
|
icon: 'fas fa-external-link-alt',
|
||||||
@ -79,7 +79,7 @@ function popout() {
|
|||||||
popout_(props.to);
|
popout_(props.to);
|
||||||
}
|
}
|
||||||
|
|
||||||
function nav() {
|
function nav(ev: MouseEvent) {
|
||||||
if (props.behavior === 'browser') {
|
if (props.behavior === 'browser') {
|
||||||
location.href = props.to;
|
location.href = props.to;
|
||||||
return;
|
return;
|
||||||
@ -93,6 +93,10 @@ function nav() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
router.push(props.to);
|
if (ev.shiftKey) {
|
||||||
|
return openWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
router.push(props.to, ev.ctrlKey ? 'forcePage' : null);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { } from 'vue';
|
import { } from 'vue';
|
||||||
import { instanceName } from '@/config';
|
import { instanceName } from '@/config';
|
||||||
|
import { instance as Instance } from '@/instance';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
instance?: {
|
instance?: {
|
||||||
@ -19,7 +20,7 @@ const props = defineProps<{
|
|||||||
|
|
||||||
// if no instance data is given, this is for the local instance
|
// if no instance data is given, this is for the local instance
|
||||||
const instance = props.instance ?? {
|
const instance = props.instance ?? {
|
||||||
faviconUrl: '/favicon.ico',
|
faviconUrl: Instance.iconUrl || Instance.faviconUrl || '/favicon.ico',
|
||||||
name: instanceName,
|
name: instanceName,
|
||||||
themeColor: (document.querySelector('meta[name="theme-color-orig"]') as HTMLMetaElement)?.content
|
themeColor: (document.querySelector('meta[name="theme-color-orig"]') as HTMLMetaElement)?.content
|
||||||
};
|
};
|
||||||
|
@ -15,20 +15,6 @@
|
|||||||
</MkA>
|
</MkA>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div class="sub">
|
|
||||||
<button v-click-anime class="_button" @click="help">
|
|
||||||
<i class="fas fa-question-circle icon"></i>
|
|
||||||
<div class="text">{{ $ts.help }}</div>
|
|
||||||
</button>
|
|
||||||
<MkA v-click-anime to="/about" @click.passive="close()">
|
|
||||||
<i class="fas fa-info-circle icon"></i>
|
|
||||||
<div class="text">{{ $ts.instanceInfo }}</div>
|
|
||||||
</MkA>
|
|
||||||
<MkA v-click-anime to="/about-misskey" @click.passive="close()">
|
|
||||||
<img src="/static-assets/favicon.png" class="icon"/>
|
|
||||||
<div class="text">{{ $ts.aboutMisskey }}</div>
|
|
||||||
</MkA>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</MkModal>
|
</MkModal>
|
||||||
</template>
|
</template>
|
||||||
@ -74,28 +60,6 @@ const items = Object.keys(navbarItemDef).filter(k => !menu.includes(k)).map(k =>
|
|||||||
function close() {
|
function close() {
|
||||||
modal.close();
|
modal.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
function help(ev: MouseEvent) {
|
|
||||||
os.popupMenu([{
|
|
||||||
type: 'link',
|
|
||||||
to: '/mfm-cheat-sheet',
|
|
||||||
text: i18n.ts._mfm.cheatSheet,
|
|
||||||
icon: 'fas fa-code',
|
|
||||||
}, {
|
|
||||||
type: 'link',
|
|
||||||
to: '/scratchpad',
|
|
||||||
text: i18n.ts.scratchpad,
|
|
||||||
icon: 'fas fa-terminal',
|
|
||||||
}, null, {
|
|
||||||
text: i18n.ts.document,
|
|
||||||
icon: 'fas fa-question-circle',
|
|
||||||
action: () => {
|
|
||||||
window.open('https://misskey-hub.net/help.html', '_blank');
|
|
||||||
},
|
|
||||||
}], ev.currentTarget ?? ev.target);
|
|
||||||
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@ -50,14 +50,14 @@ const emit = defineEmits<{
|
|||||||
}
|
}
|
||||||
|
|
||||||
> .name {
|
> .name {
|
||||||
font-size: 0.9em;
|
font-size: 1em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
> .users {
|
> .users {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
font-size: 0.9em;
|
font-size: 0.95em;
|
||||||
border-left: solid 0.5px var(--divider);
|
border-left: solid 0.5px var(--divider);
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
|
@ -46,7 +46,7 @@ export default defineComponent({
|
|||||||
rounded: {
|
rounded: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
required: false,
|
||||||
default: false,
|
default: true,
|
||||||
},
|
},
|
||||||
inline: {
|
inline: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<transition :name="$store.state.animation ? 'fade' : ''" appear>
|
<transition :name="$store.state.animation ? 'fade' : ''" appear>
|
||||||
<div ref="rootEl" class="nvlagfpb" :style="{ zIndex }" @contextmenu.prevent.stop="() => {}">
|
<div ref="rootEl" class="nvlagfpb" :style="{ zIndex }" @contextmenu.prevent.stop="() => {}">
|
||||||
<MkMenu :items="items" class="_popup _shadow" :align="'left'" @close="$emit('closed')"/>
|
<MkMenu :items="items" :align="'left'" @close="$emit('closed')"/>
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, onBeforeUnmount } from 'vue';
|
import { onMounted, onBeforeUnmount } from 'vue';
|
||||||
import contains from '@/scripts/contains';
|
|
||||||
import MkMenu from './menu.vue';
|
import MkMenu from './menu.vue';
|
||||||
import { MenuItem } from './types/menu.vue';
|
import { MenuItem } from './types/menu.vue';
|
||||||
|
import contains from '@/scripts/contains';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
65
packages/client/src/components/ui/menu.child.vue
Normal file
65
packages/client/src/components/ui/menu.child.vue
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<template>
|
||||||
|
<div ref="el" class="sfhdhdhr">
|
||||||
|
<MkMenu ref="menu" :items="items" :align="align" :width="width" :as-drawer="false" @close="onChildClosed"/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { on } from 'events';
|
||||||
|
import { nextTick, onBeforeUnmount, onMounted, onUnmounted, ref, watch } from 'vue';
|
||||||
|
import MkMenu from './menu.vue';
|
||||||
|
import { MenuItem } from '@/types/menu';
|
||||||
|
import * as os from '@/os';
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
items: MenuItem[];
|
||||||
|
targetElement: HTMLElement;
|
||||||
|
rootElement: HTMLElement;
|
||||||
|
width?: number;
|
||||||
|
viaKeyboard?: boolean;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(ev: 'closed'): void;
|
||||||
|
(ev: 'actioned'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const el = ref<HTMLElement>();
|
||||||
|
const align = 'left';
|
||||||
|
|
||||||
|
function setPosition() {
|
||||||
|
const rootRect = props.rootElement.getBoundingClientRect();
|
||||||
|
const rect = props.targetElement.getBoundingClientRect();
|
||||||
|
const left = props.targetElement.offsetWidth;
|
||||||
|
const top = (rect.top - rootRect.top) - 8;
|
||||||
|
el.value.style.left = left + 'px';
|
||||||
|
el.value.style.top = top + 'px';
|
||||||
|
}
|
||||||
|
|
||||||
|
function onChildClosed(actioned?: boolean) {
|
||||||
|
if (actioned) {
|
||||||
|
emit('actioned');
|
||||||
|
} else {
|
||||||
|
emit('closed');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
setPosition();
|
||||||
|
nextTick(() => {
|
||||||
|
setPosition();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
checkHit: (ev: MouseEvent) => {
|
||||||
|
return (ev.target === el.value || el.value.contains(ev.target));
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.sfhdhdhr {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
</style>
|
@ -1,11 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div>
|
||||||
|
<div
|
||||||
ref="itemsEl" v-hotkey="keymap"
|
ref="itemsEl" v-hotkey="keymap"
|
||||||
class="rrevdjwt"
|
class="rrevdjwt _popup _shadow"
|
||||||
:class="{ center: align === 'center', asDrawer }"
|
:class="{ center: align === 'center', asDrawer }"
|
||||||
:style="{ width: (width && !asDrawer) ? width + 'px' : '', maxHeight: maxHeight ? maxHeight + 'px' : '' }"
|
:style="{ width: (width && !asDrawer) ? width + 'px' : '', maxHeight: maxHeight ? maxHeight + 'px' : '' }"
|
||||||
@contextmenu.self="e => e.preventDefault()"
|
@contextmenu.self="e => e.preventDefault()"
|
||||||
>
|
>
|
||||||
<template v-for="(item, i) in items2">
|
<template v-for="(item, i) in items2">
|
||||||
<div v-if="item === null" class="divider"></div>
|
<div v-if="item === null" class="divider"></div>
|
||||||
<span v-else-if="item.type === 'label'" class="label item">
|
<span v-else-if="item.type === 'label'" class="label item">
|
||||||
@ -14,25 +15,30 @@
|
|||||||
<span v-else-if="item.type === 'pending'" :tabindex="i" class="pending item">
|
<span v-else-if="item.type === 'pending'" :tabindex="i" class="pending item">
|
||||||
<span><MkEllipsis/></span>
|
<span><MkEllipsis/></span>
|
||||||
</span>
|
</span>
|
||||||
<MkA v-else-if="item.type === 'link'" :to="item.to" :tabindex="i" class="_button item" @click.passive="close()">
|
<MkA v-else-if="item.type === 'link'" :to="item.to" :tabindex="i" class="_button item" @click.passive="close(true)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
|
||||||
<i v-if="item.icon" class="fa-fw" :class="item.icon"></i>
|
<i v-if="item.icon" class="fa-fw" :class="item.icon"></i>
|
||||||
<MkAvatar v-if="item.avatar" :user="item.avatar" class="avatar"/>
|
<MkAvatar v-if="item.avatar" :user="item.avatar" class="avatar"/>
|
||||||
<span>{{ item.text }}</span>
|
<span>{{ item.text }}</span>
|
||||||
<span v-if="item.indicate" class="indicator"><i class="fas fa-circle"></i></span>
|
<span v-if="item.indicate" class="indicator"><i class="fas fa-circle"></i></span>
|
||||||
</MkA>
|
</MkA>
|
||||||
<a v-else-if="item.type === 'a'" :href="item.href" :target="item.target" :download="item.download" :tabindex="i" class="_button item" @click="close()">
|
<a v-else-if="item.type === 'a'" :href="item.href" :target="item.target" :download="item.download" :tabindex="i" class="_button item" @click="close(true)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
|
||||||
<i v-if="item.icon" class="fa-fw" :class="item.icon"></i>
|
<i v-if="item.icon" class="fa-fw" :class="item.icon"></i>
|
||||||
<span>{{ item.text }}</span>
|
<span>{{ item.text }}</span>
|
||||||
<span v-if="item.indicate" class="indicator"><i class="fas fa-circle"></i></span>
|
<span v-if="item.indicate" class="indicator"><i class="fas fa-circle"></i></span>
|
||||||
</a>
|
</a>
|
||||||
<button v-else-if="item.type === 'user'" :tabindex="i" class="_button item" :class="{ active: item.active }" :disabled="item.active" @click="clicked(item.action, $event)">
|
<button v-else-if="item.type === 'user'" :tabindex="i" class="_button item" :class="{ active: item.active }" :disabled="item.active" @click="clicked(item.action, $event)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
|
||||||
<MkAvatar :user="item.user" class="avatar"/><MkUserName :user="item.user"/>
|
<MkAvatar :user="item.user" class="avatar"/><MkUserName :user="item.user"/>
|
||||||
<span v-if="item.indicate" class="indicator"><i class="fas fa-circle"></i></span>
|
<span v-if="item.indicate" class="indicator"><i class="fas fa-circle"></i></span>
|
||||||
</button>
|
</button>
|
||||||
<span v-else-if="item.type === 'switch'" :tabindex="i" class="item">
|
<span v-else-if="item.type === 'switch'" :tabindex="i" class="item" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
|
||||||
<FormSwitch v-model="item.ref" :disabled="item.disabled" class="form-switch">{{ item.text }}</FormSwitch>
|
<FormSwitch v-model="item.ref" :disabled="item.disabled" class="form-switch">{{ item.text }}</FormSwitch>
|
||||||
</span>
|
</span>
|
||||||
<button v-else :tabindex="i" class="_button item" :class="{ danger: item.danger, active: item.active }" :disabled="item.active" @click="clicked(item.action, $event)">
|
<button v-else-if="item.type === 'parent'" :tabindex="i" class="_button item parent" :class="{ childShowing: childShowingItem === item }" @mouseenter="showChildren(item, $event)">
|
||||||
|
<i v-if="item.icon" class="fa-fw" :class="item.icon"></i>
|
||||||
|
<span>{{ item.text }}</span>
|
||||||
|
<span class="caret"><i class="fas fa-caret-right fa-fw"></i></span>
|
||||||
|
</button>
|
||||||
|
<button v-else :tabindex="i" class="_button item" :class="{ danger: item.danger, active: item.active }" :disabled="item.active" @click="clicked(item.action, $event)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
|
||||||
<i v-if="item.icon" class="fa-fw" :class="item.icon"></i>
|
<i v-if="item.icon" class="fa-fw" :class="item.icon"></i>
|
||||||
<MkAvatar v-if="item.avatar" :user="item.avatar" class="avatar"/>
|
<MkAvatar v-if="item.avatar" :user="item.avatar" class="avatar"/>
|
||||||
<span>{{ item.text }}</span>
|
<span>{{ item.text }}</span>
|
||||||
@ -42,14 +48,20 @@
|
|||||||
<span v-if="items2.length === 0" class="none item">
|
<span v-if="items2.length === 0" class="none item">
|
||||||
<span>{{ $ts.none }}</span>
|
<span>{{ $ts.none }}</span>
|
||||||
</span>
|
</span>
|
||||||
|
</div>
|
||||||
|
<div v-if="childMenu" class="child">
|
||||||
|
<XChild ref="child" :items="childMenu" :target-element="childTarget" :root-element="itemsEl" showing @actioned="childActioned"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { nextTick, onMounted, watch } from 'vue';
|
import { defineAsyncComponent, nextTick, onBeforeUnmount, onMounted, onUnmounted, Ref, ref, watch } from 'vue';
|
||||||
import { focusPrev, focusNext } from '@/scripts/focus';
|
import { focusPrev, focusNext } from '@/scripts/focus';
|
||||||
import FormSwitch from '@/components/form/switch.vue';
|
import FormSwitch from '@/components/form/switch.vue';
|
||||||
import { MenuItem, InnerMenuItem, MenuPending, MenuAction } from '@/types/menu';
|
import { MenuItem, InnerMenuItem, MenuPending, MenuAction } from '@/types/menu';
|
||||||
|
import * as os from '@/os';
|
||||||
|
const XChild = defineAsyncComponent(() => import('./menu.child.vue'));
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
items: MenuItem[];
|
items: MenuItem[];
|
||||||
@ -61,19 +73,23 @@ const props = defineProps<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(ev: 'close'): void;
|
(ev: 'close', actioned?: boolean): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
let itemsEl = $ref<HTMLDivElement>();
|
let itemsEl = $ref<HTMLDivElement>();
|
||||||
|
|
||||||
let items2: InnerMenuItem[] = $ref([]);
|
let items2: InnerMenuItem[] = $ref([]);
|
||||||
|
|
||||||
|
let child = $ref<InstanceType<typeof XChild>>();
|
||||||
|
|
||||||
let keymap = $computed(() => ({
|
let keymap = $computed(() => ({
|
||||||
'up|k|shift+tab': focusUp,
|
'up|k|shift+tab': focusUp,
|
||||||
'down|j|tab': focusDown,
|
'down|j|tab': focusDown,
|
||||||
'esc': close,
|
'esc': close,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
let childShowingItem = $ref<MenuItem | null>();
|
||||||
|
|
||||||
watch(() => props.items, () => {
|
watch(() => props.items, () => {
|
||||||
const items: (MenuItem | MenuPending)[] = [...props.items].filter(item => item !== undefined);
|
const items: (MenuItem | MenuPending)[] = [...props.items].filter(item => item !== undefined);
|
||||||
|
|
||||||
@ -93,21 +109,53 @@ watch(() => props.items, () => {
|
|||||||
immediate: true,
|
immediate: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
let childMenu = $ref<MenuItem[] | null>();
|
||||||
if (props.viaKeyboard) {
|
let childTarget = $ref<HTMLElement | null>();
|
||||||
nextTick(() => {
|
|
||||||
focusNext(itemsEl.children[0], true, false);
|
function closeChild() {
|
||||||
});
|
childMenu = null;
|
||||||
|
childShowingItem = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function childActioned() {
|
||||||
|
closeChild();
|
||||||
|
close(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onGlobalMousedown(event: MouseEvent) {
|
||||||
|
if (childTarget && (event.target === childTarget || childTarget.contains(event.target))) return;
|
||||||
|
if (child && child.checkHit(event)) return;
|
||||||
|
closeChild();
|
||||||
|
}
|
||||||
|
|
||||||
|
let childCloseTimer: null | number = null;
|
||||||
|
function onItemMouseEnter(item) {
|
||||||
|
childCloseTimer = window.setTimeout(() => {
|
||||||
|
closeChild();
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
|
function onItemMouseLeave(item) {
|
||||||
|
if (childCloseTimer) window.clearTimeout(childCloseTimer);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function showChildren(item: MenuItem, ev: MouseEvent) {
|
||||||
|
if (props.asDrawer) {
|
||||||
|
os.popupMenu(item.children, ev.currentTarget ?? ev.target);
|
||||||
|
close();
|
||||||
|
} else {
|
||||||
|
childTarget = ev.currentTarget ?? ev.target;
|
||||||
|
childMenu = item.children;
|
||||||
|
childShowingItem = item;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
function clicked(fn: MenuAction, ev: MouseEvent) {
|
function clicked(fn: MenuAction, ev: MouseEvent) {
|
||||||
fn(ev);
|
fn(ev);
|
||||||
close();
|
close(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function close() {
|
function close(actioned = false) {
|
||||||
emit('close');
|
emit('close', actioned);
|
||||||
}
|
}
|
||||||
|
|
||||||
function focusUp() {
|
function focusUp() {
|
||||||
@ -117,6 +165,20 @@ function focusUp() {
|
|||||||
function focusDown() {
|
function focusDown() {
|
||||||
focusNext(document.activeElement);
|
focusNext(document.activeElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (props.viaKeyboard) {
|
||||||
|
nextTick(() => {
|
||||||
|
focusNext(itemsEl.children[0], true, false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('mousedown', onGlobalMousedown, { passive: true });
|
||||||
|
});
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
document.removeEventListener('mousedown', onGlobalMousedown);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@ -225,6 +287,25 @@ function focusDown() {
|
|||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.parent {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
cursor: default;
|
||||||
|
|
||||||
|
> .caret {
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.childShowing {
|
||||||
|
color: var(--accent);
|
||||||
|
text-decoration: none;
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
background: var(--accentedBg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
> i {
|
> i {
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
width: 20px;
|
width: 20px;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<MkModal ref="modal" v-slot="{ type, maxHeight }" :z-priority="'high'" :src="src" :transparent-bg="true" @click="modal.close()" @closed="emit('closed')">
|
<MkModal ref="modal" v-slot="{ type, maxHeight }" :z-priority="'high'" :src="src" :transparent-bg="true" @click="modal.close()" @closed="emit('closed')">
|
||||||
<MkMenu :items="items" :align="align" :width="width" :max-height="maxHeight" :as-drawer="type === 'drawer'" class="sfhdhdhq _popup _shadow" :class="{ drawer: type === 'drawer' }" @close="modal.close()"/>
|
<MkMenu :items="items" :align="align" :width="width" :max-height="maxHeight" :as-drawer="type === 'drawer'" class="sfhdhdhq" :class="{ drawer: type === 'drawer' }" @close="modal.close()"/>
|
||||||
</MkModal>
|
</MkModal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { nextTick, onMounted, onUnmounted, ref } from 'vue';
|
import { nextTick, onMounted, onUnmounted, ref } from 'vue';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
|
import { calcPopupPosition } from '@/scripts/popup-position';
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
showing: boolean;
|
showing: boolean;
|
||||||
@ -36,151 +37,20 @@ const emit = defineEmits<{
|
|||||||
const el = ref<HTMLElement>();
|
const el = ref<HTMLElement>();
|
||||||
const zIndex = os.claimZIndex('high');
|
const zIndex = os.claimZIndex('high');
|
||||||
|
|
||||||
const setPosition = () => {
|
function setPosition() {
|
||||||
if (el.value == null) return;
|
const data = calcPopupPosition(el.value, {
|
||||||
|
anchorElement: props.targetElement,
|
||||||
|
direction: props.direction,
|
||||||
|
align: 'center',
|
||||||
|
innerMargin: props.innerMargin,
|
||||||
|
x: props.x,
|
||||||
|
y: props.y,
|
||||||
|
});
|
||||||
|
|
||||||
const contentWidth = el.value.offsetWidth;
|
el.value.style.transformOrigin = data.transformOrigin;
|
||||||
const contentHeight = el.value.offsetHeight;
|
el.value.style.left = data.left + 'px';
|
||||||
|
el.value.style.top = data.top + 'px';
|
||||||
let rect: DOMRect;
|
}
|
||||||
|
|
||||||
if (props.targetElement) {
|
|
||||||
rect = props.targetElement.getBoundingClientRect();
|
|
||||||
}
|
|
||||||
|
|
||||||
const calcPosWhenTop = () => {
|
|
||||||
let left: number;
|
|
||||||
let top: number;
|
|
||||||
|
|
||||||
if (props.targetElement) {
|
|
||||||
left = rect.left + window.pageXOffset + (props.targetElement.offsetWidth / 2);
|
|
||||||
top = (rect.top + window.pageYOffset - contentHeight) - props.innerMargin;
|
|
||||||
} else {
|
|
||||||
left = props.x;
|
|
||||||
top = (props.y - contentHeight) - props.innerMargin;
|
|
||||||
}
|
|
||||||
|
|
||||||
left -= (el.value.offsetWidth / 2);
|
|
||||||
|
|
||||||
if (left + contentWidth - window.pageXOffset > window.innerWidth) {
|
|
||||||
left = window.innerWidth - contentWidth + window.pageXOffset - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return [left, top];
|
|
||||||
};
|
|
||||||
|
|
||||||
const calcPosWhenBottom = () => {
|
|
||||||
let left: number;
|
|
||||||
let top: number;
|
|
||||||
|
|
||||||
if (props.targetElement) {
|
|
||||||
left = rect.left + window.pageXOffset + (props.targetElement.offsetWidth / 2);
|
|
||||||
top = (rect.top + window.pageYOffset + props.targetElement.offsetHeight) + props.innerMargin;
|
|
||||||
} else {
|
|
||||||
left = props.x;
|
|
||||||
top = (props.y) + props.innerMargin;
|
|
||||||
}
|
|
||||||
|
|
||||||
left -= (el.value.offsetWidth / 2);
|
|
||||||
|
|
||||||
if (left + contentWidth - window.pageXOffset > window.innerWidth) {
|
|
||||||
left = window.innerWidth - contentWidth + window.pageXOffset - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return [left, top];
|
|
||||||
};
|
|
||||||
|
|
||||||
const calcPosWhenLeft = () => {
|
|
||||||
let left: number;
|
|
||||||
let top: number;
|
|
||||||
|
|
||||||
if (props.targetElement) {
|
|
||||||
left = (rect.left + window.pageXOffset - contentWidth) - props.innerMargin;
|
|
||||||
top = rect.top + window.pageYOffset + (props.targetElement.offsetHeight / 2);
|
|
||||||
} else {
|
|
||||||
left = (props.x - contentWidth) - props.innerMargin;
|
|
||||||
top = props.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
top -= (el.value.offsetHeight / 2);
|
|
||||||
|
|
||||||
if (top + contentHeight - window.pageYOffset > window.innerHeight) {
|
|
||||||
top = window.innerHeight - contentHeight + window.pageYOffset - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return [left, top];
|
|
||||||
};
|
|
||||||
|
|
||||||
const calcPosWhenRight = () => {
|
|
||||||
let left: number;
|
|
||||||
let top: number;
|
|
||||||
|
|
||||||
if (props.targetElement) {
|
|
||||||
left = (rect.left + props.targetElement.offsetWidth + window.pageXOffset) + props.innerMargin;
|
|
||||||
top = rect.top + window.pageYOffset + (props.targetElement.offsetHeight / 2);
|
|
||||||
} else {
|
|
||||||
left = props.x + props.innerMargin;
|
|
||||||
top = props.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
top -= (el.value.offsetHeight / 2);
|
|
||||||
|
|
||||||
if (top + contentHeight - window.pageYOffset > window.innerHeight) {
|
|
||||||
top = window.innerHeight - contentHeight + window.pageYOffset - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return [left, top];
|
|
||||||
};
|
|
||||||
|
|
||||||
const calc = (): {
|
|
||||||
left: number;
|
|
||||||
top: number;
|
|
||||||
transformOrigin: string;
|
|
||||||
} => {
|
|
||||||
switch (props.direction) {
|
|
||||||
case 'top': {
|
|
||||||
const [left, top] = calcPosWhenTop();
|
|
||||||
|
|
||||||
// ツールチップを上に向かって表示するスペースがなければ下に向かって出す
|
|
||||||
if (top - window.pageYOffset < 0) {
|
|
||||||
const [left, top] = calcPosWhenBottom();
|
|
||||||
return { left, top, transformOrigin: 'center top' };
|
|
||||||
}
|
|
||||||
|
|
||||||
return { left, top, transformOrigin: 'center bottom' };
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'bottom': {
|
|
||||||
const [left, top] = calcPosWhenBottom();
|
|
||||||
// TODO: ツールチップを下に向かって表示するスペースがなければ上に向かって出す
|
|
||||||
return { left, top, transformOrigin: 'center top' };
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'left': {
|
|
||||||
const [left, top] = calcPosWhenLeft();
|
|
||||||
|
|
||||||
// ツールチップを左に向かって表示するスペースがなければ右に向かって出す
|
|
||||||
if (left - window.pageXOffset < 0) {
|
|
||||||
const [left, top] = calcPosWhenRight();
|
|
||||||
return { left, top, transformOrigin: 'left center' };
|
|
||||||
}
|
|
||||||
|
|
||||||
return { left, top, transformOrigin: 'right center' };
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'right': {
|
|
||||||
const [left, top] = calcPosWhenRight();
|
|
||||||
// TODO: ツールチップを右に向かって表示するスペースがなければ左に向かって出す
|
|
||||||
return { left, top, transformOrigin: 'left center' };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const { left, top, transformOrigin } = calc();
|
|
||||||
el.value.style.transformOrigin = transformOrigin;
|
|
||||||
el.value.style.left = left + 'px';
|
|
||||||
el.value.style.top = top + 'px';
|
|
||||||
};
|
|
||||||
|
|
||||||
let loopHandler;
|
let loopHandler;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<transition :name="$store.state.animation ? 'window' : ''" appear @after-leave="$emit('closed')">
|
<transition :name="$store.state.animation ? 'window' : ''" appear @after-leave="$emit('closed')">
|
||||||
<div v-if="showing" class="ebkgocck">
|
<div v-if="showing" ref="rootEl" class="ebkgocck" :class="{ maximized }">
|
||||||
<div class="body _shadow _narrow_" @mousedown="onBodyMousedown" @keydown="onKeydown">
|
<div class="body _shadow _narrow_" @mousedown="onBodyMousedown" @keydown="onKeydown">
|
||||||
<div class="header" :class="{ mini }" @contextmenu.prevent.stop="onContextmenu">
|
<div class="header" :class="{ mini }" @contextmenu.prevent.stop="onContextmenu">
|
||||||
<span class="left">
|
<span class="left">
|
||||||
@ -11,6 +11,8 @@
|
|||||||
</span>
|
</span>
|
||||||
<span class="right">
|
<span class="right">
|
||||||
<button v-for="button in buttonsRight" v-tooltip="button.title" class="button _button" :class="{ highlighted: button.highlighted }" @click="button.onClick"><i :class="button.icon"></i></button>
|
<button v-for="button in buttonsRight" v-tooltip="button.title" class="button _button" :class="{ highlighted: button.highlighted }" @click="button.onClick"><i :class="button.icon"></i></button>
|
||||||
|
<button v-if="canResize && maximized" class="button _button" @click="unMaximize()"><i class="fas fa-window-restore"></i></button>
|
||||||
|
<button v-else-if="canResize && !maximized" class="button _button" @click="maximize()"><i class="fas fa-window-maximize"></i></button>
|
||||||
<button v-if="closeButton" class="button _button" @click="close()"><i class="fas fa-times"></i></button>
|
<button v-if="closeButton" class="button _button" @click="close()"><i class="fas fa-times"></i></button>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@ -32,15 +34,16 @@
|
|||||||
</transition>
|
</transition>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { defineComponent } from 'vue';
|
import { onBeforeUnmount, onMounted, provide } from 'vue';
|
||||||
import contains from '@/scripts/contains';
|
import contains from '@/scripts/contains';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
|
import { MenuItem } from '@/types/menu';
|
||||||
|
|
||||||
const minHeight = 50;
|
const minHeight = 50;
|
||||||
const minWidth = 250;
|
const minWidth = 250;
|
||||||
|
|
||||||
function dragListen(fn) {
|
function dragListen(fn: (ev: MouseEvent) => void) {
|
||||||
window.addEventListener('mousemove', fn);
|
window.addEventListener('mousemove', fn);
|
||||||
window.addEventListener('touchmove', fn);
|
window.addEventListener('touchmove', fn);
|
||||||
window.addEventListener('mouseleave', dragClear.bind(null, fn));
|
window.addEventListener('mouseleave', dragClear.bind(null, fn));
|
||||||
@ -56,117 +59,117 @@ function dragClear(fn) {
|
|||||||
window.removeEventListener('touchend', dragClear);
|
window.removeEventListener('touchend', dragClear);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default defineComponent({
|
const props = withDefaults(defineProps<{
|
||||||
provide: {
|
initialWidth?: number;
|
||||||
inWindow: true,
|
initialHeight?: number | null;
|
||||||
},
|
canResize?: boolean;
|
||||||
|
closeButton?: boolean;
|
||||||
|
mini?: boolean;
|
||||||
|
front?: boolean;
|
||||||
|
contextmenu?: MenuItem[] | null;
|
||||||
|
buttonsLeft?: any[];
|
||||||
|
buttonsRight?: any[];
|
||||||
|
}>(), {
|
||||||
|
initialWidth: 400,
|
||||||
|
initialHeight: null,
|
||||||
|
canResize: false,
|
||||||
|
closeButton: true,
|
||||||
|
mini: false,
|
||||||
|
front: true,
|
||||||
|
contextmenu: null,
|
||||||
|
buttonsLeft: () => [],
|
||||||
|
buttonsRight: () => [],
|
||||||
|
});
|
||||||
|
|
||||||
props: {
|
const emit = defineEmits<{
|
||||||
initialWidth: {
|
(ev: 'closed'): void;
|
||||||
type: Number,
|
}>();
|
||||||
required: false,
|
|
||||||
default: 400,
|
|
||||||
},
|
|
||||||
initialHeight: {
|
|
||||||
type: Number,
|
|
||||||
required: false,
|
|
||||||
default: null,
|
|
||||||
},
|
|
||||||
canResize: {
|
|
||||||
type: Boolean,
|
|
||||||
required: false,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
closeButton: {
|
|
||||||
type: Boolean,
|
|
||||||
required: false,
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
mini: {
|
|
||||||
type: Boolean,
|
|
||||||
required: false,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
front: {
|
|
||||||
type: Boolean,
|
|
||||||
required: false,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
contextmenu: {
|
|
||||||
type: Array,
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
buttonsLeft: {
|
|
||||||
type: Array,
|
|
||||||
required: false,
|
|
||||||
default: () => [],
|
|
||||||
},
|
|
||||||
buttonsRight: {
|
|
||||||
type: Array,
|
|
||||||
required: false,
|
|
||||||
default: () => [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
emits: ['closed'],
|
provide('inWindow', true);
|
||||||
|
|
||||||
data() {
|
let rootEl = $ref<HTMLElement | null>();
|
||||||
return {
|
let showing = $ref(true);
|
||||||
showing: true,
|
let beforeClickedAt = 0;
|
||||||
id: Math.random().toString(), // TODO: UUIDとかにする
|
let maximized = $ref(false);
|
||||||
};
|
let unMaximizedTop = '';
|
||||||
},
|
let unMaximizedLeft = '';
|
||||||
|
let unMaximizedWidth = '';
|
||||||
|
let unMaximizedHeight = '';
|
||||||
|
|
||||||
mounted() {
|
function close() {
|
||||||
if (this.initialWidth) this.applyTransformWidth(this.initialWidth);
|
showing = false;
|
||||||
if (this.initialHeight) this.applyTransformHeight(this.initialHeight);
|
}
|
||||||
|
|
||||||
this.applyTransformTop((window.innerHeight / 2) - (this.$el.offsetHeight / 2));
|
function onKeydown(evt) {
|
||||||
this.applyTransformLeft((window.innerWidth / 2) - (this.$el.offsetWidth / 2));
|
|
||||||
|
|
||||||
// 他のウィンドウ内のボタンなどを押してこのウィンドウが開かれた場合、親が最前面になろうとするのでそれに隠されないようにする
|
|
||||||
this.top();
|
|
||||||
|
|
||||||
window.addEventListener('resize', this.onBrowserResize);
|
|
||||||
},
|
|
||||||
|
|
||||||
unmounted() {
|
|
||||||
window.removeEventListener('resize', this.onBrowserResize);
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
close() {
|
|
||||||
this.showing = false;
|
|
||||||
},
|
|
||||||
|
|
||||||
onKeydown(evt) {
|
|
||||||
if (evt.which === 27) { // Esc
|
if (evt.which === 27) { // Esc
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
evt.stopPropagation();
|
evt.stopPropagation();
|
||||||
this.close();
|
close();
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
onContextmenu(ev: MouseEvent) {
|
function onContextmenu(ev: MouseEvent) {
|
||||||
if (this.contextmenu) {
|
if (props.contextmenu) {
|
||||||
os.contextMenu(this.contextmenu, ev);
|
os.contextMenu(props.contextmenu, ev);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
// 最前面へ移動
|
// 最前面へ移動
|
||||||
top() {
|
function top() {
|
||||||
(this.$el as any).style.zIndex = os.claimZIndex(this.front ? 'middle' : 'low');
|
if (rootEl) {
|
||||||
},
|
rootEl.style.zIndex = os.claimZIndex(props.front ? 'middle' : 'low');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onBodyMousedown() {
|
function maximize() {
|
||||||
this.top();
|
maximized = true;
|
||||||
},
|
unMaximizedTop = rootEl.style.top;
|
||||||
|
unMaximizedLeft = rootEl.style.left;
|
||||||
|
unMaximizedWidth = rootEl.style.width;
|
||||||
|
unMaximizedHeight = rootEl.style.height;
|
||||||
|
rootEl.style.top = '0';
|
||||||
|
rootEl.style.left = '0';
|
||||||
|
rootEl.style.width = '100%';
|
||||||
|
rootEl.style.height = '100%';
|
||||||
|
}
|
||||||
|
|
||||||
onHeaderMousedown(evt: MouseEvent) {
|
function unMaximize() {
|
||||||
|
maximized = false;
|
||||||
|
rootEl.style.top = unMaximizedTop;
|
||||||
|
rootEl.style.left = unMaximizedLeft;
|
||||||
|
rootEl.style.width = unMaximizedWidth;
|
||||||
|
rootEl.style.height = unMaximizedHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onBodyMousedown() {
|
||||||
|
top();
|
||||||
|
}
|
||||||
|
|
||||||
|
function onDblClick() {
|
||||||
|
maximize();
|
||||||
|
}
|
||||||
|
|
||||||
|
function onHeaderMousedown(evt: MouseEvent) {
|
||||||
// 右クリックはコンテキストメニューを開こうとした可能性が高いため無視
|
// 右クリックはコンテキストメニューを開こうとした可能性が高いため無視
|
||||||
if (evt.button === 2) return;
|
if (evt.button === 2) return;
|
||||||
|
|
||||||
const main = this.$el as any;
|
let beforeMaximized = false;
|
||||||
|
|
||||||
|
if (maximized) {
|
||||||
|
beforeMaximized = true;
|
||||||
|
unMaximize();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ダブルクリック判定
|
||||||
|
if (Date.now() - beforeClickedAt < 300) {
|
||||||
|
beforeClickedAt = Date.now();
|
||||||
|
onDblClick();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
beforeClickedAt = Date.now();
|
||||||
|
|
||||||
|
const main = rootEl;
|
||||||
|
|
||||||
if (!contains(main, document.activeElement)) main.focus();
|
if (!contains(main, document.activeElement)) main.focus();
|
||||||
|
|
||||||
@ -174,18 +177,14 @@ export default defineComponent({
|
|||||||
|
|
||||||
const clickX = evt.touches && evt.touches.length > 0 ? evt.touches[0].clientX : evt.clientX;
|
const clickX = evt.touches && evt.touches.length > 0 ? evt.touches[0].clientX : evt.clientX;
|
||||||
const clickY = evt.touches && evt.touches.length > 0 ? evt.touches[0].clientY : evt.clientY;
|
const clickY = evt.touches && evt.touches.length > 0 ? evt.touches[0].clientY : evt.clientY;
|
||||||
const moveBaseX = clickX - position.left;
|
const moveBaseX = beforeMaximized ? parseInt(unMaximizedWidth, 10) / 2 : clickX - position.left; // TODO: parseIntやめる
|
||||||
const moveBaseY = clickY - position.top;
|
const moveBaseY = beforeMaximized ? 20 : clickY - position.top;
|
||||||
const browserWidth = window.innerWidth;
|
const browserWidth = window.innerWidth;
|
||||||
const browserHeight = window.innerHeight;
|
const browserHeight = window.innerHeight;
|
||||||
const windowWidth = main.offsetWidth;
|
const windowWidth = main.offsetWidth;
|
||||||
const windowHeight = main.offsetHeight;
|
const windowHeight = main.offsetHeight;
|
||||||
|
|
||||||
// 動かした時
|
function move(x: number, y: number) {
|
||||||
dragListen(me => {
|
|
||||||
const x = me.touches && me.touches.length > 0 ? me.touches[0].clientX : me.clientX;
|
|
||||||
const y = me.touches && me.touches.length > 0 ? me.touches[0].clientY : me.clientY;
|
|
||||||
|
|
||||||
let moveLeft = x - moveBaseX;
|
let moveLeft = x - moveBaseX;
|
||||||
let moveTop = y - moveBaseY;
|
let moveTop = y - moveBaseY;
|
||||||
|
|
||||||
@ -201,14 +200,26 @@ export default defineComponent({
|
|||||||
// 右はみ出し
|
// 右はみ出し
|
||||||
if (moveLeft + windowWidth > browserWidth) moveLeft = browserWidth - windowWidth;
|
if (moveLeft + windowWidth > browserWidth) moveLeft = browserWidth - windowWidth;
|
||||||
|
|
||||||
this.$el.style.left = moveLeft + 'px';
|
rootEl.style.left = moveLeft + 'px';
|
||||||
this.$el.style.top = moveTop + 'px';
|
rootEl.style.top = moveTop + 'px';
|
||||||
});
|
}
|
||||||
},
|
|
||||||
|
|
||||||
// 上ハンドル掴み時
|
if (beforeMaximized) {
|
||||||
onTopHandleMousedown(evt) {
|
move(clickX, clickY);
|
||||||
const main = this.$el as any;
|
}
|
||||||
|
|
||||||
|
// 動かした時
|
||||||
|
dragListen(me => {
|
||||||
|
const x = me.touches && me.touches.length > 0 ? me.touches[0].clientX : me.clientX;
|
||||||
|
const y = me.touches && me.touches.length > 0 ? me.touches[0].clientY : me.clientY;
|
||||||
|
|
||||||
|
move(x, y);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 上ハンドル掴み時
|
||||||
|
function onTopHandleMousedown(evt) {
|
||||||
|
const main = rootEl;
|
||||||
|
|
||||||
const base = evt.clientY;
|
const base = evt.clientY;
|
||||||
const height = parseInt(getComputedStyle(main, '').height, 10);
|
const height = parseInt(getComputedStyle(main, '').height, 10);
|
||||||
@ -219,22 +230,22 @@ export default defineComponent({
|
|||||||
const move = me.clientY - base;
|
const move = me.clientY - base;
|
||||||
if (top + move > 0) {
|
if (top + move > 0) {
|
||||||
if (height + -move > minHeight) {
|
if (height + -move > minHeight) {
|
||||||
this.applyTransformHeight(height + -move);
|
applyTransformHeight(height + -move);
|
||||||
this.applyTransformTop(top + move);
|
applyTransformTop(top + move);
|
||||||
} else { // 最小の高さより小さくなろうとした時
|
} else { // 最小の高さより小さくなろうとした時
|
||||||
this.applyTransformHeight(minHeight);
|
applyTransformHeight(minHeight);
|
||||||
this.applyTransformTop(top + (height - minHeight));
|
applyTransformTop(top + (height - minHeight));
|
||||||
}
|
}
|
||||||
} else { // 上のはみ出し時
|
} else { // 上のはみ出し時
|
||||||
this.applyTransformHeight(top + height);
|
applyTransformHeight(top + height);
|
||||||
this.applyTransformTop(0);
|
applyTransformTop(0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
// 右ハンドル掴み時
|
// 右ハンドル掴み時
|
||||||
onRightHandleMousedown(evt) {
|
function onRightHandleMousedown(evt) {
|
||||||
const main = this.$el as any;
|
const main = rootEl;
|
||||||
|
|
||||||
const base = evt.clientX;
|
const base = evt.clientX;
|
||||||
const width = parseInt(getComputedStyle(main, '').width, 10);
|
const width = parseInt(getComputedStyle(main, '').width, 10);
|
||||||
@ -246,19 +257,19 @@ export default defineComponent({
|
|||||||
const move = me.clientX - base;
|
const move = me.clientX - base;
|
||||||
if (left + width + move < browserWidth) {
|
if (left + width + move < browserWidth) {
|
||||||
if (width + move > minWidth) {
|
if (width + move > minWidth) {
|
||||||
this.applyTransformWidth(width + move);
|
applyTransformWidth(width + move);
|
||||||
} else { // 最小の幅より小さくなろうとした時
|
} else { // 最小の幅より小さくなろうとした時
|
||||||
this.applyTransformWidth(minWidth);
|
applyTransformWidth(minWidth);
|
||||||
}
|
}
|
||||||
} else { // 右のはみ出し時
|
} else { // 右のはみ出し時
|
||||||
this.applyTransformWidth(browserWidth - left);
|
applyTransformWidth(browserWidth - left);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
// 下ハンドル掴み時
|
// 下ハンドル掴み時
|
||||||
onBottomHandleMousedown(evt) {
|
function onBottomHandleMousedown(evt) {
|
||||||
const main = this.$el as any;
|
const main = rootEl;
|
||||||
|
|
||||||
const base = evt.clientY;
|
const base = evt.clientY;
|
||||||
const height = parseInt(getComputedStyle(main, '').height, 10);
|
const height = parseInt(getComputedStyle(main, '').height, 10);
|
||||||
@ -270,19 +281,19 @@ export default defineComponent({
|
|||||||
const move = me.clientY - base;
|
const move = me.clientY - base;
|
||||||
if (top + height + move < browserHeight) {
|
if (top + height + move < browserHeight) {
|
||||||
if (height + move > minHeight) {
|
if (height + move > minHeight) {
|
||||||
this.applyTransformHeight(height + move);
|
applyTransformHeight(height + move);
|
||||||
} else { // 最小の高さより小さくなろうとした時
|
} else { // 最小の高さより小さくなろうとした時
|
||||||
this.applyTransformHeight(minHeight);
|
applyTransformHeight(minHeight);
|
||||||
}
|
}
|
||||||
} else { // 下のはみ出し時
|
} else { // 下のはみ出し時
|
||||||
this.applyTransformHeight(browserHeight - top);
|
applyTransformHeight(browserHeight - top);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
// 左ハンドル掴み時
|
// 左ハンドル掴み時
|
||||||
onLeftHandleMousedown(evt) {
|
function onLeftHandleMousedown(evt) {
|
||||||
const main = this.$el as any;
|
const main = rootEl;
|
||||||
|
|
||||||
const base = evt.clientX;
|
const base = evt.clientX;
|
||||||
const width = parseInt(getComputedStyle(main, '').width, 10);
|
const width = parseInt(getComputedStyle(main, '').width, 10);
|
||||||
@ -293,78 +304,97 @@ export default defineComponent({
|
|||||||
const move = me.clientX - base;
|
const move = me.clientX - base;
|
||||||
if (left + move > 0) {
|
if (left + move > 0) {
|
||||||
if (width + -move > minWidth) {
|
if (width + -move > minWidth) {
|
||||||
this.applyTransformWidth(width + -move);
|
applyTransformWidth(width + -move);
|
||||||
this.applyTransformLeft(left + move);
|
applyTransformLeft(left + move);
|
||||||
} else { // 最小の幅より小さくなろうとした時
|
} else { // 最小の幅より小さくなろうとした時
|
||||||
this.applyTransformWidth(minWidth);
|
applyTransformWidth(minWidth);
|
||||||
this.applyTransformLeft(left + (width - minWidth));
|
applyTransformLeft(left + (width - minWidth));
|
||||||
}
|
}
|
||||||
} else { // 左のはみ出し時
|
} else { // 左のはみ出し時
|
||||||
this.applyTransformWidth(left + width);
|
applyTransformWidth(left + width);
|
||||||
this.applyTransformLeft(0);
|
applyTransformLeft(0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
// 左上ハンドル掴み時
|
// 左上ハンドル掴み時
|
||||||
onTopLeftHandleMousedown(evt) {
|
function onTopLeftHandleMousedown(evt) {
|
||||||
this.onTopHandleMousedown(evt);
|
onTopHandleMousedown(evt);
|
||||||
this.onLeftHandleMousedown(evt);
|
onLeftHandleMousedown(evt);
|
||||||
},
|
}
|
||||||
|
|
||||||
// 右上ハンドル掴み時
|
// 右上ハンドル掴み時
|
||||||
onTopRightHandleMousedown(evt) {
|
function onTopRightHandleMousedown(evt) {
|
||||||
this.onTopHandleMousedown(evt);
|
onTopHandleMousedown(evt);
|
||||||
this.onRightHandleMousedown(evt);
|
onRightHandleMousedown(evt);
|
||||||
},
|
}
|
||||||
|
|
||||||
// 右下ハンドル掴み時
|
// 右下ハンドル掴み時
|
||||||
onBottomRightHandleMousedown(evt) {
|
function onBottomRightHandleMousedown(evt) {
|
||||||
this.onBottomHandleMousedown(evt);
|
onBottomHandleMousedown(evt);
|
||||||
this.onRightHandleMousedown(evt);
|
onRightHandleMousedown(evt);
|
||||||
},
|
}
|
||||||
|
|
||||||
// 左下ハンドル掴み時
|
// 左下ハンドル掴み時
|
||||||
onBottomLeftHandleMousedown(evt) {
|
function onBottomLeftHandleMousedown(evt) {
|
||||||
this.onBottomHandleMousedown(evt);
|
onBottomHandleMousedown(evt);
|
||||||
this.onLeftHandleMousedown(evt);
|
onLeftHandleMousedown(evt);
|
||||||
},
|
}
|
||||||
|
|
||||||
// 高さを適用
|
// 高さを適用
|
||||||
applyTransformHeight(height) {
|
function applyTransformHeight(height) {
|
||||||
if (height > window.innerHeight) height = window.innerHeight;
|
if (height > window.innerHeight) height = window.innerHeight;
|
||||||
(this.$el as any).style.height = height + 'px';
|
rootEl.style.height = height + 'px';
|
||||||
},
|
}
|
||||||
|
|
||||||
// 幅を適用
|
// 幅を適用
|
||||||
applyTransformWidth(width) {
|
function applyTransformWidth(width) {
|
||||||
if (width > window.innerWidth) width = window.innerWidth;
|
if (width > window.innerWidth) width = window.innerWidth;
|
||||||
(this.$el as any).style.width = width + 'px';
|
rootEl.style.width = width + 'px';
|
||||||
},
|
}
|
||||||
|
|
||||||
// Y座標を適用
|
// Y座標を適用
|
||||||
applyTransformTop(top) {
|
function applyTransformTop(top) {
|
||||||
(this.$el as any).style.top = top + 'px';
|
rootEl.style.top = top + 'px';
|
||||||
},
|
}
|
||||||
|
|
||||||
// X座標を適用
|
// X座標を適用
|
||||||
applyTransformLeft(left) {
|
function applyTransformLeft(left) {
|
||||||
(this.$el as any).style.left = left + 'px';
|
rootEl.style.left = left + 'px';
|
||||||
},
|
}
|
||||||
|
|
||||||
onBrowserResize() {
|
function onBrowserResize() {
|
||||||
const main = this.$el as any;
|
const main = rootEl;
|
||||||
const position = main.getBoundingClientRect();
|
const position = main.getBoundingClientRect();
|
||||||
const browserWidth = window.innerWidth;
|
const browserWidth = window.innerWidth;
|
||||||
const browserHeight = window.innerHeight;
|
const browserHeight = window.innerHeight;
|
||||||
const windowWidth = main.offsetWidth;
|
const windowWidth = main.offsetWidth;
|
||||||
const windowHeight = main.offsetHeight;
|
const windowHeight = main.offsetHeight;
|
||||||
if (position.left < 0) main.style.left = 0; // 左はみ出し
|
if (position.left < 0) main.style.left = '0'; // 左はみ出し
|
||||||
if (position.top + windowHeight > browserHeight) main.style.top = browserHeight - windowHeight + 'px'; // 下はみ出し
|
if (position.top + windowHeight > browserHeight) main.style.top = browserHeight - windowHeight + 'px'; // 下はみ出し
|
||||||
if (position.left + windowWidth > browserWidth) main.style.left = browserWidth - windowWidth + 'px'; // 右はみ出し
|
if (position.left + windowWidth > browserWidth) main.style.left = browserWidth - windowWidth + 'px'; // 右はみ出し
|
||||||
if (position.top < 0) main.style.top = 0; // 上はみ出し
|
if (position.top < 0) main.style.top = '0'; // 上はみ出し
|
||||||
},
|
}
|
||||||
},
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (props.initialWidth) applyTransformWidth(props.initialWidth);
|
||||||
|
if (props.initialHeight) applyTransformHeight(props.initialHeight);
|
||||||
|
|
||||||
|
applyTransformTop((window.innerHeight / 2) - (rootEl.offsetHeight / 2));
|
||||||
|
applyTransformLeft((window.innerWidth / 2) - (rootEl.offsetWidth / 2));
|
||||||
|
|
||||||
|
// 他のウィンドウ内のボタンなどを押してこのウィンドウが開かれた場合、親が最前面になろうとするのでそれに隠されないようにする
|
||||||
|
top();
|
||||||
|
|
||||||
|
window.addEventListener('resize', onBrowserResize);
|
||||||
|
});
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
window.removeEventListener('resize', onBrowserResize);
|
||||||
|
});
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
close,
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -384,7 +414,7 @@ export default defineComponent({
|
|||||||
left: 0;
|
left: 0;
|
||||||
|
|
||||||
> .body {
|
> .body {
|
||||||
overflow: hidden;
|
overflow: clip;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
contain: content;
|
contain: content;
|
||||||
@ -522,5 +552,11 @@ export default defineComponent({
|
|||||||
cursor: nesw-resize;
|
cursor: nesw-resize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.maximized {
|
||||||
|
> .body {
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -330,13 +330,11 @@ definePageMetadata(INFO);
|
|||||||
width: 34%;
|
width: 34%;
|
||||||
padding-right: 32px;
|
padding-right: 32px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
overflow: auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
> .main {
|
> .main {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
overflow: auto;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="_formRoot">
|
<div class="_formRoot">
|
||||||
<div class="llvierxe" :style="{ backgroundImage: $i.bannerUrl ? `url(${ $i.bannerUrl })` : null }">
|
<div class="llvierxe" :style="{ backgroundImage: $i.bannerUrl ? `url(${ $i.bannerUrl })` : null }">
|
||||||
<div class="avatar _acrylic">
|
<div class="avatar">
|
||||||
<MkAvatar class="avatar" :user="$i" :disable-link="true" @click="changeAvatar"/>
|
<MkAvatar class="avatar" :user="$i" :disable-link="true" @click="changeAvatar"/>
|
||||||
<MkButton primary class="avatarEdit" @click="changeAvatar">{{ i18n.ts._profile.changeAvatar }}</MkButton>
|
<MkButton primary rounded class="avatarEdit" @click="changeAvatar">{{ i18n.ts._profile.changeAvatar }}</MkButton>
|
||||||
</div>
|
</div>
|
||||||
<MkButton primary class="bannerEdit" @click="changeBanner">{{ i18n.ts._profile.changeBanner }}</MkButton>
|
<MkButton primary rounded class="bannerEdit" @click="changeBanner">{{ i18n.ts._profile.changeBanner }}</MkButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<FormInput v-model="profile.name" :max="30" manual-save class="_formBlock">
|
<FormInput v-model="profile.name" :max="30" manual-save class="_formBlock">
|
||||||
@ -187,6 +187,7 @@ definePageMetadata({
|
|||||||
position: relative;
|
position: relative;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
|
border: solid 1px var(--divider);
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
overflow: clip;
|
overflow: clip;
|
||||||
|
|
||||||
|
158
packages/client/src/scripts/popup-position.ts
Normal file
158
packages/client/src/scripts/popup-position.ts
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
import { Ref } from 'vue';
|
||||||
|
|
||||||
|
export function calcPopupPosition(el: HTMLElement, props: {
|
||||||
|
anchorElement: HTMLElement | null;
|
||||||
|
innerMargin: number;
|
||||||
|
direction: 'top' | 'bottom' | 'left' | 'right';
|
||||||
|
align: 'top' | 'bottom' | 'left' | 'right' | 'center';
|
||||||
|
alignOffset?: number;
|
||||||
|
x?: number;
|
||||||
|
y?: number;
|
||||||
|
}): { top: number; left: number; transformOrigin: string; } {
|
||||||
|
const contentWidth = el.offsetWidth;
|
||||||
|
const contentHeight = el.offsetHeight;
|
||||||
|
|
||||||
|
let rect: DOMRect;
|
||||||
|
|
||||||
|
if (props.anchorElement) {
|
||||||
|
rect = props.anchorElement.getBoundingClientRect();
|
||||||
|
}
|
||||||
|
|
||||||
|
const calcPosWhenTop = () => {
|
||||||
|
let left: number;
|
||||||
|
let top: number;
|
||||||
|
|
||||||
|
if (props.anchorElement) {
|
||||||
|
left = rect.left + window.pageXOffset + (props.anchorElement.offsetWidth / 2);
|
||||||
|
top = (rect.top + window.pageYOffset - contentHeight) - props.innerMargin;
|
||||||
|
} else {
|
||||||
|
left = props.x;
|
||||||
|
top = (props.y - contentHeight) - props.innerMargin;
|
||||||
|
}
|
||||||
|
|
||||||
|
left -= (el.offsetWidth / 2);
|
||||||
|
|
||||||
|
if (left + contentWidth - window.pageXOffset > window.innerWidth) {
|
||||||
|
left = window.innerWidth - contentWidth + window.pageXOffset - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [left, top];
|
||||||
|
};
|
||||||
|
|
||||||
|
const calcPosWhenBottom = () => {
|
||||||
|
let left: number;
|
||||||
|
let top: number;
|
||||||
|
|
||||||
|
if (props.anchorElement) {
|
||||||
|
left = rect.left + window.pageXOffset + (props.anchorElement.offsetWidth / 2);
|
||||||
|
top = (rect.top + window.pageYOffset + props.anchorElement.offsetHeight) + props.innerMargin;
|
||||||
|
} else {
|
||||||
|
left = props.x;
|
||||||
|
top = (props.y) + props.innerMargin;
|
||||||
|
}
|
||||||
|
|
||||||
|
left -= (el.offsetWidth / 2);
|
||||||
|
|
||||||
|
if (left + contentWidth - window.pageXOffset > window.innerWidth) {
|
||||||
|
left = window.innerWidth - contentWidth + window.pageXOffset - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [left, top];
|
||||||
|
};
|
||||||
|
|
||||||
|
const calcPosWhenLeft = () => {
|
||||||
|
let left: number;
|
||||||
|
let top: number;
|
||||||
|
|
||||||
|
if (props.anchorElement) {
|
||||||
|
left = (rect.left + window.pageXOffset - contentWidth) - props.innerMargin;
|
||||||
|
top = rect.top + window.pageYOffset + (props.anchorElement.offsetHeight / 2);
|
||||||
|
} else {
|
||||||
|
left = (props.x - contentWidth) - props.innerMargin;
|
||||||
|
top = props.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
top -= (el.offsetHeight / 2);
|
||||||
|
|
||||||
|
if (top + contentHeight - window.pageYOffset > window.innerHeight) {
|
||||||
|
top = window.innerHeight - contentHeight + window.pageYOffset - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [left, top];
|
||||||
|
};
|
||||||
|
|
||||||
|
const calcPosWhenRight = () => {
|
||||||
|
let left: number;
|
||||||
|
let top: number;
|
||||||
|
|
||||||
|
if (props.anchorElement) {
|
||||||
|
left = (rect.left + props.anchorElement.offsetWidth + window.pageXOffset) + props.innerMargin;
|
||||||
|
|
||||||
|
if (props.align === 'top') {
|
||||||
|
top = rect.top + window.pageYOffset;
|
||||||
|
if (props.alignOffset != null) top += props.alignOffset;
|
||||||
|
} else if (props.align === 'bottom') {
|
||||||
|
// TODO
|
||||||
|
} else { // center
|
||||||
|
top = rect.top + window.pageYOffset + (props.anchorElement.offsetHeight / 2);
|
||||||
|
top -= (el.offsetHeight / 2);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
left = props.x + props.innerMargin;
|
||||||
|
top = props.y;
|
||||||
|
top -= (el.offsetHeight / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (top + contentHeight - window.pageYOffset > window.innerHeight) {
|
||||||
|
top = window.innerHeight - contentHeight + window.pageYOffset - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [left, top];
|
||||||
|
};
|
||||||
|
|
||||||
|
const calc = (): {
|
||||||
|
left: number;
|
||||||
|
top: number;
|
||||||
|
transformOrigin: string;
|
||||||
|
} => {
|
||||||
|
switch (props.direction) {
|
||||||
|
case 'top': {
|
||||||
|
const [left, top] = calcPosWhenTop();
|
||||||
|
|
||||||
|
// ツールチップを上に向かって表示するスペースがなければ下に向かって出す
|
||||||
|
if (top - window.pageYOffset < 0) {
|
||||||
|
const [left, top] = calcPosWhenBottom();
|
||||||
|
return { left, top, transformOrigin: 'center top' };
|
||||||
|
}
|
||||||
|
|
||||||
|
return { left, top, transformOrigin: 'center bottom' };
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'bottom': {
|
||||||
|
const [left, top] = calcPosWhenBottom();
|
||||||
|
// TODO: ツールチップを下に向かって表示するスペースがなければ上に向かって出す
|
||||||
|
return { left, top, transformOrigin: 'center top' };
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'left': {
|
||||||
|
const [left, top] = calcPosWhenLeft();
|
||||||
|
|
||||||
|
// ツールチップを左に向かって表示するスペースがなければ右に向かって出す
|
||||||
|
if (left - window.pageXOffset < 0) {
|
||||||
|
const [left, top] = calcPosWhenRight();
|
||||||
|
return { left, top, transformOrigin: 'left center' };
|
||||||
|
}
|
||||||
|
|
||||||
|
return { left, top, transformOrigin: 'right center' };
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'right': {
|
||||||
|
const [left, top] = calcPosWhenRight();
|
||||||
|
// TODO: ツールチップを右に向かって表示するスペースがなければ左に向かって出す
|
||||||
|
return { left, top, transformOrigin: 'left center' };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return calc();
|
||||||
|
}
|
@ -270,7 +270,7 @@ type Plugin = {
|
|||||||
* 常にメモリにロードしておく必要がないような設定情報を保管するストレージ(非リアクティブ)
|
* 常にメモリにロードしておく必要がないような設定情報を保管するストレージ(非リアクティブ)
|
||||||
*/
|
*/
|
||||||
import lightTheme from '@/themes/l-light.json5';
|
import lightTheme from '@/themes/l-light.json5';
|
||||||
import darkTheme from '@/themes/d-dark.json5';
|
import darkTheme from '@/themes/d-green-lime.json5';
|
||||||
|
|
||||||
export class ColdDeviceStorage {
|
export class ColdDeviceStorage {
|
||||||
public static default = {
|
public static default = {
|
||||||
|
@ -11,10 +11,11 @@ export type MenuA = { type: 'a', href: string, target?: string, download?: strin
|
|||||||
export type MenuUser = { type: 'user', user: Misskey.entities.User, active?: boolean, indicate?: boolean, action: MenuAction };
|
export type MenuUser = { type: 'user', user: Misskey.entities.User, active?: boolean, indicate?: boolean, action: MenuAction };
|
||||||
export type MenuSwitch = { type: 'switch', ref: Ref<boolean>, text: string, disabled?: boolean };
|
export type MenuSwitch = { type: 'switch', ref: Ref<boolean>, text: string, disabled?: boolean };
|
||||||
export type MenuButton = { type?: 'button', text: string, icon?: string, indicate?: boolean, danger?: boolean, active?: boolean, avatar?: Misskey.entities.User; action: MenuAction };
|
export type MenuButton = { type?: 'button', text: string, icon?: string, indicate?: boolean, danger?: boolean, active?: boolean, avatar?: Misskey.entities.User; action: MenuAction };
|
||||||
|
export type MenuParent = { type: 'parent', text: string, icon?: string, children: OuterMenuItem[] };
|
||||||
|
|
||||||
export type MenuPending = { type: 'pending' };
|
export type MenuPending = { type: 'pending' };
|
||||||
|
|
||||||
type OuterMenuItem = MenuDivider | MenuNull | MenuLabel | MenuLink | MenuA | MenuUser | MenuSwitch | MenuButton;
|
type OuterMenuItem = MenuDivider | MenuNull | MenuLabel | MenuLink | MenuA | MenuUser | MenuSwitch | MenuButton | MenuParent;
|
||||||
type OuterPromiseMenuItem = Promise<MenuLabel | MenuLink | MenuA | MenuUser | MenuSwitch | MenuButton>;
|
type OuterPromiseMenuItem = Promise<MenuLabel | MenuLink | MenuA | MenuUser | MenuSwitch | MenuButton | MenuParent>;
|
||||||
export type MenuItem = OuterMenuItem | OuterPromiseMenuItem;
|
export type MenuItem = OuterMenuItem | OuterPromiseMenuItem;
|
||||||
export type InnerMenuItem = MenuDivider | MenuPending | MenuLabel | MenuLink | MenuA | MenuUser | MenuSwitch | MenuButton;
|
export type InnerMenuItem = MenuDivider | MenuPending | MenuLabel | MenuLink | MenuA | MenuUser | MenuSwitch | MenuButton | MenuParent;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<component :is="popup.component"
|
<component
|
||||||
|
:is="popup.component"
|
||||||
v-for="popup in popups"
|
v-for="popup in popups"
|
||||||
:key="popup.id"
|
:key="popup.id"
|
||||||
v-bind="popup.props"
|
v-bind="popup.props"
|
||||||
@ -15,39 +16,37 @@
|
|||||||
<div v-if="dev" id="devTicker"><span>DEV BUILD</span></div>
|
<div v-if="dev" id="devTicker"><span>DEV BUILD</span></div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { defineAsyncComponent, defineComponent } from 'vue';
|
import { defineAsyncComponent } from 'vue';
|
||||||
|
import { swInject } from './sw-inject';
|
||||||
import { popup, popups, pendingApiRequestsCount } from '@/os';
|
import { popup, popups, pendingApiRequestsCount } from '@/os';
|
||||||
import { uploads } from '@/scripts/upload';
|
import { uploads } from '@/scripts/upload';
|
||||||
import * as sound from '@/scripts/sound';
|
import * as sound from '@/scripts/sound';
|
||||||
import { $i } from '@/account';
|
import { $i } from '@/account';
|
||||||
import { swInject } from './sw-inject';
|
|
||||||
import { stream } from '@/stream';
|
import { stream } from '@/stream';
|
||||||
|
|
||||||
export default defineComponent({
|
const XStreamIndicator = defineAsyncComponent(() => import('./stream-indicator.vue'));
|
||||||
components: {
|
const XUpload = defineAsyncComponent(() => import('./upload.vue'));
|
||||||
XStreamIndicator: defineAsyncComponent(() => import('./stream-indicator.vue')),
|
|
||||||
XUpload: defineAsyncComponent(() => import('./upload.vue')),
|
|
||||||
},
|
|
||||||
|
|
||||||
setup() {
|
const dev = _DEV_;
|
||||||
const onNotification = notification => {
|
|
||||||
|
const onNotification = notification => {
|
||||||
if ($i.mutingNotificationTypes.includes(notification.type)) return;
|
if ($i.mutingNotificationTypes.includes(notification.type)) return;
|
||||||
|
|
||||||
if (document.visibilityState === 'visible') {
|
if (document.visibilityState === 'visible') {
|
||||||
stream.send('readNotification', {
|
stream.send('readNotification', {
|
||||||
id: notification.id
|
id: notification.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
popup(defineAsyncComponent(() => import('@/components/notification-toast.vue')), {
|
popup(defineAsyncComponent(() => import('@/components/notification-toast.vue')), {
|
||||||
notification
|
notification,
|
||||||
}, {}, 'closed');
|
}, {}, 'closed');
|
||||||
}
|
}
|
||||||
|
|
||||||
sound.play('notification');
|
sound.play('notification');
|
||||||
};
|
};
|
||||||
|
|
||||||
if ($i) {
|
if ($i) {
|
||||||
const connection = stream.useChannel('main', null, 'UI');
|
const connection = stream.useChannel('main', null, 'UI');
|
||||||
connection.on('notification', onNotification);
|
connection.on('notification', onNotification);
|
||||||
|
|
||||||
@ -55,16 +54,7 @@ export default defineComponent({
|
|||||||
if ('serviceWorker' in navigator) {
|
if ('serviceWorker' in navigator) {
|
||||||
swInject();
|
swInject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
|
||||||
uploads,
|
|
||||||
popups,
|
|
||||||
pendingApiRequestsCount,
|
|
||||||
dev: _DEV_,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
@ -87,6 +87,36 @@ function openInstanceMenu(ev: MouseEvent) {
|
|||||||
text: i18n.ts.federation,
|
text: i18n.ts.federation,
|
||||||
icon: 'fas fa-globe',
|
icon: 'fas fa-globe',
|
||||||
to: '/about#federation',
|
to: '/about#federation',
|
||||||
|
}, null, {
|
||||||
|
type: 'parent',
|
||||||
|
text: i18n.ts.help,
|
||||||
|
icon: 'fas fa-question-circle',
|
||||||
|
children: [{
|
||||||
|
type: 'link',
|
||||||
|
to: '/mfm-cheat-sheet',
|
||||||
|
text: i18n.ts._mfm.cheatSheet,
|
||||||
|
icon: 'fas fa-code',
|
||||||
|
}, {
|
||||||
|
type: 'link',
|
||||||
|
to: '/scratchpad',
|
||||||
|
text: i18n.ts.scratchpad,
|
||||||
|
icon: 'fas fa-terminal',
|
||||||
|
}, {
|
||||||
|
type: 'link',
|
||||||
|
to: '/api-console',
|
||||||
|
text: 'API Console',
|
||||||
|
icon: 'fas fa-terminal',
|
||||||
|
}, null, {
|
||||||
|
text: i18n.ts.document,
|
||||||
|
icon: 'fas fa-question-circle',
|
||||||
|
action: () => {
|
||||||
|
window.open('https://misskey-hub.net/help.html', '_blank');
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
}, {
|
||||||
|
type: 'link',
|
||||||
|
text: i18n.ts.aboutMisskey,
|
||||||
|
to: '/about-misskey',
|
||||||
}], ev.currentTarget ?? ev.target, {
|
}], ev.currentTarget ?? ev.target, {
|
||||||
align: 'left',
|
align: 'left',
|
||||||
});
|
});
|
||||||
|
@ -110,6 +110,36 @@ function openInstanceMenu(ev: MouseEvent) {
|
|||||||
text: i18n.ts.federation,
|
text: i18n.ts.federation,
|
||||||
icon: 'fas fa-globe',
|
icon: 'fas fa-globe',
|
||||||
to: '/about#federation',
|
to: '/about#federation',
|
||||||
|
}, null, {
|
||||||
|
type: 'parent',
|
||||||
|
text: i18n.ts.help,
|
||||||
|
icon: 'fas fa-question-circle',
|
||||||
|
children: [{
|
||||||
|
type: 'link',
|
||||||
|
to: '/mfm-cheat-sheet',
|
||||||
|
text: i18n.ts._mfm.cheatSheet,
|
||||||
|
icon: 'fas fa-code',
|
||||||
|
}, {
|
||||||
|
type: 'link',
|
||||||
|
to: '/scratchpad',
|
||||||
|
text: i18n.ts.scratchpad,
|
||||||
|
icon: 'fas fa-terminal',
|
||||||
|
}, {
|
||||||
|
type: 'link',
|
||||||
|
to: '/api-console',
|
||||||
|
text: 'API Console',
|
||||||
|
icon: 'fas fa-terminal',
|
||||||
|
}, null, {
|
||||||
|
text: i18n.ts.document,
|
||||||
|
icon: 'fas fa-question-circle',
|
||||||
|
action: () => {
|
||||||
|
window.open('https://misskey-hub.net/help.html', '_blank');
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
}, {
|
||||||
|
type: 'link',
|
||||||
|
text: i18n.ts.aboutMisskey,
|
||||||
|
to: '/about-misskey',
|
||||||
}], ev.currentTarget ?? ev.target, {
|
}], ev.currentTarget ?? ev.target, {
|
||||||
align: 'left',
|
align: 'left',
|
||||||
});
|
});
|
||||||
|
@ -128,7 +128,11 @@ function getMenu() {
|
|||||||
if (canceled) return;
|
if (canceled) return;
|
||||||
updateColumn(props.column.id, result);
|
updateColumn(props.column.id, result);
|
||||||
},
|
},
|
||||||
}, null, {
|
}, {
|
||||||
|
type: 'parent',
|
||||||
|
text: i18n.ts.move + '...',
|
||||||
|
icon: 'fas fa-arrows-up-down-left-right',
|
||||||
|
children: [{
|
||||||
icon: 'fas fa-arrow-left',
|
icon: 'fas fa-arrow-left',
|
||||||
text: i18n.ts._deck.swapLeft,
|
text: i18n.ts._deck.swapLeft,
|
||||||
action: () => {
|
action: () => {
|
||||||
@ -152,7 +156,8 @@ function getMenu() {
|
|||||||
action: () => {
|
action: () => {
|
||||||
swapDownColumn(props.column.id);
|
swapDownColumn(props.column.id);
|
||||||
},
|
},
|
||||||
} : undefined, null, {
|
} : undefined],
|
||||||
|
}, {
|
||||||
icon: 'fas fa-window-restore',
|
icon: 'fas fa-window-restore',
|
||||||
text: i18n.ts._deck.stackLeft,
|
text: i18n.ts._deck.stackLeft,
|
||||||
action: () => {
|
action: () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user