@veltdev/slate-velt-comments-staging 1.0.0
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 +59 -0
- package/cjs/index.js +2 -0
- package/cjs/index.js.map +1 -0
- package/cjs/types/index.d.ts +7 -0
- package/esm/index.js +2 -0
- package/esm/index.js.map +1 -0
- package/esm/types/index.d.ts +7 -0
- package/index.d.ts +10 -0
- package/package.json +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Slate Velt Comments Extension
|
|
2
|
+
|
|
3
|
+
<p>
|
|
4
|
+
<a href="https://www.npmjs.com/package/@veltdev/slate-velt-comments">
|
|
5
|
+
<img src="https://img.shields.io/npm/v/@veltdev/slate-velt-comments?style=flat&label=npm&color=09f" alt="NPM" />
|
|
6
|
+
</a>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
With Slate Velt Comments Extension, you can add Google Docs-style overlay comments to your Slate editor. It works with the Velt Collaboration SDK (more on that below). It's fully customizable and comes with a lot of powerful built-in features like attachments, mentions, recording, notifications and more.
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## About Velt SDK
|
|
13
|
+
|
|
14
|
+
With Velt SDK you can add powerful collaboration features to your product extremely fast.
|
|
15
|
+
|
|
16
|
+
The SDK provides **fullstack components**:
|
|
17
|
+
- UI and behavior are fully customizable to match your product's needs
|
|
18
|
+
- fully-managed on a scalable realtime backend
|
|
19
|
+
|
|
20
|
+
Features include:
|
|
21
|
+
* **Comments** like Figma, Frame.io, Google Docs, Sheets and more
|
|
22
|
+
* **Recording** like Loom (audio, video, screen)
|
|
23
|
+
* **Huddle** like Slack (audio, video, screensharing)
|
|
24
|
+
* In-app and off-app **notifications**
|
|
25
|
+
* **@mentions** and assignment
|
|
26
|
+
* **Presence**, **Cursors**, **Live Selection**
|
|
27
|
+
* **Live state sync** with Single Editor mode
|
|
28
|
+
* **Multiplayer editing** with conflict resolution
|
|
29
|
+
* **Follow mode** like Figma
|
|
30
|
+
* ... and so much more
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
npm install @veltdev/slate-velt-comments
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Documentation
|
|
39
|
+
|
|
40
|
+
- Read the [documentation](https://docs.velt.dev/async-collaboration/comments/setup/slate) for guides and API references.
|
|
41
|
+
|
|
42
|
+
## Use cases
|
|
43
|
+
|
|
44
|
+
- Explore [use cases](https://velt.dev/use-case) to learn how collaboration could look like on your product.
|
|
45
|
+
- [Figma Template](https://www.figma.com/community/file/1402312407969730816/velt-collaboration-kit): To visualize what collaboration features could look like on your product.
|
|
46
|
+
|
|
47
|
+
## Releases
|
|
48
|
+
|
|
49
|
+
- See the [latest changes](https://docs.velt.dev/release-notes/).
|
|
50
|
+
|
|
51
|
+
## Security
|
|
52
|
+
- Velt is SOC2 Type 2 and HIPAA compliant. [Learn more](https://velt.dev/security)
|
|
53
|
+
|
|
54
|
+
## Community
|
|
55
|
+
|
|
56
|
+
- [X](https://x.com/veltjs): To receive updates, announcements,
|
|
57
|
+
and general Velt tips.
|
|
58
|
+
|
|
59
|
+
- [Discord](https://discord.gg/GupvcYH27h): To ask questions and share tips. (Less active).
|
package/cjs/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("slate"),r=function(r,o){void 0===o&&(o={});var t=o.customMessage,i=void 0===t?"Hello, World!":t,l=r.insertText;return r.insertText=function(o){if(" "===o&&r.selection){var t=r.selection.anchor,n=e.Editor.before(r,t,{unit:"word"});if(n){var s={anchor:n,focus:t};if("hello"===e.Editor.string(r,s))return e.Editor.deleteBackward(r,{unit:"word"}),void l("".concat(i," "))}}l(o)},r};exports.default=r,exports.isHelloWorld=function(e){return"hello-world"===e.type},exports.withHelloWorld=r;
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/cjs/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import { Editor } from 'slate';\n// Create the plugin\nexport var withHelloWorld = function (editor, options) {\n if (options === void 0) { options = {}; }\n var _a = options.customMessage, customMessage = _a === void 0 ? 'Hello, World!' : _a;\n // Store the original insertText method\n var insertText = editor.insertText;\n // Override the insertText method to add plugin behavior\n editor.insertText = function (text) {\n // First check if selection exists\n if (text === ' ' && editor.selection) {\n // Make sure we have a valid selection before checking text\n var currentPoint = editor.selection.anchor;\n // Get the word before the current selection\n var wordBefore = Editor.before(editor, currentPoint, { unit: 'word' });\n if (wordBefore) {\n var range = { anchor: wordBefore, focus: currentPoint };\n var wordText = Editor.string(editor, range);\n if (wordText === 'hello') {\n // Delete the word \"hello\"\n Editor.deleteBackward(editor, { unit: 'word' });\n // Insert our custom message\n insertText(\"\".concat(customMessage, \" \"));\n return;\n }\n }\n }\n // Otherwise, perform the default behavior\n insertText(text);\n };\n return editor;\n};\n// Utility function to check if a node is a HelloWorld element\nexport var isHelloWorld = function (element) {\n return element.type === 'hello-world';\n};\n// Export everything\nexport default withHelloWorld;\n"],"names":["withHelloWorld","editor","options","_a","customMessage","insertText","text","selection","currentPoint","anchor","wordBefore","Editor","before","unit","range","focus","string","deleteBackward","concat","element","type"],"mappings":"2FAEWA,EAAiB,SAAUC,EAAQC,QAC1B,IAAZA,IAAsBA,EAAU,CAAE,GACtC,IAAIC,EAAKD,EAAQE,cAAeA,OAAuB,IAAPD,EAAgB,gBAAkBA,EAE9EE,EAAaJ,EAAOI,WAwBxB,OAtBAJ,EAAOI,WAAa,SAAUC,GAE1B,GAAa,MAATA,GAAgBL,EAAOM,UAAW,CAElC,IAAIC,EAAeP,EAAOM,UAAUE,OAEhCC,EAAaC,EAAMA,OAACC,OAAOX,EAAQO,EAAc,CAAEK,KAAM,SAC7D,GAAIH,EAAY,CACZ,IAAII,EAAQ,CAAEL,OAAQC,EAAYK,MAAOP,GAEzC,GAAiB,UADFG,EAAMA,OAACK,OAAOf,EAAQa,GAMjC,OAHAH,EAAMA,OAACM,eAAehB,EAAQ,CAAEY,KAAM,cAEtCR,EAAW,GAAGa,OAAOd,EAAe,KAG3C,CACJ,CAEDC,EAAWC,EACnB,EACWL,CACX,yCAE0B,SAAUkB,GAChC,MAAwB,gBAAjBA,EAAQC,IACnB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Editor, Element } from 'slate';
|
|
2
|
+
export type HelloWorldPluginOptions = {
|
|
3
|
+
customMessage?: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const withHelloWorld: (editor: Editor, options?: HelloWorldPluginOptions) => import("slate").BaseEditor;
|
|
6
|
+
export declare const isHelloWorld: (element: Element) => boolean;
|
|
7
|
+
export default withHelloWorld;
|
package/esm/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Editor as e}from"slate";var o=function(o,r){void 0===r&&(r={});var t=r.customMessage,n=void 0===t?"Hello, World!":t,i=o.insertText;return o.insertText=function(r){if(" "===r&&o.selection){var t=o.selection.anchor,a=e.before(o,t,{unit:"word"});if(a){var l={anchor:a,focus:t};if("hello"===e.string(o,l))return e.deleteBackward(o,{unit:"word"}),void i("".concat(n," "))}}i(r)},o},r=function(e){return"hello-world"===e.type};export{o as default,r as isHelloWorld,o as withHelloWorld};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import { Editor } from 'slate';\n// Create the plugin\nexport var withHelloWorld = function (editor, options) {\n if (options === void 0) { options = {}; }\n var _a = options.customMessage, customMessage = _a === void 0 ? 'Hello, World!' : _a;\n // Store the original insertText method\n var insertText = editor.insertText;\n // Override the insertText method to add plugin behavior\n editor.insertText = function (text) {\n // First check if selection exists\n if (text === ' ' && editor.selection) {\n // Make sure we have a valid selection before checking text\n var currentPoint = editor.selection.anchor;\n // Get the word before the current selection\n var wordBefore = Editor.before(editor, currentPoint, { unit: 'word' });\n if (wordBefore) {\n var range = { anchor: wordBefore, focus: currentPoint };\n var wordText = Editor.string(editor, range);\n if (wordText === 'hello') {\n // Delete the word \"hello\"\n Editor.deleteBackward(editor, { unit: 'word' });\n // Insert our custom message\n insertText(\"\".concat(customMessage, \" \"));\n return;\n }\n }\n }\n // Otherwise, perform the default behavior\n insertText(text);\n };\n return editor;\n};\n// Utility function to check if a node is a HelloWorld element\nexport var isHelloWorld = function (element) {\n return element.type === 'hello-world';\n};\n// Export everything\nexport default withHelloWorld;\n"],"names":["withHelloWorld","editor","options","_a","customMessage","insertText","text","selection","currentPoint","anchor","wordBefore","Editor","before","unit","range","focus","string","deleteBackward","concat","isHelloWorld","element","type"],"mappings":"+BAEU,IAACA,EAAiB,SAAUC,EAAQC,QAC1B,IAAZA,IAAsBA,EAAU,CAAE,GACtC,IAAIC,EAAKD,EAAQE,cAAeA,OAAuB,IAAPD,EAAgB,gBAAkBA,EAE9EE,EAAaJ,EAAOI,WAwBxB,OAtBAJ,EAAOI,WAAa,SAAUC,GAE1B,GAAa,MAATA,GAAgBL,EAAOM,UAAW,CAElC,IAAIC,EAAeP,EAAOM,UAAUE,OAEhCC,EAAaC,EAAOC,OAAOX,EAAQO,EAAc,CAAEK,KAAM,SAC7D,GAAIH,EAAY,CACZ,IAAII,EAAQ,CAAEL,OAAQC,EAAYK,MAAOP,GAEzC,GAAiB,UADFG,EAAOK,OAAOf,EAAQa,GAMjC,OAHAH,EAAOM,eAAehB,EAAQ,CAAEY,KAAM,cAEtCR,EAAW,GAAGa,OAAOd,EAAe,KAG3C,CACJ,CAEDC,EAAWC,EACnB,EACWL,CACX,EAEWkB,EAAe,SAAUC,GAChC,MAAwB,gBAAjBA,EAAQC,IACnB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Editor, Element } from 'slate';
|
|
2
|
+
export type HelloWorldPluginOptions = {
|
|
3
|
+
customMessage?: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const withHelloWorld: (editor: Editor, options?: HelloWorldPluginOptions) => import("slate").BaseEditor;
|
|
6
|
+
export declare const isHelloWorld: (element: Element) => boolean;
|
|
7
|
+
export default withHelloWorld;
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as slate from 'slate';
|
|
2
|
+
import { Editor, Element } from 'slate';
|
|
3
|
+
|
|
4
|
+
type HelloWorldPluginOptions = {
|
|
5
|
+
customMessage?: string;
|
|
6
|
+
};
|
|
7
|
+
declare const withHelloWorld: (editor: Editor, options?: HelloWorldPluginOptions) => slate.BaseEditor;
|
|
8
|
+
declare const isHelloWorld: (element: Element) => boolean;
|
|
9
|
+
|
|
10
|
+
export { HelloWorldPluginOptions, withHelloWorld as default, isHelloWorld, withHelloWorld };
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@veltdev/slate-velt-comments-staging",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Slate Extension to add Google Docs-style overlay comments to your Slate editor. Works with the Velt Collaboration SDK.",
|
|
5
|
+
"homepage": "https://velt.dev",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"slate",
|
|
8
|
+
"react",
|
|
9
|
+
"velt",
|
|
10
|
+
"real-time",
|
|
11
|
+
"realtime",
|
|
12
|
+
"toolkit",
|
|
13
|
+
"multiplayer",
|
|
14
|
+
"websockets",
|
|
15
|
+
"collaboration",
|
|
16
|
+
"collaborative",
|
|
17
|
+
"presence",
|
|
18
|
+
"rooms",
|
|
19
|
+
"documents",
|
|
20
|
+
"conflict resolution",
|
|
21
|
+
"crdts",
|
|
22
|
+
"comment",
|
|
23
|
+
"comments",
|
|
24
|
+
"recording",
|
|
25
|
+
"screen recording",
|
|
26
|
+
"cursors",
|
|
27
|
+
"notifications",
|
|
28
|
+
"cord",
|
|
29
|
+
"liveblocks"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
33
|
+
"version:update": "node ../update-npm-package.mjs",
|
|
34
|
+
"publish:extension": "npm publish"
|
|
35
|
+
},
|
|
36
|
+
"author": "",
|
|
37
|
+
"license": "Proprietary",
|
|
38
|
+
"main": "cjs/index.js",
|
|
39
|
+
"module": "esm/index.js",
|
|
40
|
+
"types": "index.d.ts",
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"slate": "^0.112.0",
|
|
43
|
+
"slate-react": "^0.112.1"
|
|
44
|
+
}
|
|
45
|
+
}
|