Skip to content

Commit

Permalink
Rte fix focus removes new lines at the end (#535)
Browse files Browse the repository at this point in the history
* RTE fix focusing removes new lines;

* Fix bad dropdown logic on android;

* Extended RTE vite config;
  • Loading branch information
stef-coenen authored Jan 21, 2025
1 parent 10c2159 commit 3226fdc
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ export const DraftSaver = ({

if (metadata && draftKey && updatedAt) {
if (
getPlainTextFromRichText(drafts[draftKey]?.message) === getPlainTextFromRichText(message) ||
(drafts[draftKey]?.message?.length === message?.length &&
getPlainTextFromRichText(drafts[draftKey]?.message) ===
getPlainTextFromRichText(message)) ||
(drafts[draftKey] && drafts[draftKey]?.updatedAt >= updatedAt)
)
return;
Expand Down
3 changes: 0 additions & 3 deletions packages/common/rich-text-editor/src/app/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@
}

@layer base {
* {
@apply border-border;
}
body {
@apply bg-background text-foreground;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
} from '@udecode/plate-common';
import { findNodePath, useComposedRef, useEditorRef } from '@udecode/plate-common/react';
import { cva } from 'class-variance-authority';
import { isTouchDevice } from '@homebase-id/js-lib/helpers';

type FilterFn = (item: { value: string; keywords?: string[] }, search: string) => boolean;

Expand Down Expand Up @@ -125,8 +126,9 @@ const InlineCombobox = ({
};
}, [editor, element]);

const isTouch = useMemo(() => isTouchDevice(), []);
const { props: inputProps, removeInput } = useComboboxInput({
cancelInputOnBlur: true,
cancelInputOnBlur: !isTouch,
cancelInputOnEscape: true,
cancelInputOnBackspace: true,
cursorState,
Expand Down
1 change: 1 addition & 0 deletions packages/common/rich-text-editor/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const hostConfig = {
export default defineConfig({
plugins: [react()],
server: {
// host: true,
...hostConfig,
https: {
key: fs.readFileSync('../../../dev-dotyou-cloud.key'),
Expand Down

0 comments on commit 3226fdc

Please sign in to comment.