mirror of
https://github.com/anyproto/anytype-ts.git
synced 2025-06-08 05:57:02 +09:00
code fix
This commit is contained in:
parent
52a5fef46a
commit
40a0ecbc6f
1 changed files with 10 additions and 3 deletions
|
@ -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 } }
|
||||
]);
|
||||
};
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue