tao_editor 1.0.0.beta.1
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.
- checksums.yaml +7 -0
- data/LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +10 -0
- data/lib/tao_editor.rb +9 -0
- data/lib/tao_editor/components/editor_component.rb +55 -0
- data/lib/tao_editor/components/toolbar/align_item_component.rb +20 -0
- data/lib/tao_editor/components/toolbar/base_item_component.rb +55 -0
- data/lib/tao_editor/components/toolbar/block_item_component.rb +27 -0
- data/lib/tao_editor/components/toolbar/command_item_component.rb +20 -0
- data/lib/tao_editor/components/toolbar/list_item_component.rb +20 -0
- data/lib/tao_editor/components/toolbar/mark_item_component.rb +20 -0
- data/lib/tao_editor/components/toolbar/menu_item_component.rb +46 -0
- data/lib/tao_editor/components/toolbar/table_item_component.rb +20 -0
- data/lib/tao_editor/components/toolbar_component.rb +70 -0
- data/lib/tao_editor/engine.rb +19 -0
- data/lib/tao_editor/inputs/editor_input.rb +20 -0
- data/lib/tao_editor/toolbar_default_items_config.rb +44 -0
- data/lib/tao_editor/version.rb +3 -0
- data/lib/views/components/tao_editor/components/toolbar/_menu_item.html.erb +15 -0
- data/lib/views/components/tao_editor/components/toolbar/_table_item.html.erb +31 -0
- metadata +120 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fdc27084893ed1e9c6f1e0ff2e275cf0e495f20b
|
4
|
+
data.tar.gz: 52ba3d38bcca068f3bc53b25878e9f3b1b7b4727
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 812db616f553953bbd0ea75df2a4fc1b00f983ac4b6a2650e96bf6c4d8861e2d8bf0e5852275e36bbca846a21583575ff82f26d15bc661f49e209e18ac80a0a4
|
7
|
+
data.tar.gz: bb6831c0196f7e6b00d2962a9e1e940aebd1cb44b0cdc1ec72fad8f39a2d40573c0f8aab5b1c2ba38812578ecfe685f998538edd6523b1cb29ac7c838f160939
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2017 farthinker
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# TaoEditor
|
2
|
+
Short description and motivation.
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
How to use my plugin.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'tao_editor'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
```bash
|
16
|
+
$ bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
```bash
|
21
|
+
$ gem install tao_editor
|
22
|
+
```
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
Contribution directions go here.
|
26
|
+
|
27
|
+
## License
|
28
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/lib/tao_editor.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
module TaoEditor
|
2
|
+
module Components
|
3
|
+
class EditorComponent < TaoForm::Components::FieldComponent
|
4
|
+
|
5
|
+
attr_reader :toolbar_options
|
6
|
+
|
7
|
+
def initialize view, builder = nil, attribute_name = nil, options = {}
|
8
|
+
super
|
9
|
+
init_toolbar_options
|
10
|
+
end
|
11
|
+
|
12
|
+
def render &block
|
13
|
+
view.content_tag tag_name, html_options do
|
14
|
+
if block_given?
|
15
|
+
view.concat yield
|
16
|
+
else
|
17
|
+
view.concat builder.hidden_field(attribute_name, class: 'editor-field')
|
18
|
+
end
|
19
|
+
view.concat(render_toolbar) if @options[:toolbar].present?
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.component_name
|
24
|
+
:editor
|
25
|
+
end
|
26
|
+
|
27
|
+
def render_toolbar
|
28
|
+
ToolbarComponent.new(view, toolbar_options).render
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def default_options
|
34
|
+
{
|
35
|
+
class: 'tao-editor',
|
36
|
+
toolbar: true,
|
37
|
+
toolbar_floatable: true
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
def init_toolbar_options
|
42
|
+
@toolbar_options ||= begin
|
43
|
+
if @options[:toolbar].is_a?(Hash)
|
44
|
+
options = @options[:toolbar]
|
45
|
+
@options[:toolbar] = true
|
46
|
+
else
|
47
|
+
options = {}
|
48
|
+
end
|
49
|
+
options
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module TaoEditor
|
2
|
+
module Components
|
3
|
+
module Toolbar
|
4
|
+
class AlignItemComponent < BaseItemComponent
|
5
|
+
|
6
|
+
def self.component_name
|
7
|
+
:editor_toolbar_align_item
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def default_options
|
13
|
+
merge_options super, {
|
14
|
+
class: 'tao-editor-toolbar-align-item'
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module TaoEditor
|
2
|
+
module Components
|
3
|
+
module Toolbar
|
4
|
+
class BaseItemComponent < TaoOnRails::Components::Base
|
5
|
+
|
6
|
+
attr_reader :icon, :label, :tooltip
|
7
|
+
|
8
|
+
def initialize view, options = {}
|
9
|
+
super
|
10
|
+
@icon = @options[:icon].presence
|
11
|
+
@label = @options.delete(:label)
|
12
|
+
@tooltip = @options.delete(:tooltip)
|
13
|
+
|
14
|
+
@label = @options[:title] if @label == true
|
15
|
+
|
16
|
+
if @tooltip.present?
|
17
|
+
@tooltip = @options[:title] if @tooltip == true
|
18
|
+
@options.delete(:title)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def render &block
|
23
|
+
if template = find_template
|
24
|
+
render_template template, &block
|
25
|
+
else
|
26
|
+
view.content_tag tag_name, html_options do
|
27
|
+
view.concat render_item_link
|
28
|
+
view.concat(render_tooltip) if tooltip
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def render_item_link
|
34
|
+
view.link_to 'javascript:;', class: 'item-link' do
|
35
|
+
view.concat(view.tao_icon icon) if icon.present? && label.blank?
|
36
|
+
view.concat(view.content_tag :span, label, class: 'item-name') if label.present?
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def render_tooltip
|
41
|
+
view.tao_tooltip target_traversal: 'siblings', target_selector: '.item-link',
|
42
|
+
direction: 'bottom-center' do
|
43
|
+
tooltip
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def default_options
|
50
|
+
{class: 'tao-editor-toolbar-item'}
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module TaoEditor
|
2
|
+
module Components
|
3
|
+
module Toolbar
|
4
|
+
class BlockItemComponent < BaseItemComponent
|
5
|
+
|
6
|
+
def initialize view, options = {}
|
7
|
+
super
|
8
|
+
if @options[:block_attrs].present? && @options[:block_attrs].is_a?(Hash)
|
9
|
+
@options[:block_attrs] = @options[:block_attrs].to_json
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.component_name
|
14
|
+
:editor_toolbar_block_item
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def default_options
|
20
|
+
merge_options super, {
|
21
|
+
class: 'tao-editor-toolbar-block-item'
|
22
|
+
}
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module TaoEditor
|
2
|
+
module Components
|
3
|
+
module Toolbar
|
4
|
+
class CommandItemComponent < BaseItemComponent
|
5
|
+
|
6
|
+
def self.component_name
|
7
|
+
:editor_toolbar_command_item
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def default_options
|
13
|
+
merge_options super, {
|
14
|
+
class: 'tao-editor-toolbar-command-item'
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module TaoEditor
|
2
|
+
module Components
|
3
|
+
module Toolbar
|
4
|
+
class ListItemComponent < BaseItemComponent
|
5
|
+
|
6
|
+
def self.component_name
|
7
|
+
:editor_toolbar_list_item
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def default_options
|
13
|
+
merge_options super, {
|
14
|
+
class: 'tao-editor-toolbar-list-item'
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module TaoEditor
|
2
|
+
module Components
|
3
|
+
module Toolbar
|
4
|
+
class MarkItemComponent < BaseItemComponent
|
5
|
+
|
6
|
+
def self.component_name
|
7
|
+
:editor_toolbar_mark_item
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def default_options
|
13
|
+
merge_options super, {
|
14
|
+
class: 'tao-editor-toolbar-mark-item'
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module TaoEditor
|
2
|
+
module Components
|
3
|
+
module Toolbar
|
4
|
+
class MenuItemComponent < BaseItemComponent
|
5
|
+
|
6
|
+
attr_reader :items
|
7
|
+
|
8
|
+
def initialize view, options = {}
|
9
|
+
super
|
10
|
+
@items = @options.delete(:items)
|
11
|
+
end
|
12
|
+
|
13
|
+
def render &block
|
14
|
+
render_template find_template, &block
|
15
|
+
end
|
16
|
+
|
17
|
+
def render_item item_options
|
18
|
+
type = item_options.delete(:type).to_s
|
19
|
+
item_name = item_options.delete(:name)
|
20
|
+
item_options = {
|
21
|
+
title: view.t("tao_editor.components.toolbar.items.#{item_name}"),
|
22
|
+
label: true,
|
23
|
+
class: "#{item_name.to_s.dasherize}-item"
|
24
|
+
}.merge(item_options)
|
25
|
+
view.send("tao_editor_toolbar_#{type.dasherize}_item", item_options)
|
26
|
+
end
|
27
|
+
|
28
|
+
def render_separator
|
29
|
+
view.content_tag 'div', nil, class: 'item-separator'
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.component_name
|
33
|
+
:editor_toolbar_menu_item
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def default_options
|
39
|
+
merge_options super, {
|
40
|
+
class: 'tao-editor-toolbar-menu-item'
|
41
|
+
}
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module TaoEditor
|
2
|
+
module Components
|
3
|
+
module Toolbar
|
4
|
+
class TableItemComponent < MenuItemComponent
|
5
|
+
|
6
|
+
def self.component_name
|
7
|
+
:editor_toolbar_table_item
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def default_options
|
13
|
+
merge_options super, {
|
14
|
+
class: 'tao-editor-toolbar-table-item'
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module TaoEditor
|
2
|
+
module Components
|
3
|
+
class ToolbarComponent < TaoOnRails::Components::Base
|
4
|
+
|
5
|
+
include TaoEditor::ToolbarDefaultItemsConfig
|
6
|
+
|
7
|
+
attr_reader :items, :items_config
|
8
|
+
|
9
|
+
def initialize view, options = {}
|
10
|
+
super
|
11
|
+
@items = @options.delete(:items)
|
12
|
+
@items_config = default_items_config.dup
|
13
|
+
@items_config.deep_merge! @options.delete(:items_config) || {}
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.component_name
|
17
|
+
:editor_toolbar
|
18
|
+
end
|
19
|
+
|
20
|
+
def render &block
|
21
|
+
view.content_tag tag_name, html_options do
|
22
|
+
items.map(&:to_sym).each do |item|
|
23
|
+
if item == :'|'
|
24
|
+
view.concat render_separator
|
25
|
+
else
|
26
|
+
view.concat render_item item
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def render_item item_name
|
33
|
+
item_options = get_item_options item_name
|
34
|
+
return unless item_options.present?
|
35
|
+
|
36
|
+
type = item_options.delete(:type)
|
37
|
+
component = if type
|
38
|
+
"tao_editor_toolbar_#{type.to_s.dasherize}_item"
|
39
|
+
else
|
40
|
+
item_options.delete(:component)
|
41
|
+
end
|
42
|
+
view.send(component, item_options)
|
43
|
+
end
|
44
|
+
|
45
|
+
def render_separator
|
46
|
+
view.content_tag 'div', nil, class: 'item-separator'
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def default_options
|
52
|
+
{
|
53
|
+
class: 'tao-editor-toolbar',
|
54
|
+
items: ['heading', 'bold', 'italic', 'underline', 'alignment', '|', 'ul', 'ol', 'table', 'hr']
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
def get_item_options item_name
|
59
|
+
item_options = items_config[item_name]
|
60
|
+
return unless item_options.present?
|
61
|
+
{
|
62
|
+
title: view.t("tao_editor.components.toolbar.items.#{item_name}"),
|
63
|
+
tooltip: true,
|
64
|
+
class: "#{item_name.to_s.dasherize}-item"
|
65
|
+
}.merge(item_options)
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'tao_on_rails'
|
2
|
+
require 'tao_ui'
|
3
|
+
require 'tao_form'
|
4
|
+
|
5
|
+
module TaoEditor
|
6
|
+
class Engine < Rails::Engine
|
7
|
+
|
8
|
+
config.eager_load_paths += Dir["#{config.root}/lib"]
|
9
|
+
|
10
|
+
config.i18n.load_path += Dir[config.root.join('config', 'locales', '**', '*.{rb,yml}')]
|
11
|
+
|
12
|
+
paths['app/views'] << 'lib/views'
|
13
|
+
|
14
|
+
::ActiveSupport.on_load :tao_components do
|
15
|
+
load_tao_components TaoEditor::Engine.root
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module TaoEditor
|
2
|
+
module Inputs
|
3
|
+
class EditorInput < ::SimpleForm::Inputs::Base
|
4
|
+
|
5
|
+
def input(wrapper_options = nil)
|
6
|
+
merged_html_options = merge_wrapper_options(input_html_options, wrapper_options)
|
7
|
+
merged_component_options = component_options.merge(merged_html_options)
|
8
|
+
template.tao_editor(
|
9
|
+
@builder, attribute_name, merged_component_options
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def component_options
|
16
|
+
@component_options ||= input_options.slice(:toolbar, :placeholder)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module TaoEditor
|
2
|
+
module ToolbarDefaultItemsConfig
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
delegate :default_items_config, to: :class
|
7
|
+
end
|
8
|
+
|
9
|
+
class_methods do
|
10
|
+
def default_items_config
|
11
|
+
@default_items_config ||= {
|
12
|
+
bold: { type: :mark, icon: :bold, mark_name: :strong },
|
13
|
+
italic: { type: :mark, icon: :italic, mark_name: :em },
|
14
|
+
underline: { type: :mark, icon: :underline, mark_name: :u },
|
15
|
+
ul: { type: :list, icon: :unorder_list, list_name: :bullet_list },
|
16
|
+
ol: { type: :list, icon: :order_list, list_name: :ordered_list },
|
17
|
+
hr: { type: :command, command_name: :insertHr, icon: :hr },
|
18
|
+
alignment: { type: :menu, icon: :align_left, items: [
|
19
|
+
{ type: :align, alignment: :left, name: :align_left, icon: :align_left },
|
20
|
+
{ type: :align, alignment: :center, name: :align_center, icon: :align_center },
|
21
|
+
{ type: :align, alignment: :right, name: :align_right, icon: :align_right }
|
22
|
+
]},
|
23
|
+
heading: { type: :menu, icon: :heading, items: [
|
24
|
+
{ type: :block, block_name: :heading, block_attrs: {level: 1}, name: :h1, icon: :heading_1 },
|
25
|
+
{ type: :block, block_name: :heading, block_attrs: {level: 2}, name: :h2, icon: :heading_2 },
|
26
|
+
{ type: :block, block_name: :heading, block_attrs: {level: 3}, name: :h3, icon: :heading_3 },
|
27
|
+
{ type: :block, block_name: :heading, block_attrs: {level: 4}, name: :h4, icon: :heading_4 }, '|',
|
28
|
+
{ type: :block, block_name: :paragraph, name: :text, icon: :heading }
|
29
|
+
]},
|
30
|
+
table: { type: :table, icon: :table, items: [
|
31
|
+
{ type: :command, command_name: :addColumnBefore, name: :add_column_before},
|
32
|
+
{ type: :command, command_name: :addColumnAfter, name: :add_column_after},
|
33
|
+
{ type: :command, command_name: :deleteColumn, name: :delete_column}, '|',
|
34
|
+
{ type: :command, command_name: :addRowBefore, name: :add_row_before},
|
35
|
+
{ type: :command, command_name: :addRowAfter, name: :add_row_after},
|
36
|
+
{ type: :command, command_name: :deleteRow, name: :delete_row}, '|',
|
37
|
+
{ type: :command, command_name: :deleteTable, name: :delete_table}
|
38
|
+
]}
|
39
|
+
}
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<%= content_tag component.tag_name, component.html_options do %>
|
2
|
+
<%= component.render_item_link %>
|
3
|
+
<%= component.render_tooltip %>
|
4
|
+
|
5
|
+
<%= tao_popover target_selector: '.item-link', target_traversal: 'siblings',
|
6
|
+
class: 'menu-popover', with_arrow: false, direction: 'bottom-right', offset: -8 do %>
|
7
|
+
<% component.items.each do |item| %>
|
8
|
+
<% if item == '|' %>
|
9
|
+
<%= component.render_separator %>
|
10
|
+
<% else %>
|
11
|
+
<%= component.render_item item.clone %>
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|
14
|
+
<% end %>
|
15
|
+
<% end %>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<%= content_tag component.tag_name, component.html_options do %>
|
2
|
+
<%= component.render_item_link %>
|
3
|
+
<%= component.render_tooltip %>
|
4
|
+
|
5
|
+
<%= tao_popover target_selector: '.item-link', target_traversal: 'siblings',
|
6
|
+
class: 'menu-popover', with_arrow: false, direction: 'bottom-right', offset: -8 do %>
|
7
|
+
<div class="table-creator">
|
8
|
+
<table>
|
9
|
+
<tbody>
|
10
|
+
<% (1..6).each do |row_index| %>
|
11
|
+
<tr>
|
12
|
+
<% (1..6).each do |cell_index| %>
|
13
|
+
<td><%= link_to '', 'javascript:;', class: 'link-create-table' %></td>
|
14
|
+
<% end %>
|
15
|
+
</tr>
|
16
|
+
<% end %>
|
17
|
+
</tbody>
|
18
|
+
</table>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<div class="table-command-items">
|
22
|
+
<% component.items.each do |item| %>
|
23
|
+
<% if item == '|' %>
|
24
|
+
<%= component.render_separator %>
|
25
|
+
<% else %>
|
26
|
+
<%= component.render_item item.clone %>
|
27
|
+
<% end %>
|
28
|
+
<% end %>
|
29
|
+
</div>
|
30
|
+
<% end %>
|
31
|
+
<% end %>
|
metadata
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tao_editor
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0.beta.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- farthinker
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-01-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: tao_on_rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.0.0.beta.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.0.0.beta.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: tao_ui
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.0.0.beta.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.0.0.beta.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: tao_form
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.0.0.beta.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.0.0.beta.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: sqlite3
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Editor component based on prosemirror and tao_form
|
70
|
+
email:
|
71
|
+
- farthinker@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- LICENSE
|
77
|
+
- README.md
|
78
|
+
- Rakefile
|
79
|
+
- lib/tao_editor.rb
|
80
|
+
- lib/tao_editor/components/editor_component.rb
|
81
|
+
- lib/tao_editor/components/toolbar/align_item_component.rb
|
82
|
+
- lib/tao_editor/components/toolbar/base_item_component.rb
|
83
|
+
- lib/tao_editor/components/toolbar/block_item_component.rb
|
84
|
+
- lib/tao_editor/components/toolbar/command_item_component.rb
|
85
|
+
- lib/tao_editor/components/toolbar/list_item_component.rb
|
86
|
+
- lib/tao_editor/components/toolbar/mark_item_component.rb
|
87
|
+
- lib/tao_editor/components/toolbar/menu_item_component.rb
|
88
|
+
- lib/tao_editor/components/toolbar/table_item_component.rb
|
89
|
+
- lib/tao_editor/components/toolbar_component.rb
|
90
|
+
- lib/tao_editor/engine.rb
|
91
|
+
- lib/tao_editor/inputs/editor_input.rb
|
92
|
+
- lib/tao_editor/toolbar_default_items_config.rb
|
93
|
+
- lib/tao_editor/version.rb
|
94
|
+
- lib/views/components/tao_editor/components/toolbar/_menu_item.html.erb
|
95
|
+
- lib/views/components/tao_editor/components/toolbar/_table_item.html.erb
|
96
|
+
homepage: https://github.com/mycolorway/tao_editor
|
97
|
+
licenses:
|
98
|
+
- MIT
|
99
|
+
metadata: {}
|
100
|
+
post_install_message:
|
101
|
+
rdoc_options: []
|
102
|
+
require_paths:
|
103
|
+
- lib
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: 2.3.1
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">"
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: 1.3.1
|
114
|
+
requirements: []
|
115
|
+
rubyforge_project:
|
116
|
+
rubygems_version: 2.6.14
|
117
|
+
signing_key:
|
118
|
+
specification_version: 4
|
119
|
+
summary: Online editor component
|
120
|
+
test_files: []
|