Append correct toolbar depending on markdown/wysiwyg/textile

pull/6316/head
Oliver Günther 7 years ago
parent ba22266a93
commit e7b43349a8
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 2
      app/assets/javascripts/jstoolbar.js
  2. 5
      app/assets/javascripts/jstoolbar/jstoolbar.js
  3. 2
      app/views/layouts/base.html.erb
  4. 3
      config/initializers/assets.rb
  5. 4
      frontend/app/components/common/config/configuration.service.ts
  6. 2
      frontend/app/components/wp-edit/field-types/wp-edit-wiki-textarea-field.module.ts
  7. 1
      lib/open_project/client_preference_extractor.rb
  8. 6
      lib/open_project/text_formatting/formatters/markdown/helper.rb
  9. 2
      lib/open_project/text_formatting/formatters/textile/helper.rb

@ -28,5 +28,3 @@
//= require jstoolbar/jstoolbar
//= require jstoolbar/translations
//= require jstoolbar/textile
//= require jstoolbar/markdown

@ -224,7 +224,10 @@ jsToolBar.prototype = {
}
}
}
this.toolbar.appendChild(this.help_link);
if (this.help_link !== '') {
this.toolbar.appendChild(this.help_link);
}
},
singleTag: function(stag,etag) {

@ -50,9 +50,9 @@ See docs/COPYRIGHT.rdoc for more details.
<%= csrf_meta_tags %>
<%= render 'common/favicons' %>
<%= stylesheet_link_tag 'openproject', media: "all" %>
<%= text_formatting_js_includes %>
<%= javascript_include_tag 'application' %>
<%= javascript_include_tag "locales/#{I18n.locale}" %>
<%= text_formatting_js_includes %>
<!-- project specific tags -->
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->

@ -13,7 +13,8 @@ OpenProject::Application.configure do
copy_issue_actions.js
date-de-DE.js
date-en-US.js
jstoolbar/lang/*.js
jstoolbar/textile.js
jstoolbar/markdown.js
locales/*.js
members_form.js
members_select_boxes.js

@ -129,6 +129,10 @@ export class ConfigurationService {
return this.settings.display.text_format;
}
public useWysiwyg() {
return this.settings.display.use_wysiwyg;
}
public dateFormat() {
return this.settings.display.date_format;
}

@ -62,7 +62,7 @@ export class WikiTextareaEditField extends EditField {
protected initialize() {
const configurationService:ConfigurationService = this.$injector.get(ConfigurationService);
this.wysiwig = configurationService.textFormat() === 'markdown';
this.wysiwig = configurationService.textFormat() === 'markdown' && configurationService.useWysiwyg();
this.setupTemplate();
this.text = {

@ -33,6 +33,7 @@ module OpenProject
gon.settings = {
user_preferences: user_preferences,
display: {
use_wysiwyg: Setting.use_wysiwyg?,
text_format: Setting.text_formatting,
date_format: momentjstify_date_format(Setting.date_format),
time_format: momentjstify_time_format(Setting.time_format),

@ -38,7 +38,11 @@ module OpenProject::TextFormatting::Formatters
def text_formatting_js_includes
view_context.javascript_include_tag 'vendor/ckeditor/ckeditor.js'
if Setting.use_wysiwyg?
view_context.javascript_include_tag 'vendor/ckeditor/ckeditor.js'
else
view_context.javascript_include_tag 'jstoolbar/markdown.js'
end
end
def text_formatting_has_preview?

@ -38,7 +38,7 @@ module OpenProject::TextFormatting::Formatters
end
def text_formatting_js_includes
# TODO Nothing to do here yet, since the js_toolbar is still part of application
view_context.javascript_include_tag 'jstoolbar/textile.js'
end
def text_formatting_has_preview?

Loading…
Cancel
Save