Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(md): add blockquote to formatting toolbars (#1814)

Seamus169c9dd94bb0
diff --git a/js/app/packages/block-channel/component/FormatRibbon.tsx b/js/app/packages/block-channel/component/FormatRibbon.tsx
index 0f1b765d3e..419ebf816f 100644
--- a/js/app/packages/block-channel/component/FormatRibbon.tsx
+++ b/js/app/packages/block-channel/component/FormatRibbon.tsx
@@ -9,6 +9,7 @@ import ListChecks from '@icon/regular/list-checks.svg';
import ListNumbers from '@icon/regular/list-numbers.svg';
import TextItalic from '@icon/regular/text-italic.svg';
import TextStriketrough from '@icon/regular/text-strikethrough.svg';
+import TextQuote from '@icon/regular/quotes.svg';
import type { TextFormatType } from 'lexical';
import { ActionButton } from './ActionButton';
@@ -20,6 +21,11 @@ export type FormatRibbonProps = {
};
export function FormatRibbon(props: FormatRibbonProps) {
+ const dispatchFormat = (transform: NodeTransformType) => {
+ const hasFormat = props.state.elementsInRange.has(transform);
+ props.nodeFormat(hasFormat ? 'paragraph' : transform);
+ };
+
return (
<div
class="flex flex-row w-full gap-2 items-center p-2"
@@ -82,7 +88,7 @@ export function FormatRibbon(props: FormatRibbonProps) {
clicked={props.state.elementsInRange.has('list-bullet')}
onClick={(e) => {
e.preventDefault();
- props.nodeFormat('list-bullet');
+ dispatchFormat('list-bullet');
}}
>
<ListBullets width={20} height={20} />
@@ -93,7 +99,7 @@ export function FormatRibbon(props: FormatRibbonProps) {
clicked={props.state.elementsInRange.has('list-number')}
onClick={(e) => {
e.preventDefault();
- props.nodeFormat('list-number');
+ dispatchFormat('list-number');
}}
>
<ListNumbers width={20} height={20} />
@@ -104,11 +110,22 @@ export function FormatRibbon(props: FormatRibbonProps) {
clicked={props.state.elementsInRange.has('list-check')}
onClick={(e) => {
e.preventDefault();
- props.nodeFormat('list-check');
+ dispatchFormat('list-check');
}}
>
<ListChecks width={20} height={20} />
</ActionButton>
+ <ActionButton
+ tooltip="Blockquote"
+ darker
+ clicked={props.state.elementsInRange.has('quote')}
+ onClick={(e) => {
+ e.preventDefault();
+ dispatchFormat('quote');
+ }}
+ >
+ <TextQuote width={20} height={20} />
+ </ActionButton>
</div>
);
}
diff --git a/js/app/packages/block-md/component/FormatTools.tsx b/js/app/packages/block-md/component/FormatTools.tsx
index 4c1fca483a..43647731ec 100644
--- a/js/app/packages/block-md/component/FormatTools.tsx
+++ b/js/app/packages/block-md/component/FormatTools.tsx
@@ -427,6 +427,7 @@ export function FormatTools(props: { withinPopup?: boolean }) {
'heading3',
'paragraph',
'code',
+ 'quote',
'list-bullet',
'list-number',
'list-check',
@@ -639,6 +640,7 @@ export function FormatTools(props: { withinPopup?: boolean }) {
'list-number',
'list-check',
'code',
+ 'quote',
];
if (props.withinPopup) {
@@ -667,6 +669,16 @@ export function FormatTools(props: { withinPopup?: boolean }) {
}}
buttonIsDisabled={buttonIsDisabled}
/>
+ <ElementFormatButton
+ format="quote"
+ selection={selection}
+ onClick={(e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ nodeFormat('quote');
+ }}
+ buttonIsDisabled={buttonIsDisabled}
+ />
<InlineFormatPopDown
formats={[
'bold',