Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3 of the editor #9288

Open
wants to merge 53 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
9f02a36
use a new image strategy which does not require a dialog
burtonator Sep 13, 2024
7b878bf
Fixed the CWIcons...
burtonator Sep 13, 2024
4cd0b9d
making a new file upload button...
burtonator Sep 13, 2024
755b4e9
cleanup of buttons.
burtonator Sep 13, 2024
b4850c1
improved desktop footer.
burtonator Sep 13, 2024
29f70f1
cleanup
burtonator Sep 13, 2024
d101565
Fixed spacing.
burtonator Sep 13, 2024
52776b3
The mobile keyboard adjustment should work now.
burtonator Sep 13, 2024
f9b930d
We switch to the new viewer now..
burtonator Sep 13, 2024
238abcc
ability to expand toggle the content.
burtonator Sep 13, 2024
720c3c7
The cutoff now works...
burtonator Sep 13, 2024
0b50728
I still have a few features to fix in the markdown viewer but this is…
burtonator Sep 16, 2024
16271ce
- fixed table layout, compared to quill
burtonator Sep 16, 2024
2fe3d57
show more link types in the supported example to verify that embeds a…
burtonator Sep 16, 2024
eee2d1f
- added the custom view button onw
burtonator Sep 16, 2024
1633006
- killed off another two uses...
burtonator Sep 16, 2024
9113dad
added new className...
burtonator Sep 16, 2024
c7c0db4
this should work as a hit highlighter now... It's the existing system…
burtonator Sep 16, 2024
17540d6
this should work now...
burtonator Sep 16, 2024
936c2c9
use the new markdown viewer or the fallback.
burtonator Sep 16, 2024
b5ca1f4
new component for rendering withi fallback.
burtonator Sep 16, 2024
ca8359e
Ability to render search hits now.
burtonator Sep 17, 2024
66833fe
Merge branch 'refs/heads/master' into burton/editor-v3
burtonator Sep 17, 2024
a273b5d
Fixed pnpmp lock issue.
burtonator Sep 17, 2024
09f0a75
Working on making the editor support active/inactive...
burtonator Sep 17, 2024
eebb5e2
make the editor more like the current editor and we can revise the UX…
burtonator Sep 17, 2024
489d599
Fixed bug in table layout.
burtonator Sep 17, 2024
19c80f4
the editor can pass back a ref to getMarkdown now
burtonator Sep 17, 2024
3eca3f8
adding support for changing the button.
burtonator Sep 17, 2024
0758192
Refactored so that the button can be a component.
burtonator Sep 18, 2024
708a300
have a context for the manually set mode...
burtonator Sep 18, 2024
c6360c6
Made the error handler work with errors now.
burtonator Sep 18, 2024
fcdc5fd
new thread creation works now.
burtonator Sep 18, 2024
e4f08e5
The new thread form should basically be setup correctly.
burtonator Sep 18, 2024
33fd53c
new on change ...
burtonator Sep 18, 2024
2669e0a
new components for the modern version.
burtonator Sep 18, 2024
59a3eeb
renamed to legacy ...
burtonator Sep 18, 2024
4666a8f
old code removed...
burtonator Sep 18, 2024
38fe5e1
ok we can select the older one now...
burtonator Sep 18, 2024
b3931b7
No quill usage.
burtonator Sep 18, 2024
ed18a5d
change the draft version as the type has changed.
burtonator Sep 18, 2024
5e921a7
Fixed an error found by Marcin.
burtonator Sep 18, 2024
a4c0868
removed FIXME
burtonator Sep 18, 2024
6fc5987
Merge branch 'refs/heads/master' into burton/editor-v3
burtonator Sep 19, 2024
fbcd6e2
Merge branch 'refs/heads/burton/editor-v2' into burton/editor-v3
burtonator Sep 19, 2024
e6322ba
Fixed type issue...
burtonator Sep 19, 2024
ffa59cc
Fixed build issues...
burtonator Sep 19, 2024
1f04e94
Fixed issue with the tooltip which I'm going to support in v4.
burtonator Sep 19, 2024
378341a
Fixed eslint issues.
burtonator Sep 19, 2024
22ebd24
Merge branch 'refs/heads/master' into burton/editor-v3
burtonator Sep 19, 2024
e75f1ab
Merge branch 'refs/heads/master' into burton/editor-v3
burtonator Oct 2, 2024
226aa5f
ported back marcin's changed to the old form.
burtonator Oct 2, 2024
1bd03c3
Fixed for the modern version.
burtonator Oct 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions packages/commonwealth/client/scripts/hooks/useDraft.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
const KEY_VERSION = 'v2'; // update this for breaking changes
const PREFIX = `cw-draft-${KEY_VERSION}`;

const MAX_DRAFT_SIZE = 1024 * 1024 * 4;

export function useDraft<T>(key: string) {
const fullKey = `${PREFIX}-${key}`;
type DraftOpts = {
keyVersion?: string;
};

export function useDraft<T>(key: string, opts: DraftOpts = {}) {
const keyVersion = opts.keyVersion ?? 'v2';
const prefix = `cw-draft-${keyVersion}`;

const fullKey = `${prefix}-${key}`;

const saveDraft = (data: T) => {
const draft = JSON.stringify(data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ import { Route } from 'react-router-dom';
import { withLayout } from 'views/Layout';
import { RouteFeatureFlags } from './Router';

const QuillPage = lazy(() => import('views/pages/QuillPage'));
const MarkdownEditorPage = lazy(() => import('views/pages/MarkdownEditorPage'));
const MarkdownViewerPage = lazy(() => import('views/pages/MarkdownViewerPage'));
const MarkdownHitHighlighterPage = lazy(
() => import('views/pages/MarkdownHitHighlighterPage'),
);

const DashboardPage = lazy(() => import('views/pages/user_dashboard'));
const CommunitiesPage = lazy(() => import('views/pages/Communities'));
Expand Down Expand Up @@ -118,14 +122,26 @@ const CommonDomainRoutes = ({
tokenizedCommunityEnabled,
}: RouteFeatureFlags) => [
<Route
key="/markdown-editor"
path="/markdown-editor"
key="/_internal/quill"
path="/_internal/quill"
element={<QuillPage />}
/>,

<Route
key="/_internal/markdown-editor"
path="/_internal/markdown-editor"
element={<MarkdownEditorPage />}
/>,

<Route
key="/markdown-viewer"
path="/markdown-viewer"
key="/_internal/markdown-hit-highlighter"
path="/_internal/markdown-hit-highlighter"
element={<MarkdownHitHighlighterPage />}
/>,

<Route
key="/_internal/markdown-viewer"
path="/_internal/markdown-viewer"
element={<MarkdownViewerPage />}
/>,

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,38 @@ body,
display: none;
}

.mdxeditor-container {
outline: 1px solid $neutral-200;
border-radius: 4px;
}

.mdxeditor-container-active {
outline: 1px solid $primary-300;
}

.mdxeditor-container-mode-mobile {
.mdxeditor {
flex-grow: 1;
overflow: auto;
}

.mdxeditor-toolbar {
border-top: solid $neutral-200 1px;

min-height: 45px !important;
}
}

.mdxeditor-container-disabled {
.mdxeditor-root-contenteditable {
// TODO: disable editing here...
}
}

.mdxeditor-container-mode-desktop {
.mdxeditor-root-contenteditable {
border-top: 1px solid $neutral-200;

min-height: 150px;
max-height: 450px;
}
Expand Down Expand Up @@ -61,7 +80,6 @@ body,
.mdxeditor-toolbar {
// TODO this only shows up properly for the *mobile* editor not the desktop
// one.
border-top: solid $neutral-200 1px;
border-radius: inherit;
background-color: inherit;
overflow: hidden;
Expand All @@ -74,6 +92,10 @@ body,
// necessary because otherwise code mirror line numbers are too small.
font-size: inherit !important;
}

button {
outline: none;
}
}

.mdxeditor-diff-source-wrapper {
Expand Down
Loading
Loading