@yoopta/paragraph 1.9.0-rc

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # `yoopta-paragraph`
2
+
3
+ > TODO: description
4
+
5
+ ## Usage
6
+
7
+ ```
8
+ const paragraph = require('yoopta-paragraph');
9
+
10
+ // TODO: DEMONSTRATE API
11
+ ```
@@ -0,0 +1,11 @@
1
+ import { YoEditor } from '@yoopta/editor';
2
+ import { ParagraphElement } from './types';
3
+ import { Paragraph } from './ui/Paragraph';
4
+ declare module 'slate' {
5
+ interface CustomTypes {
6
+ Editor: YoEditor;
7
+ Element: ParagraphElement;
8
+ }
9
+ }
10
+ export default Paragraph;
11
+ export { ParagraphElement };
package/dist/index.js ADDED
@@ -0,0 +1,69 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { createYoptaPlugin, generateId } from '@yoopta/editor';
3
+ import { Transforms } from 'slate';
4
+
5
+ function styleInject(css, ref) {
6
+ if ( ref === void 0 ) ref = {};
7
+ var insertAt = ref.insertAt;
8
+
9
+ if (!css || typeof document === 'undefined') { return; }
10
+
11
+ var head = document.head || document.getElementsByTagName('head')[0];
12
+ var style = document.createElement('style');
13
+ style.type = 'text/css';
14
+
15
+ if (insertAt === 'top') {
16
+ if (head.firstChild) {
17
+ head.insertBefore(style, head.firstChild);
18
+ } else {
19
+ head.appendChild(style);
20
+ }
21
+ } else {
22
+ head.appendChild(style);
23
+ }
24
+
25
+ if (style.styleSheet) {
26
+ style.styleSheet.cssText = css;
27
+ } else {
28
+ style.appendChild(document.createTextNode(css));
29
+ }
30
+ }
31
+
32
+ var css_248z = ".Paragraph-module_paragraph{color:#292929;font-size:16px;letter-spacing:-.003em;line-height:24px;margin-bottom:1px;margin-top:2px;padding-bottom:2px;padding-top:2px;position:relative}";
33
+ var s = {"paragraph":"Paragraph-module_paragraph"};
34
+ styleInject(css_248z);
35
+
36
+ const ParagraphRender = ({ attributes, children, element }) => {
37
+ return (jsx("p", Object.assign({ draggable: false, className: s.paragraph }, attributes, { children: children })));
38
+ };
39
+ ParagraphRender.displayName = 'Paragraph';
40
+ const Paragraph = createYoptaPlugin({
41
+ type: 'paragraph',
42
+ renderer: (editor) => ParagraphRender,
43
+ defineElement: () => ({
44
+ id: generateId(),
45
+ type: 'paragraph',
46
+ children: [{ text: '' }],
47
+ nodeType: 'block',
48
+ }),
49
+ createElement: function (editor) {
50
+ var _a;
51
+ const node = Paragraph.getPlugin.defineElement();
52
+ Transforms.setNodes(editor, node, {
53
+ at: (_a = editor.selection) === null || _a === void 0 ? void 0 : _a.anchor,
54
+ });
55
+ },
56
+ exports: {
57
+ markdown: {
58
+ serialize: (node, text) => `${text}\n`,
59
+ },
60
+ html: {
61
+ serialize: (node, children) => `<p>${children}</p>`,
62
+ deserialize: {
63
+ nodeName: 'P',
64
+ },
65
+ },
66
+ },
67
+ });
68
+
69
+ export { Paragraph as default };
@@ -0,0 +1,2 @@
1
+ import { YoptaBaseElement } from '@yoopta/editor';
2
+ export type ParagraphElement = YoptaBaseElement<'paragraph'>;
@@ -0,0 +1,3 @@
1
+ import { ParagraphElement } from '../types';
2
+ declare const Paragraph: import("@yoopta/editor").YoptaPlugin<any, ParagraphElement>;
3
+ export { Paragraph };
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@yoopta/paragraph",
3
+ "version": "1.9.0-rc",
4
+ "description": "> TODO: description",
5
+ "author": "Darginec05 <devopsbanda@gmail.com>",
6
+ "homepage": "https://github.com/Darginec05/Editor-Yopta#readme",
7
+ "license": "MIT",
8
+ "private": false,
9
+ "type": "module",
10
+ "main": "dist/index.js",
11
+ "module": "dist/index.js",
12
+ "types": "./dist/index.d.ts",
13
+ "files": [
14
+ "dist/"
15
+ ],
16
+ "peerDependencies": {
17
+ "@yoopta/editor": "1.1.4",
18
+ "react": ">=17.0.2",
19
+ "react-dom": ">=17.0.2",
20
+ "slate": ">=0.72.3",
21
+ "slate-react": ">=0.72.4"
22
+ },
23
+ "publishConfig": {
24
+ "registry": "https://registry.yarnpkg.com"
25
+ },
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/Darginec05/Editor-Yopta.git"
29
+ },
30
+ "scripts": {
31
+ "test": "node ./__tests__/@yoopta/paragraph.test.js"
32
+ },
33
+ "bugs": {
34
+ "url": "https://github.com/Darginec05/Editor-Yopta/issues"
35
+ }
36
+ }