lib/ckeditor/utils.rb in glebtv-ckeditor-4.11.1 vs lib/ckeditor/utils.rb in glebtv-ckeditor-4.13.0
- old
+ new
@@ -1,13 +1,12 @@
-# encoding: utf-8
+# frozen_string_literal: true
require 'active_support/json/encoding'
module Ckeditor
module Utils
autoload :JavascriptCode, 'ckeditor/utils/javascript_code'
- autoload :ContentTypeDetector, 'ckeditor/utils/content_type_detector'
class << self
def escape_single_quotes(str)
str.gsub('\\', '\0\0').gsub('</', '<\/').gsub(/\r\n|\n|\r/, "\\n").gsub(/["']/) { |m| "\\#{m}" }
end
@@ -75,23 +74,15 @@
def select_assets(path, relative_path)
relative_folder = Ckeditor.root_path.join(relative_path)
folder = relative_folder.join(path)
extensions = '*.{js,css,png,gif,jpg,html}'
- languages = (Ckeditor.assets_languages || [])
# Files at root
files = Dir[folder.join(extensions)]
- # Filter plugins
- if Ckeditor.assets_plugins.nil?
- files += Dir[folder.join('plugins', '**', extensions)]
- else
- Ckeditor.assets_plugins.each do |plugin|
- files += Dir[folder.join('plugins', plugin, '**', extensions)]
- end
- end
+ files += Dir[folder.join('plugins', '**', extensions)]
# Other folders
Dir[folder.join('*/')].each do |subfolder|
path = Pathname.new(subfolder)
next if ['plugins'].include?(path.basename.to_s)
@@ -99,14 +90,10 @@
end
files.inject([]) do |items, name|
file = Pathname.new(name)
base = file.basename('.*').to_s
-
- if !name.include?('/lang/') || languages.include?(base) || languages.empty?
- items << file.relative_path_from(relative_folder).to_s
- end
-
+ items << file.relative_path_from(relative_folder).to_s
items
end
end
end
end