-
-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
22 changed files
with
1,887 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<browserconfig> | ||
<msapplication> | ||
<tile> | ||
<square150x150logo src="/mstile-150x150.png"/> | ||
<TileColor>#da532c</TileColor> | ||
</tile> | ||
</msapplication> | ||
</browserconfig> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
User-agent: * | ||
Allow: / |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "Yoopta Editor", | ||
"short_name": "Yoopta Editor", | ||
"icons": [ | ||
{ | ||
"src": "/android-chrome-192x192.png", | ||
"sizes": "192x192", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "/android-chrome-384x384.png", | ||
"sizes": "384x384", | ||
"type": "image/png" | ||
} | ||
], | ||
"theme_color": "#ffffff", | ||
"background_color": "#ffffff", | ||
"display": "standalone" | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
121 changes: 121 additions & 0 deletions
121
web/next-example/src/components/LandingEditor/LandingEditor.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
import YooptaEditor, { createYooptaEditor, Elements, YooEditor } from '@yoopta/editor'; | ||
|
||
import Paragraph from '@yoopta/paragraph'; | ||
import Blockquote from '@yoopta/blockquote'; | ||
import Embed from '@yoopta/embed'; | ||
import Image from '@yoopta/image'; | ||
import Link from '@yoopta/link'; | ||
import Callout from '@yoopta/callout'; | ||
import Video from '@yoopta/video'; | ||
import File from '@yoopta/file'; | ||
import Accordion from '@yoopta/accordion'; | ||
import { NumberedList, BulletedList, TodoList } from '@yoopta/lists'; | ||
import { Bold, Italic, CodeMark, Underline, Strike, Highlight } from '@yoopta/marks'; | ||
import { HeadingOne, HeadingThree, HeadingTwo } from '@yoopta/headings'; | ||
import Code from '@yoopta/code'; | ||
import ActionMenuList, { DefaultActionMenuRender } from '@yoopta/action-menu-list'; | ||
import Toolbar, { DefaultToolbarRender } from '@yoopta/toolbar'; | ||
import LinkTool, { DefaultLinkToolRender } from '@yoopta/link-tool'; | ||
|
||
import { uploadToCloudinary } from '@/utils/cloudinary'; | ||
import { value } from './value'; | ||
|
||
const plugins = [ | ||
Paragraph, | ||
Accordion, | ||
HeadingOne, | ||
HeadingTwo, | ||
HeadingThree, | ||
Blockquote.extend({ | ||
options: { | ||
HTMLAttributes: { | ||
className: 'yoopta-main-page-blockquote', | ||
spellCheck: true, | ||
}, | ||
shortcuts: ['>', 'bq'], | ||
}, | ||
}), | ||
Callout, | ||
NumberedList, | ||
BulletedList, | ||
TodoList, | ||
Code, | ||
Link, | ||
Embed, | ||
Image.extend({ | ||
options: { | ||
async onUpload(file) { | ||
const data = await uploadToCloudinary(file, 'image'); | ||
|
||
return { | ||
src: data.secure_url, | ||
alt: 'cloudinary', | ||
sizes: { | ||
width: data.width, | ||
height: data.height, | ||
}, | ||
}; | ||
}, | ||
}, | ||
}), | ||
Video.extend({ | ||
options: { | ||
onUpload: async (file) => { | ||
const data = await uploadToCloudinary(file, 'video'); | ||
return { | ||
src: data.secure_url, | ||
alt: 'cloudinary', | ||
sizes: { | ||
width: data.width, | ||
height: data.height, | ||
}, | ||
}; | ||
}, | ||
}, | ||
}), | ||
File.extend({ | ||
options: { | ||
onUpload: async (file) => { | ||
const response = await uploadToCloudinary(file, 'auto'); | ||
return { src: response.url }; | ||
}, | ||
}, | ||
}), | ||
]; | ||
|
||
const TOOLS = { | ||
ActionMenu: { | ||
render: DefaultActionMenuRender, | ||
tool: ActionMenuList, | ||
}, | ||
Toolbar: { | ||
render: DefaultToolbarRender, | ||
tool: Toolbar, | ||
}, | ||
LinkTool: { | ||
render: DefaultLinkToolRender, | ||
tool: LinkTool, | ||
}, | ||
}; | ||
|
||
const MARKS = [Bold, Italic, CodeMark, Underline, Strike, Highlight]; | ||
|
||
type Props = { | ||
editor: YooEditor; | ||
selectionRef: React.RefObject<HTMLDivElement>; | ||
}; | ||
|
||
export const LandingEditor = ({ selectionRef, editor }: Props) => { | ||
return ( | ||
<YooptaEditor | ||
editor={editor} | ||
plugins={plugins} | ||
marks={MARKS} | ||
tools={TOOLS} | ||
selectionBoxRoot={selectionRef} | ||
value={value} | ||
autoFocus={false} | ||
className="py-4 !h-full md:max-w-none max-w-[100vw] md:px-0 px-2" | ||
/> | ||
); | ||
}; |
Oops, something went wrong.