Sha256: 3063508183047b6eb26091be6aa4baea08b030b08c9f030031a497a4ef379fd5

Contents?: true

Size: 1.56 KB

Versions: 10

Compression:

Stored size: 1.56 KB

Contents

module Alchemy
  module Tinymce
    mattr_accessor :languages, :plugins

    @@plugins = %w(alchemy_link anchor autoresize charmap code directionality fullscreen hr link paste tabfocus table)
    @@languages = ['en', 'de']
    @@init = {
      skin: 'alchemy',
      width: '100%',
      resize: true,
      autoresize_min_height: '105',
      autoresize_max_height: '480',
      menubar: false,
      statusbar: true,
      toolbar: [
        'bold italic underline | strikethrough subscript superscript | numlist bullist indent outdent | removeformat | fullscreen',
        'pastetext charmap hr | undo redo | alchemy_link unlink anchor | code'
      ],
      fix_list_elements: true,
      convert_urls: false,
      entity_encoding: 'raw',
      paste_as_text: true,
      element_format: 'html'
    }

    class << self
      def init=(settings)
        @@init.merge!(settings)
      end

      def init
        @@init
      end

      def custom_config_contents(page = nil)
        if page
          content_definitions_from_elements(page.element_definitions)
        else
          content_definitions_from_elements(Element.definitions)
        end
      end

      private

      def content_definitions_from_elements(definitions)
        definitions.collect do |el|
          next if el['contents'].blank?
          contents = el['contents'].select do |c|
            c['settings'] && c['settings']['tinymce'].is_a?(Hash)
          end
          next if contents.blank?
          contents.map { |c| c.merge('element' => el['name']) }
        end.flatten.compact
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
alchemy_cms-3.4.2 lib/alchemy/tinymce.rb
alchemy_cms-3.4.1 lib/alchemy/tinymce.rb
alchemy_cms-3.3.3 lib/alchemy/tinymce.rb
alchemy_cms-3.3.2 lib/alchemy/tinymce.rb
alchemy_cms-3.4.0 lib/alchemy/tinymce.rb
alchemy_cms-3.4.0.rc1 lib/alchemy/tinymce.rb
alchemy_cms-3.3.1 lib/alchemy/tinymce.rb
alchemy_cms-3.3.0 lib/alchemy/tinymce.rb
alchemy_cms-3.3.0.rc2 lib/alchemy/tinymce.rb
alchemy_cms-3.3.0.rc1 lib/alchemy/tinymce.rb