diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6e968fe5..02388b05 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,9 +1,28 @@
# Sable Client Changelog
+## 1.2.2 - in dev
+
+- Fixed/updated unknown extended profile keys rendering.
+- Added support for `---`, `-#`, and fixed `-` to be unordered.
+
+## 1.2.1
+
+- Update pronouns to match [MSC4247](https://github.com/matrix-org/matrix-spec-proposals/pull/4247) format better and support up to 3 pronoun pills on desktop, 1 on mobile ([#23](https://github.com/7w1/sable/issues/23), [#33](https://github.com/7w1/sable/pull/33)) - [ranidspace](https://github.com/ranidspace)
+ - Unfortunately, **everyone who set pronouns in Sable will need to reset them.**
+- Fix jumbo-ified non-emojis with colons. ([#32](https://github.com/7w1/sable/issues/32))
+- Show full timestamps on hover. ([cinnyapp#2699](https://github.com/cinnyapp/cinny/issues/2699))
+- Enable Twitter-style emojis by default.
+- Make inline editor buttons buttons.
+- Name colors in pinned messages.
+- Rename "Heating up" to "Petting cats"
+- Concurrency guard for profile lookups.
+- Hex color input for power level editor.
+- Editing previous messages with keybinds no longer breaks message bar ([#36](https://github.com/7w1/sable/issues/36))
+
## 1.2.0
-- Codebase cleanup ([#22](https://github.com/7w1/sable/pull/22))
-- Fix mono font ([#18](https://github.com/7w1/sable/pull/18))
+- Codebase cleanup ([#22](https://github.com/7w1/sable/pull/22)) - [haz](https://github.com/hazre)
+- Fix mono font ([#18](https://github.com/7w1/sable/pull/18)) - [Alexia](https://github.com/cyrneko)
- Merge final commits from ([cinnyapp#2599](https://github.com/cinnyapp/cinny/pull/2599))
- Unread pin counter & highlighting ([#25](https://github.com/7w1/sable/pull/25), [#31](https://github.com/7w1/sable/pull/31))
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index ff80e4c1..b9812722 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -7,14 +7,13 @@ All types of contributions are encouraged and valued. Please make sure to read t
> And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about:
>
> - Star the project
-> - Tweet about it (tag @cinnyapp)
+> - Talk abot it!
> - Refer this project in your project's readme
> - Mention the project at local meetups and tell your friends/colleagues
-> - [Donate to us](https://cinny.in/#sponsor)
## Bug reports
-Bug reports and feature suggestions must use descriptive and concise titles and be submitted to [GitHub Issues](https://github.com/ajbura/cinny/issues). Please use the search function to make sure that you are not submitting duplicates, and that a similar report or request has not already been resolved or rejected.
+Bug reports and feature suggestions must use descriptive and concise titles and be submitted to [GitHub Issues](https://github.com/7w1/sable/issues). Please use the search function to make sure that you are not submitting duplicates, and that a similar report or request has not already been resolved or rejected.
## Pull requests
@@ -38,7 +37,7 @@ It is not always possible to phrase every change in such a manner, but it is des
Also, we use [ESLint](https://eslint.org/) for clean and stylistically consistent code syntax, so make sure your pull request follow it.
-**For any query or design discussion, join our [Matrix room](https://matrix.to/#/#cinny:matrix.org).**
+**For any query or design discussion, join our [Matrix room](https://matrix.to/#/#sable:sable.moe).**
## Helpful links
diff --git a/README.md b/README.md
index de883fff..a893884f 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@ The web app is available at [app.sable.moe](https://app.sable.moe/) and gets upd
You can also download our desktop app for windows and linux from [releases](https://github.com/7w1/sable/releases/latest).
## Self-hosting
-To host Cinny on your own, download this repo and built with nginx.
+To host Sable on your own, download this repo and built with nginx.
```sh
npm ci # Installs all dependencies
diff --git a/package-lock.json b/package-lock.json
index f71748f4..c9df2f0b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "sable",
- "version": "1.2.0",
+ "version": "1.2.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sable",
- "version": "1.2.0",
+ "version": "1.2.1",
"license": "AGPL-3.0-only",
"dependencies": {
"@atlaskit/pragmatic-drag-and-drop": "^1.7.7",
diff --git a/package.json b/package.json
index f6c37ced..ed3a15a8 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "sable",
- "version": "1.2.0",
+ "version": "1.2.1",
"description": "Yet another matrix client fork",
"type": "module",
"packageManager": "npm@11.11.0",
diff --git a/src/app/components/editor/Elements.tsx b/src/app/components/editor/Elements.tsx
index 938e38f8..ce24872d 100644
--- a/src/app/components/editor/Elements.tsx
+++ b/src/app/components/editor/Elements.tsx
@@ -226,6 +226,19 @@ export function RenderElement({ attributes, element, children }: RenderElementPr
{children}
);
+ case BlockType.Small:
+ return (
+
+ {children}
+
+ );
+ case BlockType.HorizontalRule:
+ return (
+
+ );
default:
return (
+
<>
diff --git a/src/app/components/editor/input.ts b/src/app/components/editor/input.ts
index c0d5b03f..af686a9e 100644
--- a/src/app/components/editor/input.ts
+++ b/src/app/components/editor/input.ts
@@ -11,10 +11,12 @@ import {
EmoticonElement,
HeadingElement,
HeadingLevel,
+ HorizontalRuleElement,
InlineElement,
MentionElement,
OrderedListElement,
ParagraphElement,
+ SmallElement,
UnorderedListElement,
} from './slate';
import { createEmoticonElement, createMentionElement } from './utils';
@@ -342,6 +344,42 @@ const parseHeadingNode = (
};
};
+const parseSmallNode = (
+ node: Element,
+ processText: ProcessTextCallback
+): SmallElement | ParagraphElement => {
+ const children = node.children.flatMap((child) => getInlineElement(child, processText));
+ const mdSequence = node.attribs['data-md'];
+
+ if (mdSequence !== undefined) {
+ return {
+ type: BlockType.Paragraph,
+ children: [{ text: `${mdSequence} ` }, ...children],
+ };
+ }
+
+ return {
+ type: BlockType.Small,
+ children,
+ };
+};
+
+const parseHorizontalRuleNode = (node: Element): HorizontalRuleElement | ParagraphElement => {
+ const mdSequence = node.attribs['data-md'];
+
+ if (mdSequence !== undefined) {
+ return {
+ type: BlockType.Paragraph,
+ children: [{ text: mdSequence }],
+ };
+ }
+
+ return {
+ type: BlockType.HorizontalRule,
+ children: [{ text: '' }],
+ };
+};
+
export const domToEditorInput = (
domNodes: ChildNode[],
processText: ProcessTextCallback,
@@ -380,6 +418,18 @@ export const domToEditorInput = (
return;
}
+ if (node.name === 'small') {
+ appendLine();
+ children.push(parseSmallNode(node, processText));
+ return;
+ }
+
+ if (node.name === 'hr') {
+ appendLine();
+ children.push(parseHorizontalRuleNode(node));
+ return;
+ }
+
if (node.name === 'p') {
appendLine();
children.push({
diff --git a/src/app/components/editor/output.ts b/src/app/components/editor/output.ts
index c9683dc3..1e827a92 100644
--- a/src/app/components/editor/output.ts
+++ b/src/app/components/editor/output.ts
@@ -57,6 +57,10 @@ const elementToCustomHtml = (node: CustomElement, children: string): string => {
return `${children} `;
case BlockType.UnorderedList:
return ``;
+ case BlockType.Small:
+ return `${children} `;
+ case BlockType.HorizontalRule:
+ return ` `;
case BlockType.Mention: {
let fragment = node.id;
@@ -159,6 +163,10 @@ const elementToPlainText = (node: CustomElement, children: string): string => {
return `[${node.children}](${node.href})`;
case BlockType.Command:
return `/${node.command}`;
+ case BlockType.Small:
+ return `-# ${children}\n`;
+ case BlockType.HorizontalRule:
+ return `\n---\n`;
default:
return children;
}
diff --git a/src/app/components/editor/slate.d.ts b/src/app/components/editor/slate.d.ts
index da1460e5..81d690fb 100644
--- a/src/app/components/editor/slate.d.ts
+++ b/src/app/components/editor/slate.d.ts
@@ -87,6 +87,16 @@ export type UnorderedListElement = {
children: ListItemElement[];
};
+export type SmallElement = {
+ type: BlockType.Small;
+ children: InlineElement[];
+};
+
+export type HorizontalRuleElement = {
+ type: BlockType.HorizontalRule;
+ children: Text[];
+};
+
export type CustomElement =
| LinkElement
| MentionElement
@@ -100,7 +110,9 @@ export type CustomElement =
| BlockQuoteElement
| ListItemElement
| OrderedListElement
- | UnorderedListElement;
+ | UnorderedListElement
+ | SmallElement
+ | HorizontalRuleElement;
declare module 'slate' {
interface CustomTypes {
diff --git a/src/app/components/editor/types.ts b/src/app/components/editor/types.ts
index 9a108ec7..7eb1cfb8 100644
--- a/src/app/components/editor/types.ts
+++ b/src/app/components/editor/types.ts
@@ -21,4 +21,6 @@ export enum BlockType {
Emoticon = 'emoticon',
Link = 'link',
Command = 'command',
+ Small = 'small',
+ HorizontalRule = 'hr',
}
diff --git a/src/app/components/editor/utils.ts b/src/app/components/editor/utils.ts
index d1f1c421..851bc30d 100644
--- a/src/app/components/editor/utils.ts
+++ b/src/app/components/editor/utils.ts
@@ -130,6 +130,19 @@ export const toggleBlock = (editor: Editor, format: BlockType, option?: BlockOpt
});
}
+ if (format === BlockType.HorizontalRule) {
+ Transforms.insertNodes(editor, {
+ type: BlockType.HorizontalRule,
+ children: [{ text: '' }],
+ });
+ return;
+ }
+
+ if (format === BlockType.Small) {
+ Transforms.setNodes(editor, { type: BlockType.Small });
+ return;
+ }
+
Transforms.setNodes(editor, {
type: format,
});
diff --git a/src/app/components/message/MsgTypeRenderers.tsx b/src/app/components/message/MsgTypeRenderers.tsx
index fc9acd6e..a3bc3cf4 100644
--- a/src/app/components/message/MsgTypeRenderers.tsx
+++ b/src/app/components/message/MsgTypeRenderers.tsx
@@ -1,4 +1,4 @@
-import React, { CSSProperties, ReactNode } from 'react';
+import React, { CSSProperties, ReactNode, useMemo } from 'react';
import { Box, Chip, Icon, Icons, Text, toRem } from 'folds';
import { IContent } from '$types/matrix-sdk';
import { JUMBO_EMOJI_REG, URL_REG } from '$appUtils/regex';
@@ -79,24 +79,37 @@ type MTextProps = {
style?: CSSProperties;
};
export function MText({ edited, content, renderBody, renderUrlsPreview, style }: MTextProps) {
- const { body, formatted_body: customBody } = content;
const [jumboEmojiSize] = useSetting(settingsAtom, 'jumboEmojiSize');
- if (typeof body !== 'string') return ;
+ const body = typeof content.body === 'string' ? content.body : '';
+ const customBody =
+ typeof content.formatted_body === 'string' ? content.formatted_body : undefined;
- const trimmedBody = trimReplyFromBody(body);
+ const trimmedBody = useMemo(() => trimReplyFromBody(body), [body]);
- let safeCustomBody: string | undefined = typeof customBody === 'string' ? customBody : undefined;
- if (safeCustomBody && safeCustomBody.length > 8000) {
- const imageTags = safeCustomBody.match(/ ]*>/g);
- if (imageTags) {
- safeCustomBody = imageTags.join(' ');
- } else {
- safeCustomBody = undefined;
+ const safeCustomBody = useMemo(() => {
+ if (!customBody) return undefined;
+ if (customBody.length > 8000) {
+ const imageTags = customBody.match(/ ]*>/g);
+ return imageTags ? imageTags.join(' ') : undefined;
}
- }
+ return customBody;
+ }, [customBody]);
+
+ const isJumbo = useMemo(() => {
+ if (!trimmedBody || trimmedBody.length >= 500) return false;
+ if (!JUMBO_EMOJI_REG.test(trimmedBody)) return false;
+
+ if (trimmedBody.includes(':')) {
+ const hasImage = safeCustomBody && / ]*>/i.test(safeCustomBody);
+ if (!hasImage) return false;
+ }
+
+ return true;
+ }, [trimmedBody, safeCustomBody]);
+
+ if (!body) return ;
- const isJumbo = trimmedBody.length < 500 && JUMBO_EMOJI_REG.test(trimmedBody);
const urlsMatch = renderUrlsPreview && trimmedBody.match(URL_REG);
const urls = urlsMatch ? [...new Set(urlsMatch)] : undefined;
diff --git a/src/app/components/message/Time.tsx b/src/app/components/message/Time.tsx
index b1ba7571..37572a2a 100644
--- a/src/app/components/message/Time.tsx
+++ b/src/app/components/message/Time.tsx
@@ -1,6 +1,12 @@
import React, { ComponentProps } from 'react';
import { Text, as } from 'folds';
-import { timeDayMonYear, timeHourMinute, today, yesterday } from '$appUtils/time';
+import {
+ timeDayMonYear,
+ timeHourMinute,
+ timeHourMinuteSecond,
+ today,
+ yesterday,
+} from '$appUtils/time';
export type TimeProps = {
compact?: boolean;
@@ -35,9 +41,18 @@ export const Time = as<'span', TimeProps & ComponentProps>(
} else {
time = `${timeDayMonYear(ts, dateFormatString)} ${formattedTime}`;
}
+ const title = `${timeDayMonYear(ts, dateFormatString)} ${timeHourMinuteSecond(ts, hour24Clock)}`;
return (
-
+
{time}
);
diff --git a/src/app/components/message/layout/Base.tsx b/src/app/components/message/layout/Base.tsx
index ac196a5b..922e704a 100644
--- a/src/app/components/message/layout/Base.tsx
+++ b/src/app/components/message/layout/Base.tsx
@@ -28,6 +28,10 @@ export const UsernameBold = as<'b'>(({ as: AsUsernameBold = 'b', className, ...p
));
+export const PronounPill = as<'span'>(({ as: AsPronounPill = 'span', className, ...props }, ref) => (
+
+));
+
export const MessageTextBody = as<'div', css.MessageTextBodyVariants & { notice?: boolean }>(
({ as: asComp = 'div', className, preWrap, jumboEmoji, emote, notice, ...props }, ref) => (
(str.length > len ? `${str.slice(0, len)}...` : str);
+ const clamp = (str: any, len: number) => {
+ const stringified = String(str ?? '');
+ return stringified.length > len ? `${stringified.slice(0, len)}...` : stringified;
+ };
const [showMore, setShowMore] = useState(false);
- const pronouns = profile.pronouns?.map((p: any) => clamp(p.summary, 20)).join('/');
+ const renderValue = (val: any) => {
+ if (val === null || val === undefined) return 'n/a';
+ if (typeof val === 'boolean') return val ? 'Yes' : 'No';
+ if (typeof val === 'object') return JSON.stringify(val);
+ return String(val);
+ };
+
+ const pronouns = profile.pronouns?.map((p: any) => clamp(p.summary, 16)).join(', ');
const timezone = profile.timezone ? clamp(profile.timezone, 64) : null;
const localTime = timezone
? new Intl.DateTimeFormat([], {
@@ -102,8 +112,7 @@ function UserExtendedSection({
}, [profile]);
const unknownFields = Object.entries(profile.extended || {}).filter(
- ([key, value]) =>
- !KNOWN_KEYS.includes(key) && (typeof value === 'string' || typeof value === 'number')
+ ([key]) => !KNOWN_KEYS.includes(key)
);
return (
@@ -182,10 +191,10 @@ function UserExtendedSection({
{unknownFields.map(([key, value]) => (
- {clamp(key, 64).split('.').pop()?.replace(/_/g, ' ')}
+ {key}
- {String(clamp(value, 64))}
+ {clamp(renderValue(value), 128)}
))}
diff --git a/src/app/features/common-settings/permissions/PowersEditor.tsx b/src/app/features/common-settings/permissions/PowersEditor.tsx
index 1ed122a6..68cfba60 100644
--- a/src/app/features/common-settings/permissions/PowersEditor.tsx
+++ b/src/app/features/common-settings/permissions/PowersEditor.tsx
@@ -69,11 +69,17 @@ function EditPower({ maxPower, power, tag, onSave, onClose }: EditPowerProps) {
const [iconFile, setIconFile] = useState();
const pickFile = useFilePicker(setIconFile, false);
- const [tagColor, setTagColor] = useState(tag?.color);
+ const [tagColor, setTagColor] = useState(tag?.color || '#FFFFFF');
const [tagIcon, setTagIcon] = useState(tag?.icon);
+
const uploadingIcon = iconFile && !tagIcon;
const tagIconSrc = tagIcon && getPowerTagIconSrc(mx, useAuthentication, tagIcon);
+ const handleUpdateColor = (newColor: string) => {
+ const sanitized = newColor.startsWith('#') ? newColor : `#${newColor}`;
+ setTagColor(sanitized);
+ };
+
const iconUploadAtom = useMemo(() => {
if (iconFile) return createUploadAtom(iconFile);
return undefined;
@@ -84,9 +90,7 @@ function EditPower({ maxPower, power, tag, onSave, onClose }: EditPowerProps) {
}, []);
const handleIconUploaded = useCallback((upload: UploadSuccess) => {
- setTagIcon({
- key: upload.mxc,
- });
+ setTagIcon({ key: upload.mxc });
setIconFile(undefined);
}, []);
@@ -105,9 +109,11 @@ function EditPower({ maxPower, power, tag, onSave, onClose }: EditPowerProps) {
const tagName = nameInput.value.trim();
if (!tagName) return;
+ const finalColor = /^#[0-9A-F]{6}$/i.test(tagColor) ? tagColor : undefined;
+
const editedTag: MemberPowerTag = {
name: tagName,
- color: tagColor,
+ color: finalColor,
icon: tagIcon,
};
@@ -121,10 +127,10 @@ function EditPower({ maxPower, power, tag, onSave, onClose }: EditPowerProps) {
Color
-
+
}
- onRemove={() => setTagColor(undefined)}
+ picker={ }
+ onRemove={() => setTagColor('#FFFFFF')}
>
{(openPicker, opened) => (
)}
+ handleUpdateColor(e.currentTarget.value)}
+ placeholder="#FFFFFF"
+ size="300"
+ variant="Secondary"
+ radii="300"
+ style={{
+ width: toRem(100),
+ fontFamily: 'monospace',
+ textTransform: 'uppercase',
+ }}
+ />
diff --git a/src/app/features/room/RoomTimeline.tsx b/src/app/features/room/RoomTimeline.tsx
index 899a76d3..42a9005d 100644
--- a/src/app/features/room/RoomTimeline.tsx
+++ b/src/app/features/room/RoomTimeline.tsx
@@ -257,6 +257,7 @@ type RoomTimelineProps = {
eventId?: string;
roomInputRef: RefObject;
editor: Editor;
+ onEditorReset?: () => void;
};
const PAGINATION_LIMIT = 60;
@@ -459,7 +460,13 @@ const getRoomUnreadInfo = (room: Room, scrollTo = false) => {
};
};
-export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimelineProps) {
+export function RoomTimeline({
+ room,
+ eventId,
+ roomInputRef,
+ editor,
+ onEditorReset,
+}: RoomTimelineProps) {
const mx = useMatrixClient();
const useAuthentication = useMediaAuthentication();
const [hideActivity] = useSetting(settingsAtom, 'hideActivity');
@@ -1136,9 +1143,15 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
return;
}
setEditId(undefined);
- ReactEditor.focus(editor);
+ onEditorReset?.();
+
+ requestAnimationFrame(() => {
+ if (!alive()) return;
+ ReactEditor.focus(editor);
+ moveCursor(editor);
+ });
},
- [editor]
+ [editor, alive, onEditorReset]
);
const { t } = useTranslation();
diff --git a/src/app/features/room/RoomView.tsx b/src/app/features/room/RoomView.tsx
index 0b4c5ee0..0cb84947 100644
--- a/src/app/features/room/RoomView.tsx
+++ b/src/app/features/room/RoomView.tsx
@@ -1,4 +1,4 @@
-import React, { useCallback, useRef } from 'react';
+import React, { useCallback, useRef, useState } from 'react';
import { Box, Text, config, toRem } from 'folds';
import { EventType, Room } from '$types/matrix-sdk';
import { ReactEditor } from 'slate-react';
@@ -79,6 +79,9 @@ export function RoomView({ room, eventId }: { room: Room; eventId?: string }) {
const permissions = useRoomPermissions(creators, powerLevels);
const canMessage = permissions.event(EventType.RoomMessage, mx.getSafeUserId());
+ const [editorResetKey, setEditorResetKey] = useState(0);
+ const handleResetEditor = useCallback(() => setEditorResetKey((prev) => prev + 1), []);
+
useKeyDown(
window,
useCallback(
@@ -124,6 +127,7 @@ export function RoomView({ room, eventId }: { room: Room; eventId?: string }) {
eventId={eventId}
roomInputRef={roomInputRef}
editor={editor}
+ onEditorReset={handleResetEditor}
/>
@@ -140,6 +144,7 @@ export function RoomView({ room, eventId }: { room: Room; eventId?: string }) {
<>
{canMessage && (
{
return hashHex.slice(0, 10);
}
-interface PinReadMarker {
+export interface PinReadMarker {
hash: string;
count: number;
last_seen_id: string;
diff --git a/src/app/features/room/message/Message.tsx b/src/app/features/room/message/Message.tsx
index ff7882aa..7e266f91 100644
--- a/src/app/features/room/message/Message.tsx
+++ b/src/app/features/room/message/Message.tsx
@@ -35,6 +35,7 @@ import {
CompactLayout,
MessageBase,
ModernLayout,
+ PronounPill,
Time,
Username,
UsernameBold,
@@ -249,46 +250,33 @@ function useMobileDoubleTap(callback: () => void, delay = 300) {
);
}
-function PronounTag({ pronouns, tagColor }: { pronouns?: any[]; tagColor: string }) {
+const Pronouns = as<
+ 'div',
+ {
+ pronouns?: any[];
+ tagColor: string;
+ }
+>(({ pronouns, tagColor, ...props }, ref) => {
if (!pronouns || pronouns.length === 0) return null;
const clamp = (str: string, len: number) => (str.length > len ? `${str.slice(0, len)}...` : str);
+ const limit = mobileOrTablet() ? 1 : 3;
- const display = clamp(
- pronouns
- .slice(0, 2)
- .map((p) => clamp(p.summary, 48))
- .join('/'),
- 128
- );
- const hasMore = pronouns.length > 2;
+ const display = pronouns.slice(0, limit).map((p) => (
+
+ {clamp(p.summary, 16)}
+
+ ));
- return (
-
-
- {display}
- {hasMore ? '...' : ''}
-
-
- );
-}
+ if (pronouns.length > limit) {
+ display.push(
+
+ ...
+
+ );
+ }
+ return <>{display}>;
+});
function MessageInternal(
{
@@ -404,7 +392,7 @@ function MessageInternal(
{showPronouns && (
-
+
)}
{tagIconSrc && }
diff --git a/src/app/features/room/room-pin-menu/RoomPinMenu.tsx b/src/app/features/room/room-pin-menu/RoomPinMenu.tsx
index de1c0f12..12574e8c 100644
--- a/src/app/features/room/room-pin-menu/RoomPinMenu.tsx
+++ b/src/app/features/room/room-pin-menu/RoomPinMenu.tsx
@@ -1,4 +1,3 @@
-/* eslint-disable react/destructuring-assignment */
import React, { forwardRef, MouseEventHandler, useCallback, useMemo, useRef } from 'react';
import { MatrixEvent, Room } from '$types/matrix-sdk';
import { RoomPinnedEventsEventContent } from '$types/matrix-sdk';
@@ -76,8 +75,6 @@ import { ContainerColor } from '$styles/ContainerColor.css';
import { usePowerLevelTags } from '$hooks/usePowerLevelTags';
import { useTheme } from '$hooks/useTheme';
import { PowerIcon } from '$components/power';
-import colorMXID from '$util/colorMXID';
-import { useIsDirectRoom } from '$hooks/useRoom';
import { useRoomCreators } from '$hooks/useRoomCreators';
import { useRoomPermissions } from '$hooks/useRoomPermissions';
import {
@@ -89,6 +86,8 @@ import {
import { useRoomCreatorsTag } from '$hooks/useRoomCreatorsTag';
import { nicknamesAtom } from '$state/nicknames';
import { AccountDataEvent } from '$types/matrix/accountData';
+import { useSableCosmetics } from '$hooks/useSableCosmetics';
+import { PinReadMarker } from '../RoomViewHeader';
type PinnedMessageProps = {
room: Room;
@@ -98,110 +97,46 @@ type PinnedMessageProps = {
canPinEvent: boolean;
getMemberPowerTag: GetMemberPowerTag;
accessibleTagColors: Map;
- legacyUsernameColor: boolean;
hour24Clock: boolean;
dateFormatString: string;
isNew: boolean;
};
-function PinnedMessage({
- room,
- eventId,
- renderContent,
- onOpen,
- canPinEvent,
- getMemberPowerTag,
- accessibleTagColors,
- legacyUsernameColor,
- hour24Clock,
- dateFormatString,
- isNew,
-}: PinnedMessageProps) {
- const pinnedEvent = useRoomEvent(room, eventId);
- const useAuthentication = useMediaAuthentication();
+
+const PinnedMessageActiveContent = (
+ props: PinnedMessageProps & {
+ pinnedEvent: MatrixEvent;
+ renderOptions: () => React.ReactNode;
+ handleOpenClick: MouseEventHandler;
+ }
+) => {
+ const {
+ pinnedEvent,
+ room,
+ renderContent,
+ hour24Clock,
+ dateFormatString,
+ getMemberPowerTag,
+ renderOptions,
+ handleOpenClick,
+ } = props;
+
const mx = useMatrixClient();
+ const useAuthentication = useMediaAuthentication();
const nicknames = useAtomValue(nicknamesAtom);
- const [unpinState, unpin] = useAsyncCallback(
- useCallback(() => {
- const pinEvent = getStateEvent(room, StateEvent.RoomPinnedEvents);
- const content = pinEvent?.getContent() ?? { pinned: [] };
- const newContent: RoomPinnedEventsEventContent = {
- pinned: content.pinned.filter((id: string) => id !== eventId),
- };
-
- return mx.sendStateEvent(room.roomId, StateEvent.RoomPinnedEvents as any, newContent);
- }, [room, eventId, mx])
- );
-
- const handleOpenClick: MouseEventHandler = (evt) => {
- evt.stopPropagation();
- const evtId = evt.currentTarget.getAttribute('data-event-id');
- if (!evtId) return;
- onOpen(room.roomId, evtId);
- };
-
- const handleUnpinClick: MouseEventHandler = (evt) => {
- evt.stopPropagation();
- unpin();
- };
-
- const renderOptions = () => (
-
-
- Jump
-
- {canPinEvent && (
-
- {unpinState.status === AsyncStatus.Loading ? (
-
- ) : (
-
- )}
-
- )}
-
- );
-
- if (pinnedEvent === undefined) return ;
- if (pinnedEvent === null)
- return (
-
-
- Failed to load message!
-
- {renderOptions()}
-
- );
-
const sender = pinnedEvent.getSender()!;
+ const { color: usernameColor, font: usernameFont } = useSableCosmetics(sender, room);
+
const displayName =
getMemberDisplayName(room, sender, nicknames) ?? getMxIdLocalPart(sender) ?? sender;
const senderAvatarMxc = getMemberAvatarMxc(room, sender);
const getContent = (() => pinnedEvent.getContent()) as GetContentCallback;
const memberPowerTag = getMemberPowerTag(sender);
- const tagColor = memberPowerTag?.color
- ? accessibleTagColors?.get(memberPowerTag.color)
- : undefined;
const tagIconSrc = memberPowerTag?.icon
? getPowerTagIconSrc(mx, useAuthentication, memberPowerTag.icon)
: undefined;
- const usernameColor = legacyUsernameColor ? colorMXID(sender) : tagColor;
-
return (
-
+
{displayName}
@@ -251,6 +186,85 @@ function PinnedMessage({
{renderContent(pinnedEvent.getType(), false, pinnedEvent, displayName, getContent)}
);
+};
+
+function PinnedMessage(props: PinnedMessageProps) {
+ const { room, eventId, onOpen, canPinEvent } = props;
+ const pinnedEvent = useRoomEvent(room, eventId);
+ const mx = useMatrixClient();
+
+ const [unpinState, unpin] = useAsyncCallback(
+ useCallback(() => {
+ const pinEvent = getStateEvent(room, StateEvent.RoomPinnedEvents);
+ const content = pinEvent?.getContent() ?? { pinned: [] };
+ const newContent: RoomPinnedEventsEventContent = {
+ pinned: content.pinned.filter((id: string) => id !== eventId),
+ };
+
+ return mx.sendStateEvent(room.roomId, StateEvent.RoomPinnedEvents as any, newContent);
+ }, [room, eventId, mx])
+ );
+
+ const handleOpenClick: MouseEventHandler = useCallback(
+ (evt) => {
+ evt.stopPropagation();
+ onOpen(room.roomId, eventId);
+ },
+ [onOpen, room.roomId, eventId]
+ );
+
+ const handleUnpinClick: MouseEventHandler = useCallback(
+ (evt) => {
+ evt.stopPropagation();
+ void unpin();
+ },
+ [unpin]
+ );
+
+ const renderOptions = () => (
+
+
+ Jump
+
+ {canPinEvent && (
+
+ {unpinState.status === AsyncStatus.Loading ? (
+
+ ) : (
+
+ )}
+
+ )}
+
+ );
+
+ if (pinnedEvent === undefined) return ;
+
+ if (pinnedEvent === null) {
+ return (
+
+
+ Failed to load message!
+
+ {renderOptions()}
+
+ );
+ }
+
+ return (
+
+ );
}
type RoomPinMenuProps = {
@@ -258,6 +272,7 @@ type RoomPinMenuProps = {
requestClose: () => void;
currentHash: string;
};
+
export const RoomPinMenu = forwardRef(
({ room, requestClose, currentHash }, ref) => {
const mx = useMatrixClient();
@@ -286,26 +301,22 @@ export const RoomPinMenu = forwardRef(
const [mediaAutoLoad] = useSetting(settingsAtom, 'mediaAutoLoad');
const [urlPreview] = useSetting(settingsAtom, 'urlPreview');
- const direct = useIsDirectRoom();
- const [legacyUsernameColor] = useSetting(settingsAtom, 'legacyUsernameColor');
-
const [hour24Clock] = useSetting(settingsAtom, 'hour24Clock');
const [dateFormatString] = useSetting(settingsAtom, 'dateFormatString');
const { navigateRoom } = useRoomNavigate();
const scrollRef = useRef(null);
- const pinMarker = useMemo(() =>
- room.getAccountData(AccountDataEvent.SablePinStatus)?.getContent(),
- [room]);
+ const pinMarker = useMemo(
+ () => room.getAccountData(AccountDataEvent.SablePinStatus)?.getContent() as PinReadMarker,
+ [room]
+ );
const lastSeenIndex = useMemo(() => {
if (!pinMarker?.last_seen_id) return -1;
return pinnedEvents.indexOf(pinMarker.last_seen_id);
}, [pinnedEvents, pinMarker]);
- const hasNewContent = pinMarker?.hash !== currentHash;
-
const virtualizer = useVirtualizer({
count: sortedPinnedEvent.length,
getScrollElement: () => scrollRef.current,
@@ -355,9 +366,11 @@ export const RoomPinMenu = forwardRef(
{
[MessageEvent.RoomMessage]: (event, displayName, getContent) => {
if (event.isRedacted()) {
- return (
-
- );
+ const unsigned = event.getUnsigned();
+ const redactionContent = unsigned.redacted_because?.content as
+ | { reason?: string }
+ | undefined;
+ return ;
}
return (
@@ -396,7 +409,7 @@ export const RoomPinMenu = forwardRef(
{() => {
if (mEvent.isRedacted()) return ;
- if (mEvent.getType() === MessageEvent.Sticker)
+ if ((mEvent.getType() as MessageEvent) === MessageEvent.Sticker)
return (
(
)}
/>
);
- if (mEvent.getType() === MessageEvent.RoomMessage) {
+ if ((mEvent.getType() as MessageEvent) === MessageEvent.RoomMessage) {
const editedEvent = getEditedEvent(eventId, mEvent, evtTimeline.getTimelineSet());
- const getContent = (() =>
- editedEvent?.getContent()['m.new_content'] ??
- mEvent.getContent()) as GetContentCallback;
+ const getContent = (() => {
+ const eventContent = mEvent.getContent();
+ const editContent = editedEvent?.getContent();
+ return (editContent?.['m.new_content'] ?? eventContent) as Record<
+ string,
+ unknown
+ >;
+ }) as GetContentCallback;
return (
(
/>
);
}
- if (mEvent.getType() === MessageEvent.RoomMessageEncrypted)
+ if ((mEvent.getType() as MessageEvent) === MessageEvent.RoomMessageEncrypted)
return (
@@ -445,11 +463,14 @@ export const RoomPinMenu = forwardRef(
);
},
- [MessageEvent.Sticker]: (event, displayName, getContent) => {
+ [MessageEvent.Sticker]: (event, _displayName, getContent) => {
if (event.isRedacted()) {
- return (
-
- );
+ const unsigned = event.getUnsigned();
+ const redactionContent = unsigned.redacted_because?.content as
+ | Record
+ | undefined;
+
+ return ;
}
return (
(
undefined,
(event) => {
if (event.isRedacted()) {
- return ;
+ const unsigned = event.getUnsigned();
+ const redactionContent = unsigned.redacted_because?.content as
+ | Record
+ | undefined;
+ return ;
}
return (
@@ -521,7 +546,7 @@ export const RoomPinMenu = forwardRef(
isNew = originalIndex > lastSeenIndex;
} else {
const oldCount = pinMarker?.count ?? 0;
- isNew = originalIndex >= (oldCount - 1);
+ isNew = originalIndex >= oldCount - 1;
}
}
@@ -533,12 +558,14 @@ export const RoomPinMenu = forwardRef(
key={vItem.index}
>
(
canPinEvent={canPinEvent}
getMemberPowerTag={getMemberPowerTag}
accessibleTagColors={accessibleTagColors}
- legacyUsernameColor={legacyUsernameColor || direct}
hour24Clock={hour24Clock}
isNew={isNew}
dateFormatString={dateFormatString}
@@ -584,7 +610,7 @@ export const RoomPinMenu = forwardRef(
No Pinned Messages
- Users with sufficient power level can pin a messages from its context menu.
+ Users with sufficient power level can pin messages from the context menu.
@@ -597,3 +623,5 @@ export const RoomPinMenu = forwardRef(
);
}
);
+
+RoomPinMenu.displayName = 'RoomPinMenu';
diff --git a/src/app/features/settings/about/About.tsx b/src/app/features/settings/about/About.tsx
index 53d3e1bd..a9ac0f11 100644
--- a/src/app/features/settings/about/About.tsx
+++ b/src/app/features/settings/about/About.tsx
@@ -46,7 +46,7 @@ export function About({ requestClose }: AboutProps) {
Sable
- v1.2.0
+ v1.2.1
Yet another matrix client fork(ed from cinny).
diff --git a/src/app/features/settings/account/PronounEditor.tsx b/src/app/features/settings/account/PronounEditor.tsx
index 8cab2db2..b138c8f2 100644
--- a/src/app/features/settings/account/PronounEditor.tsx
+++ b/src/app/features/settings/account/PronounEditor.tsx
@@ -5,6 +5,7 @@ import { SettingTile } from '$components/setting-tile';
type PronounSet = {
summary: string;
language?: string;
+ grammatical_gender?: string;
};
type PronounEditorProps = {
@@ -13,7 +14,7 @@ type PronounEditorProps = {
};
export function PronounEditor({ current, onSave }: PronounEditorProps) {
- const initialString = current.map((p) => p.summary).join('/');
+ const initialString = current.map((p) => p.summary).join(', ');
const [val, setVal] = useState(initialString);
useEffect(() => setVal(initialString), [initialString]);
@@ -22,10 +23,10 @@ export function PronounEditor({ current, onSave }: PronounEditorProps) {
if (val === initialString) return;
const safeVal = val.slice(0, 128);
const next = safeVal
- .split('/')
+ .split(',')
.map((s) => s.trim())
.filter(Boolean)
- .map((s) => ({ summary: s.slice(0, 16) }));
+ .map((s) => ({ summary: s.slice(0, 16), language: "en" }));
onSave(next);
};
@@ -36,7 +37,7 @@ export function PronounEditor({ current, onSave }: PronounEditorProps) {
return (
>();
+
export type UserProfile = {
avatarUrl?: string;
displayName?: string;
@@ -21,17 +23,38 @@ export type UserProfile = {
_fetched?: boolean;
};
-const normalizeInfo = (info: any): UserProfile => ({
- avatarUrl: info.avatar_url,
- displayName: info.displayname,
- pronouns: info['io.fsky.nyx.pronouns'],
- timezone: info['us.cloke.msc4175.tz'] || info['m.tz'],
- bio: info['moe.sable.app.bio'] || info['chat.commet.profile_bio'],
- bannerUrl: info['chat.commet.profile_banner'],
- nameColor: info['moe.sable.app.name_color'],
- extended: {},
- _fetched: true,
-});
+const normalizeInfo = (info: any): UserProfile => {
+ const knownKeys = [
+ 'avatar_url',
+ 'displayname',
+ 'io.fsky.nyx.pronouns',
+ 'us.cloke.msc4175.tz',
+ 'm.tz',
+ 'moe.sable.app.bio',
+ 'chat.commet.profile_bio',
+ 'chat.commet.profile_banner',
+ 'moe.sable.app.name_color',
+ ];
+
+ const extended: Record = {};
+ Object.entries(info).forEach(([key, value]) => {
+ if (!knownKeys.includes(key)) {
+ extended[key] = value;
+ }
+ });
+
+ return {
+ avatarUrl: info.avatar_url,
+ displayName: info.displayname,
+ pronouns: info['io.fsky.nyx.pronouns'],
+ timezone: info['us.cloke.msc4175.tz'] || info['m.tz'],
+ bio: info['moe.sable.app.bio'] || info['chat.commet.profile_bio'],
+ bannerUrl: info['chat.commet.profile_banner'],
+ nameColor: info['moe.sable.app.name_color'],
+ extended,
+ _fetched: true,
+ };
+};
const isValidHex = (c: string) => /^#[0-9A-F]{6}$/i.test(c);
const sanitizeFont = (f: string) => f.replace(/[;{}<>]/g, '').slice(0, 32);
@@ -54,9 +77,19 @@ export const useUserProfile = (
useEffect(() => {
if (!needsFetch) return;
+
+ let fetchPromise = inFlightProfiles.get(userId);
+
+ if (!fetchPromise) {
+ fetchPromise = mx.getProfileInfo(userId).finally(() => {
+ inFlightProfiles.delete(userId);
+ });
+ inFlightProfiles.set(userId, fetchPromise);
+ }
+
let isMounted = true;
- mx.getProfileInfo(userId)
+ fetchPromise
.then((info: any) => {
if (!isMounted) return;
const normalized = normalizeInfo(info);
@@ -66,11 +99,13 @@ export const useUserProfile = (
}));
})
.catch(() => {
+ if (!isMounted) return;
setGlobalProfiles((prev) => ({
...prev,
[userId]: { ...prev[userId], _fetched: true },
}));
});
+
return () => {
isMounted = false;
};
diff --git a/src/app/pages/ConfigConfig.tsx b/src/app/pages/ConfigConfig.tsx
index dbcdca73..464b1cc3 100644
--- a/src/app/pages/ConfigConfig.tsx
+++ b/src/app/pages/ConfigConfig.tsx
@@ -7,7 +7,7 @@ export function ConfigConfigLoading() {
- Heating up
+ Petting cats
);
diff --git a/src/app/pages/auth/AuthFooter.tsx b/src/app/pages/auth/AuthFooter.tsx
index 0873bb57..2df5281c 100644
--- a/src/app/pages/auth/AuthFooter.tsx
+++ b/src/app/pages/auth/AuthFooter.tsx
@@ -15,7 +15,7 @@ export function AuthFooter() {
target="_blank"
rel="noreferrer"
>
- v1.2.0
+ v1.2.1
Twitter
diff --git a/src/app/pages/client/ClientRoot.tsx b/src/app/pages/client/ClientRoot.tsx
index a0fc61a2..9c89054b 100644
--- a/src/app/pages/client/ClientRoot.tsx
+++ b/src/app/pages/client/ClientRoot.tsx
@@ -50,7 +50,7 @@ function ClientRootLoading() {
- Heating up
+ Petting cats
);
diff --git a/src/app/pages/client/WelcomePage.tsx b/src/app/pages/client/WelcomePage.tsx
index b5741eb3..ef227ee5 100644
--- a/src/app/pages/client/WelcomePage.tsx
+++ b/src/app/pages/client/WelcomePage.tsx
@@ -20,7 +20,7 @@ export function WelcomePage() {
Yet another matrix client fork.{' '}
- v1.2.0
+ v1.2.1
}
diff --git a/src/app/plugins/markdown/block/parser.ts b/src/app/plugins/markdown/block/parser.ts
index ed16a327..a86ccb0e 100644
--- a/src/app/plugins/markdown/block/parser.ts
+++ b/src/app/plugins/markdown/block/parser.ts
@@ -6,6 +6,8 @@ import {
HeadingRule,
OrderedListRule,
UnorderedListRule,
+ SmallRule,
+ HorizontalRuleRule,
} from './rules';
import { runBlockRule } from './runner';
import { BlockMDParser } from './type';
@@ -22,9 +24,11 @@ export const parseBlockMD: BlockMDParser = (text, parseInline) => {
let result: string | undefined;
if (!result) result = runBlockRule(text, CodeBlockRule, parseBlockMD, parseInline);
+ if (!result) result = runBlockRule(text, HorizontalRuleRule, parseBlockMD, parseInline);
if (!result) result = runBlockRule(text, BlockQuoteRule, parseBlockMD, parseInline);
if (!result) result = runBlockRule(text, OrderedListRule, parseBlockMD, parseInline);
if (!result) result = runBlockRule(text, UnorderedListRule, parseBlockMD, parseInline);
+ if (!result) result = runBlockRule(text, SmallRule, parseBlockMD, parseInline);
if (!result) result = runBlockRule(text, HeadingRule, parseBlockMD, parseInline);
// replace \n with because want to preserve empty lines
diff --git a/src/app/plugins/markdown/block/rules.ts b/src/app/plugins/markdown/block/rules.ts
index f598ee63..b85998d8 100644
--- a/src/app/plugins/markdown/block/rules.ts
+++ b/src/app/plugins/markdown/block/rules.ts
@@ -43,12 +43,12 @@ export const BlockQuoteRule: BlockMDRule = {
},
};
-const ORDERED_LIST_MD_1 = '-';
-const O_LIST_ITEM_PREFIX = /^(-|[\da-zA-Z]\.) */;
+const ORDERED_LIST_MD_1 = '1.';
+const O_LIST_ITEM_PREFIX = /^([\da-zA-Z]\.) */;
const O_LIST_START = /^([\d])\./;
const O_LIST_TYPE = /^([aAiI])\./;
const O_LIST_TRAILING_NEWLINE = /\n$/;
-const ORDERED_LIST_REG_1 = /(^(?:-|[\da-zA-Z]\.) +.+\n?)+/m;
+const ORDERED_LIST_REG_1 = /(^(?:[\da-zA-Z]\.) +.+\n?)+/m;
export const OrderedListRule: BlockMDRule = {
match: (text) => text.match(ORDERED_LIST_REG_1),
html: (match, parseInline) => {
@@ -73,10 +73,10 @@ export const OrderedListRule: BlockMDRule = {
},
};
-const UNORDERED_LIST_MD_1 = '*';
-const U_LIST_ITEM_PREFIX = /^\* */;
+const UNORDERED_LIST_MD_1 = '-';
+const U_LIST_ITEM_PREFIX = /^[*-] */;
const U_LIST_TRAILING_NEWLINE = /\n$/;
-const UNORDERED_LIST_REG_1 = /(^\* +.+\n?)+/m;
+const UNORDERED_LIST_REG_1 = /(^[*-] +.+\n?)+/m;
export const UnorderedListRule: BlockMDRule = {
match: (text) => text.match(UNORDERED_LIST_REG_1),
html: (match, parseInline) => {
@@ -96,5 +96,23 @@ export const UnorderedListRule: BlockMDRule = {
},
};
-export const UN_ESC_BLOCK_SEQ = /^\\*(#{1,6} +|```|>|(-|[\da-zA-Z]\.) +|\* +)/;
-export const ESC_BLOCK_SEQ = /^\\(\\*(#{1,6} +|```|>|(-|[\da-zA-Z]\.) +|\* +))/;
+const HR_MD = '---';
+const HR_REG = /^--- *(?:\n|$)/m;
+export const HorizontalRuleRule: BlockMDRule = {
+ match: (text) => text.match(HR_REG),
+ html: () => ` `,
+};
+
+const SMALL_MD = '-#';
+const SMALL_REG = /^-# +(.+)\n?/m;
+export const SmallRule: BlockMDRule = {
+ match: (text) => text.match(SMALL_REG),
+ html: (match, parseInline) => {
+ const [, g1] = match;
+ const content = parseInline ? parseInline(g1) : g1;
+ return `${content} `;
+ },
+};
+
+export const UN_ESC_BLOCK_SEQ = /^\\*(#{1,6} +|```|>|([\da-zA-Z]\.) +|[*-] +|-# +|--- *)/;
+export const ESC_BLOCK_SEQ = /^\\(\\*(#{1,6} +|```|>|([\da-zA-Z]\.) +|[*-] +|-# +|--- *))/;
diff --git a/src/app/plugins/react-custom-html-parser.tsx b/src/app/plugins/react-custom-html-parser.tsx
index bac7f5b6..f1fb3ee1 100644
--- a/src/app/plugins/react-custom-html-parser.tsx
+++ b/src/app/plugins/react-custom-html-parser.tsx
@@ -391,6 +391,18 @@ export const getReactCustomHtmlParser = (
);
}
+ if (name === 'small') {
+ return (
+
+ {renderChildren()}
+
+ );
+ }
+
+ if (name === 'hr') {
+ return ;
+ }
+
if (name === 'pre') {
return {children} ;
}
diff --git a/src/app/state/settings.ts b/src/app/state/settings.ts
index 84a053ba..0ea29e16 100644
--- a/src/app/state/settings.ts
+++ b/src/app/state/settings.ts
@@ -72,7 +72,7 @@ const defaultSettings: Settings = {
monochromeMode: false,
isMarkdown: true,
editorToolbar: false,
- twitterEmoji: false,
+ twitterEmoji: true,
pageZoom: 100,
hideActivity: false,
diff --git a/src/app/styles/CustomHtml.css.ts b/src/app/styles/CustomHtml.css.ts
index 771490da..7820c633 100644
--- a/src/app/styles/CustomHtml.css.ts
+++ b/src/app/styles/CustomHtml.css.ts
@@ -248,3 +248,23 @@ export const highlightText = style([
color: 'black',
},
]);
+
+export const Small = style([
+ DefaultReset,
+ {
+ fontSize: '0.85rem',
+ opacity: config.opacity.Placeholder,
+ },
+]);
+
+export const HorizontalRule = style([
+ DefaultReset,
+ MarginSpaced,
+ {
+ border: 'none',
+ borderBottom: `${config.borderWidth.B300} solid ${color.SurfaceVariant.ContainerLine}`,
+ height: 0,
+ margin: `${config.space.S400} 0`,
+ userSelect: 'none',
+ },
+]);
diff --git a/src/app/styles/overrides/Composer.css.ts b/src/app/styles/overrides/Composer.css.ts
index dd0c7e14..35e76d32 100644
--- a/src/app/styles/overrides/Composer.css.ts
+++ b/src/app/styles/overrides/Composer.css.ts
@@ -4,6 +4,10 @@ export const floatingEditor = style({
minWidth: '100%',
});
+export const floatingToolbar = style({
+ minWidth: '100%',
+});
+
globalStyle(
`
${floatingEditor} > div,
@@ -18,7 +22,7 @@ globalStyle(
}
);
-globalStyle(`${floatingEditor} button`, {
+globalStyle(`${floatingEditor} ${floatingToolbar} button`, {
borderRadius: '20px',
backgroundColor: 'transparent',
border: 'none',
@@ -27,11 +31,11 @@ globalStyle(`${floatingEditor} button`, {
cursor: 'pointer',
});
-globalStyle(`${floatingEditor} button *`, {
+globalStyle(`${floatingEditor} ${floatingToolbar} button *`, {
color: 'inherit',
});
-globalStyle(`${floatingEditor} button:hover`, {
+globalStyle(`${floatingEditor} ${floatingToolbar} button:hover`, {
backgroundColor: 'var(--sable-surface-container-hover)',
color: 'var(--sable-primary-main)',
});
diff --git a/src/app/utils/sanitize.ts b/src/app/utils/sanitize.ts
index 28e0db59..2b7dde0f 100644
--- a/src/app/utils/sanitize.ts
+++ b/src/app/utils/sanitize.ts
@@ -5,6 +5,7 @@ const MAX_TAG_NESTING = 100;
const permittedHtmlTags = [
'font',
'del',
+ 'small',
'h1',
'h2',
'h3',
@@ -78,6 +79,8 @@ const permittedTagToAttributes = {
u: ['data-md'],
s: ['data-md'],
del: ['data-md'],
+ small: ['data-md'],
+ hr: ['data-md'],
};
const transformFontTag: Transformer = (tagName, attribs) => ({
diff --git a/src/app/utils/time.ts b/src/app/utils/time.ts
index 8f1e30e9..f0beb54e 100644
--- a/src/app/utils/time.ts
+++ b/src/app/utils/time.ts
@@ -21,6 +21,9 @@ export const timeYear = (ts: number): string => dayjs(ts).format('YYYY');
export const timeHourMinute = (ts: number, hour24Clock: boolean): string =>
dayjs(ts).format(hour24Clock ? 'HH:mm' : 'hh:mm A');
+export const timeHourMinuteSecond = (ts: number, hour24Clock: boolean): string =>
+ dayjs(ts).format(hour24Clock ? 'HH:mm:ss' : 'hh:mm:ss A');
+
export const timeDayMonYear = (ts: number, dateFormatString: string): string =>
dayjs(ts).format(dateFormatString);