This commit is contained in:
FineArchs 2024-09-11 11:45:41 +09:00
parent 51a66ae328
commit a1fe50f6b9
5 changed files with 50 additions and 44 deletions

View File

@ -121,7 +121,7 @@ import EmUserName from '@/components/EmUserName.vue';
import EmTime from '@/components/EmTime.vue';
import { userPage } from '@/utils.js';
import { i18n } from '@/i18n.js';
import { shouldCollapsed } from '@@/js/collapsed.js';
import { shouldCollapse } from '@@/js/collapsed.js';
import { url } from '@@/js/config.js';
function getAppearNote(note: Misskey.entities.Note) {
@ -150,7 +150,7 @@ const renoteTime = shallowRef<HTMLElement>();
const appearNote = computed(() => getAppearNote(note.value));
const showContent = ref(false);
const parsed = computed(() => appearNote.value.text ? mfm.parse(appearNote.value.text) : null);
const isLong = shouldCollapsed(appearNote.value, []);
const isLong = shouldCollapse(appearNote.value, 13.5, parsed.value);
const collapsed = ref(appearNote.value.cw == null && isLong);
const isDeleted = ref(false);
</script>

View File

@ -142,7 +142,7 @@ import EmAcct from '@/components/EmAcct.vue';
import { userPage } from '@/utils.js';
import { notePage } from '@/utils.js';
import { i18n } from '@/i18n.js';
import { shouldCollapsed } from '@@/js/collapsed.js';
import { shouldCollapse } from '@@/js/collapsed.js';
import { serverMetadata } from '@/server-metadata.js';
import { url } from '@@/js/config.js';
import EmMfm from '@/components/EmMfm.js';
@ -168,7 +168,7 @@ const appearNote = computed(() => isRenote ? note.value.renote as Misskey.entiti
const showContent = ref(false);
const isDeleted = ref(false);
const parsed = appearNote.value.text ? mfm.parse(appearNote.value.text) : null;
const isLong = shouldCollapsed(appearNote.value, []);
const isLong = shouldCollapse(appearNote.value, 13.5, parsed.value);
const collapsed = ref(appearNote.value.cw == null && isLong);
</script>

View File

@ -36,7 +36,7 @@ import EmMediaList from '@/components/EmMediaList.vue';
import EmPoll from '@/components/EmPoll.vue';
import { i18n } from '@/i18n.js';
import { url } from '@@/js/config.js';
import { shouldCollapsed } from '@@/js/collapsed.js';
import { shouldCollapse } from '@@/js/collapsed.js';
import EmA from '@/components/EmA.vue';
import EmMfm from '@/components/EmMfm.js';
@ -44,7 +44,7 @@ const props = defineProps<{
note: Misskey.entities.Note;
}>();
const isLong = shouldCollapsed(props.note, []);
const isLong = shouldCollapse(props.note, 13.5);
const collapsed = ref(isLong);
</script>

View File

@ -178,8 +178,10 @@ export function shouldCollapse(note: Misskey.entities.Note, limitY: number, ast?
}
case 'border': {
// TODO: 枠線の幅も計算に入れる?
const width = safeParseFloat(node.props.args.width) ?? 1;
addHeightsInline(getHeightForEachLine(node.children, depth + 1).map(l => l + (width * 2)));
if (width > 20) forceCollapsed = true;
addHeightsInline(getHeightForEachLine(node.children, depth + 1));
break;
}

View File

@ -1257,6 +1257,9 @@ importers:
packages/frontend-shared:
dependencies:
mfm-js:
specifier: 0.24.0
version: 0.24.0
misskey-js:
specifier: workspace:*
version: link:../misskey-js
@ -11333,6 +11336,7 @@ packages:
ts-case-convert@2.0.2:
resolution: {integrity: sha512-vdKfx1VAdpvEBOBv5OpVu5ZFqRg9HdTI4sYt6qqMeICBeNyXvitrarCnFWNDAki51IKwCyx+ZssY46Q9jH5otA==}
bundledDependencies: []
ts-dedent@2.2.0:
resolution: {integrity: sha512-q5W7tVM71e2xjHZTlgfTDoPF/SmqKG5hddq9SzR49CH2hayqRKJtQ4mtRlSxKaJlR/+9rEM+mnBHf7I2/BQcpQ==}
@ -12674,7 +12678,7 @@ snapshots:
'@babel/traverse': 7.23.5
'@babel/types': 7.24.7
convert-source-map: 2.0.0
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
gensync: 1.0.0-beta.2
json5: 2.2.3
semver: 6.3.1
@ -12694,7 +12698,7 @@ snapshots:
'@babel/traverse': 7.24.7
'@babel/types': 7.24.7
convert-source-map: 2.0.0
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
gensync: 1.0.0-beta.2
json5: 2.2.3
semver: 6.3.1
@ -12769,7 +12773,7 @@ snapshots:
'@babel/core': 7.24.7
'@babel/helper-compilation-targets': 7.24.7
'@babel/helper-plugin-utils': 7.24.7
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
lodash.debounce: 4.0.8
resolve: 1.22.8
transitivePeerDependencies:
@ -13636,7 +13640,7 @@ snapshots:
'@babel/helper-split-export-declaration': 7.22.6
'@babel/parser': 7.24.7
'@babel/types': 7.24.7
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
globals: 11.12.0
transitivePeerDependencies:
- supports-color
@ -13651,7 +13655,7 @@ snapshots:
'@babel/helper-split-export-declaration': 7.24.7
'@babel/parser': 7.24.7
'@babel/types': 7.24.7
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
globals: 11.12.0
transitivePeerDependencies:
- supports-color
@ -14111,7 +14115,7 @@ snapshots:
'@eslint/config-array@0.17.1':
dependencies:
'@eslint/object-schema': 2.1.4
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
minimatch: 3.1.2
transitivePeerDependencies:
- supports-color
@ -14119,7 +14123,7 @@ snapshots:
'@eslint/eslintrc@3.1.0':
dependencies:
ajv: 6.12.6
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
espree: 10.1.0
globals: 14.0.0
ignore: 5.3.1
@ -17285,7 +17289,7 @@ snapshots:
'@typescript-eslint/types': 7.17.0
'@typescript-eslint/typescript-estree': 7.17.0(typescript@5.5.4)
'@typescript-eslint/visitor-keys': 7.17.0
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
eslint: 9.8.0
optionalDependencies:
typescript: 5.5.4
@ -17311,7 +17315,7 @@ snapshots:
dependencies:
'@typescript-eslint/typescript-estree': 6.11.0(typescript@5.3.3)
'@typescript-eslint/utils': 6.11.0(eslint@9.8.0)(typescript@5.3.3)
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
eslint: 9.8.0
ts-api-utils: 1.0.1(typescript@5.3.3)
optionalDependencies:
@ -17323,7 +17327,7 @@ snapshots:
dependencies:
'@typescript-eslint/typescript-estree': 7.1.0(typescript@5.3.3)
'@typescript-eslint/utils': 7.1.0(eslint@9.8.0)(typescript@5.3.3)
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
eslint: 9.8.0
ts-api-utils: 1.0.1(typescript@5.3.3)
optionalDependencies:
@ -17335,7 +17339,7 @@ snapshots:
dependencies:
'@typescript-eslint/typescript-estree': 7.17.0(typescript@5.5.4)
'@typescript-eslint/utils': 7.17.0(eslint@9.8.0)(typescript@5.5.4)
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
eslint: 9.8.0
ts-api-utils: 1.3.0(typescript@5.5.4)
optionalDependencies:
@ -17353,7 +17357,7 @@ snapshots:
dependencies:
'@typescript-eslint/types': 6.11.0
'@typescript-eslint/visitor-keys': 6.11.0
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
globby: 11.1.0
is-glob: 4.0.3
semver: 7.6.0
@ -17367,7 +17371,7 @@ snapshots:
dependencies:
'@typescript-eslint/types': 7.1.0
'@typescript-eslint/visitor-keys': 7.1.0
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
globby: 11.1.0
is-glob: 4.0.3
minimatch: 9.0.3
@ -17382,7 +17386,7 @@ snapshots:
dependencies:
'@typescript-eslint/types': 7.17.0
'@typescript-eslint/visitor-keys': 7.17.0
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
globby: 11.1.0
is-glob: 4.0.3
minimatch: 9.0.4
@ -17458,7 +17462,7 @@ snapshots:
dependencies:
'@ampproject/remapping': 2.2.1
'@bcoe/v8-coverage': 0.2.3
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
istanbul-lib-coverage: 3.2.2
istanbul-lib-report: 3.0.1
istanbul-lib-source-maps: 5.0.4
@ -17477,7 +17481,7 @@ snapshots:
dependencies:
'@ampproject/remapping': 2.2.1
'@bcoe/v8-coverage': 0.2.3
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
istanbul-lib-coverage: 3.2.2
istanbul-lib-report: 3.0.1
istanbul-lib-source-maps: 5.0.4
@ -17719,13 +17723,13 @@ snapshots:
agent-base@6.0.2:
dependencies:
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
transitivePeerDependencies:
- supports-color
agent-base@7.1.0:
dependencies:
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
transitivePeerDependencies:
- supports-color
@ -17983,7 +17987,7 @@ snapshots:
dependencies:
'@fastify/error': 3.4.0
archy: 1.0.0
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
fastq: 1.17.1
transitivePeerDependencies:
- supports-color
@ -19037,7 +19041,7 @@ snapshots:
detect-port@1.5.1:
dependencies:
address: 1.2.2
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
transitivePeerDependencies:
- supports-color
@ -19250,7 +19254,7 @@ snapshots:
esbuild-register@3.5.0(esbuild@0.19.11):
dependencies:
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
esbuild: 0.19.11
transitivePeerDependencies:
- supports-color
@ -19480,7 +19484,7 @@ snapshots:
ajv: 6.12.6
chalk: 4.1.2
cross-spawn: 7.0.3
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
escape-string-regexp: 4.0.0
eslint-scope: 8.0.2
eslint-visitor-keys: 4.0.0
@ -19933,7 +19937,7 @@ snapshots:
follow-redirects@1.15.2(debug@4.3.5):
optionalDependencies:
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
for-each@0.3.3:
dependencies:
@ -20393,7 +20397,7 @@ snapshots:
http-proxy-agent@7.0.2:
dependencies:
agent-base: 7.1.0
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
transitivePeerDependencies:
- supports-color
@ -20432,28 +20436,28 @@ snapshots:
https-proxy-agent@5.0.1:
dependencies:
agent-base: 6.0.2
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
transitivePeerDependencies:
- supports-color
https-proxy-agent@7.0.2:
dependencies:
agent-base: 7.1.0
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
transitivePeerDependencies:
- supports-color
https-proxy-agent@7.0.4:
dependencies:
agent-base: 7.1.0
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
transitivePeerDependencies:
- supports-color
https-proxy-agent@7.0.5:
dependencies:
agent-base: 7.1.0
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
transitivePeerDependencies:
- supports-color
@ -20801,7 +20805,7 @@ snapshots:
istanbul-lib-source-maps@4.0.1:
dependencies:
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
istanbul-lib-coverage: 3.2.2
source-map: 0.6.1
transitivePeerDependencies:
@ -20810,7 +20814,7 @@ snapshots:
istanbul-lib-source-maps@5.0.4:
dependencies:
'@jridgewell/trace-mapping': 0.3.25
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
istanbul-lib-coverage: 3.2.2
transitivePeerDependencies:
- supports-color
@ -21948,7 +21952,7 @@ snapshots:
micromark@4.0.0:
dependencies:
'@types/debug': 4.1.12
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
decode-named-character-reference: 1.0.2
devlop: 1.1.0
micromark-core-commonmark: 2.0.0
@ -23505,7 +23509,7 @@ snapshots:
require-in-the-middle@7.3.0:
dependencies:
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
module-details-from-path: 1.0.3
resolve: 1.22.8
transitivePeerDependencies:
@ -23786,7 +23790,7 @@ snapshots:
dependencies:
'@hapi/hoek': 11.0.4
'@hapi/wreck': 18.0.1
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
joi: 17.11.0
transitivePeerDependencies:
- supports-color
@ -23886,7 +23890,7 @@ snapshots:
socks-proxy-agent@8.0.2:
dependencies:
agent-base: 7.1.0
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
socks: 2.7.1
transitivePeerDependencies:
- supports-color
@ -23981,7 +23985,7 @@ snapshots:
arg: 5.0.2
bluebird: 3.7.2
check-more-types: 2.24.0
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
execa: 5.1.1
lazy-ass: 1.6.0
ps-tree: 1.2.0
@ -24722,7 +24726,7 @@ snapshots:
vite-node@1.6.0(@types/node@20.14.12)(sass@1.77.8)(terser@5.31.3):
dependencies:
cac: 6.7.14
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
pathe: 1.1.2
picocolors: 1.0.1
vite: 5.3.5(@types/node@20.14.12)(sass@1.77.8)(terser@5.31.3)
@ -24889,7 +24893,7 @@ snapshots:
vue-eslint-parser@9.4.3(eslint@9.8.0):
dependencies:
debug: 4.3.5(supports-color@5.5.0)
debug: 4.3.5(supports-color@8.1.1)
eslint: 9.8.0
eslint-scope: 7.2.2
eslint-visitor-keys: 3.4.3