@bigbinary/neeto-editor 0.2.1 → 0.2.5

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.
Files changed (78) hide show
  1. package/index.js +9 -9
  2. package/package.json +2 -3
  3. package/tailwind.config.js +13 -9
  4. package/webpack.config.js +5 -3
  5. package/webpack.dev.config.js +5 -3
  6. package/public/favicon.ico +0 -0
  7. package/public/index.html +0 -28
  8. package/public/robots.txt +0 -3
  9. package/src/App.js +0 -8
  10. package/src/Common/Avatar.js +0 -168
  11. package/src/Common/Button.js +0 -95
  12. package/src/Common/CodeBlock.js +0 -11
  13. package/src/Common/Description.js +0 -8
  14. package/src/Common/Dropdown/index.js +0 -122
  15. package/src/Common/Heading.js +0 -13
  16. package/src/Common/HighlightText.js +0 -7
  17. package/src/Common/Icons/HashtagFilled.js +0 -59
  18. package/src/Common/Icons/TextColor.js +0 -35
  19. package/src/Common/Icons/index.js +0 -2
  20. package/src/Common/Input.js +0 -70
  21. package/src/Common/Label.js +0 -45
  22. package/src/Common/ListItems.js +0 -17
  23. package/src/Common/Modal.js +0 -91
  24. package/src/Common/Tab.js +0 -79
  25. package/src/Common/ToolTip.js +0 -37
  26. package/src/Editor/CustomExtensions/BubbleMenu/index.js +0 -92
  27. package/src/Editor/CustomExtensions/CodeBlock/CodeBlockComponent.js +0 -12
  28. package/src/Editor/CustomExtensions/CodeBlock/ExtensionConfig.js +0 -10
  29. package/src/Editor/CustomExtensions/Embeds.js +0 -72
  30. package/src/Editor/CustomExtensions/FixedMenu/FontSizeOption.js +0 -32
  31. package/src/Editor/CustomExtensions/FixedMenu/TextColorOption.js +0 -29
  32. package/src/Editor/CustomExtensions/FixedMenu/constants.js +0 -3
  33. package/src/Editor/CustomExtensions/FixedMenu/index.js +0 -183
  34. package/src/Editor/CustomExtensions/Image/ExtensionConfig.js +0 -47
  35. package/src/Editor/CustomExtensions/Image/LinkUploader/URLForm.js +0 -39
  36. package/src/Editor/CustomExtensions/Image/LocalUploader.js +0 -21
  37. package/src/Editor/CustomExtensions/Image/ProgressBar.js +0 -34
  38. package/src/Editor/CustomExtensions/Image/Uploader.js +0 -82
  39. package/src/Editor/CustomExtensions/Image/constants.js +0 -5
  40. package/src/Editor/CustomExtensions/Mention/ExtensionConfig.js +0 -66
  41. package/src/Editor/CustomExtensions/Mention/MentionList.js +0 -96
  42. package/src/Editor/CustomExtensions/Mention/helpers.js +0 -23
  43. package/src/Editor/CustomExtensions/Placeholder/ExtensionConfig.js +0 -81
  44. package/src/Editor/CustomExtensions/Placeholder/helpers.js +0 -18
  45. package/src/Editor/CustomExtensions/SlashCommands/Commands.js +0 -20
  46. package/src/Editor/CustomExtensions/SlashCommands/CommandsList.js +0 -109
  47. package/src/Editor/CustomExtensions/SlashCommands/ExtensionConfig.js +0 -209
  48. package/src/Editor/CustomExtensions/Variable/ExtensionConfig.js +0 -208
  49. package/src/Editor/CustomExtensions/Variable/VariableList.js +0 -45
  50. package/src/Editor/CustomExtensions/Variable/VariableSuggestion.js +0 -20
  51. package/src/Editor/CustomExtensions/Variable/helpers.js +0 -31
  52. package/src/Editor/CustomExtensions/Variable/index.js +0 -35
  53. package/src/Editor/CustomExtensions/useCustomExtensions.js +0 -88
  54. package/src/Editor/index.js +0 -104
  55. package/src/Editor/sharedState.js +0 -8
  56. package/src/constants/regexp.js +0 -1
  57. package/src/examples/constants.js +0 -95
  58. package/src/examples/index.js +0 -186
  59. package/src/hooks/useOutsideClick.js +0 -19
  60. package/src/hooks/useTabBar.js +0 -9
  61. package/src/index.js +0 -10
  62. package/src/index.scss +0 -46
  63. package/src/styles/abstracts/_mixins.scss +0 -20
  64. package/src/styles/abstracts/_neeto-ui-variables.scss +0 -107
  65. package/src/styles/abstracts/_variables.scss +0 -13
  66. package/src/styles/components/_avatar.scss +0 -105
  67. package/src/styles/components/_button.scss +0 -161
  68. package/src/styles/components/_codeblock.scss +0 -16
  69. package/src/styles/components/_command-list.scss +0 -19
  70. package/src/styles/components/_dropdown.scss +0 -69
  71. package/src/styles/components/_editor-variables.scss +0 -12
  72. package/src/styles/components/_editor.scss +0 -102
  73. package/src/styles/components/_fixed-menu.scss +0 -17
  74. package/src/styles/components/_image-uploader.scss +0 -109
  75. package/src/styles/components/_input.scss +0 -165
  76. package/src/styles/components/_tab.scss +0 -74
  77. package/src/styles/components/_tooltip.scss +0 -152
  78. package/src/utils/common.js +0 -13
@@ -1,70 +0,0 @@
1
- import React from "react";
2
- import classnames from "classnames";
3
-
4
- import Label from "./Label";
5
- import { hyphenize } from "../utils/common";
6
-
7
- const Input = React.forwardRef((props, ref) => {
8
- const {
9
- id,
10
- size = "small",
11
- type = "text",
12
- label,
13
- error = null,
14
- suffix = null,
15
- prefix = null,
16
- disabled = false,
17
- helpText = "",
18
- className = "",
19
- nakedInput = false,
20
- contentSize = null,
21
- required = false,
22
- ...otherProps
23
- } = props;
24
-
25
- return (
26
- <div className={classnames(["neeto-ui-input__wrapper", className])}>
27
- {label && (
28
- <Label
29
- required={required}
30
- data-cy={`${hyphenize(label)}-input-label`}
31
- htmlFor={id}
32
- >
33
- {label}
34
- </Label>
35
- )}
36
- <div
37
- className={classnames("neeto-ui-input", {
38
- "neeto-ui-input--naked": !!nakedInput,
39
- "neeto-ui-input--error": !!error,
40
- "neeto-ui-input--disabled": !!disabled,
41
- "neeto-ui-input--small": size === "small",
42
- })}
43
- >
44
- {prefix && <div className="neeto-ui-input__prefix">{prefix}</div>}
45
- <input
46
- ref={ref}
47
- type={type}
48
- disabled={disabled}
49
- size={contentSize}
50
- required={required}
51
- aria-invalid={!!error}
52
- data-cy={"input-field"}
53
- {...otherProps}
54
- />
55
- {suffix && <div className="neeto-ui-input__suffix">{suffix}</div>}
56
- </div>
57
- {!!error && (
58
- <p
59
- data-cy={`${hyphenize(label)}-input-error`}
60
- className="neeto-ui-input__error"
61
- >
62
- {error}
63
- </p>
64
- )}
65
- {helpText && <p className="neeto-ui-input__help-text">{helpText}</p>}
66
- </div>
67
- );
68
- });
69
-
70
- export default Input;
@@ -1,45 +0,0 @@
1
- import React from "react";
2
- import classnames from "classnames";
3
- import { Info } from "@bigbinary/neeto-icons";
4
-
5
- import Tooltip from "common/ToolTip";
6
-
7
- const Label = ({
8
- children,
9
- className = "",
10
- required = false,
11
- helpIconProps = null,
12
- ...otherProps
13
- }) => {
14
- const {
15
- onClick,
16
- icon,
17
- tooltipProps,
18
- className: helpIconClassName,
19
- ...otherHelpIconProps
20
- } = helpIconProps || {};
21
- const HelpIcon = icon || Info;
22
- return (
23
- <label
24
- className={classnames("neeto-ui-label flex items-center", className)}
25
- {...otherProps}
26
- >
27
- {children}
28
- {required && <span aria-hidden>*</span>}
29
- {helpIconProps && (
30
- <Tooltip {...tooltipProps} disabled={!tooltipProps}>
31
- <span
32
- className={classnames("ml-1", {
33
- [helpIconClassName]: helpIconClassName,
34
- })}
35
- onClick={onClick}
36
- >
37
- <HelpIcon size={16} {...otherHelpIconProps} />
38
- </span>
39
- </Tooltip>
40
- )}
41
- </label>
42
- );
43
- };
44
-
45
- export default Label;
@@ -1,17 +0,0 @@
1
- import React from "react";
2
-
3
- const ListItems = ({ items, ordered }) => {
4
- const itemElements = items.map((item, index) => (
5
- <li key={item.key || index}>{item}</li>
6
- ));
7
-
8
- const className = "font-serif text-lg list-inside";
9
-
10
- return ordered ? (
11
- <ol className={`${className} list-decimal`}>{itemElements}</ol>
12
- ) : (
13
- <ul className={`${className} list-disc`}>{itemElements}</ul>
14
- );
15
- };
16
-
17
- export default ListItems;
@@ -1,91 +0,0 @@
1
- import React from "react";
2
-
3
- const Modal = ({
4
- isVisible,
5
- onClose,
6
- title,
7
- buttonTextPrimary,
8
- buttonTextSecondary,
9
- content,
10
- children = null,
11
- }) => {
12
- if (!isVisible) {
13
- return null;
14
- }
15
-
16
- return (
17
- <div
18
- className="fixed inset-0 z-10 overflow-y-auto"
19
- aria-labelledby="modal-title"
20
- role="dialog"
21
- aria-modal="true"
22
- >
23
- <div
24
- className="flex items-end justify-center min-h-screen px-4 pt-4 pb-20 text-center sm:block sm:p-0"
25
- onClick={onClose}
26
- >
27
- <div
28
- className="fixed inset-0 transition-opacity bg-gray-500 bg-opacity-50"
29
- aria-hidden="true"
30
- ></div>
31
-
32
- <span
33
- className="hidden sm:inline-block sm:align-middle sm:h-screen"
34
- aria-hidden="true"
35
- >
36
- &#8203;
37
- </span>
38
-
39
- <div
40
- className="inline-block overflow-hidden text-left align-bottom transition-all transform bg-white rounded shadow-xl sm:my-8 sm:align-middle sm:max-w-lg"
41
- onClick={(e) => e.stopPropagation()}
42
- >
43
- {title || content ? (
44
- <div className="px-4 pt-5 pb-4 bg-white sm:p-6 sm:pb-4">
45
- <div className="sm:flex sm:items-start">
46
- <div className="mt-3 text-center sm:mt-0 sm:text-left">
47
- {title ? (
48
- <h3
49
- className="text-lg font-medium leading-6 text-gray-900"
50
- id="modal-title"
51
- >
52
- {title}
53
- </h3>
54
- ) : null}
55
- {content ? (
56
- <div className="mt-2">
57
- <p className="text-sm text-gray-500">{content}</p>
58
- </div>
59
- ) : null}
60
- </div>
61
- </div>
62
- </div>
63
- ) : null}
64
- {children}
65
- {buttonTextPrimary || buttonTextSecondary ? (
66
- <div className="px-4 py-3 bg-gray-50 sm:px-6 sm:flex sm:flex-row-reverse">
67
- {buttonTextPrimary ? (
68
- <button
69
- type="button"
70
- className="inline-flex justify-center w-full px-4 py-2 text-base font-medium text-white bg-red-600 border border-transparent rounded-md shadow-sm hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm"
71
- >
72
- {buttonTextPrimary}
73
- </button>
74
- ) : null}
75
- {buttonTextSecondary ? (
76
- <button
77
- type="button"
78
- className="inline-flex justify-center w-full px-4 py-2 mt-3 text-base font-medium text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm"
79
- >
80
- {buttonTextSecondary}
81
- </button>
82
- ) : null}
83
- </div>
84
- ) : null}
85
- </div>
86
- </div>
87
- </div>
88
- );
89
- };
90
-
91
- export default Modal;
package/src/Common/Tab.js DELETED
@@ -1,79 +0,0 @@
1
- import React from "react";
2
- import { NavLink } from "react-router-dom";
3
- import classnames from "classnames";
4
-
5
- const noop = () => {};
6
-
7
- const TAB_SIZES = { large: "large", default: "default" };
8
-
9
- const Tab = ({
10
- children,
11
- size,
12
- noUnderline,
13
- className = "",
14
- ...otherProps
15
- }) => {
16
- return (
17
- <div
18
- className={classnames(
19
- {
20
- "neeto-ui-tab__wrapper flex": true,
21
- },
22
- {
23
- "neeto-ui-tab__wrapper--size-large": size === TAB_SIZES.large,
24
- },
25
- {
26
- "neeto-ui-tab__wrapper--underline-none": noUnderline,
27
- },
28
- [className]
29
- )}
30
- data-cy="tab-container"
31
- {...otherProps}
32
- >
33
- {children}
34
- </div>
35
- );
36
- };
37
-
38
- const Item = ({
39
- active,
40
- className = "",
41
- children,
42
- icon = null,
43
- onClick = noop,
44
- activeClassName = "",
45
- ...otherProps
46
- }) => {
47
- let Parent = "button";
48
- let Icon =
49
- typeof icon == "string"
50
- ? () => <i className={icon} data-cy="tab-item-icon" />
51
- : icon || React.Fragment;
52
-
53
- if (activeClassName) {
54
- Parent = NavLink;
55
- }
56
- return (
57
- <Parent
58
- className={classnames(
59
- [
60
- "neeto-ui-tab flex items-center justify-center select-none",
61
- className,
62
- ],
63
- {
64
- active: active,
65
- }
66
- )}
67
- onClick={onClick}
68
- data-cy="tab-item"
69
- {...otherProps}
70
- >
71
- {icon && <Icon className="neeto-ui-tab__icon" />}
72
- {children}
73
- </Parent>
74
- );
75
- };
76
-
77
- Tab.Item = Item;
78
-
79
- export default Tab;
@@ -1,37 +0,0 @@
1
- import React from "react";
2
- import Tippy from "@tippyjs/react";
3
- import { followCursor } from "tippy.js";
4
-
5
- const Tooltip = ({
6
- content,
7
- children,
8
- theme = "dark",
9
- disabled = false,
10
- placement, // Remove this prop once this prop is migrated to position in all neeto products
11
- position = "auto",
12
- interactive = false,
13
- ...otherProps
14
- }) => {
15
- return (
16
- <Tippy
17
- role="tooltip"
18
- theme={theme}
19
- content={content}
20
- arrow={
21
- "<svg width='10' height='5' viewBox='0 0 10 5' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M10 5H0.926697L3.95208 1.63847C4.74227 0.760478 6.11722 0.754951 6.91445 1.62656L10 5Z' /></svg>"
22
- }
23
- disabled={disabled}
24
- animation={"scale-subtle"}
25
- placement={placement || position}
26
- plugins={[followCursor]}
27
- interactive={interactive}
28
- duration={[100, 200]}
29
- zIndex={100001}
30
- {...otherProps}
31
- >
32
- {children}
33
- </Tippy>
34
- );
35
- };
36
-
37
- export default Tooltip;
@@ -1,92 +0,0 @@
1
- import React from "react";
2
- import classnames from "classnames";
3
- import { BubbleMenu } from "@tiptap/react";
4
- import {
5
- TextBold,
6
- TextItalic,
7
- TextCross,
8
- Link,
9
- Code,
10
- Highlight,
11
- } from "@bigbinary/neeto-icons";
12
- import { roundArrow } from "tippy.js";
13
- import "tippy.js/dist/svg-arrow.css";
14
-
15
- export default function index({ editor, formatterOptions }) {
16
- if (!editor) {
17
- return null;
18
- }
19
- const options = [
20
- {
21
- Icon: TextBold,
22
- command: () => editor.chain().focus().toggleBold().run(),
23
- active: editor.isActive("bold"),
24
- optionName: "bold",
25
- },
26
- {
27
- Icon: TextItalic,
28
- command: () => editor.chain().focus().toggleItalic().run(),
29
- active: editor.isActive("italic"),
30
- optionName: "italic",
31
- },
32
- {
33
- Icon: TextCross,
34
- command: () => editor.chain().focus().toggleStrike().run(),
35
- active: editor.isActive("strike"),
36
- optionName: "strike",
37
- },
38
- {
39
- Icon: Link,
40
- command: () => {
41
- if (editor.isActive("link")) {
42
- editor.chain().focus().unsetLink().run();
43
- } else {
44
- const url = window.prompt("Please enter your URL");
45
- editor.chain().focus().setLink({ href: url }).run();
46
- }
47
- },
48
- active: editor.isActive("link"),
49
- optionName: "link",
50
- },
51
- {
52
- Icon: Code,
53
- command: () => editor.chain().focus().toggleCode().run(),
54
- active: editor.isActive("code"),
55
- optionName: "code",
56
- },
57
- {
58
- Icon: Highlight,
59
- command: () => editor.chain().focus().toggleHighlight().run(),
60
- active: editor.isActive("highlight"),
61
- optionName: "highlight",
62
- },
63
- ];
64
- return (
65
- <BubbleMenu
66
- editor={editor}
67
- tippyOptions={{ arrow: roundArrow }}
68
- className="relative flex overflow-hidden rounded shadow editor-command-list--root"
69
- >
70
- {options
71
- .filter(({ optionName }) => formatterOptions.includes(optionName))
72
- .map((option) => (
73
- <Option {...option} key={option.optionName} />
74
- ))}
75
- </BubbleMenu>
76
- );
77
- }
78
-
79
- const Option = ({ Icon, command, active, iconSize }) => (
80
- <div
81
- className={classnames(
82
- "p-3 cursor-pointer editor-command-list--item transition-colors",
83
- {
84
- "text-gray-400": !active,
85
- "text-white": active,
86
- }
87
- )}
88
- onClick={command}
89
- >
90
- <Icon size={iconSize || 24} />
91
- </div>
92
- );
@@ -1,12 +0,0 @@
1
- import React from "react";
2
- import { NodeViewWrapper, NodeViewContent } from "@tiptap/react";
3
-
4
- export default function index() {
5
- return (
6
- <NodeViewWrapper>
7
- <pre>
8
- <NodeViewContent as="code" />
9
- </pre>
10
- </NodeViewWrapper>
11
- );
12
- }
@@ -1,10 +0,0 @@
1
- import CodeBlockLowlight from "@tiptap/extension-code-block-lowlight";
2
- import { ReactNodeViewRenderer } from "@tiptap/react";
3
- import CodeBlockComponent from "./CodeBlockComponent";
4
- import lowlight from "lowlight";
5
-
6
- export default CodeBlockLowlight.extend({
7
- addNodeView() {
8
- return new ReactNodeViewRenderer(CodeBlockComponent);
9
- },
10
- }).configure({ lowlight });
@@ -1,72 +0,0 @@
1
- import { Node, mergeAttributes } from "@tiptap/core";
2
-
3
- export default Node.create({
4
- name: "external-video",
5
-
6
- addOptions() {
7
- return {
8
- inline: false,
9
- HTMLAttributes: {},
10
- };
11
- },
12
-
13
- inline() {
14
- return this.options.inline;
15
- },
16
-
17
- group() {
18
- return this.options.inline ? "inline" : "block";
19
- },
20
-
21
- draggable: true,
22
-
23
- addAttributes() {
24
- return {
25
- src: {
26
- default: null,
27
- },
28
- title: {
29
- default: null,
30
- },
31
- frameborder: {
32
- default: "0",
33
- },
34
- allow: {
35
- default:
36
- "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
37
- },
38
- allowfullscreen: {
39
- default: "allowfullscreen",
40
- },
41
- };
42
- },
43
-
44
- parseHTML() {
45
- return [
46
- {
47
- tag: "iframe[src]",
48
- },
49
- ];
50
- },
51
-
52
- renderHTML({ HTMLAttributes }) {
53
- return [
54
- "div",
55
- { class: "video-wrapper" },
56
- ["iframe", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)],
57
- ];
58
- },
59
-
60
- addCommands() {
61
- return {
62
- setExternalVideo:
63
- (options) =>
64
- ({ commands }) => {
65
- return commands.insertContent({
66
- type: this.name,
67
- attrs: options,
68
- });
69
- },
70
- };
71
- },
72
- });
@@ -1,32 +0,0 @@
1
- import React from "react";
2
-
3
- import { TextSize } from "@bigbinary/neeto-icons";
4
-
5
- import { ICON_COLOR_ACTIVE, MENU_ICON_SIZE } from "./constants";
6
- import Dropdown from "common/Dropdown";
7
-
8
- const FontSizeOption = ({ onChange }) => {
9
- const options = [
10
- { label: <h2 className="text-xl font-medium">Large</h2>, value: "large" },
11
- { label: <h3 className="text-lg">Medium</h3>, value: "medium" },
12
- { label: <span className="text-sm">Normal</span>, value: "normal" },
13
- ];
14
-
15
- return (
16
- <Dropdown
17
- customTarget={() => (
18
- <button className="h-full p-3 transition-colors editor-fixed-menu--item">
19
- <TextSize size={MENU_ICON_SIZE} color={ICON_COLOR_ACTIVE} />
20
- </button>
21
- )}
22
- >
23
- {options.map(({ label, className, value }) => (
24
- <li className={className} onClick={() => onChange(value)} key={value}>
25
- {label}
26
- </li>
27
- ))}
28
- </Dropdown>
29
- );
30
- };
31
-
32
- export default FontSizeOption;
@@ -1,29 +0,0 @@
1
- import React, { useRef } from "react";
2
-
3
- import { TextColor } from "common/Icons";
4
- import { ICON_COLOR_ACTIVE, MENU_ICON_SIZE } from "./constants";
5
-
6
- const TextColorOption = ({ color = "#000", onChange }) => {
7
- const colorInputRef = useRef();
8
-
9
- return (
10
- <div
11
- onClick={() => colorInputRef.current?.click()}
12
- className="flex items-center justify-center p-3 transition-colors cursor-pointer editor-fixed-menu--item"
13
- >
14
- <TextColor
15
- size={MENU_ICON_SIZE}
16
- underlineColor={color}
17
- color={ICON_COLOR_ACTIVE}
18
- />
19
- <input
20
- ref={colorInputRef}
21
- type="color"
22
- className="invisible w-0 h-0"
23
- onChange={(event) => onChange && onChange(event.target.value)}
24
- />
25
- </div>
26
- );
27
- };
28
-
29
- export default TextColorOption;
@@ -1,3 +0,0 @@
1
- export const MENU_ICON_SIZE = 24;
2
- export const ICON_COLOR_ACTIVE = "#2F3941";
3
- export const ICON_COLOR_INACTIVE = "#87929D";