@squiz/formatted-text-editor 1.12.0-alpha.40 → 1.12.0-alpha.8
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 +3 -2
- package/lib/Editor/Editor.js +9 -3
- package/lib/EditorToolbar/EditorToolbar.js +3 -10
- package/lib/EditorToolbar/Tools/TextAlign/TextAlignButtons.js +1 -4
- package/lib/index.css +93 -803
- package/package.json +8 -12
- package/.eslintrc.json +0 -34
- package/CHANGELOG.md +0 -48
- package/build.js +0 -21
- package/cypress/e2e/bold.spec.cy.ts +0 -18
- package/cypress/global.d.ts +0 -9
- package/cypress/support/commands.ts +0 -130
- package/cypress/support/e2e.ts +0 -20
- package/cypress/tsconfig.json +0 -8
- package/cypress.config.ts +0 -7
- package/demo/App.tsx +0 -12
- package/demo/index.html +0 -13
- package/demo/index.scss +0 -1
- package/demo/main.tsx +0 -10
- package/demo/public/favicon-dxp.svg +0 -3
- package/demo/vite-env.d.ts +0 -1
- package/file-transformer.js +0 -1
- package/jest.config.ts +0 -27
- package/lib/EditorToolbar/Tools/Redo/RedoButton.d.ts +0 -2
- package/lib/EditorToolbar/Tools/Redo/RedoButton.js +0 -16
- package/lib/EditorToolbar/Tools/TextType/Heading/HeadingButton.d.ts +0 -5
- package/lib/EditorToolbar/Tools/TextType/Heading/HeadingButton.js +0 -32
- package/lib/EditorToolbar/Tools/TextType/Paragraph/ParagraphButton.d.ts +0 -2
- package/lib/EditorToolbar/Tools/TextType/Paragraph/ParagraphButton.js +0 -17
- package/lib/EditorToolbar/Tools/TextType/Preformatted/PreformattedButton.d.ts +0 -2
- package/lib/EditorToolbar/Tools/TextType/Preformatted/PreformattedButton.js +0 -16
- package/lib/EditorToolbar/Tools/TextType/TextTypeDropdown.d.ts +0 -2
- package/lib/EditorToolbar/Tools/TextType/TextTypeDropdown.js +0 -35
- package/lib/EditorToolbar/Tools/Undo/UndoButton.d.ts +0 -2
- package/lib/EditorToolbar/Tools/Undo/UndoButton.js +0 -16
- package/lib/Extensions/Extensions.d.ts +0 -3
- package/lib/Extensions/Extensions.js +0 -13
- package/lib/Extensions/PreformattedExtension/PreformattedExtension.d.ts +0 -10
- package/lib/Extensions/PreformattedExtension/PreformattedExtension.js +0 -46
- package/lib/ui/DropdownButton/DropdownButton.d.ts +0 -9
- package/lib/ui/DropdownButton/DropdownButton.js +0 -8
- package/lib/ui/ToolbarDropdown/ToolbarDropdown.d.ts +0 -7
- package/lib/ui/ToolbarDropdown/ToolbarDropdown.js +0 -12
- package/postcss.config.js +0 -3
- package/src/Editor/Editor.mock.tsx +0 -40
- package/src/Editor/Editor.spec.tsx +0 -254
- package/src/Editor/Editor.tsx +0 -32
- package/src/Editor/_editor.scss +0 -75
- package/src/EditorToolbar/EditorToolbar.tsx +0 -51
- package/src/EditorToolbar/Tools/Bold/BoldButton.spec.tsx +0 -19
- package/src/EditorToolbar/Tools/Bold/BoldButton.tsx +0 -30
- package/src/EditorToolbar/Tools/Italic/ItalicButton.spec.tsx +0 -19
- package/src/EditorToolbar/Tools/Italic/ItalicButton.tsx +0 -30
- package/src/EditorToolbar/Tools/Redo/RedoButton.spec.tsx +0 -59
- package/src/EditorToolbar/Tools/Redo/RedoButton.tsx +0 -30
- package/src/EditorToolbar/Tools/TextAlign/CenterAlign/CenterAlignButton.tsx +0 -31
- package/src/EditorToolbar/Tools/TextAlign/JustifyAlign/JustifyAlignButton.tsx +0 -31
- package/src/EditorToolbar/Tools/TextAlign/LeftAlign/LeftAlignButton.tsx +0 -31
- package/src/EditorToolbar/Tools/TextAlign/RightAlign/RightAlignButton.tsx +0 -31
- package/src/EditorToolbar/Tools/TextAlign/TextAlignButtons.tsx +0 -21
- package/src/EditorToolbar/Tools/TextType/Heading/HeadingButton.tsx +0 -52
- package/src/EditorToolbar/Tools/TextType/Paragraph/ParagraphButton.tsx +0 -26
- package/src/EditorToolbar/Tools/TextType/Preformatted/PreformattedButton.tsx +0 -30
- package/src/EditorToolbar/Tools/TextType/TextTypeDropdown.tsx +0 -44
- package/src/EditorToolbar/Tools/Underline/Underline.spec.tsx +0 -19
- package/src/EditorToolbar/Tools/Underline/UnderlineButton.tsx +0 -30
- package/src/EditorToolbar/Tools/Undo/UndoButton.spec.tsx +0 -49
- package/src/EditorToolbar/Tools/Undo/UndoButton.tsx +0 -30
- package/src/EditorToolbar/_editor-toolbar.scss +0 -19
- package/src/Extensions/Extensions.tsx +0 -24
- package/src/Extensions/PreformattedExtension/PreformattedExtension.tsx +0 -50
- package/src/FormattedTextEditor.spec.tsx +0 -10
- package/src/FormattedTextEditor.tsx +0 -12
- package/src/index.scss +0 -15
- package/src/index.ts +0 -3
- package/src/ui/DropdownButton/DropdownButton.tsx +0 -28
- package/src/ui/DropdownButton/_dropdown-button.scss +0 -7
- package/src/ui/ToolbarButton/ToolbarButton.tsx +0 -26
- package/src/ui/ToolbarButton/_toolbar-button.scss +0 -37
- package/src/ui/ToolbarDropdown/ToolbarDropdown.tsx +0 -32
- package/src/ui/ToolbarDropdown/_toolbar-dropdown.scss +0 -27
- package/tailwind.config.cjs +0 -62
- package/tsconfig.json +0 -22
- package/vite.config.ts +0 -19
@@ -1,28 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import CheckIcon from '@mui/icons-material/Check';
|
3
|
-
|
4
|
-
type DropdownButtonProps = {
|
5
|
-
children?: JSX.Element;
|
6
|
-
handleOnClick: () => void;
|
7
|
-
isDisabled: boolean;
|
8
|
-
isActive: boolean;
|
9
|
-
label: string;
|
10
|
-
};
|
11
|
-
|
12
|
-
const DropdownButton = ({ children, handleOnClick, isDisabled, isActive, label }: DropdownButtonProps) => {
|
13
|
-
return (
|
14
|
-
<button
|
15
|
-
aria-label={label}
|
16
|
-
title={label}
|
17
|
-
type="button"
|
18
|
-
onClick={handleOnClick}
|
19
|
-
disabled={isDisabled}
|
20
|
-
className={`btn dropdown-button ${isActive ? 'is-active' : ''}`}
|
21
|
-
>
|
22
|
-
<span>{children || label}</span>
|
23
|
-
{isActive && <CheckIcon className="dropdown-button-icon" />}
|
24
|
-
</button>
|
25
|
-
);
|
26
|
-
};
|
27
|
-
|
28
|
-
export default DropdownButton;
|
@@ -1,26 +0,0 @@
|
|
1
|
-
import React, { ReactElement } from 'react';
|
2
|
-
|
3
|
-
type ToolbarButtonProps = {
|
4
|
-
handleOnClick: () => void;
|
5
|
-
isDisabled: boolean;
|
6
|
-
isActive: boolean;
|
7
|
-
icon: ReactElement;
|
8
|
-
label: string;
|
9
|
-
};
|
10
|
-
|
11
|
-
const ToolbarButton = ({ handleOnClick, isDisabled, isActive, icon, label }: ToolbarButtonProps) => {
|
12
|
-
return (
|
13
|
-
<button
|
14
|
-
aria-label={label}
|
15
|
-
title={label}
|
16
|
-
type="button"
|
17
|
-
onClick={handleOnClick}
|
18
|
-
disabled={isDisabled}
|
19
|
-
className={`btn toolbar-button ${isActive ? 'is-active' : ''}`}
|
20
|
-
>
|
21
|
-
{icon}
|
22
|
-
</button>
|
23
|
-
);
|
24
|
-
};
|
25
|
-
|
26
|
-
export default ToolbarButton;
|
@@ -1,37 +0,0 @@
|
|
1
|
-
.btn {
|
2
|
-
@apply font-normal rounded;
|
3
|
-
display: flex;
|
4
|
-
align-items: center;
|
5
|
-
text-align: center;
|
6
|
-
white-space: nowrap;
|
7
|
-
vertical-align: middle;
|
8
|
-
touch-action: manipulation;
|
9
|
-
cursor: pointer;
|
10
|
-
background-image: none;
|
11
|
-
border: 1px solid transparent;
|
12
|
-
|
13
|
-
&:active,
|
14
|
-
&:hover,
|
15
|
-
&:focus {
|
16
|
-
background-color: rgba(black, 0.04);
|
17
|
-
}
|
18
|
-
|
19
|
-
&.disabled,
|
20
|
-
&[disabled] {
|
21
|
-
cursor: not-allowed;
|
22
|
-
@apply opacity-50;
|
23
|
-
}
|
24
|
-
}
|
25
|
-
|
26
|
-
.toolbar-button {
|
27
|
-
@apply bg-white text-gray-600 p-1;
|
28
|
-
|
29
|
-
~ .toolbar-button {
|
30
|
-
margin-left: 2px;
|
31
|
-
}
|
32
|
-
|
33
|
-
&.is-active,
|
34
|
-
&:active {
|
35
|
-
@apply text-blue-300 bg-blue-100;
|
36
|
-
}
|
37
|
-
}
|
@@ -1,32 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
3
|
-
import 'flowbite';
|
4
|
-
|
5
|
-
type ToolbarDropdownProps = {
|
6
|
-
children: JSX.Element | JSX.Element[];
|
7
|
-
label: string;
|
8
|
-
};
|
9
|
-
|
10
|
-
const ToolbarDropdown = ({ children, label }: ToolbarDropdownProps) => {
|
11
|
-
return (
|
12
|
-
<>
|
13
|
-
<button
|
14
|
-
id="dropdownHoverButton"
|
15
|
-
data-dropdown-toggle="dropdown"
|
16
|
-
className="toolbar-dropdown__button"
|
17
|
-
type="button"
|
18
|
-
>
|
19
|
-
<span className="toolbar-dropdown__label">{label}</span>
|
20
|
-
<ExpandMoreIcon className="toolbar-dropdown__icon" aria-hidden="true" />
|
21
|
-
</button>
|
22
|
-
<div
|
23
|
-
id="dropdown"
|
24
|
-
className="toolbar-dropdown__menu z-10 hidden bg-white divide-y divide-gray-100 rounded-lg shadow w-169 dark:bg-gray-700"
|
25
|
-
>
|
26
|
-
<ul aria-labelledby="dropdownHoverButton">{children}</ul>
|
27
|
-
</div>
|
28
|
-
</>
|
29
|
-
);
|
30
|
-
};
|
31
|
-
|
32
|
-
export default ToolbarDropdown;
|
@@ -1,27 +0,0 @@
|
|
1
|
-
.toolbar-dropdown__button {
|
2
|
-
@apply font-base text-md font-semibold text-gray-600;
|
3
|
-
align-self: center;
|
4
|
-
|
5
|
-
height: 2rem;
|
6
|
-
padding-left: 0.5rem;
|
7
|
-
|
8
|
-
&:active,
|
9
|
-
&:hover,
|
10
|
-
&:focus {
|
11
|
-
background-color: rgba(black, 0.04);
|
12
|
-
}
|
13
|
-
|
14
|
-
.toolbar-dropdown__label {
|
15
|
-
display: inline-flex;
|
16
|
-
width: 7rem;
|
17
|
-
}
|
18
|
-
|
19
|
-
.toolbar-dropdown__icon {
|
20
|
-
width: 1rem;
|
21
|
-
height: 1.5rem;
|
22
|
-
}
|
23
|
-
}
|
24
|
-
|
25
|
-
.toolbar-dropdown__menu {
|
26
|
-
inset: 0rem auto auto 1rem !important;
|
27
|
-
}
|
package/tailwind.config.cjs
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
/** @type {import('tailwindcss').Config} */
|
2
|
-
module.exports = {
|
3
|
-
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}', './node_modules/flowbite/**/*.js'],
|
4
|
-
theme: {
|
5
|
-
extend: {
|
6
|
-
borderRadius: {
|
7
|
-
DEFAULT: '4px',
|
8
|
-
md: '6px',
|
9
|
-
},
|
10
|
-
fontFamily: {
|
11
|
-
base: 'Open Sans, Arial, sans-serif',
|
12
|
-
},
|
13
|
-
fontWeight: {
|
14
|
-
normal: '400',
|
15
|
-
medium: '500',
|
16
|
-
semibold: '600',
|
17
|
-
bold: '700',
|
18
|
-
},
|
19
|
-
fontSize: {
|
20
|
-
xlg: '1.125rem',
|
21
|
-
lg: '1rem',
|
22
|
-
md: '0.875rem',
|
23
|
-
sm: '0.8125rem',
|
24
|
-
},
|
25
|
-
boxShadow: {
|
26
|
-
outline: '0 0 0 1px rgba(0,0,0,0.10)',
|
27
|
-
sm: '0 0 0 1px rgba(0,0,0,0.04), 0 1px 4px 2px rgba(0,0,0,0.08)',
|
28
|
-
DEFAULT: '0 0 0 1px rgba(0,0,0,0.04), 0 1px 12px 4px rgba(0,0,0,0.12)',
|
29
|
-
md: '0 0 0 1px rgba(0,0,0,0.04), 0 1px 12px 4px rgba(0,0,0,0.12)',
|
30
|
-
lg: '0 0 0 1px rgba(0,0,0,0.04), 0 1px 24px 12px rgba(0,0,0,0.12)',
|
31
|
-
inner: 'inset 0 2px 4px 0 rgb(0 0 0 / 0.05)',
|
32
|
-
none: 'none',
|
33
|
-
},
|
34
|
-
spacing: {
|
35
|
-
1: '0.25rem', // 4px
|
36
|
-
2: '0.5rem', // 8px
|
37
|
-
3: '0.75rem', // 12px
|
38
|
-
4: '1rem', // 16px
|
39
|
-
5: '1.25rem', // 20px
|
40
|
-
6: '1.5rem', // 24px
|
41
|
-
7: '1.75rem', // 28px
|
42
|
-
8: '2rem', // 32px
|
43
|
-
169: '169px', // 169px
|
44
|
-
},
|
45
|
-
colors: {
|
46
|
-
gray: {
|
47
|
-
200: '#ededed',
|
48
|
-
300: '#e0e0e0',
|
49
|
-
600: '#707070',
|
50
|
-
},
|
51
|
-
blue: {
|
52
|
-
100: '#e6f1fa',
|
53
|
-
300: '#0774d2',
|
54
|
-
},
|
55
|
-
orange: {
|
56
|
-
100: '#dadbe9',
|
57
|
-
},
|
58
|
-
},
|
59
|
-
},
|
60
|
-
},
|
61
|
-
plugins: [require('flowbite/plugin')],
|
62
|
-
};
|
package/tsconfig.json
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"compilerOptions": {
|
3
|
-
"target": "ESNext",
|
4
|
-
"useDefineForClassFields": true,
|
5
|
-
"experimentalDecorators": true,
|
6
|
-
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
7
|
-
"allowJs": false,
|
8
|
-
"skipLibCheck": true,
|
9
|
-
"esModuleInterop": true,
|
10
|
-
"allowSyntheticDefaultImports": true,
|
11
|
-
"strict": true,
|
12
|
-
"forceConsistentCasingInFileNames": true,
|
13
|
-
"module": "ESNext",
|
14
|
-
"moduleResolution": "Node",
|
15
|
-
"resolveJsonModule": true,
|
16
|
-
"isolatedModules": true,
|
17
|
-
"jsx": "react",
|
18
|
-
"declaration": true,
|
19
|
-
"outDir": "./lib"
|
20
|
-
},
|
21
|
-
"files": ["src/index.ts"]
|
22
|
-
}
|
package/vite.config.ts
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
import { defineConfig } from 'vite';
|
2
|
-
import react from '@vitejs/plugin-react';
|
3
|
-
|
4
|
-
// https://vitejs.dev/config/
|
5
|
-
export default defineConfig({
|
6
|
-
root: 'demo',
|
7
|
-
build: {
|
8
|
-
outDir: 'build/demo',
|
9
|
-
},
|
10
|
-
plugins: [
|
11
|
-
react({
|
12
|
-
babel: {
|
13
|
-
parserOpts: {
|
14
|
-
plugins: ['decorators-legacy'],
|
15
|
-
},
|
16
|
-
},
|
17
|
-
}),
|
18
|
-
],
|
19
|
-
});
|