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

Feature/artciles: add softbreak plugin #306

Open
wants to merge 164 commits into
base: feature/articles
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
164 commits
Select commit Hold shift + click to select a range
2d89d22
add eslint-config-prettier
maerzhase May 9, 2022
f59364b
add eslint-plugin-prettier
maerzhase May 9, 2022
90ba32e
add softbreak plugin; fix #304
maerzhase Aug 1, 2022
64ae0df
add util to retrieve block elements
maerzhase Aug 2, 2022
33cf15c
make softLineBreak plugin extensible
maerzhase Aug 2, 2022
397f27a
remove encoded whitespaces from markdown
maerzhase Aug 5, 2022
37997d0
Revert "remove encoded whitespaces from markdown"
maerzhase Aug 5, 2022
94b6ca8
Merge branch 'feature/articles' into fix/#304-softbreak-plugin
maerzhase Aug 5, 2022
e5b75ff
fix merge conflict
maerzhase Aug 5, 2022
0afc58d
Merge pull request #343 from fxhash/feature/articles
ciphrd Aug 20, 2022
a2633ed
fix(import): csv parser trim cols correctly
GemN Aug 21, 2022
11014ab
fix(import): add scrollable import table
GemN Aug 21, 2022
a024055
fix(import): display number of address to imported, reduce size of im…
GemN Aug 21, 2022
7a1bb89
feat(article): add mentions to article
GemN Aug 28, 2022
3c66892
add normalisation for emtpy links and without url
maerzhase Aug 28, 2022
e2ed6a4
🐛 user guard shouldn't check if user was fetched
ciphrd Aug 30, 2022
6722003
📝 add articles contract address to the doc
ciphrd Aug 30, 2022
55b85b1
remove test files
GemN Aug 30, 2022
c4e7029
🚑 NFTArticleEditor dynamic import breaks reference on parent component
ciphrd Aug 30, 2022
2aca8c9
Merge pull request #348 from fxhash/fix/remove-test-files
ciphrd Aug 30, 2022
f14af8c
✨ banner link to article text
ciphrd Aug 30, 2022
057651b
✨ added twitte rmeta tags
ciphrd Aug 30, 2022
e37c9ec
Merge branch 'dev' into staging
ciphrd Aug 30, 2022
3293c84
🐛 article URL id if slug not working
ciphrd Aug 30, 2022
612ccdc
Merge branch 'dev' into staging
ciphrd Aug 30, 2022
68696da
🔒️ sanitize href links
ciphrd Aug 30, 2022
d62f4c2
✨ moderation UI to moderate an article
ciphrd Aug 31, 2022
f10d911
✨ show a flag banner on the article page
ciphrd Aug 31, 2022
a66bcb2
🚸 retain the route /explore/articles in the DOM
ciphrd Aug 31, 2022
0dede9e
✨ rules applied to articles based on moderation state
ciphrd Aug 31, 2022
714e838
✨ hidden articles are not shown on the user's profile anymore
ciphrd Aug 31, 2022
60e9b77
✨ update article page title
ciphrd Aug 31, 2022
2df8740
🔧 env articles
ciphrd Aug 31, 2022
2f09d5f
Merge pull request #351 from fxhash/feature/articles-moderation
ciphrd Aug 31, 2022
39a3501
💄 fix compiler warnings
ciphrd Aug 31, 2022
e730275
fix(user): articles load correctly without infinite loop
GemN Sep 1, 2022
a5fa849
fix(article): remove entire nodes when deleting foward/backward for m…
GemN Sep 1, 2022
1be7d9f
Merge pull request #358 from fxhash/fix/articles-user-loading
ciphrd Sep 1, 2022
8642ac4
Merge pull request #359 from fxhash/fix/articles-image-crash
ciphrd Sep 1, 2022
154d926
Merge branch 'dev' into fix/normalisation-for-links
ciphrd Sep 1, 2022
53a9c58
Merge pull request #346 from fxhash/fix/normalisation-for-links
ciphrd Sep 1, 2022
a2e7046
🐛 add missing thumbnail caption
ciphrd Sep 1, 2022
8969312
fix(article): uncomment autosave
GemN Sep 1, 2022
ada0d8b
fix(article): blockquote style work in preview
GemN Sep 1, 2022
2f42da8
fix(article): add break in a list only convert to paragraph at the en…
GemN Sep 1, 2022
91acd47
💄 styling for user mentions more readable
ciphrd Sep 2, 2022
ca90edf
fix(article): invalid slug with just a dot redirect to id
GemN Sep 2, 2022
43c4078
fix(article): change mention style / remove rehypeFormat that was bad…
GemN Sep 2, 2022
c09d27a
fix(article): change font weight of mentions
GemN Sep 2, 2022
67577e0
🔒️ add headers to protect from embedding fxhash into an iframe / popup
ciphrd Sep 2, 2022
4f5db82
🔒️ stricter CSP to prevent anything not fxhash
ciphrd Sep 2, 2022
aaf3e7a
🔒️ improve security headers, support for articles too
ciphrd Sep 2, 2022
e279922
✨ update the mint reserve input (pack with method id)
ciphrd Sep 4, 2022
8aee2dd
fix date floating for mobile article cards
maerzhase Sep 5, 2022
f6045af
✨ add basic reserve mint pass support
ciphrd Sep 5, 2022
3b3c507
✨ add mint pass unpack reserve
ciphrd Sep 5, 2022
5ff8df0
Merge pull request #360 from fxhash/fix/autosave
GemN Sep 5, 2022
6458629
Merge branch 'dev' into feature/article-mentions
ciphrd Sep 5, 2022
9f98969
Merge pull request #345 from fxhash/feature/article-mentions
ciphrd Sep 5, 2022
be064f8
💄 articles > explore remove top level padding + responsive margin bet…
ciphrd Sep 5, 2022
b9f89a5
Merge pull request #367 from fxhash/fix/#353-article-card-responsive
ciphrd Sep 5, 2022
253f988
Merge branch 'dev' into fix/get-article-url
ciphrd Sep 5, 2022
847835e
Merge pull request #365 from fxhash/fix/get-article-url
ciphrd Sep 5, 2022
d6a5018
Merge pull request #363 from fxhash/fix/article-list-break
ciphrd Sep 5, 2022
459b988
💄 remove top and bottom margin on first/last elements inside blockquotes
ciphrd Sep 5, 2022
2a8764b
Merge pull request #362 from fxhash/fix/article-blockquote-style
ciphrd Sep 5, 2022
031a788
Merge pull request #344 from fxhash/fix/import-csv
ciphrd Sep 5, 2022
3e48b0b
✨ added article actions to list of actions
ciphrd Sep 6, 2022
6e855e6
fix(article): update media size (video, image)
GemN Sep 6, 2022
6e7b520
🔧 10000 -> 50000 max editions
ciphrd Sep 7, 2022
ce3fa29
add article infos to user actions
maerzhase Sep 7, 2022
ba35d82
add components for article related actions
maerzhase Sep 7, 2022
65f77ec
feat(live-minting): add minimalist layout, page generative, page reve…
GemN Sep 7, 2022
58126cc
feat(live-minting): add live event skeleton
GemN Sep 7, 2022
26a560b
♻️ refacto of the actions
ciphrd Sep 8, 2022
d10ef16
Merge pull request #373 from fxhash/fix/#369-add-article-related-actions
ciphrd Sep 8, 2022
67ee4e7
Merge branch 'staging' into dev
ciphrd Sep 8, 2022
5771711
🚨 fix wront imports
ciphrd Sep 8, 2022
31fba6d
🚨 HARDFIX compiler error - bad, bad :(
ciphrd Sep 8, 2022
61800b0
🔧 added rehype-format back for processing documentation md
ciphrd Sep 8, 2022
d25efc3
fix(article): autosave warn user if using incognito mode, check that …
GemN Sep 8, 2022
d553728
fix(article): autosave check size used
GemN Sep 8, 2022
8dd2329
add new tabstyle subtabs-vertical
maerzhase Sep 8, 2022
a526da9
add iconSide null for centered icon button
maerzhase Sep 8, 2022
5ffeb2f
add query for user articles owned
maerzhase Sep 8, 2022
4de7ab8
add interface NFTArticlesOwned
maerzhase Sep 8, 2022
fc691d3
add prop for hiding the spacing above the section content
maerzhase Sep 8, 2022
84c758e
add articles to user collection
maerzhase Sep 8, 2022
dfec58e
fix(article): embed youtube need allow-presentation to work properlly
GemN Sep 8, 2022
fa37c14
🔒️ limit user search input to users with safe flag
ciphrd Sep 8, 2022
0ab073f
💄 small adjustements to vertical subtabs style
ciphrd Sep 8, 2022
dc35f6d
💄 articles are centered like for the rest of the layout
ciphrd Sep 8, 2022
9ee64a4
📱 select font size smaller on mobile
ciphrd Sep 8, 2022
d05d32c
💄 updated enjoy collection btn icon & less padding on single icon btn
ciphrd Sep 8, 2022
2261415
♻️ user collec > refacto split sub comps
ciphrd Sep 8, 2022
1534f32
✨ show number of editions owned on user collec articles
ciphrd Sep 8, 2022
21726dd
Merge pull request #380 from fxhash/feature/#376-add-articles-to-user…
ciphrd Sep 8, 2022
e46851f
💄 live minting UI adjustement
ciphrd Sep 8, 2022
62d01a4
✨ live minting > show wallet balance at the top
ciphrd Sep 8, 2022
b21af01
💄 adjust live minting token card design
ciphrd Sep 9, 2022
8761965
feat(article): add marketplace listings to article
GemN Sep 9, 2022
81a54bc
fix(article): change article li style
GemN Sep 9, 2022
0fa8c07
🔒️ auth flow for the event (check id & token validity)
ciphrd Sep 9, 2022
975921b
✨ live minting show event projects
ciphrd Sep 9, 2022
b7607b3
💄 wallet balance increase tezos size
ciphrd Sep 9, 2022
e7ca7cd
Merge branch 'feature/reserve-mint-pass' into feature/live-minting
ciphrd Sep 9, 2022
cffbb93
🔒️ show mint button if reserve mint pass is met
ciphrd Sep 9, 2022
ba20b6a
✨ full support for minting with reserve mint pass
ciphrd Sep 10, 2022
28138f4
💄 minor UI changes to the article bottom infos
ciphrd Sep 10, 2022
b9f6caa
✨ removed linking of the tabs (created a weird UX experience)
ciphrd Sep 10, 2022
68ff616
Merge pull request #382 from fxhash/feature/marketplace-listings
ciphrd Sep 10, 2022
bd65a1b
✨ added actions for marketplace v3 (only articles supported)
ciphrd Sep 10, 2022
8033dca
✨ added contract operations for marketplace v3 + btns for articles
ciphrd Sep 10, 2022
6284404
✨ add quick collect button on article
ciphrd Sep 10, 2022
e36e9dd
🔇 clear console logs
ciphrd Sep 10, 2022
c26abe7
Merge pull request #384 from fxhash/feature/marketplace-v3-contracts
ciphrd Sep 10, 2022
343fa1d
🔧 set marketplace v3 address in env
ciphrd Sep 10, 2022
c66f1f5
Merge branch 'feature/marketplace-v3' into dev
ciphrd Sep 10, 2022
b02872f
📝 added address contract doc
ciphrd Sep 10, 2022
b375e15
Merge branch 'dev' into feature/live-minting
ciphrd Sep 10, 2022
be72a85
✨ naan url & log error
ciphrd Sep 11, 2022
05b2d4c
🐛 fix user by pkh > collection > articles 404
ciphrd Sep 11, 2022
5f1b1d2
fix(article): media video dont crash page when url is wrong
GemN Sep 12, 2022
eafb270
Merge branch 'dev' into devx/#97-add-eslint-prettier
maerzhase Sep 12, 2022
272712d
add prettier configuration
maerzhase Sep 12, 2022
499ae90
add lint.fix command
maerzhase Sep 12, 2022
58be27e
✨ live event, improved onboarding flow
ciphrd Sep 13, 2022
f752df5
🚸 improve user experience for live minting flow
ciphrd Sep 13, 2022
335ae4d
✨ handle minting pass expired error
ciphrd Sep 13, 2022
3a06990
✨ hide warning on live minting context
ciphrd Sep 13, 2022
ad586a4
Merge branch 'feature/live-minting' into dev
ciphrd Sep 13, 2022
2a258c1
✨ display mint pass group details in the reserve
ciphrd Sep 13, 2022
9df58dd
🔧 added events url to the main .env
ciphrd Sep 13, 2022
11089fe
✨ added fetch event when input reserve mint pass
ciphrd Sep 13, 2022
f80bfe0
🐛 add support for reserve mint pass at preview
ciphrd Sep 13, 2022
8f97b45
fix: small typos in docs
gregsadetsky Sep 13, 2022
908c1d9
fix(article): medias, thumbnail and tezos storage take viewport as ma…
GemN Sep 14, 2022
0239e4f
fix(article): thumbnail update correctly, don't throw error on edition
GemN Sep 14, 2022
22e1b08
fix(article): card nft article have buttons working as intended -> ed…
GemN Sep 14, 2022
a6028ab
Merge branch 'dev' into devx/#97-add-eslint-prettier
ciphrd Sep 15, 2022
2f86ed8
✨ format code; run `run lint:fix`
ciphrd Sep 15, 2022
72da489
🚨 fix compiler warnings (@ts-ignore were move by auto format)
ciphrd Sep 15, 2022
e840fe6
Merge pull request #121 from fxhash/devx/#97-add-eslint-prettier
ciphrd Sep 15, 2022
b259615
Revert "Add eslint plugin prettier"
ciphrd Sep 15, 2022
73792a6
Merge pull request #397 from fxhash/revert-121-devx/#97-add-eslint-pr…
ciphrd Sep 15, 2022
52881b3
fix: optimize infinite scroll - doesn't trigger empty queries when un…
GemN Sep 15, 2022
ce94f66
Merge pull request #372 from fxhash/fix/article-media-size
ciphrd Sep 15, 2022
c62136a
Merge pull request #379 from fxhash/fix/articles-autosave
ciphrd Sep 15, 2022
0b09f3e
Merge pull request #381 from fxhash/fix/article-embed-sandbox
ciphrd Sep 15, 2022
aaa83b0
Merge pull request #383 from fxhash/fix/article-li-style
ciphrd Sep 15, 2022
ca14f31
Merge pull request #388 from fxhash/fix/article-medias-url
ciphrd Sep 15, 2022
bad0ebc
Merge pull request #393 from fxhash/fix/article-edit-thumbnail-error
ciphrd Sep 15, 2022
c885d84
Merge pull request #391 from gregsadetsky/bug/small-typos
ciphrd Sep 15, 2022
7fac117
🐛 remove detect incognito
ciphrd Sep 15, 2022
76d25ae
Merge branch 'dev' of https://github.com/fxhash/website into dev
ciphrd Sep 15, 2022
900692c
Merge branch 'dev' into fix/article-card-edit
ciphrd Sep 15, 2022
2cebe88
Merge pull request #394 from fxhash/fix/article-card-edit
ciphrd Sep 15, 2022
065ddba
Merge pull request #398 from fxhash/fix/optimize-infinite-scroll
ciphrd Sep 15, 2022
b91af13
🚨 fix compiler warnings
ciphrd Sep 15, 2022
54deba5
🔧 added eslint config back
ciphrd Sep 15, 2022
ee27d3f
🎨 run lint:fix
ciphrd Sep 15, 2022
286fd02
🚨 fix post lint ts-ignore merge magic
ciphrd Sep 15, 2022
76b78f8
Merge pull request #399 from fxhash/fix/prettier-back
ciphrd Sep 15, 2022
8e0c1a2
Merge branch 'dev' into fix/#304-softbreak-plugin
maerzhase Sep 19, 2022
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
27 changes: 27 additions & 0 deletions src/components/NFTArticle/SlateEditor/Plugins/SoftBreakPlugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { EnhanceEditorWith } from "../../../../types/ArticleEditor/Editor";
import { getBlockElementAtSelection } from "../utils";

const BLOCK_TYPES_WITH_SOFT_LINEBREAK = [
'paragraph',
'blockquote',
'list',
'table',
'heading',
]

export const withSoftBreak: EnhanceEditorWith = (editor) => {
const { insertText, insertSoftBreak } = editor

editor.insertSoftBreak = () => {
if(editor.selection) {
const [element] = getBlockElementAtSelection(editor, editor.selection)
if (element && BLOCK_TYPES_WITH_SOFT_LINEBREAK.includes(element.type)) {
insertText('\n')
return true;
}
}
insertSoftBreak();
}

return editor
}
2 changes: 2 additions & 0 deletions src/components/NFTArticle/SlateEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
import { withHistory } from "slate-history"
import { TezosStorageProps } from "../elements/TezosStorage"
import { withAutoFormat } from './AutoFormatPlugin/'
import { withSoftBreak } from './Plugins/SoftBreakPlugin'
import { withImages } from "./Plugins/SlateImagePlugin"
import { ImageElement } from "../elements/ImageElement"
import { onKeyDownHotkeyPlugin } from "./HotkeyPlugin/HotkeyPlugin"
Expand Down Expand Up @@ -115,6 +116,7 @@ export const SlateEditor = forwardRef<FxEditor, SlateEditorProps>(({
{ f: withImages },
{ f: withTables },
{ f: withConstraints },
{ f: withSoftBreak }
]
const enhancedEditor = withs.reduce((e, enhanceWith) => {
return enhanceWith.f(e, ...Object.values(enhanceWith.args || {}));
Expand Down
10 changes: 10 additions & 0 deletions src/components/NFTArticle/SlateEditor/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,13 @@ export function lookupElementAtSelection(
const [, nodePath] = Editor.last(editor, selection)
return Editor.parent(editor, nodePath)
}


export function getBlockElementAtSelection(editor: Editor, selection: Location): NodeEntry {
const [element] = Editor.nodes(editor, {
at: selection,
match: n =>
!Editor.isEditor(n) && Element.isElement(n),
})
return element
}