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

Featured comment editor #1255

Merged
merged 30 commits into from
Mar 27, 2025
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c842240
Working tiptap editor...
mattwoberts Feb 28, 2025
4ccac53
Looknig at mentions - contrived example working
mattwoberts Mar 2, 2025
0aba26e
Bit mnessy, but this is a working mentions implementation - it's usin…
mattwoberts Mar 6, 2025
ac36ede
Working tiptap editor component
mattwoberts Mar 7, 2025
cc7cabb
Placeholders and more css tidying
mattwoberts Mar 7, 2025
57b245f
More functionality
mattwoberts Mar 7, 2025
cd706ce
Fixed linting
mattwoberts Mar 7, 2025
00c3b47
Removed the test that includes HTML for now..
mattwoberts Mar 7, 2025
8978024
Fixed the SSR rendering.
mattwoberts Mar 11, 2025
bada879
Stylinig for the tiptap editor.
mattwoberts Mar 11, 2025
74a3498
Fix: non-signed in users get sign in popup
mattwoberts Mar 12, 2025
7da5e92
Removed defaultProps
mattwoberts Mar 12, 2025
e7d669c
Removed slate, more tidying
mattwoberts Mar 12, 2025
7fb921f
Tidy the css a bit
mattwoberts Mar 12, 2025
10832c3
Rmoved tippy - looks less impressive but it's much lighter.
mattwoberts Mar 13, 2025
71aae1e
Mention icon support
mattwoberts Mar 13, 2025
25f0088
More nice functionality in the editor
mattwoberts Mar 14, 2025
99d864c
Disabled menubar support
mattwoberts Mar 14, 2025
53a9758
Total re-implementation of mentions
mattwoberts Mar 21, 2025
cd84277
Wrong table name
mattwoberts Mar 21, 2025
6097f65
Fixed some niggles, styling
mattwoberts Mar 21, 2025
36004a3
Insert space before mention
mattwoberts Mar 21, 2025
816db85
A little bit nicer on mobiles
mattwoberts Mar 21, 2025
f32c1f4
Removed the slate stuff
mattwoberts Mar 21, 2025
beef2e5
Minor tweaks
mattwoberts Mar 21, 2025
2d68d69
UI tweaks
mattwoberts Mar 21, 2025
7965434
Add migration code for old mentions
mattwoberts Mar 22, 2025
90ba7a0
Fixed issue with mentions
mattwoberts Mar 23, 2025
bab5376
Fixed the background color
mattwoberts Mar 25, 2025
9eb8db1
Merge branch 'main' into tiptap
mattwoberts Mar 26, 2025
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
Prev Previous commit
Next Next commit
Stylinig for the tiptap editor.
mattwoberts committed Mar 11, 2025
commit bada879013b0d865842fcd55cca76d1016d9e560
87 changes: 18 additions & 69 deletions public/components/common/form/CommentEditor.scss
Original file line number Diff line number Diff line change
@@ -1,55 +1,5 @@
@import "~@fider/assets/styles/variables.scss";

.slate-editor {
background-color: get("colors.white");
width: 100%;
line-height: get("font.size.xl");
padding: spacing(2);
resize: none;
border: 1px solid get("colors.gray.300");
border-radius: get("border.radius.medium");
-webkit-appearance: none;
appearance: none;
margin: spacing(3) 0;

&:disabled {
@include disabled();
}
&--error {
border-color: get("colors.red.600");
}
p {
// line-height: 9px;
margin-bottom: 0;
}
}
.slate-editor--mention {
// padding: 3px 3px 2px;
margin: 0 1px;
vertical-align: baseline;
display: inline-block;
border-radius: 4px;
background-color: get("colors.gray.100");
font-size: get("font.size.sm");
}

.slate-editor--mentions {
top: -9999px;
left: -9999px;
position: absolute;
z-index: 1;
padding: 3px;
background: get("colors.white");
border-radius: 4px;
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
}

.fider-tiptap-editor .ProseMirror {
padding: 12px;
min-height: 120px;
outline: none;
}

/* Styling for content elements */
.fider-tiptap-editor .ProseMirror p {
margin: 0 0 0.75em 0;
@@ -109,38 +59,37 @@
border-radius: 6px;
overflow: hidden;

.ProseMirror {
.tiptap {
:first-child {
margin-top: 0;
}

padding: 12px;
min-height: 120px;
outline: none;

&:focus {
outline: none;
}
}
}

// These are hacked in for mentions
/* Basic editor styles */
.tiptap {
:first-child {
margin-top: 0;
}

.mention {
background-color: get("colors.primary.light");
border-radius: get("border.radius.medium");
box-decoration-break: clone;
color: get("colors.primary.base");
padding: spacing(0.1) spacing(0.3);
&::after {
content: "\200B";
.mention {
background-color: get("colors.blue.200");
border-radius: get("border.radius.medium");
box-decoration-break: clone;
color: get("colors.blue.600");
padding-left: spacing(1);
padding-right: spacing(1);
padding-top: 4px;
padding-bottom: 4px;
&::after {
content: "\200B";
}
}
}
}

// Placeholder
.tiptap p.is-editor-empty:first-child::before {
.tiptap p.tiptap-is-empty:first-child::before {
color: get("colors.gray.400");
content: attr(data-placeholder);
float: left;
1 change: 1 addition & 0 deletions public/components/common/form/CommentEditor2.tsx
Original file line number Diff line number Diff line change
@@ -129,6 +129,7 @@ const Tiptap: React.FunctionComponent<CommentEditorProps2> = (props) => {
}),
Placeholder.configure({
placeholder: props.placeholder ?? "Write your comment here...",
emptyEditorClass: "tiptap-is-empty",
}),
]

2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ if (isProduction) {
new PurgecssPlugin({
paths: glob.sync(`./public/**/*.{html,tsx}`, { nodir: true }),
defaultExtractor: (content) => content.match(/[^<>"'`\s]*[^<>"'`\s:]/g) || [],
safelist: [/--/, /__/, /data-/],
safelist: [/--/, /__/, /data-/, /tiptap/],
})
)
}