playbook_ui 12.21.0.pre.alpha.PLAY807RTEcustomtoolbar680 → 12.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_docs/kit_example.html.erb +19 -23
- data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/Toolbar.tsx +2 -10
- data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarDropdown.tsx +0 -10
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +2 -4
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/index.js +1 -2
- data/lib/playbook/version.rb +2 -2
- metadata +7 -10
- data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx +0 -69
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_more_extensions.jsx +0 -55
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_more_extensions.md +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1649557cda106585da9087061c3e7e8017578aed64a96820b78ff08ae29b357a
|
4
|
+
data.tar.gz: 7969b004419abdc3a207667de30b50439a42559d00ad1c9144755074932aa2e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cad804b80ced6b0f966c72f7e35a02e782898b03ed8b789120ac8662f6c88c293f63f4b5cc5970916bc91aa0be3a182d42d17e365c79ca07b4f5500edf3aa348
|
7
|
+
data.tar.gz: f8abc54b2526773eb5bdb0244f157a23f27cda78ea88029b59261c4d58938761b0d9eaa9cadce84ea31ffafc23c9a8ff6cb5c09914dcf294b9a74664ab6bddd7
|
@@ -46,29 +46,25 @@
|
|
46
46
|
|
47
47
|
<script>
|
48
48
|
var htmlButton = document.getElementById('<%= "copy-html-#{example_key}" %>')
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
})
|
56
|
-
}
|
49
|
+
htmlButton.addEventListener('click', function() {
|
50
|
+
var tempElement = document.createElement('div')
|
51
|
+
tempElement.innerHTML = `<%= example_html %>`
|
52
|
+
var decodedString = tempElement.textContent || tempElement.innerText;
|
53
|
+
copyContent(decodedString)
|
54
|
+
})
|
57
55
|
|
58
56
|
var button = document.getElementById('<%= "copy-button-#{example_key}" %>')
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
})
|
73
|
-
}
|
57
|
+
button.addEventListener('click', function() {
|
58
|
+
var tempElement = document.createElement('div')
|
59
|
+
tempElement.innerHTML = `<%= source %>`
|
60
|
+
var decodedString = tempElement.textContent || tempElement.innerText;
|
61
|
+
copyContent(decodedString)
|
62
|
+
var fadeAwayDiv = document.getElementById("<%= "tooltip-#{example_key}" %>")
|
63
|
+
setTimeout(function() {
|
64
|
+
fadeAwayDiv.classList.remove('show')
|
65
|
+
}, 3000)
|
66
|
+
setTimeout(function() {
|
67
|
+
fadeAwayDiv.classList.add('hide')
|
68
|
+
}, 3001)
|
69
|
+
})
|
74
70
|
</script>
|
@@ -9,9 +9,8 @@ import ToolbarDropdown from "./ToolbarDropdown";
|
|
9
9
|
import ToolbarNodes from "./ToolbarNodes";
|
10
10
|
import { ToolbarTypes } from "./EditorTypes";
|
11
11
|
import ToolbarHistoryItems from "./ToolbarHistory";
|
12
|
-
import MoreExtensionsDropdown from "./MoreExtensionsDropdown";
|
13
12
|
|
14
|
-
const EditorToolbar = ({ editor
|
13
|
+
const EditorToolbar = ({ editor }:any) => {
|
15
14
|
const toolbaritems = [
|
16
15
|
{
|
17
16
|
icon: "bold",
|
@@ -52,17 +51,10 @@ const EditorToolbar = ({ editor, extensions }:any) => {
|
|
52
51
|
)}
|
53
52
|
<SectionSeparator orientation="vertical" />
|
54
53
|
<ToolbarNodes editor={editor} />
|
55
|
-
{
|
56
|
-
extensions && (
|
57
|
-
<>
|
58
|
-
<MoreExtensionsDropdown extensions={extensions}/>
|
59
|
-
</>
|
60
|
-
)
|
61
|
-
}
|
62
|
-
|
63
54
|
</FlexItem>
|
64
55
|
<ToolbarHistoryItems editor={editor} />
|
65
56
|
</Flex>
|
57
|
+
{/* <SectionSeparator /> */}
|
66
58
|
</Background>
|
67
59
|
);
|
68
60
|
};
|
@@ -98,17 +98,7 @@ const popoverReference = (
|
|
98
98
|
activeCount === 2 ? (
|
99
99
|
activeItems[1]
|
100
100
|
) : (
|
101
|
-
activeCount === 1 ? (
|
102
101
|
activeItems[0] || null
|
103
|
-
) : (
|
104
|
-
<Flex align="center" key="paragraph" gap="xs">
|
105
|
-
<Icon icon="paragraph" size="lg" />
|
106
|
-
<div>Paragraph</div>
|
107
|
-
<Flex className={showPopover ? "fa-flip-vertical" : ""} display="inline_flex">
|
108
|
-
<Icon fixedWidth icon="angle-down" margin-left="xs" />
|
109
|
-
</Flex>
|
110
|
-
</Flex>
|
111
|
-
)
|
112
102
|
)
|
113
103
|
}
|
114
104
|
</Button>
|
@@ -35,8 +35,7 @@ type RichTextEditorProps = {
|
|
35
35
|
data?: { [key: string]: string },
|
36
36
|
focus?: boolean,
|
37
37
|
id?: string,
|
38
|
-
inline?: boolean,
|
39
|
-
extensions?: { [key: string]: string }[],
|
38
|
+
inline?: boolean,
|
40
39
|
name?: string,
|
41
40
|
onChange: (html: string, text: string) => void,
|
42
41
|
placeholder?: string,
|
@@ -57,7 +56,6 @@ const RichTextEditor = (props: RichTextEditorProps) => {
|
|
57
56
|
data = {},
|
58
57
|
focus = false,
|
59
58
|
inline = false,
|
60
|
-
extensions,
|
61
59
|
name,
|
62
60
|
onChange = noop,
|
63
61
|
placeholder,
|
@@ -164,7 +162,7 @@ const RichTextEditor = (props: RichTextEditorProps) => {
|
|
164
162
|
{
|
165
163
|
advancedEditor ? (
|
166
164
|
<div className='pb_rich_text_editor_advanced_container'>
|
167
|
-
<EditorToolbar
|
165
|
+
<EditorToolbar editor={advancedEditor}/>
|
168
166
|
{ children }
|
169
167
|
</div>
|
170
168
|
) : (
|
@@ -14,7 +14,6 @@ examples:
|
|
14
14
|
react:
|
15
15
|
- rich_text_editor_default: Default
|
16
16
|
- rich_text_editor_advanced_default: Advanced Default
|
17
|
-
- rich_text_editor_more_extensions: Advanced (Extra Extensions)
|
18
17
|
- rich_text_editor_simple: Simple
|
19
18
|
- rich_text_editor_attributes: Attributes
|
20
19
|
- rich_text_editor_focus: Focus
|
@@ -7,5 +7,4 @@ export { default as RichTextEditorTemplates } from './_rich_text_editor_template
|
|
7
7
|
export { default as RichTextEditorToolbarBottom } from './_rich_text_editor_toolbar_bottom.jsx'
|
8
8
|
export { default as RichTextEditorInline } from './_rich_text_editor_inline.jsx'
|
9
9
|
export { default as RichTextEditorPreview } from './_rich_text_editor_preview.jsx'
|
10
|
-
export { default as RichTextEditorAdvancedDefault } from './_rich_text_editor_advanced_default.jsx'
|
11
|
-
export { default as RichTextEditorMoreExtensions } from './_rich_text_editor_more_extensions.jsx'
|
10
|
+
export { default as RichTextEditorAdvancedDefault } from './_rich_text_editor_advanced_default.jsx'
|
data/lib/playbook/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playbook_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 12.21.0
|
4
|
+
version: 12.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Power UX
|
8
8
|
- Power Devs
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-05-
|
12
|
+
date: 2023-05-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -1721,7 +1721,6 @@ files:
|
|
1721
1721
|
- app/pb_kits/playbook/pb_radio/radio.test.js
|
1722
1722
|
- app/pb_kits/playbook/pb_rich_text_editor/TipTap/EditorButton.tsx
|
1723
1723
|
- app/pb_kits/playbook/pb_rich_text_editor/TipTap/EditorTypes.ts
|
1724
|
-
- app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx
|
1725
1724
|
- app/pb_kits/playbook/pb_rich_text_editor/TipTap/Toolbar.tsx
|
1726
1725
|
- app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarDropdown.tsx
|
1727
1726
|
- app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarHistory.tsx
|
@@ -1741,8 +1740,6 @@ files:
|
|
1741
1740
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_focus.jsx
|
1742
1741
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_inline.html.erb
|
1743
1742
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_inline.jsx
|
1744
|
-
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_more_extensions.jsx
|
1745
|
-
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_more_extensions.md
|
1746
1743
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
|
1747
1744
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
|
1748
1745
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_simple.html.erb
|
@@ -2490,7 +2487,7 @@ homepage: http://playbook.powerapp.cloud
|
|
2490
2487
|
licenses:
|
2491
2488
|
- ISC
|
2492
2489
|
metadata: {}
|
2493
|
-
post_install_message:
|
2490
|
+
post_install_message:
|
2494
2491
|
rdoc_options: []
|
2495
2492
|
require_paths:
|
2496
2493
|
- lib
|
@@ -2501,12 +2498,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
2501
2498
|
version: '0'
|
2502
2499
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
2503
2500
|
requirements:
|
2504
|
-
- - "
|
2501
|
+
- - ">="
|
2505
2502
|
- !ruby/object:Gem::Version
|
2506
|
-
version:
|
2503
|
+
version: '0'
|
2507
2504
|
requirements: []
|
2508
2505
|
rubygems_version: 3.3.7
|
2509
|
-
signing_key:
|
2506
|
+
signing_key:
|
2510
2507
|
specification_version: 4
|
2511
2508
|
summary: Playbook Design System
|
2512
2509
|
test_files: []
|
@@ -1,69 +0,0 @@
|
|
1
|
-
import React, { useState } from 'react'
|
2
|
-
|
3
|
-
import Flex from '../../pb_flex/_flex'
|
4
|
-
import PbReactPopover from '../../pb_popover/_popover'
|
5
|
-
import Icon from '../../pb_icon/_icon'
|
6
|
-
import Nav from '../../pb_nav/_nav'
|
7
|
-
import NavItem from '../../pb_nav/_item'
|
8
|
-
|
9
|
-
const MoreExtensionsDropdown = ({extensions}: any) => {
|
10
|
-
const [showPopover, setShowPopover] = useState(false)
|
11
|
-
|
12
|
-
const handleTogglePopover = () => {
|
13
|
-
setShowPopover(true)
|
14
|
-
}
|
15
|
-
|
16
|
-
const handlePopoverClose = (shouldClosePopover: boolean) => {
|
17
|
-
setShowPopover(!shouldClosePopover)
|
18
|
-
}
|
19
|
-
|
20
|
-
|
21
|
-
const popoverReference = (
|
22
|
-
<button
|
23
|
-
className="toolbar_button"
|
24
|
-
onClick={handleTogglePopover}
|
25
|
-
>
|
26
|
-
<Flex
|
27
|
-
align="center"
|
28
|
-
className="toolbar_button_icon"
|
29
|
-
justify="center"
|
30
|
-
>
|
31
|
-
<Icon icon="ellipsis" size="lg" />
|
32
|
-
</Flex>
|
33
|
-
</button>
|
34
|
-
|
35
|
-
);
|
36
|
-
|
37
|
-
return (
|
38
|
-
<PbReactPopover
|
39
|
-
closeOnClick='outside'
|
40
|
-
padding='none'
|
41
|
-
placement="bottom"
|
42
|
-
reference={popoverReference}
|
43
|
-
shouldClosePopover={handlePopoverClose}
|
44
|
-
show={showPopover}
|
45
|
-
>
|
46
|
-
<Nav
|
47
|
-
paddingTop={extensions.length > 1 ? "xs" : "none"}
|
48
|
-
paddingBottom={extensions.length > 1 ? "xs" : "none"}
|
49
|
-
variant="subtle"
|
50
|
-
>
|
51
|
-
{extensions && extensions.map(({ icon, text, onclick, isActive}:any, index:number) => (
|
52
|
-
<NavItem
|
53
|
-
cursor="pointer"
|
54
|
-
className={`pb_tiptap_toolbar_dropdown_list_item ${isActive ? "is-active" : ""}`}
|
55
|
-
iconLeft={icon}
|
56
|
-
key={`${text}_${index}`}
|
57
|
-
margin='none'
|
58
|
-
onClick={()=> {onclick(); setShowPopover(false)}}
|
59
|
-
text={text}
|
60
|
-
paddingTop='xxs'
|
61
|
-
paddingBottom='xxs'
|
62
|
-
/>
|
63
|
-
))}
|
64
|
-
</Nav>
|
65
|
-
</PbReactPopover>
|
66
|
-
)
|
67
|
-
}
|
68
|
-
|
69
|
-
export default MoreExtensionsDropdown
|
@@ -1,55 +0,0 @@
|
|
1
|
-
import React from 'react'
|
2
|
-
import { RichTextEditor } from '../..'
|
3
|
-
import { useEditor, EditorContent } from "@tiptap/react"
|
4
|
-
import StarterKit from "@tiptap/starter-kit"
|
5
|
-
import Link from '@tiptap/extension-link'
|
6
|
-
|
7
|
-
import HorizontalRule from "@tiptap/extension-horizontal-rule"
|
8
|
-
import Highlight from '@tiptap/extension-highlight'
|
9
|
-
|
10
|
-
|
11
|
-
const RichTextEditorMoreExtensions = (props) => {
|
12
|
-
|
13
|
-
const editor = useEditor({
|
14
|
-
extensions: [
|
15
|
-
StarterKit,
|
16
|
-
Link,
|
17
|
-
HorizontalRule,
|
18
|
-
Highlight.configure({ multicolor: true })
|
19
|
-
],
|
20
|
-
content:"Add your text here. You can format your text, add links, quotes, and bullets."
|
21
|
-
})
|
22
|
-
if (!editor) {
|
23
|
-
return null
|
24
|
-
}
|
25
|
-
|
26
|
-
const ExtensionsList = [
|
27
|
-
{
|
28
|
-
icon: "horizontal-rule",
|
29
|
-
isActive: editor.isActive("horizontalRule"),
|
30
|
-
text: "Horizontal Rule",
|
31
|
-
onclick: () => editor.chain().focus().setHorizontalRule().run(),
|
32
|
-
},
|
33
|
-
{
|
34
|
-
icon: "highlighter",
|
35
|
-
isActive: editor.isActive("highlight"),
|
36
|
-
text: "Highlighter",
|
37
|
-
onclick: () => editor.chain().focus().toggleHighlight().run(),
|
38
|
-
}
|
39
|
-
]
|
40
|
-
|
41
|
-
|
42
|
-
return (
|
43
|
-
<div>
|
44
|
-
<RichTextEditor
|
45
|
-
advancedEditor={editor}
|
46
|
-
extensions={ExtensionsList}
|
47
|
-
{...props}
|
48
|
-
>
|
49
|
-
<EditorContent editor={editor}/>
|
50
|
-
</RichTextEditor>
|
51
|
-
</div>
|
52
|
-
)
|
53
|
-
}
|
54
|
-
|
55
|
-
export default RichTextEditorMoreExtensions
|
@@ -1,12 +0,0 @@
|
|
1
|
-
This variant allows you to optionally include any of [Tiptap’s 53 extensions](https://tiptap.dev/extensions) within any advanced editor by using the `extensions` prop.
|
2
|
-
|
3
|
-
__NOTE__: In order to leverage this prop, you __must__ install the extension you need in your project, import it and pass it to the extensions array as shown in this example with the HorizontalRule and the Highlight extensions.
|
4
|
-
|
5
|
-
In order to add the extension to the editor toolbar, create an array of objects (as shown in the ExtensionsList array in the example below). Each object in this array should include:
|
6
|
-
|
7
|
-
`icon`: the icon to display within the toolbar dropdown (any Fontawesome icons can be used)
|
8
|
-
`isActive`: sets the extension to active within the dropdown, when applicable
|
9
|
-
`text`: the label within the toolbar dropdown
|
10
|
-
`onclick`: initializes the extension when it’s clicked within the dropdown (snytax varies with extension, see Tiptap's docs for more information)
|
11
|
-
|
12
|
-
This array can then be passed to the `extensions` prop and all extensions in the array will be rendered in the ellipsis dropdown.
|