Skip to content

Commit 8df90fd

Browse files
fix: Added icon for comment; Changed initial toolbar lineup for heading; (#440)
Because there is no icon for comment, there is this bug that is causing unnecessary padding on the toolbar; Initial toolbar now includes a group containing all headings w/ their keyboard shortcuts
1 parent 3670afb commit 8df90fd

2 files changed

Lines changed: 23 additions & 13 deletions

File tree

core/src/commands/comment.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,10 @@ export const comment: ICommand = {
1919
end: state2.selection.end - 4,
2020
});
2121
},
22+
icon: (
23+
<svg role="img" viewBox="0 0 512 512" width="12" height="12">
24+
<path fill="currentColor" d="M281 72H231oLuLFozwYpLrBi5VTa8sg7fDqKkeyD81V172H281V72Z" />
25+
<path fill="currentColor" d="M287.817 501H213.333L298.667 334H438.857C438.857 334 438.857 333.021 438.857 308.308V187.875V74.6028C438.857 64.3818 438.857 67.2814 438.857 62.625C438.857 61.7594 439.31 62.625 426.667 62.625H256H73.1429C73.1429 65.4903 73.1429 77.3378 73.1429 79.8845V187.875V308.308C73.1429 311.005 73.1429 334 73.1429 334C73.1429 334 113.826 334 106.667 334H149.333H237.714V385.385H73.1429C53.7442 385.385 35.14 377.264 21.423 362.809C7.7061 348.355 0 328.75 0 308.308V77.0769C0 56.6349 7.7061 37.03 21.423 22.5753C35.14 8.12058 53.7442 0 73.1429 0H438.857C458.256 0 476.86 8.12058 490.577 22.5753C504.294 37.03 512 56.6349 512 77.0769V308.308C512 328.75 504.294 348.355 490.577 362.809C476.86 377.264 458.256 385.385 438.857 385.385H350.354L287.817 501Z" />
26+
</svg>
27+
)
2228
};

core/src/commands/index.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
import React from 'react';
2+
import { ContextStore, ExecuteCommandState } from '../Context';
3+
import { insertTextAtPosition } from '../utils/InsertTextAtPosition';
24
import { bold } from './bold';
35
import { code, codeBlock } from './code';
6+
import { comment } from './comment';
7+
import { divider } from './divider';
8+
import { fullscreen } from './fullscreen';
9+
import { group } from './group';
10+
import { hr } from './hr';
11+
import { image } from './image';
412
import { italic } from './italic';
513
import { link } from './link';
6-
import { unorderedListCommand, orderedListCommand, checkedListCommand } from './list';
14+
import { checkedListCommand, orderedListCommand, unorderedListCommand } from './list';
15+
import { codeEdit, codeLive, codePreview } from './preview';
716
import { quote } from './quote';
8-
import { hr } from './hr';
17+
import { strikethrough } from './strikeThrough';
918
import { title } from './title';
1019
import { title1 } from './title1';
1120
import { title2 } from './title2';
1221
import { title3 } from './title3';
1322
import { title4 } from './title4';
1423
import { title5 } from './title5';
1524
import { title6 } from './title6';
16-
import { comment } from './comment';
17-
import { group } from './group';
18-
import { divider } from './divider';
19-
import { codePreview, codeEdit, codeLive } from './preview';
20-
import { fullscreen } from './fullscreen';
21-
import { image } from './image';
22-
import { strikethrough } from './strikeThrough';
23-
import { insertTextAtPosition } from '../utils/InsertTextAtPosition';
24-
import { ContextStore, ExecuteCommandState } from '../Context';
2525

2626
export interface CommandOrchestrator {
2727
executeCommand(command: ICommand): void;
@@ -84,7 +84,11 @@ const getCommands: () => ICommand[] = () => [
8484
italic,
8585
strikethrough,
8686
hr,
87-
title,
87+
group([title1, title2, title3, title4, title5, title6], {
88+
name: "title",
89+
groupName: "title",
90+
buttonProps: { "aria-label": "Insert title", title: "Insert title" },
91+
}),
8892
divider,
8993
link,
9094
quote,
@@ -163,7 +167,6 @@ class TextAreaCommandOrchestrator implements CommandOrchestrator {
163167
}
164168

165169
export {
166-
// Toolbars.
167170
title,
168171
title1,
169172
title2,
@@ -196,3 +199,4 @@ export {
196199
TextAreaCommandOrchestrator,
197200
TextAreaTextApi,
198201
};
202+

0 commit comments

Comments
 (0)