1
0
Fork 0
mirror of https://github.com/anyproto/anytype-ts.git synced 2025-06-08 05:57:02 +09:00
This commit is contained in:
Andrew Simachev 2025-04-14 09:20:31 +02:00
parent 52a5fef46a
commit 40a0ecbc6f
No known key found for this signature in database
GPG key ID: 1DFE44B21443F0EF

View file

@ -738,7 +738,12 @@ const BlockText = observer(class BlockText extends React.Component<Props> {
continue;
};
const reg = new RegExp(`^(${k}\\s)`);
let space = '\\s';
if (newStyle == I.TextStyle.Code) {
space = '';
};
const reg = new RegExp(`^(${k})${space}`);
const match = value.match(reg);
if (!match) {
@ -766,9 +771,11 @@ const BlockText = observer(class BlockText extends React.Component<Props> {
S.Block.toggle(rootId, id, true);
};
if ((newStyle == I.TextStyle.Code) && match[2]) {
if (newStyle == I.TextStyle.Code) {
const lang = match[2] || Storage.get('codeLang') || J.Constant.default.codeLang;
C.BlockListSetFields(rootId, [
{ blockId: block.id, fields: { ...block.fields, lang: match[2] } }
{ blockId: block.id, fields: { ...block.fields, lang } }
]);
};
});