Skip to content

Commit

Permalink
float style fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ibastawisi committed Aug 19, 2024
1 parent db972cd commit 3ec4bc1
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
6 changes: 6 additions & 0 deletions src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ body:has(#app-toolbar) .editor-container [id] {
outline: 0;
}

.document-container {
user-select: text;
white-space: pre-wrap;
word-break: break-word;
}

.excalidraw.excalidraw-modal-container,
#typeahead-menu {
z-index: 1500 !important;
Expand Down
2 changes: 1 addition & 1 deletion src/components/EditorSkeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export const EditorSkeleton: React.FC<PropsWithChildren> = ({ children }) => {
</Toolbar >
</AppBar>
{toolbarTrigger && <Box sx={(theme) => ({ ...theme.mixins.toolbar, displayPrint: "none" })} />}
<div className="editor-input">{children}</div>
<div className="document-container">{children}</div>
</>
);
}
9 changes: 9 additions & 0 deletions src/editor/nodes/ImageNode/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
$createTextNode,
$getRoot,
$setSelection,
BaseSelection,
DOMConversionMap,
DOMConversionOutput,
DOMExportOutput,
Expand Down Expand Up @@ -282,6 +283,14 @@ export class ImageNode extends DecoratorNode<JSX.Element> {
return this.__altText;
}

isSelected(selection?: null | BaseSelection): boolean {
try {
return super.isSelected(selection);
} catch (e) {
return false;
}
}

decorate(): JSX.Element {
const self = this.getLatest();
const html = self.__caption.getEditorState().read(() => $generateHtmlFromNodes(self.__caption));
Expand Down
15 changes: 8 additions & 7 deletions src/editor/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
width: 100%;
position: relative;
z-index: 1;
margin: 0 0 1rem 0;
}

.LexicalTheme__tableSelection *::selection {
Expand Down Expand Up @@ -193,31 +194,30 @@
}

.LexicalTheme__table:is([style*="text-align:right"], [style*="text-align: right"]) {
margin: 0 0 0 auto;
margin-left: auto;
table-layout: auto;
width: auto;
}

.LexicalTheme__table:is([style*="text-align:left"], [style*="text-align: left"]) {
margin: 0 auto 0 0;
margin-right: auto;
table-layout: auto;
width: auto;
}

.LexicalTheme__table:is([style*='text-align:justify'], [style*='text-align: justify']) {
margin: 0;
table-layout: fixed;
width: 100%;
}

.LexicalTheme__table:is([style*="float:left"], [style*="float: left"]) {
margin: 0 1em 0 0;
margin-right: 1rem;
table-layout: auto;
width: auto;
}

.LexicalTheme__table:is([style*="float:right"], [style*="float: right"]) {
margin: 0 0 0 1em;
margin-left: 1rem;
table-layout: auto;
width: auto;
}
Expand Down Expand Up @@ -453,14 +453,15 @@ iframe {
border-bottom-right-radius: 60px 5px;
display: flex;
flex-direction: column;
margin: 0.5rem 0;
}

.sticky-note:is([style*="float:left"], [style*="float: left"]) {
margin: 0.5rem 0.5rem 0.5rem 0;
margin-right: 1rem;
}

.sticky-note:is([style*="float:right"], [style*="float: right"]) {
margin: 0.5rem 0 0.5rem 0.5rem;
margin-left: 1rem;
}

.sticky-note .nested-contentEditable {
Expand Down

0 comments on commit 3ec4bc1

Please sign in to comment.