playbook_ui_docs 12.20.0.pre.alpha.movemarkdown668 → 12.23.0.pre.alpha.movemarkdown708

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef42dd99e654b47a91a0428f661f08a594c630c6cae4f37dd3a202c13c5e86c8
4
- data.tar.gz: ea3efaebf0f722fd6102da5105e34dff222a9b5628197b3f1dd0ea973b052aa0
3
+ metadata.gz: e471b0bebeb846befc1526d396e41f109b93d8c3847cc43de0f75b238a40f855
4
+ data.tar.gz: 24ba8ae1a3d6d837f530eadff86da7108451eff0c6ff012ff86fbd77054ccc36
5
5
  SHA512:
6
- metadata.gz: 8c972e002dcaeb376f64c45c1e8ed030caa83af9ce50d088bdc429c5a32469af7a4ee37c4bdd5f0e797e8f44e1c27621f0640524fca11fc8c80d0d79b3110686
7
- data.tar.gz: b97100ec760536d2f8a238b53b405c504fa12306b325fd53e57917c88712b1984cba399d2af589f813dbc4e7bb691e09584c6feaaf780396b86095841b32a62a
6
+ metadata.gz: 4015ff527a1cc6656de8834a6cc4e702dbe58307562653d10b26c7cdfe52f85b92b3516142c8ec1cfb52039a97fa63360071f6ac859a02ad5644360d1e7ad536
7
+ data.tar.gz: e26a880970de6b0dacd442f1ab058f539986336281d2e9e934fc9cd51f016e7de9f11568a4241579cdd458dcce47f5f451cdfa1492cad570fae0a30ead45a03a
@@ -0,0 +1,55 @@
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
@@ -0,0 +1,12 @@
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.
@@ -14,6 +14,7 @@ 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)
17
18
  - rich_text_editor_simple: Simple
18
19
  - rich_text_editor_attributes: Attributes
19
20
  - rich_text_editor_focus: Focus
@@ -7,4 +7,5 @@ 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'
10
+ export { default as RichTextEditorAdvancedDefault } from './_rich_text_editor_advanced_default.jsx'
11
+ export { default as RichTextEditorMoreExtensions } from './_rich_text_editor_more_extensions.jsx'
@@ -15,31 +15,60 @@
15
15
  <div id="code-wrapper">
16
16
  <div class="pb--codeControls">
17
17
  <ul>
18
- <% if type == "rails" %>
18
+ <% hide_button = type == "rails" ? 'flex' : 'none' %>
19
19
  <li>
20
- <a href="#" id="copy-<%= example_key %>-trigger" onclick="copyOnClick(`<%= example_html %>`, `copy-<%= example_key %>`)">
21
- Copy HTML
22
- </a>
20
+ <%= pb_rails("button", props: { id:"copy-html-#{example_key}", icon: "copy", text: "Copy HTML", variant: "link", size: "sm", display: hide_button }) %>
23
21
  </li>
24
- <% end %>
25
22
  <li>
26
- <a href="#" id="toggle-open" data-toggle="code_example">Code Example</a>
23
+ <%= pb_rails("button", props: { icon: "code", id:"toggle-open-opened", text: "Close Code", variant: "link", size: "sm", display: "none" }) %>
24
+ <%= pb_rails("button", props: { icon: "code", id:"toggle-open-closed", text: "Show Code", variant: "link", size: "sm" }) %>
27
25
  </li>
28
26
  </ul>
29
27
  </div>
30
28
  <div class="pb--codeCopy" data-action="toggle" data-togglable="code_example" style="display: none" >
31
29
  <%= pb_rails("section_separator", props: { dark: dark })%>
32
- <a href="#" id="toggle-close" data-toggle="false" class="pb--close-toggle">Close</a>
30
+ <a href="#" id="copy-code-<%= example_key %>" class="pb--copy-code" onclick="copyOnClick(`<%= source %>`, `copy-code-<%= example_key %>`)">
31
+ <%= pb_rails("button", props: { id: "copy-button-#{example_key}", text: "Copy Code", size: "sm", icon: "copy", padding_x: "xs" }) %>
32
+ </a>
33
33
  <pre class="highlight"><%= raw render_code(source, highlighter) %></pre>
34
34
  </div>
35
+ <%= pb_rails("popover", props: {
36
+ trigger_element_id: "copy-button-#{example_key}",
37
+ tooltip_id: "tooltip-#{example_key}",
38
+ offset: true,
39
+ position: "bottom"
40
+ }) do %>
41
+ Code Copied
42
+ <% end %>
35
43
  </div>
36
44
  <% end %>
37
45
  <% end %>
38
46
 
39
47
  <script>
40
- function copyOnClick(content, elementID) {
41
- copyContent(content)
48
+ var htmlButton = document.getElementById('<%= "copy-html-#{example_key}" %>')
49
+ if (htmlButton) {
50
+ htmlButton.addEventListener('click', function() {
51
+ var tempElement = document.createElement('div')
52
+ tempElement.innerHTML = `<%= example_html %>`
53
+ var decodedString = tempElement.textContent || tempElement.innerText;
54
+ copyContent(decodedString)
55
+ })
56
+ }
57
+
58
+ var button = document.getElementById('<%= "copy-button-#{example_key}" %>')
59
+ if (button) {
60
+ button.addEventListener('click', function() {
61
+ var tempElement = document.createElement('div')
62
+ tempElement.innerHTML = `<%= source %>`
63
+ var decodedString = tempElement.textContent || tempElement.innerText;
64
+ copyContent(decodedString)
65
+ var fadeAwayDiv = document.getElementById("<%= "tooltip-#{example_key}" %>")
66
+ setTimeout(function() {
67
+ fadeAwayDiv.classList.remove('show')
68
+ }, 3000)
69
+ setTimeout(function() {
70
+ fadeAwayDiv.classList.add('hide')
71
+ }, 3001)
72
+ })
42
73
  }
43
-
44
74
  </script>
45
-
data/dist/menu.yml CHANGED
@@ -31,6 +31,7 @@ kits:
31
31
  - form
32
32
  - form_group
33
33
  - form_pill
34
+ - multi_level_select
34
35
  - passphrase
35
36
  - phone_number_input
36
37
  - radio
@@ -57,7 +58,6 @@ kits:
57
58
  - list
58
59
  - loading_inline
59
60
  - map
60
- - multi_level_select
61
61
  - nav
62
62
  - tags:
63
63
  - badge