-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
Create starter kit package #217
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
5d9793f
starer kit is ready
Darginec05 991cdfd
fixes export in plain text
Darginec05 9b945d0
added example template
Darginec05 600e0cf
Publish
Darginec05 2f25120
publish rc
Darginec05 2a330ff
Publish
Darginec05 c3b58f8
Publish
Darginec05 ddc035b
publish -rc versions
Darginec05 7aa6b9c
update example
Darginec05 41c576b
Fix bugs with blur
Darginec05 fe401b1
Publish
Darginec05 dbd1e81
update example packages
Darginec05 7dafc8c
oopsie voopsie
Darginec05 40f9657
fix types for plugin
Darginec05 4e6fc72
small review fixes
Darginec05 29190e2
Publish
Darginec05 1e2efd6
update example packaages
Darginec05 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Example Request | ||
description: Submit a request for an example | ||
title: '[Example Request]: ' | ||
labels: ['Example Request'] | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
Need an example of how to do something with Yoopta-Editor? | ||
- type: textarea | ||
id: description | ||
attributes: | ||
label: What's the example? | ||
description: Please describe the example. What would you like to see? | ||
validations: | ||
required: true | ||
- type: checkboxes | ||
id: terms | ||
attributes: | ||
label: Code of Conduct | ||
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/Darginec05/Yoopta-Editor/blob/master/CODE_OF_CONDUCT.md) | ||
options: | ||
- label: I agree to follow this project's Code of Conduct | ||
required: true |
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
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
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
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
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 was deleted.
Oops, something went wrong.
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
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,30 @@ | ||
import { SlateElement, YooEditor, YooptaBlockData, YooptaContentValue } from '../editor/types'; | ||
|
||
export function serialize(editor: YooEditor, blocksData: YooptaBlockData[]) { | ||
const blocks = blocksData.sort((a, b) => (a.meta.order > b.meta.order ? 1 : -1)); | ||
|
||
const markdown = blocks.map((blockData) => { | ||
const plugin = editor.plugins[blockData.type]; | ||
|
||
if (plugin) { | ||
const element = blockData.value[0] as SlateElement; | ||
|
||
if (plugin.parsers?.markdown?.serialize) { | ||
const serialized = plugin.parsers.markdown.serialize( | ||
element, | ||
element.children.map((child) => child.text).join(''), | ||
); | ||
if (serialized) return serialized; | ||
} | ||
} | ||
|
||
return ''; | ||
}); | ||
|
||
return markdown.join('\n'); | ||
} | ||
|
||
export function getMarkdown(editor: YooEditor, content: YooptaContentValue) { | ||
const selectedBlocks = Object.values(content); | ||
return serialize(editor, selectedBlocks); | ||
} |
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,10 @@ | ||
import { YooEditor, YooptaContentValue } from '../editor/types'; | ||
import { getHTML } from './getHTML'; | ||
|
||
export function getPlainText(editor: YooEditor, content: YooptaContentValue) { | ||
const htmlString = getHTML(editor, content); | ||
|
||
const div = document.createElement('div'); | ||
div.innerHTML = htmlString; | ||
return div.innerText; | ||
} |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@yoopta/exports", | ||
"version": "4.6.4", | ||
"version": "4.6.5-rc.3", | ||
"description": "Serialize/deserialize exports in different formats for Yoopta-Editor", | ||
"author": "Darginec05 <[email protected]>", | ||
"homepage": "https://github.com/Darginec05/Editor-Yoopta#readme", | ||
|
@@ -35,5 +35,6 @@ | |
}, | ||
"dependencies": { | ||
"marked": "^13.0.0" | ||
} | ||
}, | ||
"gitHead": "600e0cf267a0ce7df074ddc7db1114d67c4185d1" | ||
} |
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,21 @@ | ||
# StarterKit plugin | ||
|
||
StarterKit is plugin for Yoopta-Editor | ||
|
||
### Installation | ||
|
||
```bash | ||
yarn add @yoopta/starter-kit | ||
``` | ||
|
||
### Usage | ||
|
||
```jsx | ||
import StarterKit from '@yoopta/starter-kit'; | ||
|
||
const plugins = [StarterKit]; | ||
|
||
const Editor = () => { | ||
return <YooptaEditor plugins={plugins} />; | ||
}; | ||
``` |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add docs