Sha256: 1e117627739d8a2444783016186ba6501c19038c2d01a91b07b987d30f25312b

Contents?: true

Size: 1.49 KB

Versions: 25

Compression:

Stored size: 1.49 KB

Contents

# frozen_string_literal: true

module Alchemy
  module Tinymce
    mattr_accessor :languages, :plugins

    @@plugins = %w(alchemy_link anchor autoresize charmap code directionality fullscreen hr link lists paste tabfocus table)
    @@init = {
      skin: 'alchemy',
      width: 'auto',
      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',
      branding: false
    }

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

      def init
        @@init
      end

      def custom_config_contents(page)
        content_definitions_from_elements(page.descendent_element_definitions)
      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

25 entries across 25 versions & 1 rubygems

Version Path
alchemy_cms-4.6.7 lib/alchemy/tinymce.rb
alchemy_cms-4.6.6 lib/alchemy/tinymce.rb
alchemy_cms-4.6.5 lib/alchemy/tinymce.rb
alchemy_cms-4.5.1 lib/alchemy/tinymce.rb
alchemy_cms-4.4.5 lib/alchemy/tinymce.rb
alchemy_cms-4.6.4 lib/alchemy/tinymce.rb
alchemy_cms-4.6.3 lib/alchemy/tinymce.rb
alchemy_cms-4.6.2 lib/alchemy/tinymce.rb
alchemy_cms-4.6.1 lib/alchemy/tinymce.rb
alchemy_cms-4.6.0 lib/alchemy/tinymce.rb
alchemy_cms-4.5.0 lib/alchemy/tinymce.rb
alchemy_cms-4.4.4 lib/alchemy/tinymce.rb
alchemy_cms-4.4.3 lib/alchemy/tinymce.rb
alchemy_cms-4.4.2 lib/alchemy/tinymce.rb
alchemy_cms-4.4.1 lib/alchemy/tinymce.rb
alchemy_cms-4.4.0 lib/alchemy/tinymce.rb
alchemy_cms-4.3.2 lib/alchemy/tinymce.rb
alchemy_cms-4.2.4 lib/alchemy/tinymce.rb
alchemy_cms-4.3.1 lib/alchemy/tinymce.rb
alchemy_cms-4.2.3 lib/alchemy/tinymce.rb