spohlenz / tinymce-rails

Integration of TinyMCE with the Rails asset pipeline
Other
814 stars 257 forks source link

Link button: Cannot read property 'text' of undefined #143

Closed danaki closed 10 years ago

danaki commented 10 years ago

To reproduce: add link plugin, then click on button.

define("tinymce/ui/ListBox", [
    "tinymce/ui/MenuButton"
], function(MenuButton) {
    "use strict";
...
init: function(settings) {
...
settings.text = settings.text || selectedText || values[0].text;
...

It appears that settings.text doesn't have "text" property by default. Tested on both HEAD and 4.0.28 versions:

Gemfile:

source 'https://rubygems.org'

#ruby '2.0.0'

gem 'rails', '4.1'
gem 'sass'
gem 'sprockets'
#gem 'sprockets-sass', '~> 1.0.3'
gem 'sass-rails'
gem 'compass-rails'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails'
gem 'jquery-rails'
gem 'jquery-ui-sass-rails'
gem 'jquery-turbolinks' # needed to fix bug with the_sortable_tree
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
gem 'bootstrap-sass'
gem 'cancancan'
gem 'figaro', github: 'laserlemon/figaro'
gem 'rolify'
gem 'tzinfo-data'
gem 'lazybox'
#gem 'simple_form'
gem 'htmlentities'
gem 'carrierwave'
gem 'twitter'
#gem 'acts_as_list'
#gem 'acts_as_tree'
gem 'awesome_nested_set', '~> 3.0.0.rc.5'
gem 'the_sortable_tree', '~> 2.5.0'
gem 'kaminari'
gem 'analytics-ruby'
gem 'bcrypt-ruby'
gem 'bourbon'
gem 'font-awesome-rails'
gem 'mini_magick'
#gem 'fog'
gem 'uuidtools'
gem 'tinymce-rails', git: 'https://github.com/spohlenz/tinymce-rails.git' #, '~> 4.0.12'
gem 'tinymce-rails-imageupload', git: 'https://github.com/danaki/tinymce-rails-imageupload.git'
gem 'jcrop-rails-v2'
gem 'select2-rails'
gem 'remotipart'
gem 'simple-navigation-bootstrap'
gem 'bootstrap_form'
gem 'high_voltage', '~> 2.1.0'
gem 'russian', git: 'https://github.com/danaki/russian.git'
gem 'rails_exception_handler', '~> 2'
gem 'rails_exception_handler_admin', git: 'https://github.com/zizkovrb/rails_exception_handler_admin.git', branch: 'rails4'

# fork with rails 4 compat
gem 'themes_for_rails', git: 'https://github.com/holtkampw/themes_for_rails.git'
#gem 'themes_for_rails', :git => 'https://github.com/tkriplean/themes_for_rails.git'
#gem 'themes_for_rails', :git => 'https://github.com/codesource/themes_for_rails.git'
#gem 'themes_for_rails', :git => 'https://github.com/danaki/themes_for_rails.git'
#gem 'themes_for_rails', :path => '/Users/yuri/rr/themes_for_rails'

gem 'devise'
gem 'devise-i18n'
gem 'omniauth-facebook'
gem 'omniauth-twitter'

gem 'rails-observers'
gem 'actionpack-page_caching'
gem 'actionpack-action_caching'
gem 'activerecord-deprecated_finders'
gem 'friendly_id'
gem 'babosa'
#gem 'dotenv-rails'

gem 'pg'

group :development do
  gem 'better_errors'
  gem 'binding_of_caller'
  gem 'rails_layout'
end

group :development, :test do
  gem 'factory_girl_rails'
  gem 'rspec-rails'
end

group :test do
  gem 'capybara'
  gem 'cucumber-rails', require: false
  gem 'database_cleaner', '1.0.1'
  gem 'email_spec'
  gem 'launchy'
  gem 'simplecov'
end

group :production do
  #gem 'unicorn'
  gem 'unicorn-rails'
end
danaki commented 10 years ago

The problem was resolved after disabling this tinymce config option:

target_list: []

I suppose it's meaning changed after tinymce upgrade.