playbook_ui 12.9.1.pre.alpha.menucleanup345 → 12.9.1.pre.alpha.play664tiptapinvestigation353
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{dist → app/pb_kits/playbook/data}/menu.yml +0 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.jsx +20 -8
- data/app/pb_kits/playbook/pb_rich_text_editor/_tiptap.jsx +66 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_tip_tap.jsx +15 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/index.js +1 -0
- data/lib/playbook/pb_doc_helper.rb +3 -8
- data/lib/playbook/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61ba9a2cef24c5fa7a495f102e609cc97cc72bff9274a72c997da47e96b160a7
|
4
|
+
data.tar.gz: 1d5afc2eb0c7c1db82403a81a129133714c6966d49689f27abf009308cdd62db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f983a47ce1cb184449bb35351735e60fbc6665325ac50326c91cf63a442cfe1ceb1e8b74b4f12f410e10a9de3cf85e20113a6b2b8581aa44f1a3376e6087eec7
|
7
|
+
data.tar.gz: f167f1101eb9b74e99b3b6cd51f59ac331dc54f4557ce3a8fe2383cc805540877ae41a3df8d6f288d6fcb2b08183ea6e5c961a4fda9410d70f32e69e4cd3b2f9
|
@@ -7,6 +7,7 @@ import inlineFocus from './inlineFocus'
|
|
7
7
|
import useFocus from './useFocus'
|
8
8
|
import { globalProps } from '../utilities/globalProps'
|
9
9
|
import { buildAriaProps, buildDataProps, noop } from '../utilities/props'
|
10
|
+
import PBTipTapEditor from './_tiptap'
|
10
11
|
|
11
12
|
try {
|
12
13
|
const Trix = require('trix')
|
@@ -20,6 +21,7 @@ import { TrixEditor } from "react-trix"
|
|
20
21
|
|
21
22
|
type RichTextEditorProps = {
|
22
23
|
aria?: object,
|
24
|
+
advanced?: Boolean,
|
23
25
|
toolbarBottom?: Boolean,
|
24
26
|
className?: string,
|
25
27
|
data?: object,
|
@@ -38,6 +40,7 @@ type RichTextEditorProps = {
|
|
38
40
|
const RichTextEditor = (props: RichTextEditorProps) => {
|
39
41
|
const {
|
40
42
|
aria = {},
|
43
|
+
advanced = false,
|
41
44
|
toolbarBottom = false,
|
42
45
|
className,
|
43
46
|
data = {},
|
@@ -145,14 +148,23 @@ const RichTextEditor = (props: RichTextEditorProps) => {
|
|
145
148
|
{...dataProps}
|
146
149
|
className={css}
|
147
150
|
>
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
151
|
+
{
|
152
|
+
advanced ? (
|
153
|
+
<>
|
154
|
+
<PBTipTapEditor/>
|
155
|
+
</>
|
156
|
+
) : (
|
157
|
+
<TrixEditor
|
158
|
+
className=""
|
159
|
+
fileParamName={name}
|
160
|
+
onChange={onChange}
|
161
|
+
onEditorReady={handleOnEditorReady}
|
162
|
+
placeholder={placeholder}
|
163
|
+
value={value}
|
164
|
+
/>
|
165
|
+
)
|
166
|
+
}
|
167
|
+
|
156
168
|
</div>
|
157
169
|
)
|
158
170
|
}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { useEditor, EditorContent } from "@tiptap/react"
|
3
|
+
import StarterKit from "@tiptap/starter-kit"
|
4
|
+
import Bold from '@tiptap/extension-bold'
|
5
|
+
import Strike from '@tiptap/extension-strike'
|
6
|
+
import Italic from '@tiptap/extension-italic'
|
7
|
+
|
8
|
+
const PBTipTapEditor = () => {
|
9
|
+
const editor = useEditor({
|
10
|
+
extensions: [
|
11
|
+
StarterKit,
|
12
|
+
Bold,
|
13
|
+
Italic,
|
14
|
+
Strike
|
15
|
+
],
|
16
|
+
content:"Hi from Tiptap!"
|
17
|
+
})
|
18
|
+
Bold.configure({
|
19
|
+
HTMLAttributes: {
|
20
|
+
class: 'my-custom-class',
|
21
|
+
},
|
22
|
+
})
|
23
|
+
if (!editor) {
|
24
|
+
return null
|
25
|
+
}
|
26
|
+
|
27
|
+
return (
|
28
|
+
<>
|
29
|
+
<button
|
30
|
+
className={editor.isActive('bold') ? 'is-active' : ''}
|
31
|
+
onClick={() => editor.chain().focus().toggleBold().run()}
|
32
|
+
>
|
33
|
+
Bold
|
34
|
+
</button>
|
35
|
+
<button
|
36
|
+
className={editor.isActive('italic') ? 'is-active' : ''}
|
37
|
+
disabled={
|
38
|
+
!editor.can()
|
39
|
+
.chain()
|
40
|
+
.focus()
|
41
|
+
.toggleItalic()
|
42
|
+
.run()
|
43
|
+
}
|
44
|
+
onClick={() => editor.chain().focus().toggleItalic().run()}
|
45
|
+
>
|
46
|
+
italic
|
47
|
+
</button>
|
48
|
+
<button
|
49
|
+
className={editor.isActive('strike') ? 'is-active' : ''}
|
50
|
+
disabled={
|
51
|
+
!editor.can()
|
52
|
+
.chain()
|
53
|
+
.focus()
|
54
|
+
.toggleStrike()
|
55
|
+
.run()
|
56
|
+
}
|
57
|
+
onClick={() => editor.chain().focus().toggleStrike().run()}
|
58
|
+
>
|
59
|
+
strike
|
60
|
+
</button>
|
61
|
+
<EditorContent editor={editor}/>
|
62
|
+
</>
|
63
|
+
)
|
64
|
+
}
|
65
|
+
|
66
|
+
export default PBTipTapEditor
|
@@ -13,6 +13,7 @@ examples:
|
|
13
13
|
|
14
14
|
react:
|
15
15
|
- rich_text_editor_default: Default
|
16
|
+
- rich_text_editor_tip_tap: Advanced
|
16
17
|
- rich_text_editor_simple: Simple
|
17
18
|
- rich_text_editor_attributes: Attributes
|
18
19
|
- rich_text_editor_focus: Focus
|
@@ -21,3 +22,4 @@ examples:
|
|
21
22
|
- rich_text_editor_toolbar_bottom: Toolbar Bottom
|
22
23
|
- rich_text_editor_inline: Inline
|
23
24
|
- rich_text_editor_preview: Preview
|
25
|
+
|
@@ -7,3 +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 RichTextEditorTipTap } from './_rich_text_editor_tip_tap.jsx'
|
@@ -27,9 +27,9 @@ module Playbook
|
|
27
27
|
|
28
28
|
# Deal with lists of kits, used in Playbook doc and Externally
|
29
29
|
# rubocop:disable Style/StringConcatenation
|
30
|
-
def pb_kits(type: "rails", limit_examples: false, dark_mode: false
|
30
|
+
def pb_kits(type: "rails", limit_examples: false, dark_mode: false)
|
31
31
|
display_kits = []
|
32
|
-
kits =
|
32
|
+
kits = get_kits
|
33
33
|
kits.each do |kit|
|
34
34
|
if kit.is_a?(Hash)
|
35
35
|
nav_hash_array(kit).each do |sub_kit|
|
@@ -45,12 +45,7 @@ module Playbook
|
|
45
45
|
|
46
46
|
# rubocop:disable Naming/AccessorMethodName
|
47
47
|
def get_kits
|
48
|
-
menu = YAML.load_file(Playbook::Engine.root.join("
|
49
|
-
menu["kits"]
|
50
|
-
end
|
51
|
-
|
52
|
-
def get_kits_pb_website
|
53
|
-
menu = YAML.load_file(Rails.root.join("config/menu.yml"))
|
48
|
+
menu = YAML.load_file(Playbook::Engine.root.join("app/pb_kits/playbook/data/menu.yml"))
|
54
49
|
menu["kits"]
|
55
50
|
end
|
56
51
|
# rubocop:enable Naming/AccessorMethodName
|
data/lib/playbook/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playbook_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 12.9.1.pre.alpha.
|
4
|
+
version: 12.9.1.pre.alpha.play664tiptapinvestigation353
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Power UX
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-03-
|
12
|
+
date: 2023-03-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -294,6 +294,7 @@ files:
|
|
294
294
|
- Rakefile
|
295
295
|
- app/pb_kits/playbook/_playbook.scss
|
296
296
|
- app/pb_kits/playbook/_reset.scss
|
297
|
+
- app/pb_kits/playbook/data/menu.yml
|
297
298
|
- app/pb_kits/playbook/index.js
|
298
299
|
- app/pb_kits/playbook/pb_avatar/_avatar.scss
|
299
300
|
- app/pb_kits/playbook/pb_avatar/_avatar.tsx
|
@@ -1706,6 +1707,7 @@ files:
|
|
1706
1707
|
- app/pb_kits/playbook/pb_radio/radio.test.js
|
1707
1708
|
- app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.jsx
|
1708
1709
|
- app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.scss
|
1710
|
+
- app/pb_kits/playbook/pb_rich_text_editor/_tiptap.jsx
|
1709
1711
|
- app/pb_kits/playbook/pb_rich_text_editor/_trix_styles.scss
|
1710
1712
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_attributes.html.erb
|
1711
1713
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_attributes.jsx
|
@@ -1723,6 +1725,7 @@ files:
|
|
1723
1725
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky.jsx
|
1724
1726
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_templates.html.erb
|
1725
1727
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_templates.jsx
|
1728
|
+
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_tip_tap.jsx
|
1726
1729
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_toolbar_bottom.html.erb
|
1727
1730
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_toolbar_bottom.jsx
|
1728
1731
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml
|
@@ -2383,7 +2386,6 @@ files:
|
|
2383
2386
|
- app/pb_kits/playbook/utilities/test/globalProps/justifySelf.test.js
|
2384
2387
|
- app/pb_kits/playbook/utilities/test/globalProps/order.test.js
|
2385
2388
|
- app/pb_kits/playbook/utilities/text.ts
|
2386
|
-
- dist/menu.yml
|
2387
2389
|
- dist/reset.css
|
2388
2390
|
- lib/playbook.rb
|
2389
2391
|
- lib/playbook/align_content.rb
|