-
-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
60 changed files
with
857 additions
and
436 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
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.