mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
FEATURE: adds support for loading existing core asset in pretty text
This commit is contained in:
@ -82,6 +82,9 @@ class DiscoursePluginRegistry
|
||||
@vendored_pretty_text ||= Set.new
|
||||
end
|
||||
|
||||
def vendored_core_pretty_text
|
||||
@vendored_core_pretty_text ||= Set.new
|
||||
end
|
||||
end
|
||||
|
||||
def register_js(filename, options = {})
|
||||
@ -136,6 +139,8 @@ class DiscoursePluginRegistry
|
||||
self.admin_javascripts << asset
|
||||
elsif opts == :vendored_pretty_text
|
||||
self.vendored_pretty_text << asset
|
||||
elsif opts == :vendored_core_pretty_text
|
||||
self.vendored_core_pretty_text << asset
|
||||
else
|
||||
self.javascripts << asset
|
||||
end
|
||||
@ -180,6 +185,15 @@ class DiscoursePluginRegistry
|
||||
result.uniq
|
||||
end
|
||||
|
||||
VENDORED_CORE_PRETTY_TEXT_MAP = {
|
||||
"moment.js" => "lib/javascripts/moment.js"
|
||||
}
|
||||
def self.core_asset_for_name(name)
|
||||
asset = VENDORED_CORE_PRETTY_TEXT_MAP[name]
|
||||
raise KeyError, "Asset #{name} not found in #{VENDORED_CORE_PRETTY_TEXT_MAP}" unless asset
|
||||
asset
|
||||
end
|
||||
|
||||
def locales
|
||||
self.class.locales
|
||||
end
|
||||
@ -235,6 +249,7 @@ class DiscoursePluginRegistry
|
||||
asset_globs.clear
|
||||
html_builders.clear
|
||||
vendored_pretty_text.clear
|
||||
vendored_core_pretty_text.clear
|
||||
seed_path_builders.clear
|
||||
locales.clear
|
||||
end
|
||||
|
Reference in New Issue
Block a user