tui_editor-rails 1.0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.ruby-version +1 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +20 -0
- data/README.md +69 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/example/.gitignore +30 -0
- data/example/.ruby-version +1 -0
- data/example/Gemfile +64 -0
- data/example/Gemfile.lock +224 -0
- data/example/README.md +67 -0
- data/example/Rakefile +6 -0
- data/example/app/assets/config/manifest.js +3 -0
- data/example/app/assets/images/.keep +0 -0
- data/example/app/assets/images/screen_capture.png +0 -0
- data/example/app/assets/javascripts/application.js +23 -0
- data/example/app/assets/javascripts/cable.js +13 -0
- data/example/app/assets/javascripts/channels/.keep +0 -0
- data/example/app/assets/javascripts/home.coffee +3 -0
- data/example/app/assets/javascripts/posts.coffee +3 -0
- data/example/app/assets/stylesheets/application.scss +4 -0
- data/example/app/assets/stylesheets/home.scss +3 -0
- data/example/app/assets/stylesheets/posts.scss +3 -0
- data/example/app/assets/stylesheets/scaffolds.scss +84 -0
- data/example/app/channels/application_cable/channel.rb +4 -0
- data/example/app/channels/application_cable/connection.rb +4 -0
- data/example/app/controllers/application_controller.rb +2 -0
- data/example/app/controllers/concerns/.keep +0 -0
- data/example/app/controllers/home_controller.rb +4 -0
- data/example/app/controllers/posts_controller.rb +74 -0
- data/example/app/helpers/application_helper.rb +2 -0
- data/example/app/helpers/home_helper.rb +2 -0
- data/example/app/helpers/posts_helper.rb +2 -0
- data/example/app/jobs/application_job.rb +2 -0
- data/example/app/mailers/application_mailer.rb +4 -0
- data/example/app/models/application_record.rb +3 -0
- data/example/app/models/concerns/.keep +0 -0
- data/example/app/models/post.rb +2 -0
- data/example/app/views/home/index.html.erb +11 -0
- data/example/app/views/layouts/application.html.erb +14 -0
- data/example/app/views/layouts/mailer.html.erb +13 -0
- data/example/app/views/layouts/mailer.text.erb +1 -0
- data/example/app/views/posts/_form.html.erb +27 -0
- data/example/app/views/posts/_post.json.jbuilder +2 -0
- data/example/app/views/posts/edit.html.erb +6 -0
- data/example/app/views/posts/index.html.erb +29 -0
- data/example/app/views/posts/index.json.jbuilder +1 -0
- data/example/app/views/posts/new.html.erb +5 -0
- data/example/app/views/posts/show.html.erb +14 -0
- data/example/app/views/posts/show.json.jbuilder +1 -0
- data/example/bin/bundle +3 -0
- data/example/bin/rails +9 -0
- data/example/bin/rake +9 -0
- data/example/bin/setup +36 -0
- data/example/bin/spring +17 -0
- data/example/bin/update +31 -0
- data/example/bin/yarn +11 -0
- data/example/config.ru +5 -0
- data/example/config/application.rb +19 -0
- data/example/config/boot.rb +4 -0
- data/example/config/cable.yml +10 -0
- data/example/config/credentials.yml.enc +1 -0
- data/example/config/database.yml +25 -0
- data/example/config/environment.rb +5 -0
- data/example/config/environments/development.rb +61 -0
- data/example/config/environments/production.rb +94 -0
- data/example/config/environments/test.rb +46 -0
- data/example/config/initializers/application_controller_renderer.rb +8 -0
- data/example/config/initializers/assets.rb +14 -0
- data/example/config/initializers/backtrace_silencers.rb +7 -0
- data/example/config/initializers/content_security_policy.rb +22 -0
- data/example/config/initializers/cookies_serializer.rb +5 -0
- data/example/config/initializers/filter_parameter_logging.rb +4 -0
- data/example/config/initializers/inflections.rb +16 -0
- data/example/config/initializers/mime_types.rb +4 -0
- data/example/config/initializers/wrap_parameters.rb +14 -0
- data/example/config/locales/en.yml +33 -0
- data/example/config/puma.rb +34 -0
- data/example/config/routes.rb +6 -0
- data/example/config/spring.rb +6 -0
- data/example/config/storage.yml +35 -0
- data/example/db/migrate/20180208210404_create_posts.rb +10 -0
- data/example/db/schema.rb +22 -0
- data/example/db/seeds.rb +7 -0
- data/example/lib/assets/.keep +0 -0
- data/example/lib/tasks/.keep +0 -0
- data/example/log/.keep +0 -0
- data/example/package.json +5 -0
- data/example/public/404.html +67 -0
- data/example/public/422.html +67 -0
- data/example/public/500.html +66 -0
- data/example/public/apple-touch-icon-precomposed.png +0 -0
- data/example/public/apple-touch-icon.png +0 -0
- data/example/public/favicon.ico +0 -0
- data/example/public/robots.txt +1 -0
- data/example/test/application_system_test_case.rb +5 -0
- data/example/test/controllers/.keep +0 -0
- data/example/test/controllers/home_controller_test.rb +9 -0
- data/example/test/controllers/posts_controller_test.rb +48 -0
- data/example/test/fixtures/.keep +0 -0
- data/example/test/fixtures/files/.keep +0 -0
- data/example/test/fixtures/posts.yml +9 -0
- data/example/test/helpers/.keep +0 -0
- data/example/test/integration/.keep +0 -0
- data/example/test/mailers/.keep +0 -0
- data/example/test/models/.keep +0 -0
- data/example/test/models/post_test.rb +7 -0
- data/example/test/system/.keep +0 -0
- data/example/test/system/posts_test.rb +45 -0
- data/example/test/test_helper.rb +10 -0
- data/example/tmp/.keep +0 -0
- data/example/vendor/.keep +0 -0
- data/lib/tui_editor/rails.rb +8 -0
- data/lib/tui_editor/rails/version.rb +5 -0
- data/tui_editor-rails.gemspec +34 -0
- data/vendor/assets/components/codemirror/.bower.json +31 -0
- data/vendor/assets/components/codemirror/AUTHORS +714 -0
- data/vendor/assets/components/codemirror/CHANGELOG.md +1316 -0
- data/vendor/assets/components/codemirror/CONTRIBUTING.md +92 -0
- data/vendor/assets/components/codemirror/LICENSE +21 -0
- data/vendor/assets/components/codemirror/README.md +35 -0
- data/vendor/assets/components/codemirror/addon/comment/comment.js +209 -0
- data/vendor/assets/components/codemirror/addon/comment/continuecomment.js +78 -0
- data/vendor/assets/components/codemirror/addon/dialog/dialog.css +32 -0
- data/vendor/assets/components/codemirror/addon/dialog/dialog.js +157 -0
- data/vendor/assets/components/codemirror/addon/display/autorefresh.js +47 -0
- data/vendor/assets/components/codemirror/addon/display/fullscreen.css +6 -0
- data/vendor/assets/components/codemirror/addon/display/fullscreen.js +41 -0
- data/vendor/assets/components/codemirror/addon/display/panel.js +123 -0
- data/vendor/assets/components/codemirror/addon/display/placeholder.js +63 -0
- data/vendor/assets/components/codemirror/addon/display/rulers.js +51 -0
- data/vendor/assets/components/codemirror/addon/edit/closebrackets.js +194 -0
- data/vendor/assets/components/codemirror/addon/edit/closetag.js +175 -0
- data/vendor/assets/components/codemirror/addon/edit/continuelist.js +89 -0
- data/vendor/assets/components/codemirror/addon/edit/matchbrackets.js +145 -0
- data/vendor/assets/components/codemirror/addon/edit/matchtags.js +66 -0
- data/vendor/assets/components/codemirror/addon/edit/trailingspace.js +27 -0
- data/vendor/assets/components/codemirror/addon/fold/brace-fold.js +105 -0
- data/vendor/assets/components/codemirror/addon/fold/comment-fold.js +59 -0
- data/vendor/assets/components/codemirror/addon/fold/foldcode.js +152 -0
- data/vendor/assets/components/codemirror/addon/fold/foldgutter.css +20 -0
- data/vendor/assets/components/codemirror/addon/fold/foldgutter.js +146 -0
- data/vendor/assets/components/codemirror/addon/fold/indent-fold.js +48 -0
- data/vendor/assets/components/codemirror/addon/fold/markdown-fold.js +49 -0
- data/vendor/assets/components/codemirror/addon/fold/xml-fold.js +182 -0
- data/vendor/assets/components/codemirror/addon/hint/anyword-hint.js +41 -0
- data/vendor/assets/components/codemirror/addon/hint/css-hint.js +60 -0
- data/vendor/assets/components/codemirror/addon/hint/html-hint.js +348 -0
- data/vendor/assets/components/codemirror/addon/hint/javascript-hint.js +155 -0
- data/vendor/assets/components/codemirror/addon/hint/show-hint.css +36 -0
- data/vendor/assets/components/codemirror/addon/hint/show-hint.js +432 -0
- data/vendor/assets/components/codemirror/addon/hint/sql-hint.js +286 -0
- data/vendor/assets/components/codemirror/addon/hint/xml-hint.js +110 -0
- data/vendor/assets/components/codemirror/addon/lint/coffeescript-lint.js +47 -0
- data/vendor/assets/components/codemirror/addon/lint/css-lint.js +40 -0
- data/vendor/assets/components/codemirror/addon/lint/html-lint.js +53 -0
- data/vendor/assets/components/codemirror/addon/lint/javascript-lint.js +63 -0
- data/vendor/assets/components/codemirror/addon/lint/json-lint.js +37 -0
- data/vendor/assets/components/codemirror/addon/lint/lint.css +73 -0
- data/vendor/assets/components/codemirror/addon/lint/lint.js +252 -0
- data/vendor/assets/components/codemirror/addon/lint/yaml-lint.js +41 -0
- data/vendor/assets/components/codemirror/addon/merge/merge.css +113 -0
- data/vendor/assets/components/codemirror/addon/merge/merge.js +1001 -0
- data/vendor/assets/components/codemirror/addon/mode/loadmode.js +64 -0
- data/vendor/assets/components/codemirror/addon/mode/multiplex.js +123 -0
- data/vendor/assets/components/codemirror/addon/mode/multiplex_test.js +33 -0
- data/vendor/assets/components/codemirror/addon/mode/overlay.js +90 -0
- data/vendor/assets/components/codemirror/addon/mode/simple.js +216 -0
- data/vendor/assets/components/codemirror/addon/runmode/colorize.js +40 -0
- data/vendor/assets/components/codemirror/addon/runmode/runmode-standalone.js +158 -0
- data/vendor/assets/components/codemirror/addon/runmode/runmode.js +72 -0
- data/vendor/assets/components/codemirror/addon/runmode/runmode.node.js +197 -0
- data/vendor/assets/components/codemirror/addon/scroll/annotatescrollbar.js +122 -0
- data/vendor/assets/components/codemirror/addon/scroll/scrollpastend.js +48 -0
- data/vendor/assets/components/codemirror/addon/scroll/simplescrollbars.css +66 -0
- data/vendor/assets/components/codemirror/addon/scroll/simplescrollbars.js +152 -0
- data/vendor/assets/components/codemirror/addon/search/jump-to-line.js +49 -0
- data/vendor/assets/components/codemirror/addon/search/match-highlighter.js +165 -0
- data/vendor/assets/components/codemirror/addon/search/matchesonscrollbar.css +8 -0
- data/vendor/assets/components/codemirror/addon/search/matchesonscrollbar.js +97 -0
- data/vendor/assets/components/codemirror/addon/search/search.js +252 -0
- data/vendor/assets/components/codemirror/addon/search/searchcursor.js +289 -0
- data/vendor/assets/components/codemirror/addon/selection/active-line.js +72 -0
- data/vendor/assets/components/codemirror/addon/selection/mark-selection.js +119 -0
- data/vendor/assets/components/codemirror/addon/selection/selection-pointer.js +98 -0
- data/vendor/assets/components/codemirror/addon/tern/tern.css +87 -0
- data/vendor/assets/components/codemirror/addon/tern/tern.js +718 -0
- data/vendor/assets/components/codemirror/addon/tern/worker.js +44 -0
- data/vendor/assets/components/codemirror/addon/wrap/hardwrap.js +144 -0
- data/vendor/assets/components/codemirror/bower.json +17 -0
- data/vendor/assets/components/codemirror/component-tools/bower.json +17 -0
- data/vendor/assets/components/codemirror/component-tools/build.sh +31 -0
- data/vendor/assets/components/codemirror/component-tools/update.py +38 -0
- data/vendor/assets/components/codemirror/keymap/emacs.js +416 -0
- data/vendor/assets/components/codemirror/keymap/sublime.js +685 -0
- data/vendor/assets/components/codemirror/keymap/vim.js +5219 -0
- data/vendor/assets/components/codemirror/lib/codemirror.css +346 -0
- data/vendor/assets/components/codemirror/lib/codemirror.js +9669 -0
- data/vendor/assets/components/codemirror/mode/apl/apl.js +174 -0
- data/vendor/assets/components/codemirror/mode/asciiarmor/asciiarmor.js +74 -0
- data/vendor/assets/components/codemirror/mode/asn.1/asn.1.js +204 -0
- data/vendor/assets/components/codemirror/mode/asterisk/asterisk.js +196 -0
- data/vendor/assets/components/codemirror/mode/brainfuck/brainfuck.js +85 -0
- data/vendor/assets/components/codemirror/mode/clike/clike.js +817 -0
- data/vendor/assets/components/codemirror/mode/clojure/clojure.js +306 -0
- data/vendor/assets/components/codemirror/mode/cmake/cmake.js +97 -0
- data/vendor/assets/components/codemirror/mode/cobol/cobol.js +255 -0
- data/vendor/assets/components/codemirror/mode/coffeescript/coffeescript.js +359 -0
- data/vendor/assets/components/codemirror/mode/commonlisp/commonlisp.js +124 -0
- data/vendor/assets/components/codemirror/mode/crystal/crystal.js +433 -0
- data/vendor/assets/components/codemirror/mode/css/css.js +832 -0
- data/vendor/assets/components/codemirror/mode/cypher/cypher.js +150 -0
- data/vendor/assets/components/codemirror/mode/d/d.js +218 -0
- data/vendor/assets/components/codemirror/mode/dart/dart.js +157 -0
- data/vendor/assets/components/codemirror/mode/diff/diff.js +47 -0
- data/vendor/assets/components/codemirror/mode/django/django.js +356 -0
- data/vendor/assets/components/codemirror/mode/dockerfile/dockerfile.js +79 -0
- data/vendor/assets/components/codemirror/mode/dtd/dtd.js +142 -0
- data/vendor/assets/components/codemirror/mode/dylan/dylan.js +352 -0
- data/vendor/assets/components/codemirror/mode/ebnf/ebnf.js +195 -0
- data/vendor/assets/components/codemirror/mode/ecl/ecl.js +206 -0
- data/vendor/assets/components/codemirror/mode/eiffel/eiffel.js +160 -0
- data/vendor/assets/components/codemirror/mode/elm/elm.js +205 -0
- data/vendor/assets/components/codemirror/mode/erlang/erlang.js +619 -0
- data/vendor/assets/components/codemirror/mode/factor/factor.js +85 -0
- data/vendor/assets/components/codemirror/mode/fcl/fcl.js +173 -0
- data/vendor/assets/components/codemirror/mode/forth/forth.js +180 -0
- data/vendor/assets/components/codemirror/mode/fortran/fortran.js +188 -0
- data/vendor/assets/components/codemirror/mode/gas/gas.js +345 -0
- data/vendor/assets/components/codemirror/mode/gfm/gfm.js +129 -0
- data/vendor/assets/components/codemirror/mode/gherkin/gherkin.js +178 -0
- data/vendor/assets/components/codemirror/mode/go/go.js +187 -0
- data/vendor/assets/components/codemirror/mode/groovy/groovy.js +230 -0
- data/vendor/assets/components/codemirror/mode/haml/haml.js +161 -0
- data/vendor/assets/components/codemirror/mode/handlebars/handlebars.js +62 -0
- data/vendor/assets/components/codemirror/mode/haskell-literate/haskell-literate.js +43 -0
- data/vendor/assets/components/codemirror/mode/haskell/haskell.js +267 -0
- data/vendor/assets/components/codemirror/mode/haxe/haxe.js +515 -0
- data/vendor/assets/components/codemirror/mode/htmlembedded/htmlembedded.js +37 -0
- data/vendor/assets/components/codemirror/mode/htmlmixed/htmlmixed.js +152 -0
- data/vendor/assets/components/codemirror/mode/http/http.js +113 -0
- data/vendor/assets/components/codemirror/mode/idl/idl.js +290 -0
- data/vendor/assets/components/codemirror/mode/javascript/javascript.js +865 -0
- data/vendor/assets/components/codemirror/mode/jinja2/jinja2.js +142 -0
- data/vendor/assets/components/codemirror/mode/jsx/jsx.js +148 -0
- data/vendor/assets/components/codemirror/mode/julia/julia.js +418 -0
- data/vendor/assets/components/codemirror/mode/livescript/livescript.js +280 -0
- data/vendor/assets/components/codemirror/mode/lua/lua.js +159 -0
- data/vendor/assets/components/codemirror/mode/markdown/markdown.js +872 -0
- data/vendor/assets/components/codemirror/mode/mathematica/mathematica.js +176 -0
- data/vendor/assets/components/codemirror/mode/mbox/mbox.js +129 -0
- data/vendor/assets/components/codemirror/mode/meta.js +217 -0
- data/vendor/assets/components/codemirror/mode/mirc/mirc.js +193 -0
- data/vendor/assets/components/codemirror/mode/mllike/mllike.js +356 -0
- data/vendor/assets/components/codemirror/mode/modelica/modelica.js +245 -0
- data/vendor/assets/components/codemirror/mode/mscgen/mscgen.js +175 -0
- data/vendor/assets/components/codemirror/mode/mumps/mumps.js +148 -0
- data/vendor/assets/components/codemirror/mode/nginx/nginx.js +178 -0
- data/vendor/assets/components/codemirror/mode/nsis/nsis.js +95 -0
- data/vendor/assets/components/codemirror/mode/ntriples/ntriples.js +195 -0
- data/vendor/assets/components/codemirror/mode/octave/octave.js +139 -0
- data/vendor/assets/components/codemirror/mode/oz/oz.js +252 -0
- data/vendor/assets/components/codemirror/mode/pascal/pascal.js +109 -0
- data/vendor/assets/components/codemirror/mode/pegjs/pegjs.js +114 -0
- data/vendor/assets/components/codemirror/mode/perl/perl.js +837 -0
- data/vendor/assets/components/codemirror/mode/php/php.js +234 -0
- data/vendor/assets/components/codemirror/mode/pig/pig.js +178 -0
- data/vendor/assets/components/codemirror/mode/powershell/powershell.js +398 -0
- data/vendor/assets/components/codemirror/mode/properties/properties.js +78 -0
- data/vendor/assets/components/codemirror/mode/protobuf/protobuf.js +69 -0
- data/vendor/assets/components/codemirror/mode/pug/pug.js +591 -0
- data/vendor/assets/components/codemirror/mode/puppet/puppet.js +220 -0
- data/vendor/assets/components/codemirror/mode/python/python.js +334 -0
- data/vendor/assets/components/codemirror/mode/q/q.js +139 -0
- data/vendor/assets/components/codemirror/mode/r/r.js +183 -0
- data/vendor/assets/components/codemirror/mode/rpm/rpm.js +109 -0
- data/vendor/assets/components/codemirror/mode/rst/rst.js +557 -0
- data/vendor/assets/components/codemirror/mode/ruby/ruby.js +296 -0
- data/vendor/assets/components/codemirror/mode/rust/rust.js +72 -0
- data/vendor/assets/components/codemirror/mode/sas/sas.js +303 -0
- data/vendor/assets/components/codemirror/mode/sass/sass.js +454 -0
- data/vendor/assets/components/codemirror/mode/scheme/scheme.js +249 -0
- data/vendor/assets/components/codemirror/mode/shell/shell.js +151 -0
- data/vendor/assets/components/codemirror/mode/sieve/sieve.js +193 -0
- data/vendor/assets/components/codemirror/mode/slim/slim.js +575 -0
- data/vendor/assets/components/codemirror/mode/smalltalk/smalltalk.js +168 -0
- data/vendor/assets/components/codemirror/mode/smarty/smarty.js +225 -0
- data/vendor/assets/components/codemirror/mode/solr/solr.js +104 -0
- data/vendor/assets/components/codemirror/mode/soy/soy.js +354 -0
- data/vendor/assets/components/codemirror/mode/sparql/sparql.js +180 -0
- data/vendor/assets/components/codemirror/mode/spreadsheet/spreadsheet.js +112 -0
- data/vendor/assets/components/codemirror/mode/sql/sql.js +488 -0
- data/vendor/assets/components/codemirror/mode/stex/stex.js +251 -0
- data/vendor/assets/components/codemirror/mode/stylus/stylus.js +771 -0
- data/vendor/assets/components/codemirror/mode/swift/swift.js +219 -0
- data/vendor/assets/components/codemirror/mode/tcl/tcl.js +139 -0
- data/vendor/assets/components/codemirror/mode/textile/textile.js +469 -0
- data/vendor/assets/components/codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
- data/vendor/assets/components/codemirror/mode/tiddlywiki/tiddlywiki.js +308 -0
- data/vendor/assets/components/codemirror/mode/tiki/tiki.css +26 -0
- data/vendor/assets/components/codemirror/mode/tiki/tiki.js +312 -0
- data/vendor/assets/components/codemirror/mode/toml/toml.js +88 -0
- data/vendor/assets/components/codemirror/mode/tornado/tornado.js +68 -0
- data/vendor/assets/components/codemirror/mode/troff/troff.js +84 -0
- data/vendor/assets/components/codemirror/mode/ttcn-cfg/ttcn-cfg.js +214 -0
- data/vendor/assets/components/codemirror/mode/ttcn/ttcn.js +283 -0
- data/vendor/assets/components/codemirror/mode/turtle/turtle.js +162 -0
- data/vendor/assets/components/codemirror/mode/twig/twig.js +141 -0
- data/vendor/assets/components/codemirror/mode/vb/vb.js +275 -0
- data/vendor/assets/components/codemirror/mode/vbscript/vbscript.js +350 -0
- data/vendor/assets/components/codemirror/mode/velocity/velocity.js +201 -0
- data/vendor/assets/components/codemirror/mode/verilog/verilog.js +675 -0
- data/vendor/assets/components/codemirror/mode/vhdl/vhdl.js +189 -0
- data/vendor/assets/components/codemirror/mode/vue/vue.js +77 -0
- data/vendor/assets/components/codemirror/mode/webidl/webidl.js +195 -0
- data/vendor/assets/components/codemirror/mode/xml/xml.js +401 -0
- data/vendor/assets/components/codemirror/mode/xquery/xquery.js +448 -0
- data/vendor/assets/components/codemirror/mode/yacas/yacas.js +204 -0
- data/vendor/assets/components/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js +68 -0
- data/vendor/assets/components/codemirror/mode/yaml/yaml.js +118 -0
- data/vendor/assets/components/codemirror/mode/z80/z80.js +116 -0
- data/vendor/assets/components/codemirror/rollup.config.js +18 -0
- data/vendor/assets/components/codemirror/src/codemirror.js +3 -0
- data/vendor/assets/components/codemirror/src/display/Display.js +106 -0
- data/vendor/assets/components/codemirror/src/display/focus.js +47 -0
- data/vendor/assets/components/codemirror/src/display/gutters.js +34 -0
- data/vendor/assets/components/codemirror/src/display/highlight_worker.js +55 -0
- data/vendor/assets/components/codemirror/src/display/line_numbers.js +48 -0
- data/vendor/assets/components/codemirror/src/display/mode_state.js +22 -0
- data/vendor/assets/components/codemirror/src/display/operations.js +205 -0
- data/vendor/assets/components/codemirror/src/display/scroll_events.js +115 -0
- data/vendor/assets/components/codemirror/src/display/scrollbars.js +192 -0
- data/vendor/assets/components/codemirror/src/display/scrolling.js +184 -0
- data/vendor/assets/components/codemirror/src/display/selection.js +158 -0
- data/vendor/assets/components/codemirror/src/display/update_display.js +260 -0
- data/vendor/assets/components/codemirror/src/display/update_line.js +188 -0
- data/vendor/assets/components/codemirror/src/display/update_lines.js +64 -0
- data/vendor/assets/components/codemirror/src/display/view_tracking.js +153 -0
- data/vendor/assets/components/codemirror/src/edit/CodeMirror.js +214 -0
- data/vendor/assets/components/codemirror/src/edit/commands.js +178 -0
- data/vendor/assets/components/codemirror/src/edit/deleteNearSelection.js +30 -0
- data/vendor/assets/components/codemirror/src/edit/drop_events.js +119 -0
- data/vendor/assets/components/codemirror/src/edit/fromTextArea.js +61 -0
- data/vendor/assets/components/codemirror/src/edit/global_events.js +44 -0
- data/vendor/assets/components/codemirror/src/edit/key_events.js +159 -0
- data/vendor/assets/components/codemirror/src/edit/legacy.js +62 -0
- data/vendor/assets/components/codemirror/src/edit/main.js +69 -0
- data/vendor/assets/components/codemirror/src/edit/methods.js +539 -0
- data/vendor/assets/components/codemirror/src/edit/mouse_events.js +407 -0
- data/vendor/assets/components/codemirror/src/edit/options.js +191 -0
- data/vendor/assets/components/codemirror/src/edit/utils.js +7 -0
- data/vendor/assets/components/codemirror/src/input/ContentEditableInput.js +517 -0
- data/vendor/assets/components/codemirror/src/input/TextareaInput.js +350 -0
- data/vendor/assets/components/codemirror/src/input/indent.js +71 -0
- data/vendor/assets/components/codemirror/src/input/input.js +135 -0
- data/vendor/assets/components/codemirror/src/input/keymap.js +148 -0
- data/vendor/assets/components/codemirror/src/input/keynames.js +17 -0
- data/vendor/assets/components/codemirror/src/input/movement.js +110 -0
- data/vendor/assets/components/codemirror/src/line/highlight.js +284 -0
- data/vendor/assets/components/codemirror/src/line/line_data.js +337 -0
- data/vendor/assets/components/codemirror/src/line/pos.js +40 -0
- data/vendor/assets/components/codemirror/src/line/saw_special_spans.js +10 -0
- data/vendor/assets/components/codemirror/src/line/spans.js +372 -0
- data/vendor/assets/components/codemirror/src/line/utils_line.js +85 -0
- data/vendor/assets/components/codemirror/src/measurement/position_measurement.js +700 -0
- data/vendor/assets/components/codemirror/src/measurement/widgets.js +26 -0
- data/vendor/assets/components/codemirror/src/model/Doc.js +432 -0
- data/vendor/assets/components/codemirror/src/model/change_measurement.js +61 -0
- data/vendor/assets/components/codemirror/src/model/changes.js +330 -0
- data/vendor/assets/components/codemirror/src/model/chunk.js +167 -0
- data/vendor/assets/components/codemirror/src/model/document_data.js +111 -0
- data/vendor/assets/components/codemirror/src/model/history.js +228 -0
- data/vendor/assets/components/codemirror/src/model/line_widget.js +78 -0
- data/vendor/assets/components/codemirror/src/model/mark_text.js +292 -0
- data/vendor/assets/components/codemirror/src/model/selection.js +82 -0
- data/vendor/assets/components/codemirror/src/model/selection_updates.js +208 -0
- data/vendor/assets/components/codemirror/src/modes.js +96 -0
- data/vendor/assets/components/codemirror/src/util/StringStream.js +90 -0
- data/vendor/assets/components/codemirror/src/util/bidi.js +214 -0
- data/vendor/assets/components/codemirror/src/util/browser.js +33 -0
- data/vendor/assets/components/codemirror/src/util/dom.js +97 -0
- data/vendor/assets/components/codemirror/src/util/event.js +103 -0
- data/vendor/assets/components/codemirror/src/util/feature_detection.js +84 -0
- data/vendor/assets/components/codemirror/src/util/misc.js +150 -0
- data/vendor/assets/components/codemirror/src/util/operation_group.js +72 -0
- data/vendor/assets/components/codemirror/theme/3024-day.css +41 -0
- data/vendor/assets/components/codemirror/theme/3024-night.css +39 -0
- data/vendor/assets/components/codemirror/theme/abcdef.css +32 -0
- data/vendor/assets/components/codemirror/theme/ambiance-mobile.css +5 -0
- data/vendor/assets/components/codemirror/theme/ambiance.css +74 -0
- data/vendor/assets/components/codemirror/theme/base16-dark.css +38 -0
- data/vendor/assets/components/codemirror/theme/base16-light.css +38 -0
- data/vendor/assets/components/codemirror/theme/bespin.css +34 -0
- data/vendor/assets/components/codemirror/theme/blackboard.css +32 -0
- data/vendor/assets/components/codemirror/theme/cobalt.css +25 -0
- data/vendor/assets/components/codemirror/theme/colorforth.css +33 -0
- data/vendor/assets/components/codemirror/theme/dracula.css +40 -0
- data/vendor/assets/components/codemirror/theme/duotone-dark.css +35 -0
- data/vendor/assets/components/codemirror/theme/duotone-light.css +36 -0
- data/vendor/assets/components/codemirror/theme/eclipse.css +23 -0
- data/vendor/assets/components/codemirror/theme/elegant.css +13 -0
- data/vendor/assets/components/codemirror/theme/erlang-dark.css +34 -0
- data/vendor/assets/components/codemirror/theme/hopscotch.css +34 -0
- data/vendor/assets/components/codemirror/theme/icecoder.css +43 -0
- data/vendor/assets/components/codemirror/theme/isotope.css +34 -0
- data/vendor/assets/components/codemirror/theme/lesser-dark.css +47 -0
- data/vendor/assets/components/codemirror/theme/liquibyte.css +95 -0
- data/vendor/assets/components/codemirror/theme/material.css +53 -0
- data/vendor/assets/components/codemirror/theme/mbo.css +37 -0
- data/vendor/assets/components/codemirror/theme/mdn-like.css +46 -0
- data/vendor/assets/components/codemirror/theme/midnight.css +43 -0
- data/vendor/assets/components/codemirror/theme/monokai.css +36 -0
- data/vendor/assets/components/codemirror/theme/neat.css +12 -0
- data/vendor/assets/components/codemirror/theme/neo.css +43 -0
- data/vendor/assets/components/codemirror/theme/night.css +27 -0
- data/vendor/assets/components/codemirror/theme/oceanic-next.css +44 -0
- data/vendor/assets/components/codemirror/theme/panda-syntax.css +85 -0
- data/vendor/assets/components/codemirror/theme/paraiso-dark.css +38 -0
- data/vendor/assets/components/codemirror/theme/paraiso-light.css +38 -0
- data/vendor/assets/components/codemirror/theme/pastel-on-dark.css +52 -0
- data/vendor/assets/components/codemirror/theme/railscasts.css +34 -0
- data/vendor/assets/components/codemirror/theme/rubyblue.css +25 -0
- data/vendor/assets/components/codemirror/theme/seti.css +44 -0
- data/vendor/assets/components/codemirror/theme/shadowfox.css +52 -0
- data/vendor/assets/components/codemirror/theme/solarized.css +168 -0
- data/vendor/assets/components/codemirror/theme/the-matrix.css +30 -0
- data/vendor/assets/components/codemirror/theme/tomorrow-night-bright.css +35 -0
- data/vendor/assets/components/codemirror/theme/tomorrow-night-eighties.css +38 -0
- data/vendor/assets/components/codemirror/theme/ttcn.css +64 -0
- data/vendor/assets/components/codemirror/theme/twilight.css +32 -0
- data/vendor/assets/components/codemirror/theme/vibrant-ink.css +34 -0
- data/vendor/assets/components/codemirror/theme/xq-dark.css +53 -0
- data/vendor/assets/components/codemirror/theme/xq-light.css +43 -0
- data/vendor/assets/components/codemirror/theme/yeti.css +44 -0
- data/vendor/assets/components/codemirror/theme/zenburn.css +37 -0
- data/vendor/assets/components/eve/.bower.json +12 -0
- data/vendor/assets/components/eve/LICENSE +202 -0
- data/vendor/assets/components/eve/README.md +7 -0
- data/vendor/assets/components/eve/component.json +13 -0
- data/vendor/assets/components/eve/e.html +66 -0
- data/vendor/assets/components/eve/eve.js +371 -0
- data/vendor/assets/components/eve/package.json +18 -0
- data/vendor/assets/components/highlightjs/.bower.json +24 -0
- data/vendor/assets/components/highlightjs/LICENSE +24 -0
- data/vendor/assets/components/highlightjs/Makefile +21 -0
- data/vendor/assets/components/highlightjs/README.md +12 -0
- data/vendor/assets/components/highlightjs/bower.json +14 -0
- data/vendor/assets/components/highlightjs/component.json +12 -0
- data/vendor/assets/components/highlightjs/composer.json +26 -0
- data/vendor/assets/components/highlightjs/highlight.pack.js +16645 -0
- data/vendor/assets/components/highlightjs/highlight.pack.min.js +15 -0
- data/vendor/assets/components/highlightjs/package.json +8 -0
- data/vendor/assets/components/highlightjs/styles/agate.css +108 -0
- data/vendor/assets/components/highlightjs/styles/androidstudio.css +66 -0
- data/vendor/assets/components/highlightjs/styles/arduino-light.css +88 -0
- data/vendor/assets/components/highlightjs/styles/arta.css +73 -0
- data/vendor/assets/components/highlightjs/styles/ascetic.css +45 -0
- data/vendor/assets/components/highlightjs/styles/atelier-cave-dark.css +83 -0
- data/vendor/assets/components/highlightjs/styles/atelier-cave-light.css +85 -0
- data/vendor/assets/components/highlightjs/styles/atelier-cave.dark.css +113 -0
- data/vendor/assets/components/highlightjs/styles/atelier-cave.light.css +113 -0
- data/vendor/assets/components/highlightjs/styles/atelier-dune-dark.css +69 -0
- data/vendor/assets/components/highlightjs/styles/atelier-dune-light.css +69 -0
- data/vendor/assets/components/highlightjs/styles/atelier-dune.dark.css +94 -0
- data/vendor/assets/components/highlightjs/styles/atelier-dune.light.css +94 -0
- data/vendor/assets/components/highlightjs/styles/atelier-estuary-dark.css +84 -0
- data/vendor/assets/components/highlightjs/styles/atelier-estuary-light.css +84 -0
- data/vendor/assets/components/highlightjs/styles/atelier-estuary.dark.css +113 -0
- data/vendor/assets/components/highlightjs/styles/atelier-estuary.light.css +113 -0
- data/vendor/assets/components/highlightjs/styles/atelier-forest-dark.css +69 -0
- data/vendor/assets/components/highlightjs/styles/atelier-forest-light.css +69 -0
- data/vendor/assets/components/highlightjs/styles/atelier-forest.dark.css +94 -0
- data/vendor/assets/components/highlightjs/styles/atelier-forest.light.css +94 -0
- data/vendor/assets/components/highlightjs/styles/atelier-heath-dark.css +69 -0
- data/vendor/assets/components/highlightjs/styles/atelier-heath-light.css +69 -0
- data/vendor/assets/components/highlightjs/styles/atelier-heath.dark.css +94 -0
- data/vendor/assets/components/highlightjs/styles/atelier-heath.light.css +94 -0
- data/vendor/assets/components/highlightjs/styles/atelier-lakeside-dark.css +69 -0
- data/vendor/assets/components/highlightjs/styles/atelier-lakeside-light.css +69 -0
- data/vendor/assets/components/highlightjs/styles/atelier-lakeside.dark.css +94 -0
- data/vendor/assets/components/highlightjs/styles/atelier-lakeside.light.css +94 -0
- data/vendor/assets/components/highlightjs/styles/atelier-plateau-dark.css +84 -0
- data/vendor/assets/components/highlightjs/styles/atelier-plateau-light.css +84 -0
- data/vendor/assets/components/highlightjs/styles/atelier-plateau.dark.css +113 -0
- data/vendor/assets/components/highlightjs/styles/atelier-plateau.light.css +113 -0
- data/vendor/assets/components/highlightjs/styles/atelier-savanna-dark.css +84 -0
- data/vendor/assets/components/highlightjs/styles/atelier-savanna-light.css +84 -0
- data/vendor/assets/components/highlightjs/styles/atelier-savanna.dark.css +113 -0
- data/vendor/assets/components/highlightjs/styles/atelier-savanna.light.css +113 -0
- data/vendor/assets/components/highlightjs/styles/atelier-seaside-dark.css +69 -0
- data/vendor/assets/components/highlightjs/styles/atelier-seaside-light.css +69 -0
- data/vendor/assets/components/highlightjs/styles/atelier-seaside.dark.css +94 -0
- data/vendor/assets/components/highlightjs/styles/atelier-seaside.light.css +94 -0
- data/vendor/assets/components/highlightjs/styles/atelier-sulphurpool-dark.css +69 -0
- data/vendor/assets/components/highlightjs/styles/atelier-sulphurpool-light.css +69 -0
- data/vendor/assets/components/highlightjs/styles/atelier-sulphurpool.dark.css +94 -0
- data/vendor/assets/components/highlightjs/styles/atelier-sulphurpool.light.css +94 -0
- data/vendor/assets/components/highlightjs/styles/atom-one-dark.css +96 -0
- data/vendor/assets/components/highlightjs/styles/atom-one-light.css +96 -0
- data/vendor/assets/components/highlightjs/styles/brown-paper.css +64 -0
- data/vendor/assets/components/highlightjs/styles/brown-papersq.png +0 -0
- data/vendor/assets/components/highlightjs/styles/brown_paper.css +103 -0
- data/vendor/assets/components/highlightjs/styles/brown_papersq.png +0 -0
- data/vendor/assets/components/highlightjs/styles/codepen-embed.css +60 -0
- data/vendor/assets/components/highlightjs/styles/color-brewer.css +71 -0
- data/vendor/assets/components/highlightjs/styles/darcula.css +77 -0
- data/vendor/assets/components/highlightjs/styles/dark.css +63 -0
- data/vendor/assets/components/highlightjs/styles/darkula.css +6 -0
- data/vendor/assets/components/highlightjs/styles/default.css +99 -0
- data/vendor/assets/components/highlightjs/styles/docco.css +97 -0
- data/vendor/assets/components/highlightjs/styles/dracula.css +76 -0
- data/vendor/assets/components/highlightjs/styles/far.css +71 -0
- data/vendor/assets/components/highlightjs/styles/foundation.css +88 -0
- data/vendor/assets/components/highlightjs/styles/github-gist.css +71 -0
- data/vendor/assets/components/highlightjs/styles/github.css +99 -0
- data/vendor/assets/components/highlightjs/styles/googlecode.css +89 -0
- data/vendor/assets/components/highlightjs/styles/grayscale.css +101 -0
- data/vendor/assets/components/highlightjs/styles/gruvbox-dark.css +108 -0
- data/vendor/assets/components/highlightjs/styles/gruvbox-light.css +108 -0
- data/vendor/assets/components/highlightjs/styles/hopscotch.css +83 -0
- data/vendor/assets/components/highlightjs/styles/hybrid.css +102 -0
- data/vendor/assets/components/highlightjs/styles/idea.css +97 -0
- data/vendor/assets/components/highlightjs/styles/ir-black.css +73 -0
- data/vendor/assets/components/highlightjs/styles/ir_black.css +106 -0
- data/vendor/assets/components/highlightjs/styles/kimbie.dark.css +74 -0
- data/vendor/assets/components/highlightjs/styles/kimbie.light.css +74 -0
- data/vendor/assets/components/highlightjs/styles/magula.css +70 -0
- data/vendor/assets/components/highlightjs/styles/mono-blue.css +59 -0
- data/vendor/assets/components/highlightjs/styles/monokai-sublime.css +83 -0
- data/vendor/assets/components/highlightjs/styles/monokai.css +70 -0
- data/vendor/assets/components/highlightjs/styles/monokai_sublime.css +154 -0
- data/vendor/assets/components/highlightjs/styles/obsidian.css +88 -0
- data/vendor/assets/components/highlightjs/styles/ocean.css +74 -0
- data/vendor/assets/components/highlightjs/styles/paraiso-dark.css +72 -0
- data/vendor/assets/components/highlightjs/styles/paraiso-light.css +72 -0
- data/vendor/assets/components/highlightjs/styles/paraiso.dark.css +96 -0
- data/vendor/assets/components/highlightjs/styles/paraiso.light.css +96 -0
- data/vendor/assets/components/highlightjs/styles/pojoaque.css +83 -0
- data/vendor/assets/components/highlightjs/styles/pojoaque.jpg +0 -0
- data/vendor/assets/components/highlightjs/styles/purebasic.css +96 -0
- data/vendor/assets/components/highlightjs/styles/qtcreator_dark.css +83 -0
- data/vendor/assets/components/highlightjs/styles/qtcreator_light.css +83 -0
- data/vendor/assets/components/highlightjs/styles/railscasts.css +106 -0
- data/vendor/assets/components/highlightjs/styles/rainbow.css +85 -0
- data/vendor/assets/components/highlightjs/styles/routeros.css +108 -0
- data/vendor/assets/components/highlightjs/styles/school-book.css +72 -0
- data/vendor/assets/components/highlightjs/styles/school-book.png +0 -0
- data/vendor/assets/components/highlightjs/styles/school_book.css +111 -0
- data/vendor/assets/components/highlightjs/styles/school_book.png +0 -0
- data/vendor/assets/components/highlightjs/styles/solarized-dark.css +84 -0
- data/vendor/assets/components/highlightjs/styles/solarized-light.css +84 -0
- data/vendor/assets/components/highlightjs/styles/solarized_dark.css +107 -0
- data/vendor/assets/components/highlightjs/styles/solarized_light.css +107 -0
- data/vendor/assets/components/highlightjs/styles/sunburst.css +102 -0
- data/vendor/assets/components/highlightjs/styles/tomorrow-night-blue.css +75 -0
- data/vendor/assets/components/highlightjs/styles/tomorrow-night-bright.css +74 -0
- data/vendor/assets/components/highlightjs/styles/tomorrow-night-eighties.css +74 -0
- data/vendor/assets/components/highlightjs/styles/tomorrow-night.css +75 -0
- data/vendor/assets/components/highlightjs/styles/tomorrow.css +72 -0
- data/vendor/assets/components/highlightjs/styles/vs.css +68 -0
- data/vendor/assets/components/highlightjs/styles/vs2015.css +115 -0
- data/vendor/assets/components/highlightjs/styles/xcode.css +93 -0
- data/vendor/assets/components/highlightjs/styles/xt256.css +92 -0
- data/vendor/assets/components/highlightjs/styles/zenburn.css +80 -0
- data/vendor/assets/components/jquery/.bower.json +25 -0
- data/vendor/assets/components/jquery/AUTHORS.txt +313 -0
- data/vendor/assets/components/jquery/LICENSE.txt +36 -0
- data/vendor/assets/components/jquery/README.md +67 -0
- data/vendor/assets/components/jquery/bower.json +14 -0
- data/vendor/assets/components/jquery/dist/core.js +399 -0
- data/vendor/assets/components/jquery/dist/jquery.js +10364 -0
- data/vendor/assets/components/jquery/dist/jquery.min.js +2 -0
- data/vendor/assets/components/jquery/dist/jquery.min.map +1 -0
- data/vendor/assets/components/jquery/dist/jquery.slim.js +8269 -0
- data/vendor/assets/components/jquery/dist/jquery.slim.min.js +2 -0
- data/vendor/assets/components/jquery/dist/jquery.slim.min.map +1 -0
- data/vendor/assets/components/jquery/external/sizzle/LICENSE.txt +36 -0
- data/vendor/assets/components/jquery/external/sizzle/dist/sizzle.js +2272 -0
- data/vendor/assets/components/jquery/external/sizzle/dist/sizzle.min.js +3 -0
- data/vendor/assets/components/jquery/external/sizzle/dist/sizzle.min.map +1 -0
- data/vendor/assets/components/jquery/src/.eslintrc.json +5 -0
- data/vendor/assets/components/jquery/src/ajax.js +856 -0
- data/vendor/assets/components/jquery/src/ajax/jsonp.js +103 -0
- data/vendor/assets/components/jquery/src/ajax/load.js +77 -0
- data/vendor/assets/components/jquery/src/ajax/parseXML.js +30 -0
- data/vendor/assets/components/jquery/src/ajax/script.js +77 -0
- data/vendor/assets/components/jquery/src/ajax/var/location.js +5 -0
- data/vendor/assets/components/jquery/src/ajax/var/nonce.js +5 -0
- data/vendor/assets/components/jquery/src/ajax/var/rquery.js +5 -0
- data/vendor/assets/components/jquery/src/ajax/xhr.js +170 -0
- data/vendor/assets/components/jquery/src/attributes.js +13 -0
- data/vendor/assets/components/jquery/src/attributes/attr.js +141 -0
- data/vendor/assets/components/jquery/src/attributes/classes.js +186 -0
- data/vendor/assets/components/jquery/src/attributes/prop.js +143 -0
- data/vendor/assets/components/jquery/src/attributes/support.js +33 -0
- data/vendor/assets/components/jquery/src/attributes/val.js +191 -0
- data/vendor/assets/components/jquery/src/callbacks.js +236 -0
- data/vendor/assets/components/jquery/src/core.js +399 -0
- data/vendor/assets/components/jquery/src/core/DOMEval.js +30 -0
- data/vendor/assets/components/jquery/src/core/access.js +72 -0
- data/vendor/assets/components/jquery/src/core/camelCase.js +23 -0
- data/vendor/assets/components/jquery/src/core/init.js +129 -0
- data/vendor/assets/components/jquery/src/core/nodeName.js +13 -0
- data/vendor/assets/components/jquery/src/core/parseHTML.js +65 -0
- data/vendor/assets/components/jquery/src/core/ready-no-deferred.js +97 -0
- data/vendor/assets/components/jquery/src/core/ready.js +86 -0
- data/vendor/assets/components/jquery/src/core/readyException.js +13 -0
- data/vendor/assets/components/jquery/src/core/stripAndCollapse.js +14 -0
- data/vendor/assets/components/jquery/src/core/support.js +20 -0
- data/vendor/assets/components/jquery/src/core/toType.js +20 -0
- data/vendor/assets/components/jquery/src/core/var/rsingleTag.js +6 -0
- data/vendor/assets/components/jquery/src/css.js +481 -0
- data/vendor/assets/components/jquery/src/css/addGetHookIf.js +26 -0
- data/vendor/assets/components/jquery/src/css/adjustCSS.js +73 -0
- data/vendor/assets/components/jquery/src/css/curCSS.js +65 -0
- data/vendor/assets/components/jquery/src/css/hiddenVisibleSelectors.js +15 -0
- data/vendor/assets/components/jquery/src/css/showHide.js +105 -0
- data/vendor/assets/components/jquery/src/css/support.js +102 -0
- data/vendor/assets/components/jquery/src/css/var/cssExpand.js +5 -0
- data/vendor/assets/components/jquery/src/css/var/getStyles.js +17 -0
- data/vendor/assets/components/jquery/src/css/var/isHiddenWithinTree.js +34 -0
- data/vendor/assets/components/jquery/src/css/var/rboxStyle.js +7 -0
- data/vendor/assets/components/jquery/src/css/var/rnumnonpx.js +7 -0
- data/vendor/assets/components/jquery/src/css/var/swap.js +26 -0
- data/vendor/assets/components/jquery/src/data.js +180 -0
- data/vendor/assets/components/jquery/src/data/Data.js +162 -0
- data/vendor/assets/components/jquery/src/data/var/acceptData.js +19 -0
- data/vendor/assets/components/jquery/src/data/var/dataPriv.js +7 -0
- data/vendor/assets/components/jquery/src/data/var/dataUser.js +7 -0
- data/vendor/assets/components/jquery/src/deferred.js +399 -0
- data/vendor/assets/components/jquery/src/deferred/exceptionHook.js +21 -0
- data/vendor/assets/components/jquery/src/deprecated.js +98 -0
- data/vendor/assets/components/jquery/src/dimensions.js +57 -0
- data/vendor/assets/components/jquery/src/effects.js +702 -0
- data/vendor/assets/components/jquery/src/effects/Tween.js +123 -0
- data/vendor/assets/components/jquery/src/effects/animatedSelector.js +15 -0
- data/vendor/assets/components/jquery/src/event.js +748 -0
- data/vendor/assets/components/jquery/src/event/ajax.js +22 -0
- data/vendor/assets/components/jquery/src/event/alias.js +29 -0
- data/vendor/assets/components/jquery/src/event/focusin.js +55 -0
- data/vendor/assets/components/jquery/src/event/support.js +11 -0
- data/vendor/assets/components/jquery/src/event/trigger.js +199 -0
- data/vendor/assets/components/jquery/src/exports/amd.js +26 -0
- data/vendor/assets/components/jquery/src/exports/global.js +34 -0
- data/vendor/assets/components/jquery/src/jquery.js +40 -0
- data/vendor/assets/components/jquery/src/manipulation.js +486 -0
- data/vendor/assets/components/jquery/src/manipulation/_evalUrl.js +23 -0
- data/vendor/assets/components/jquery/src/manipulation/buildFragment.js +105 -0
- data/vendor/assets/components/jquery/src/manipulation/getAll.js +32 -0
- data/vendor/assets/components/jquery/src/manipulation/setGlobalEval.js +22 -0
- data/vendor/assets/components/jquery/src/manipulation/support.js +35 -0
- data/vendor/assets/components/jquery/src/manipulation/var/rcheckableType.js +5 -0
- data/vendor/assets/components/jquery/src/manipulation/var/rscriptType.js +5 -0
- data/vendor/assets/components/jquery/src/manipulation/var/rtagName.js +5 -0
- data/vendor/assets/components/jquery/src/manipulation/wrapMap.js +29 -0
- data/vendor/assets/components/jquery/src/offset.js +233 -0
- data/vendor/assets/components/jquery/src/queue.js +145 -0
- data/vendor/assets/components/jquery/src/queue/delay.js +24 -0
- data/vendor/assets/components/jquery/src/selector-native.js +237 -0
- data/vendor/assets/components/jquery/src/selector-sizzle.js +19 -0
- data/vendor/assets/components/jquery/src/selector.js +3 -0
- data/vendor/assets/components/jquery/src/serialize.js +132 -0
- data/vendor/assets/components/jquery/src/traversing.js +191 -0
- data/vendor/assets/components/jquery/src/traversing/findFilter.js +97 -0
- data/vendor/assets/components/jquery/src/traversing/var/dir.js +22 -0
- data/vendor/assets/components/jquery/src/traversing/var/rneedsContext.js +8 -0
- data/vendor/assets/components/jquery/src/traversing/var/siblings.js +17 -0
- data/vendor/assets/components/jquery/src/var/ObjectFunctionString.js +7 -0
- data/vendor/assets/components/jquery/src/var/arr.js +5 -0
- data/vendor/assets/components/jquery/src/var/class2type.js +6 -0
- data/vendor/assets/components/jquery/src/var/concat.js +7 -0
- data/vendor/assets/components/jquery/src/var/document.js +5 -0
- data/vendor/assets/components/jquery/src/var/documentElement.js +7 -0
- data/vendor/assets/components/jquery/src/var/fnToString.js +7 -0
- data/vendor/assets/components/jquery/src/var/getProto.js +5 -0
- data/vendor/assets/components/jquery/src/var/hasOwn.js +7 -0
- data/vendor/assets/components/jquery/src/var/indexOf.js +7 -0
- data/vendor/assets/components/jquery/src/var/isFunction.js +13 -0
- data/vendor/assets/components/jquery/src/var/isWindow.js +8 -0
- data/vendor/assets/components/jquery/src/var/pnum.js +5 -0
- data/vendor/assets/components/jquery/src/var/push.js +7 -0
- data/vendor/assets/components/jquery/src/var/rcssNum.js +9 -0
- data/vendor/assets/components/jquery/src/var/rnothtmlwhite.js +8 -0
- data/vendor/assets/components/jquery/src/var/slice.js +7 -0
- data/vendor/assets/components/jquery/src/var/support.js +6 -0
- data/vendor/assets/components/jquery/src/var/toString.js +7 -0
- data/vendor/assets/components/jquery/src/wrap.js +78 -0
- data/vendor/assets/components/markdown-it/.bower.json +38 -0
- data/vendor/assets/components/markdown-it/CHANGELOG.md +442 -0
- data/vendor/assets/components/markdown-it/CONTRIBUTING.md +15 -0
- data/vendor/assets/components/markdown-it/LICENSE +22 -0
- data/vendor/assets/components/markdown-it/Procfile +1 -0
- data/vendor/assets/components/markdown-it/README.md +294 -0
- data/vendor/assets/components/markdown-it/bin/markdown-it.js +113 -0
- data/vendor/assets/components/markdown-it/bower.json +28 -0
- data/vendor/assets/components/markdown-it/dist/markdown-it.js +7963 -0
- data/vendor/assets/components/markdown-it/dist/markdown-it.min.js +1 -0
- data/vendor/assets/components/markdown-it/package.json +64 -0
- data/vendor/assets/components/plantuml-encoder/.bower.json +29 -0
- data/vendor/assets/components/plantuml-encoder/LICENSE +19 -0
- data/vendor/assets/components/plantuml-encoder/README.md +38 -0
- data/vendor/assets/components/plantuml-encoder/bower.json +20 -0
- data/vendor/assets/components/plantuml-encoder/dist/plantuml-encoder.js +3994 -0
- data/vendor/assets/components/plantuml-encoder/dist/plantuml-encoder.min.js +1 -0
- data/vendor/assets/components/plantuml-encoder/package.json +33 -0
- data/vendor/assets/components/raphael/.bower.json +45 -0
- data/vendor/assets/components/raphael/bower.json +31 -0
- data/vendor/assets/components/raphael/dev/banner.txt +8 -0
- data/vendor/assets/components/raphael/dev/raphael.amd.js +14 -0
- data/vendor/assets/components/raphael/dev/raphael.core.js +5413 -0
- data/vendor/assets/components/raphael/dev/raphael.svg.js +1428 -0
- data/vendor/assets/components/raphael/dev/raphael.vml.js +1010 -0
- data/vendor/assets/components/raphael/dev/test/svg/dom.js +295 -0
- data/vendor/assets/components/raphael/dev/test/vml/dom.js +5 -0
- data/vendor/assets/components/raphael/license.txt +21 -0
- data/vendor/assets/components/raphael/raphael.js +8330 -0
- data/vendor/assets/components/raphael/raphael.min.js +3 -0
- data/vendor/assets/components/raphael/raphael.no-deps.js +7959 -0
- data/vendor/assets/components/raphael/raphael.no-deps.min.js +3 -0
- data/vendor/assets/components/raphael/webpack.config.js +62 -0
- data/vendor/assets/components/squire-rte/.bower.json +34 -0
- data/vendor/assets/components/squire-rte/Demo.html +143 -0
- data/vendor/assets/components/squire-rte/LICENSE +21 -0
- data/vendor/assets/components/squire-rte/Makefile +22 -0
- data/vendor/assets/components/squire-rte/README.md +473 -0
- data/vendor/assets/components/squire-rte/bower.json +24 -0
- data/vendor/assets/components/squire-rte/build/document.html +54 -0
- data/vendor/assets/components/squire-rte/build/squire-raw.js +4722 -0
- data/vendor/assets/components/squire-rte/build/squire.js +2 -0
- data/vendor/assets/components/squire-rte/package.json +31 -0
- data/vendor/assets/components/squire-rte/source/Clean.js +358 -0
- data/vendor/assets/components/squire-rte/source/Clipboard.js +331 -0
- data/vendor/assets/components/squire-rte/source/Constants.js +60 -0
- data/vendor/assets/components/squire-rte/source/Editor.js +2201 -0
- data/vendor/assets/components/squire-rte/source/KeyHandlers.js +502 -0
- data/vendor/assets/components/squire-rte/source/Node.js +553 -0
- data/vendor/assets/components/squire-rte/source/Range.js +540 -0
- data/vendor/assets/components/squire-rte/source/TreeWalker.js +118 -0
- data/vendor/assets/components/squire-rte/source/document.html +54 -0
- data/vendor/assets/components/squire-rte/source/exports.js +42 -0
- data/vendor/assets/components/squire-rte/source/intro.js +6 -0
- data/vendor/assets/components/squire-rte/source/outro.js +22 -0
- data/vendor/assets/components/to-mark/.bower.json +35 -0
- data/vendor/assets/components/to-mark/bower.json +22 -0
- data/vendor/assets/components/to-mark/demo/demo.html +24 -0
- data/vendor/assets/components/to-mark/demo/demo2.html +94 -0
- data/vendor/assets/components/to-mark/dist/to-mark.js +1283 -0
- data/vendor/assets/components/to-mark/dist/to-mark.min.js +1 -0
- data/vendor/assets/components/to-mark/gulpfile.js +112 -0
- data/vendor/assets/components/to-mark/karma.conf.js +260 -0
- data/vendor/assets/components/to-mark/package-lock.json +13061 -0
- data/vendor/assets/components/to-mark/package.json +53 -0
- data/vendor/assets/components/tui-chart/.bower.json +44 -0
- data/vendor/assets/components/tui-chart/CODE_OF_CONDUCT.md +73 -0
- data/vendor/assets/components/tui-chart/CONTRIBUTING.md +91 -0
- data/vendor/assets/components/tui-chart/LICENSE +21 -0
- data/vendor/assets/components/tui-chart/README.md +142 -0
- data/vendor/assets/components/tui-chart/bower.json +33 -0
- data/vendor/assets/components/tui-chart/dist/maps/china.js +10 -0
- data/vendor/assets/components/tui-chart/dist/maps/japan.js +10 -0
- data/vendor/assets/components/tui-chart/dist/maps/singapore.js +10 -0
- data/vendor/assets/components/tui-chart/dist/maps/south-korea.js +10 -0
- data/vendor/assets/components/tui-chart/dist/maps/taiwan.js +10 -0
- data/vendor/assets/components/tui-chart/dist/maps/thailand.js +10 -0
- data/vendor/assets/components/tui-chart/dist/maps/usa.js +10 -0
- data/vendor/assets/components/tui-chart/dist/maps/world.js +11 -0
- data/vendor/assets/components/tui-chart/dist/tui-chart.css +704 -0
- data/vendor/assets/components/tui-chart/dist/tui-chart.js +40567 -0
- data/vendor/assets/components/tui-chart/dist/tui-chart.min.css +10 -0
- data/vendor/assets/components/tui-chart/dist/tui-chart.min.js +20 -0
- data/vendor/assets/components/tui-chart/docs/COMMIT_MESSAGE_CONVENTION.md +49 -0
- data/vendor/assets/components/tui-chart/docs/ISSUE_TEMPLATE.md +24 -0
- data/vendor/assets/components/tui-chart/docs/PULL_REQUEST_TEMPLATE.md +42 -0
- data/vendor/assets/components/tui-chart/docs/README.md +11 -0
- data/vendor/assets/components/tui-chart/docs/wiki/README.md +27 -0
- data/vendor/assets/components/tui-chart/docs/wiki/_Sidebar.md +31 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-export-menu.md +66 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-type-radial.md +121 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-types-bar,column.md +312 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-types-bubble.md +63 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-types-column-line-combo.md +104 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-types-heatmap.md +39 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-types-line,area.md +333 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-types-line-area-combo.md +78 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-types-line-scatter-combo.md +101 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-types-map.md +153 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-types-pie-donut-combo.md +98 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-types-pie.md +186 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-types-scatter.md +58 -0
- data/vendor/assets/components/tui-chart/docs/wiki/chart-types-treemap.md +158 -0
- data/vendor/assets/components/tui-chart/docs/wiki/code-table-of-china-map.md +38 -0
- data/vendor/assets/components/tui-chart/docs/wiki/code-table-of-japan-map.md +51 -0
- data/vendor/assets/components/tui-chart/docs/wiki/code-table-of-singapore-map.md +9 -0
- data/vendor/assets/components/tui-chart/docs/wiki/code-table-of-south-korea-map.md +21 -0
- data/vendor/assets/components/tui-chart/docs/wiki/code-table-of-taiwan-map.md +26 -0
- data/vendor/assets/components/tui-chart/docs/wiki/code-table-of-thailand-map.md +82 -0
- data/vendor/assets/components/tui-chart/docs/wiki/code-table-of-usa-map.md +55 -0
- data/vendor/assets/components/tui-chart/docs/wiki/code-table-of-world-map.md +180 -0
- data/vendor/assets/components/tui-chart/docs/wiki/features-axes.md +209 -0
- data/vendor/assets/components/tui-chart/docs/wiki/features-chart.md +157 -0
- data/vendor/assets/components/tui-chart/docs/wiki/features-circle-legend.md +20 -0
- data/vendor/assets/components/tui-chart/docs/wiki/features-legend.md +89 -0
- data/vendor/assets/components/tui-chart/docs/wiki/features-plot.md +141 -0
- data/vendor/assets/components/tui-chart/docs/wiki/features-series.md +240 -0
- data/vendor/assets/components/tui-chart/docs/wiki/features-tooltip.md +223 -0
- data/vendor/assets/components/tui-chart/docs/wiki/getting-started.md +74 -0
- data/vendor/assets/components/tui-chart/docs/wiki/import-chart-data-from-existing-table-element.md +150 -0
- data/vendor/assets/components/tui-chart/docs/wiki/table-of-supported-options.md +344 -0
- data/vendor/assets/components/tui-chart/docs/wiki/theme.md +338 -0
- data/vendor/assets/components/tui-chart/package-lock.json +8881 -0
- data/vendor/assets/components/tui-code-snippet/.bower.json +31 -0
- data/vendor/assets/components/tui-code-snippet/LICENSE +21 -0
- data/vendor/assets/components/tui-code-snippet/README.md +109 -0
- data/vendor/assets/components/tui-code-snippet/bower.json +20 -0
- data/vendor/assets/components/tui-code-snippet/demo/postBridge/README.md +26 -0
- data/vendor/assets/components/tui-code-snippet/demo/postBridge/public/popup.html +27 -0
- data/vendor/assets/components/tui-code-snippet/demo/postBridge/public/postBridge.html +31 -0
- data/vendor/assets/components/tui-code-snippet/demo/postBridge/server.js +28 -0
- data/vendor/assets/components/tui-code-snippet/dist/tui-code-snippet.js +4228 -0
- data/vendor/assets/components/tui-code-snippet/dist/tui-code-snippet.min.js +7 -0
- data/vendor/assets/components/tui-code-snippet/package-lock.json +6038 -0
- data/vendor/assets/components/tui-color-picker/.bower.json +37 -0
- data/vendor/assets/components/tui-color-picker/ISSUE_TEMPLATE.md +26 -0
- data/vendor/assets/components/tui-color-picker/LICENSE +34 -0
- data/vendor/assets/components/tui-color-picker/README.md +69 -0
- data/vendor/assets/components/tui-color-picker/bower.json +26 -0
- data/vendor/assets/components/tui-color-picker/dist/tui-color-picker.css +148 -0
- data/vendor/assets/components/tui-color-picker/dist/tui-color-picker.js +3146 -0
- data/vendor/assets/components/tui-color-picker/dist/tui-color-picker.min.css +7 -0
- data/vendor/assets/components/tui-color-picker/dist/tui-color-picker.min.js +9 -0
- data/vendor/assets/components/tui-color-picker/package-lock.json +8440 -0
- data/vendor/assets/components/tui-editor/.bower.json +71 -0
- data/vendor/assets/components/tui-editor/CODE_OF_CONDUCT.md +73 -0
- data/vendor/assets/components/tui-editor/CONTRIBUTING.md +92 -0
- data/vendor/assets/components/tui-editor/LICENSE +21 -0
- data/vendor/assets/components/tui-editor/README.md +204 -0
- data/vendor/assets/components/tui-editor/bower.json +59 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-Editor-all.js +36850 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-Editor-all.min.js +13 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-Editor.js +24646 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-Editor.min.js +7 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-Viewer-all.js +14768 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-Viewer-all.min.js +13 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-Viewer.js +3686 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-Viewer.min.js +7 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-contents.css +239 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-contents.min.css +1 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-extChart.js +7040 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-extChart.min.js +13 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-extColorSyntax.js +472 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-extColorSyntax.min.js +7 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-extScrollSync.js +1241 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-extScrollSync.min.js +7 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-extTable.js +3930 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-extTable.min.js +7 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-extUML.js +212 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor-extUML.min.js +7 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor.css +1166 -0
- data/vendor/assets/components/tui-editor/dist/tui-editor.min.css +1 -0
- data/vendor/assets/components/tui-editor/docs/COMMIT_MESSAGE_CONVENTION.md +49 -0
- data/vendor/assets/components/tui-editor/docs/PULL_REQUEST_TEMPLATE.md +41 -0
- data/vendor/assets/components/tui-editor/docs/README.md +13 -0
- data/vendor/assets/components/tui-editor/docs/getting-started-with-bower.md +93 -0
- data/vendor/assets/components/tui-editor/docs/getting-started.md +76 -0
- data/vendor/assets/components/tui-editor/docs/using-extensions.md +91 -0
- data/vendor/assets/components/tui-editor/docs/writing-your-own-extension.md +167 -0
- data/vendor/assets/components/tui-editor/examples/example00-demo.html +85 -0
- data/vendor/assets/components/tui-editor/examples/example01-basic.html +37 -0
- data/vendor/assets/components/tui-editor/examples/example02-viewer-basic.html +68 -0
- data/vendor/assets/components/tui-editor/examples/example03-jquery.html +36 -0
- data/vendor/assets/components/tui-editor/examples/example04-viewer-jquery.html +67 -0
- data/vendor/assets/components/tui-editor/examples/example05-scrollsync.html +77 -0
- data/vendor/assets/components/tui-editor/examples/example06-colorsyntax.html +44 -0
- data/vendor/assets/components/tui-editor/examples/example07-table.html +48 -0
- data/vendor/assets/components/tui-editor/examples/example08-uml.html +69 -0
- data/vendor/assets/components/tui-editor/examples/example09-multiple-extensions.html +85 -0
- data/vendor/assets/components/tui-editor/examples/example10-viewer-multiple-extensions.html +86 -0
- data/vendor/assets/components/tui-editor/examples/example11-chart.html +60 -0
- data/vendor/assets/components/tui-editor/examples/example12-writing-extension.html +66 -0
- data/vendor/assets/components/tui-editor/examples/examples.json +41 -0
- data/vendor/assets/components/tui-editor/examples/explain.css +7 -0
- data/vendor/assets/components/tui-editor/package-lock.json +13289 -0
- data/vendor/assets/components/tui-editor/package.json +90 -0
- metadata +956 -0
@@ -0,0 +1,7 @@
|
|
1
|
+
/*!
|
2
|
+
* tui-editor
|
3
|
+
* @version 1.0.2
|
4
|
+
* @author NHN Ent. FE Development Lab <dl_javascript@nhnent.com> (https://nhnent.github.io/tui.editor/)
|
5
|
+
* @license MIT
|
6
|
+
*/
|
7
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("jquery"),require("tui-code-snippet"),function(){try{return require("tui-editor")}catch(e){}}(),function(){try{return require("tui-editor/dist/tui-editor-Viewer")}catch(e){}}());else if("function"==typeof define&&define.amd)define(["jquery","tui-code-snippet","tui-editor","tui-editor/dist/tui-editor-Viewer"],t);else{var i="object"==typeof exports?t(require("jquery"),require("tui-code-snippet"),function(){try{return require("tui-editor")}catch(e){}}(),function(){try{return require("tui-editor/dist/tui-editor-Viewer")}catch(e){}}()):t(e.$,e.tui&&e.tui.util,e.tui&&e.tui.Editor,e.tui&&e.tui.Editor);for(var n in i)("object"==typeof exports?exports:e)[n]=i[n]}}("undefined"!=typeof self?self:this,function(e,t,i,n){return function(e){function t(n){if(i[n])return i[n].exports;var o=i[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var i={};return t.m=e,t.c=i,t.d=function(e,i,n){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="dist/",t(t.s=46)}({0:function(t,i){t.exports=e},1:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=void 0;try{n=i(4)}catch(e){}if(!n)try{n=i(5)}catch(e){}t.default=n},2:function(e,i){e.exports=t},4:function(e,t){if(void 0===i){var n=new Error('Cannot find module "undefined"');throw n.code="MODULE_NOT_FOUND",n}e.exports=i},46:function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){function t(){"vertical"===e.mdPreviewStyle&&"markdown"===e.currentMode?(d.$el.show(),v.show()):(d.$el.hide(),v.hide())}var i=e.i18n,n={active:i.get("Auto scroll enabled"),inActive:i.get("Auto scroll disabled")};if(!e.isViewer()){var o=e.getCodeMirror(),r=new f.default(o,e.preview),l=new u.default(r,o,e.preview.$el),s=!1,a=!0,d=void 0,v=void 0;"default"===e.getUI().name&&(d=new h({className:"tui-scrollsync",command:"scrollSyncToggle",tooltip:n.active,$el:(0,c.default)('<button class="active tui-scrollsync" type="button"></button>')}),v=e.getUI().toolbar.addDivider(),e.getUI().toolbar.addButton(d),t(),e.on("changeMode",t),e.on("changePreviewStyle",t),e.addCommand("markdown",{name:"scrollSyncToggle",exec:function(){a=!a,d._onOut(),a?(d.$el.addClass("active"),d.tooltip=n.active):(d.$el.removeClass("active"),d.tooltip=n.inActive),d._onOver()}})),o.on("change",function(){s=!1,r.makeSectionList()}),e.on("previewRenderAfter",function(){r.sectionMatch(),l.syncPreviewScrollTopToMarkdown(),s=!0}),e.eventManager.listen("scroll",function(t){a&&(s&&e.preview.isVisible()?"markdown"!==t.source||l.isMarkdownScrollEventBlocked?"preview"!==t.source||l.isPreviewScrollEventBlocked||l.syncMarkdownScrollTopToPreview():l.syncPreviewScrollTopToMarkdown():l.saveScrollInfo())})}}Object.defineProperty(t,"__esModule",{value:!0});var r=i(0),c=n(r),l=i(1),s=n(l),a=i(47),u=n(a),d=i(48),f=n(d),h=s.default.Button;s.default.defineExtension("scrollSync",o),t.default=o},47:function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r=i(2),c=function(e){return e&&e.__esModule?e:{default:e}}(r),l=function(){function e(t,i,o){n(this,e),this.sectionManager=t,this.cm=i,this.$previewContainerEl=o,this.$contents=this.$previewContainerEl.find(".tui-editor-contents"),this.releaseTimer=null,this._currentTimeoutId=null,this._savedScrollInfo=null}return o(e,[{key:"_getEditorSectionHeight",value:function(e){var t=this.cm.heightAtLine(e.end,"local");return t-=this.cm.heightAtLine(e.start>0?e.start-1:0,"local")}},{key:"_getEditorLineHeightGapInSection",value:function(e,t){var i=this.cm.heightAtLine(t,"local");return i-=this.cm.heightAtLine(e.start>0?e.start-1:0,"local"),Math.max(i,0)}},{key:"_getEditorSectionScrollRatio",value:function(e,t){var i=e.end===e.start;return i?0:this._getEditorLineHeightGapInSection(e,t)/this._getEditorSectionHeight(e)}},{key:"_getScrollFactorsOfEditor",value:function(){var e=this.cm,t=e.getScrollInfo(),i=void 0,n=void 0,o=void 0,r=void 0;t=this._fallbackScrollInfoIfIncorrect(t);var c=t.height-t.top<=t.clientHeight;return c?r={isEditorBottom:c}:(i=e.coordsChar({left:t.left,top:t.top},"local").line,n=this.sectionManager.sectionByLine(i),o=this._getEditorSectionScrollRatio(n,i),r={section:n,sectionRatio:o}),r}},{key:"_getScrollInfoForMarkdown",value:function(){var e=this,t=this.sectionManager.getSectionList(),i=void 0;return c.default.forEachArray(t,function(t){var n=t.$previewSectionEl,o=n.parent().parent(),r=o[0].clientHeight-o.scrollTop()<=o[0].height,c=!0;return r?(i={isPreviewBottom:r},c=!1):e._isTopSection(o,n)&&(i={section:t,sectionRatio:e._getMarkdownEditorScrollRatio(o,n)},c=!1),c}),i}},{key:"_getMarkdownEditorScrollRatio",value:function(e,t){return(e.scrollTop()-t[0].offsetTop)/t.height()}},{key:"_getScrollTopForPreview",value:function(){var e=void 0,t=this._getScrollFactorsOfEditor(),i=t.section,n=t.sectionRatio;return t.isEditorBottom?e=this.$contents.height():i.$previewSectionEl&&(e=i.$previewSectionEl[0].offsetTop,e+=i.$previewSectionEl.height()*n-20),e=e&&Math.max(e,0)}},{key:"_getScrollTopForMarkdown",value:function(){var e=void 0,t=this._getScrollInfoForMarkdown(),i=t.sectionRatio;if(t.isPreviewBottom)e=this.cm.getScrollInfo().height;else if(t.section){var n=t.section,o=this.cm.charCoords({line:n.start,char:0},"local"),r=this.cm.charCoords({line:n.end,char:0},"local");e=o.top,e+=(r.top-o.top)*i}return e=e&&Math.max(e,0)}},{key:"syncPreviewScrollTopToMarkdown",value:function(){var e=this,t=this.$previewContainerEl,i=t.scrollTop(),n=this._getScrollTopForPreview();this.isPreviewScrollEventBlocked=!0,this._animateRun(i,n,function(i){clearTimeout(e.releaseTimer),t.scrollTop(i),e.releaseTimer=setTimeout(function(){e.isPreviewScrollEventBlocked=!1},15)})}},{key:"syncMarkdownScrollTopToPreview",value:function(){var e=this,t=this.cm,i=t.getScrollInfo(),n=i.top,o=this._getScrollTopForMarkdown();this.isMarkdownScrollEventBlocked=!0,this._animateRun(n,o,function(i){clearTimeout(e.releaseTimer),t.scrollTo(0,i),e.releaseTimer=setTimeout(function(){e.isMarkdownScrollEventBlocked=!1},15)})}},{key:"_animateRun",value:function(e,t,i){function n(){var l=Date.now(),s=(l-r)/200,a=void 0;s<1?(a=e+o*Math.cos((1-s)*Math.PI/2),i(Math.ceil(a)),c._currentTimeoutId=setTimeout(n,1)):(i(t),c._currentTimeoutId=null)}var o=t-e,r=Date.now(),c=this;this._currentTimeoutId&&clearTimeout(this._currentTimeoutId),n()}},{key:"_fallbackScrollInfoIfIncorrect",value:function(e){return e.height<0&&this._savedScrollInfo?this._savedScrollInfo:e}},{key:"saveScrollInfo",value:function(){this._savedScrollInfo=this.cm.getScrollInfo()}},{key:"_isTopSection",value:function(e,t){var i=e.scrollTop(),n=t[0].offsetTop,o=t.height(),r=i>=n-57,c=i>n+o;return r&&!c}}]),e}();t.default=l},48:function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(){return this.nodeType===Node.ELEMENT_NODE}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),c=i(0),l=function(e){return e&&e.__esModule?e:{default:e}}(c),s=/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/,a=/^ *(\*|-|\d+\.|[*-] \[[ xX]])\s/,u=/^ {0,3}(> ?)+\s/,d=/^ {0,3}!\[([^[\]]*)]\(([^)]*)\)/,f=/^ *(?:={1,}|-{1,})\s*$/,h=/^ *(`{3,}|~{3,})[ ]*$/,v=/^ *(`{3,}|~{3,})[ .]*(\S+)? */,p=/\s/g,_=function(){function e(t,i){n(this,e),this.cm=t,this.preview=i,this.$previewContent=i.$el.find(".tui-editor-contents"),this._sectionList=null,this._currentSection=null}return r(e,[{key:"_addNewSection",value:function(e,t){var i=this._makeSectionData(e,t);this._sectionList.push(i),this._currentSection=i}},{key:"getSectionList",value:function(){return this._sectionList||this.makeSectionList(),this._sectionList}},{key:"_makeSectionData",value:function(e,t){return{start:e,end:t,$previewSectionEl:null}}},{key:"_updateCurrentSectionEnd",value:function(e){this._currentSection.end=e}},{key:"_eachLineState",value:function(e){var t=void 0,i=void 0,n=void 0,o=void 0,r=void 0,c=!0,l=!1,s=!1,a="",u=!1,d=!1,f=void 0,h=this.cm.getDoc().lineCount();for(i=0;i<h;i+=1){t=!1,n=this.cm.getLine(i),o=this.cm.getLine(i+1)||"",r=this.cm.getLine(i-1)||"";var v=this._isCodeBlockEnd(r)&&f!==i-1;if(!l||n&&this._isTableCode(n)?!l&&this._isTable(n,o)&&(l=!0):l=!1,s&&v&&(s=!1),!s&&this._isCodeBlockStart(n)&&(s=this._doFollowedLinesHaveCodeBlockEnd(i,h),f=i),d&&0!==n.length?(this._isIndependentImage(s,l,n,r)?(u=!0,d=!0):(u=!1,d=!1),t=!0):this._isAtxHeader(n)?(u=!1,t=!0,d=!1):this._isCodeBlockEnd(n)||l||!this._isSeTextHeader(n,o)?this._isIndependentImage(s,l,n,r)?(u=!0,t=!0,d=!1):u&&0===n.length&&(u=!1,d=!0):(u=!1,t=!0,d=!1),c){if(!(a+=n.trim()))continue;c=!1}e(t,i)}}},{key:"_isIndependentImage",value:function(e,t,i,n){return!e&&!t&&this._isImage(i)&&!this._isList(i)&&!this._isQuote(i)&&0===n.length}},{key:"_doFollowedLinesHaveCodeBlockEnd",value:function(e,t){for(var i=!1,n=e+1;n<t;n+=1)if(this._isCodeBlockEnd(this.cm.getLine(n))){i=!0;break}return i}},{key:"_isCodeBlockStart",value:function(e){return v.test(e)}},{key:"_isCodeBlockEnd",value:function(e){return h.test(e)}},{key:"_isTable",value:function(e,t){return this._isTableCode(e)&&this._isTableAligner(t)}},{key:"_isTableCode",value:function(e){return/(^\S?.*\|.*)/.test(e)}},{key:"_isTableAligner",value:function(e){return/(\s*[-:]+\s*\|)+/.test(e)}},{key:"_isAtxHeader",value:function(e){return s.test(e)}},{key:"_isSeTextHeader",value:function(e,t){return""!==e.replace(p,"")&&t&&f.test(t)}},{key:"_isImage",value:function(e){return d.test(e)}},{key:"_isList",value:function(e){return a.test(e)}},{key:"_isQuote",value:function(e){return u.test(e)}},{key:"makeSectionList",value:function(){var e=this;this._sectionList=[],this._eachLineState(function(t,i){t||!e._sectionList.length?e._addNewSection(i,i):e._updateCurrentSectionEnd(i)})}},{key:"sectionMatch",value:function(){if(this.getSectionList()){var e=this._getPreviewSections();this._matchPreviewSectionsWithSectionlist(e)}}},{key:"_matchPreviewSectionsWithSectionlist",value:function(e){var t=this.getSectionList();e.forEach(function(e,i){var n=t[i];if(n){var o=(0,l.default)("<div class='content-id-"+i+"'></div>");n.$previewSectionEl=(0,l.default)(e).wrapAll(o).parent()}})}},{key:"_getPreviewSections",value:function(){var e=[],t=0,i=!1;return e[0]=[],this.$previewContent.contents().filter(o).each(function(n,o){var r="P"===o.tagName,c=o.tagName.match(/^(H1|H2|H3|H4|H5|H6)$/),l=r&&"IMG"===o.childNodes[0].nodeName;(c||l||i)&&e[t].length&&(e.push([]),t+=1,i=!1),l&&(i=!0),e[t].push(o)}),e}},{key:"sectionByLine",value:function(e){var t=void 0,i=this.getSectionList(),n=i.length;for(t=0;t<n&&!(e<=i[t].end);t+=1);return t===n&&(t=n-1),i[t]}}]),e}();t.default=_},5:function(e,t){if(void 0===n){var i=new Error('Cannot find module "undefined"');throw i.code="MODULE_NOT_FOUND",i}e.exports=n}})});
|
@@ -0,0 +1,3930 @@
|
|
1
|
+
/*!
|
2
|
+
* tui-editor
|
3
|
+
* @version 1.0.2
|
4
|
+
* @author NHN Ent. FE Development Lab <dl_javascript@nhnent.com> (https://nhnent.github.io/tui.editor/)
|
5
|
+
* @license MIT
|
6
|
+
*/
|
7
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
8
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
9
|
+
module.exports = factory(require("jquery"), require("tui-code-snippet"), (function webpackLoadOptionalExternalModule() { try { return require("tui-editor"); } catch(e) {} }()), (function webpackLoadOptionalExternalModule() { try { return require("tui-editor/dist/tui-editor-Viewer"); } catch(e) {} }()), require("to-mark"));
|
10
|
+
else if(typeof define === 'function' && define.amd)
|
11
|
+
define(["jquery", "tui-code-snippet", "tui-editor", "tui-editor/dist/tui-editor-Viewer", "to-mark"], factory);
|
12
|
+
else {
|
13
|
+
var a = typeof exports === 'object' ? factory(require("jquery"), require("tui-code-snippet"), (function webpackLoadOptionalExternalModule() { try { return require("tui-editor"); } catch(e) {} }()), (function webpackLoadOptionalExternalModule() { try { return require("tui-editor/dist/tui-editor-Viewer"); } catch(e) {} }()), require("to-mark")) : factory(root["$"], (root["tui"] && root["tui"]["util"]), (root["tui"] && root["tui"]["Editor"]), (root["tui"] && root["tui"]["Editor"]), root["toMark"]);
|
14
|
+
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
15
|
+
}
|
16
|
+
})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_0__, __WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_4__, __WEBPACK_EXTERNAL_MODULE_5__, __WEBPACK_EXTERNAL_MODULE_54__) {
|
17
|
+
return /******/ (function(modules) { // webpackBootstrap
|
18
|
+
/******/ // The module cache
|
19
|
+
/******/ var installedModules = {};
|
20
|
+
/******/
|
21
|
+
/******/ // The require function
|
22
|
+
/******/ function __webpack_require__(moduleId) {
|
23
|
+
/******/
|
24
|
+
/******/ // Check if module is in cache
|
25
|
+
/******/ if(installedModules[moduleId]) {
|
26
|
+
/******/ return installedModules[moduleId].exports;
|
27
|
+
/******/ }
|
28
|
+
/******/ // Create a new module (and put it into the cache)
|
29
|
+
/******/ var module = installedModules[moduleId] = {
|
30
|
+
/******/ i: moduleId,
|
31
|
+
/******/ l: false,
|
32
|
+
/******/ exports: {}
|
33
|
+
/******/ };
|
34
|
+
/******/
|
35
|
+
/******/ // Execute the module function
|
36
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
37
|
+
/******/
|
38
|
+
/******/ // Flag the module as loaded
|
39
|
+
/******/ module.l = true;
|
40
|
+
/******/
|
41
|
+
/******/ // Return the exports of the module
|
42
|
+
/******/ return module.exports;
|
43
|
+
/******/ }
|
44
|
+
/******/
|
45
|
+
/******/
|
46
|
+
/******/ // expose the modules object (__webpack_modules__)
|
47
|
+
/******/ __webpack_require__.m = modules;
|
48
|
+
/******/
|
49
|
+
/******/ // expose the module cache
|
50
|
+
/******/ __webpack_require__.c = installedModules;
|
51
|
+
/******/
|
52
|
+
/******/ // define getter function for harmony exports
|
53
|
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
54
|
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
55
|
+
/******/ Object.defineProperty(exports, name, {
|
56
|
+
/******/ configurable: false,
|
57
|
+
/******/ enumerable: true,
|
58
|
+
/******/ get: getter
|
59
|
+
/******/ });
|
60
|
+
/******/ }
|
61
|
+
/******/ };
|
62
|
+
/******/
|
63
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
64
|
+
/******/ __webpack_require__.n = function(module) {
|
65
|
+
/******/ var getter = module && module.__esModule ?
|
66
|
+
/******/ function getDefault() { return module['default']; } :
|
67
|
+
/******/ function getModuleExports() { return module; };
|
68
|
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
69
|
+
/******/ return getter;
|
70
|
+
/******/ };
|
71
|
+
/******/
|
72
|
+
/******/ // Object.prototype.hasOwnProperty.call
|
73
|
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
74
|
+
/******/
|
75
|
+
/******/ // __webpack_public_path__
|
76
|
+
/******/ __webpack_require__.p = "dist/";
|
77
|
+
/******/
|
78
|
+
/******/ // Load entry module and return exports
|
79
|
+
/******/ return __webpack_require__(__webpack_require__.s = 49);
|
80
|
+
/******/ })
|
81
|
+
/************************************************************************/
|
82
|
+
/******/ ([
|
83
|
+
/* 0 */
|
84
|
+
/***/ (function(module, exports) {
|
85
|
+
|
86
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_0__;
|
87
|
+
|
88
|
+
/***/ }),
|
89
|
+
/* 1 */
|
90
|
+
/***/ (function(module, exports, __webpack_require__) {
|
91
|
+
|
92
|
+
"use strict";
|
93
|
+
|
94
|
+
|
95
|
+
Object.defineProperty(exports, "__esModule", {
|
96
|
+
value: true
|
97
|
+
});
|
98
|
+
/**
|
99
|
+
* @fileoverview Editor/Viewer proxy for extensions
|
100
|
+
* @author NHN Ent. FE Development Lab <dl_javascript@nhnent.com>
|
101
|
+
*/
|
102
|
+
/* eslint global-require: 0 no-empty: 0 */
|
103
|
+
|
104
|
+
var Editor = void 0;
|
105
|
+
try {
|
106
|
+
Editor = __webpack_require__(4);
|
107
|
+
} catch (e) {}
|
108
|
+
if (!Editor) {
|
109
|
+
try {
|
110
|
+
Editor = __webpack_require__(5);
|
111
|
+
} catch (e) {}
|
112
|
+
}
|
113
|
+
|
114
|
+
exports.default = Editor;
|
115
|
+
|
116
|
+
/***/ }),
|
117
|
+
/* 2 */
|
118
|
+
/***/ (function(module, exports) {
|
119
|
+
|
120
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_2__;
|
121
|
+
|
122
|
+
/***/ }),
|
123
|
+
/* 3 */
|
124
|
+
/***/ (function(module, exports, __webpack_require__) {
|
125
|
+
|
126
|
+
"use strict";
|
127
|
+
|
128
|
+
|
129
|
+
Object.defineProperty(exports, "__esModule", {
|
130
|
+
value: true
|
131
|
+
});
|
132
|
+
exports.createTableData = createTableData;
|
133
|
+
exports.createCellIndexData = createCellIndexData;
|
134
|
+
|
135
|
+
var _jquery = __webpack_require__(0);
|
136
|
+
|
137
|
+
var _jquery2 = _interopRequireDefault(_jquery);
|
138
|
+
|
139
|
+
var _tuiCodeSnippet = __webpack_require__(2);
|
140
|
+
|
141
|
+
var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet);
|
142
|
+
|
143
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
144
|
+
|
145
|
+
/**
|
146
|
+
* Parse cell like td or th.
|
147
|
+
* @param {HTMLElement} cell - cell element like td or th
|
148
|
+
* @param {number} rowIndex - row index
|
149
|
+
* @param {number} colIndex - column index
|
150
|
+
* @returns {{
|
151
|
+
* nodeName: string,
|
152
|
+
* colspan: number,
|
153
|
+
* rowspan: number,
|
154
|
+
* content: string,
|
155
|
+
* align: ?string
|
156
|
+
* }}
|
157
|
+
* @private
|
158
|
+
*/
|
159
|
+
/**
|
160
|
+
* @fileoverview Implements tableDataHandler
|
161
|
+
* @author NHN Ent. FE Development Lab <dl_javascript@nhnent.com>
|
162
|
+
*/
|
163
|
+
function _parseCell(cell, rowIndex, colIndex) {
|
164
|
+
var $cell = (0, _jquery2.default)(cell);
|
165
|
+
var colspan = $cell.attr('colspan');
|
166
|
+
var rowspan = $cell.attr('rowspan');
|
167
|
+
var nodeName = cell.nodeName;
|
168
|
+
|
169
|
+
|
170
|
+
if (nodeName !== 'TH' && nodeName !== 'TD') {
|
171
|
+
return null;
|
172
|
+
}
|
173
|
+
|
174
|
+
var cellData = {
|
175
|
+
nodeName: cell.nodeName,
|
176
|
+
colspan: colspan ? parseInt(colspan, 10) : 1,
|
177
|
+
rowspan: rowspan ? parseInt(rowspan, 10) : 1,
|
178
|
+
content: $cell.html(),
|
179
|
+
elementIndex: {
|
180
|
+
rowIndex: rowIndex,
|
181
|
+
colIndex: colIndex
|
182
|
+
}
|
183
|
+
};
|
184
|
+
|
185
|
+
if (cell.nodeName === 'TH' && cell.align) {
|
186
|
+
cellData.align = cell.align;
|
187
|
+
}
|
188
|
+
|
189
|
+
return cellData;
|
190
|
+
}
|
191
|
+
|
192
|
+
/**
|
193
|
+
* Add merged cell.
|
194
|
+
* @param {object} base - base table data
|
195
|
+
* @param {object} cellData - cell data
|
196
|
+
* @param {number} startRowIndex - start row index
|
197
|
+
* @param {number} startCellIndex - start cell index
|
198
|
+
* @private
|
199
|
+
*/
|
200
|
+
function _addMergedCell(base, cellData, startRowIndex, startCellIndex) {
|
201
|
+
var colspan = cellData.colspan,
|
202
|
+
rowspan = cellData.rowspan,
|
203
|
+
nodeName = cellData.nodeName;
|
204
|
+
|
205
|
+
var colMerged = colspan > 1;
|
206
|
+
var rowMerged = rowspan > 1;
|
207
|
+
|
208
|
+
if (!colMerged && !rowMerged) {
|
209
|
+
return;
|
210
|
+
}
|
211
|
+
|
212
|
+
var limitRowIndex = startRowIndex + rowspan;
|
213
|
+
var limitCellIndex = startCellIndex + colspan;
|
214
|
+
|
215
|
+
_tuiCodeSnippet2.default.range(startRowIndex, limitRowIndex).forEach(function (rowIndex) {
|
216
|
+
base[rowIndex] = base[rowIndex] || [];
|
217
|
+
|
218
|
+
_tuiCodeSnippet2.default.range(startCellIndex, limitCellIndex).forEach(function (cellIndex) {
|
219
|
+
var mergedData = {
|
220
|
+
nodeName: nodeName
|
221
|
+
};
|
222
|
+
|
223
|
+
if (rowIndex === startRowIndex && cellIndex === startCellIndex) {
|
224
|
+
return;
|
225
|
+
}
|
226
|
+
|
227
|
+
if (colMerged) {
|
228
|
+
mergedData.colMergeWith = startCellIndex;
|
229
|
+
}
|
230
|
+
|
231
|
+
if (rowMerged) {
|
232
|
+
mergedData.rowMergeWith = startRowIndex;
|
233
|
+
}
|
234
|
+
|
235
|
+
base[rowIndex][cellIndex] = mergedData;
|
236
|
+
});
|
237
|
+
});
|
238
|
+
}
|
239
|
+
|
240
|
+
/**
|
241
|
+
* Create table data from jQuery table Element.
|
242
|
+
* @param {jQuery} $table - jQuery table element
|
243
|
+
* @returns {Array.<Array.<object>>}
|
244
|
+
* @ignore
|
245
|
+
*/
|
246
|
+
function createTableData($table) {
|
247
|
+
var tableData = [];
|
248
|
+
|
249
|
+
$table.find('tr').each(function (rowIndex, tr) {
|
250
|
+
var stackedColCount = 0;
|
251
|
+
|
252
|
+
tableData[rowIndex] = tableData[rowIndex] || [];
|
253
|
+
|
254
|
+
(0, _jquery2.default)(tr).children().each(function (colIndex, cell) {
|
255
|
+
var cellData = _parseCell(cell, rowIndex, colIndex);
|
256
|
+
|
257
|
+
if (!cellData) {
|
258
|
+
return;
|
259
|
+
}
|
260
|
+
var dataColIndex = colIndex + stackedColCount;
|
261
|
+
|
262
|
+
while (tableData[rowIndex][dataColIndex]) {
|
263
|
+
dataColIndex += 1;
|
264
|
+
stackedColCount += 1;
|
265
|
+
}
|
266
|
+
|
267
|
+
tableData[rowIndex][dataColIndex] = cellData;
|
268
|
+
_addMergedCell(tableData, cellData, rowIndex, dataColIndex);
|
269
|
+
});
|
270
|
+
});
|
271
|
+
|
272
|
+
if ($table[0].className) {
|
273
|
+
tableData.className = $table[0].className;
|
274
|
+
}
|
275
|
+
|
276
|
+
return tableData;
|
277
|
+
}
|
278
|
+
|
279
|
+
/**
|
280
|
+
* Create cell index data of table data.
|
281
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
282
|
+
* @returns {Array.<Array.<object>>}
|
283
|
+
* @ignore
|
284
|
+
*/
|
285
|
+
function createCellIndexData(tableData) {
|
286
|
+
var mappingData = [];
|
287
|
+
|
288
|
+
tableData.forEach(function (row, rowIndex) {
|
289
|
+
var mappingRow = [];
|
290
|
+
|
291
|
+
row.forEach(function (cell, colIndex) {
|
292
|
+
if (_tuiCodeSnippet2.default.isUndefined(cell.colMergeWith) && _tuiCodeSnippet2.default.isUndefined(cell.rowMergeWith)) {
|
293
|
+
mappingRow.push({
|
294
|
+
rowIndex: rowIndex,
|
295
|
+
colIndex: colIndex
|
296
|
+
});
|
297
|
+
}
|
298
|
+
});
|
299
|
+
mappingData.push(mappingRow);
|
300
|
+
});
|
301
|
+
|
302
|
+
return mappingData;
|
303
|
+
}
|
304
|
+
|
305
|
+
/**
|
306
|
+
* Get header aligns.
|
307
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
308
|
+
* @returns {Array.<?string>}
|
309
|
+
* @private
|
310
|
+
*/
|
311
|
+
function _getHeaderAligns(tableData) {
|
312
|
+
var headRowData = tableData[0];
|
313
|
+
|
314
|
+
|
315
|
+
return headRowData.map(function (cellData) {
|
316
|
+
var align = void 0;
|
317
|
+
|
318
|
+
if (_tuiCodeSnippet2.default.isExisty(cellData.colMergeWith)) {
|
319
|
+
align = headRowData[cellData.colMergeWith].align;
|
320
|
+
} else {
|
321
|
+
align = cellData.align;
|
322
|
+
}
|
323
|
+
|
324
|
+
return align;
|
325
|
+
});
|
326
|
+
}
|
327
|
+
|
328
|
+
/**
|
329
|
+
* Create render data.
|
330
|
+
* @param {Array.<object>} tableData - table data
|
331
|
+
* @param {Array.<object>} cellIndexData - cell index data
|
332
|
+
* @returns {Array.<Array.<object>>}
|
333
|
+
* @ignore
|
334
|
+
*/
|
335
|
+
function createRenderData(tableData, cellIndexData) {
|
336
|
+
var headerAligns = _getHeaderAligns(tableData);
|
337
|
+
var renderData = cellIndexData.map(function (row) {
|
338
|
+
return row.map(function (_ref) {
|
339
|
+
var rowIndex = _ref.rowIndex,
|
340
|
+
colIndex = _ref.colIndex;
|
341
|
+
return _tuiCodeSnippet2.default.extend({
|
342
|
+
align: headerAligns[colIndex]
|
343
|
+
}, tableData[rowIndex][colIndex]);
|
344
|
+
});
|
345
|
+
});
|
346
|
+
|
347
|
+
if (tableData.className) {
|
348
|
+
renderData.className = tableData.className;
|
349
|
+
}
|
350
|
+
|
351
|
+
return renderData;
|
352
|
+
}
|
353
|
+
|
354
|
+
var BASIC_CELL_CONTENT = _tuiCodeSnippet2.default.browser.msie ? '' : '<br>';
|
355
|
+
|
356
|
+
/**
|
357
|
+
* Create basic cell data.
|
358
|
+
* @param {number} rowIndex - row index
|
359
|
+
* @param {number} colIndex - column index
|
360
|
+
* @param {string} nodeName - node name
|
361
|
+
* @returns {{
|
362
|
+
* nodeName: string,
|
363
|
+
* colspan: number,
|
364
|
+
* rowspan: number,
|
365
|
+
* content: string
|
366
|
+
* }}
|
367
|
+
* @ignore
|
368
|
+
*/
|
369
|
+
function createBasicCell(rowIndex, colIndex, nodeName) {
|
370
|
+
return {
|
371
|
+
nodeName: nodeName || 'TD',
|
372
|
+
colspan: 1,
|
373
|
+
rowspan: 1,
|
374
|
+
content: BASIC_CELL_CONTENT,
|
375
|
+
elementIndex: {
|
376
|
+
rowIndex: rowIndex,
|
377
|
+
colIndex: colIndex
|
378
|
+
}
|
379
|
+
};
|
380
|
+
}
|
381
|
+
|
382
|
+
/**
|
383
|
+
* Find element row index.
|
384
|
+
* @param {jQuery} $cell - cell jQuery element like td or th
|
385
|
+
* @returns {number}
|
386
|
+
* @ignore
|
387
|
+
*/
|
388
|
+
function findElementRowIndex($cell) {
|
389
|
+
var $tr = $cell.closest('tr');
|
390
|
+
var rowIndex = $tr.prevAll().length;
|
391
|
+
|
392
|
+
if ($tr.parent()[0].nodeName === 'TBODY') {
|
393
|
+
rowIndex += 1;
|
394
|
+
}
|
395
|
+
|
396
|
+
return rowIndex;
|
397
|
+
}
|
398
|
+
|
399
|
+
/**
|
400
|
+
* Find element col index.
|
401
|
+
* @param {jQuery} $cell - cell jQuery element like td or th
|
402
|
+
* @returns {number}
|
403
|
+
* @ignore
|
404
|
+
*/
|
405
|
+
function findElementColIndex($cell) {
|
406
|
+
return $cell.closest('td, th').prevAll().length;
|
407
|
+
}
|
408
|
+
|
409
|
+
/**
|
410
|
+
* Find indexes of base table data from mappin data.
|
411
|
+
* @param {Array.<Array.<object>>} cellIndexData - cell index data
|
412
|
+
* @param {jQuery} $cell - cell jQuery element like td or th
|
413
|
+
* @returns {{rowIndex: number, cellIndex: number}}
|
414
|
+
* @ignore
|
415
|
+
*/
|
416
|
+
function findCellIndex(cellIndexData, $cell) {
|
417
|
+
var elementRowIndex = findElementRowIndex($cell);
|
418
|
+
var elementColIndex = findElementColIndex($cell);
|
419
|
+
|
420
|
+
return cellIndexData[elementRowIndex][elementColIndex];
|
421
|
+
}
|
422
|
+
|
423
|
+
/**
|
424
|
+
* Find last index of col merged cells.
|
425
|
+
* @param {Array.<Array.<object>>} tableData - tableData data
|
426
|
+
* @param {number} rowIndex - row index of base data
|
427
|
+
* @param {number} colIndex - column index of tabld data
|
428
|
+
* @returns {number}
|
429
|
+
* @ignore
|
430
|
+
*/
|
431
|
+
function findRowMergedLastIndex(tableData, rowIndex, colIndex) {
|
432
|
+
var cellData = tableData[rowIndex][colIndex];
|
433
|
+
var foundRowIndex = rowIndex;
|
434
|
+
|
435
|
+
if (cellData.rowspan > 1) {
|
436
|
+
foundRowIndex += cellData.rowspan - 1;
|
437
|
+
}
|
438
|
+
|
439
|
+
return foundRowIndex;
|
440
|
+
}
|
441
|
+
|
442
|
+
/**
|
443
|
+
* Find last index of col merged cells.
|
444
|
+
* @param {Array.<Array.<object>>} tableData - tableData data
|
445
|
+
* @param {number} rowIndex - row index of base data
|
446
|
+
* @param {number} colIndex - column index of tabld data
|
447
|
+
* @returns {number}
|
448
|
+
* @ignore
|
449
|
+
*/
|
450
|
+
function findColMergedLastIndex(tableData, rowIndex, colIndex) {
|
451
|
+
var cellData = tableData[rowIndex][colIndex];
|
452
|
+
var foundColIndex = colIndex;
|
453
|
+
|
454
|
+
if (cellData.colspan > 1) {
|
455
|
+
foundColIndex += cellData.colspan - 1;
|
456
|
+
}
|
457
|
+
|
458
|
+
return foundColIndex;
|
459
|
+
}
|
460
|
+
|
461
|
+
/**
|
462
|
+
* Find cell element index.
|
463
|
+
* @param {Array.<Array.<object>>} tableData - tableData data
|
464
|
+
* @param {number} rowIndex - row index of base data
|
465
|
+
* @param {number} colIndex - col index of base data
|
466
|
+
* @returns {{rowIndex: number, colIndex: number}}
|
467
|
+
* @ignore
|
468
|
+
*/
|
469
|
+
function findElementIndex(tableData, rowIndex, colIndex) {
|
470
|
+
var cellData = tableData[rowIndex][colIndex];
|
471
|
+
|
472
|
+
rowIndex = _tuiCodeSnippet2.default.isExisty(cellData.rowMergeWith) ? cellData.rowMergeWith : rowIndex;
|
473
|
+
colIndex = _tuiCodeSnippet2.default.isExisty(cellData.colMergeWith) ? cellData.colMergeWith : colIndex;
|
474
|
+
|
475
|
+
return tableData[rowIndex][colIndex].elementIndex;
|
476
|
+
}
|
477
|
+
|
478
|
+
/**
|
479
|
+
* Stuff cells into incomplete row.
|
480
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
481
|
+
* @param {number} limitIndex - limit index
|
482
|
+
* @ignore
|
483
|
+
*/
|
484
|
+
function stuffCellsIntoIncompleteRow(tableData, limitIndex) {
|
485
|
+
tableData.forEach(function (rowData, rowIndex) {
|
486
|
+
var startIndex = rowData.length;
|
487
|
+
var nodeName = rowData[0].nodeName;
|
488
|
+
|
489
|
+
|
490
|
+
_tuiCodeSnippet2.default.range(startIndex, limitIndex).forEach(function (colIndex) {
|
491
|
+
rowData.push(createBasicCell(rowIndex, colIndex, nodeName));
|
492
|
+
});
|
493
|
+
});
|
494
|
+
}
|
495
|
+
|
496
|
+
/**
|
497
|
+
* Add tbody or thead of table data if need.
|
498
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
499
|
+
* @returns {boolean}
|
500
|
+
* @ignore
|
501
|
+
*/
|
502
|
+
function addTbodyOrTheadIfNeed(tableData) {
|
503
|
+
var header = tableData[0];
|
504
|
+
|
505
|
+
var cellCount = header.length;
|
506
|
+
var added = true;
|
507
|
+
|
508
|
+
if (!cellCount && tableData[1]) {
|
509
|
+
_tuiCodeSnippet2.default.range(0, tableData[1].length).forEach(function (colIndex) {
|
510
|
+
header.push(createBasicCell(0, colIndex, 'TH'));
|
511
|
+
});
|
512
|
+
} else if (tableData[0][0].nodeName !== 'TH') {
|
513
|
+
var _ref2;
|
514
|
+
|
515
|
+
var newHeader = _tuiCodeSnippet2.default.range(0, cellCount).map(function (colIndex) {
|
516
|
+
return createBasicCell(0, colIndex, 'TH');
|
517
|
+
});
|
518
|
+
|
519
|
+
(_ref2 = []).concat.apply(_ref2, tableData).forEach(function (cellData) {
|
520
|
+
if (cellData.elementIndex) {
|
521
|
+
cellData.elementIndex.rowIndex += 1;
|
522
|
+
}
|
523
|
+
});
|
524
|
+
|
525
|
+
tableData.unshift(newHeader);
|
526
|
+
} else if (tableData.length === 1) {
|
527
|
+
var newRow = _tuiCodeSnippet2.default.range(0, cellCount).map(function (colIndex) {
|
528
|
+
return createBasicCell(1, colIndex, 'TD');
|
529
|
+
});
|
530
|
+
|
531
|
+
tableData.push(newRow);
|
532
|
+
} else {
|
533
|
+
added = false;
|
534
|
+
}
|
535
|
+
|
536
|
+
return added;
|
537
|
+
}
|
538
|
+
|
539
|
+
exports.default = {
|
540
|
+
createTableData: createTableData,
|
541
|
+
createCellIndexData: createCellIndexData,
|
542
|
+
createRenderData: createRenderData,
|
543
|
+
findElementRowIndex: findElementRowIndex,
|
544
|
+
findElementColIndex: findElementColIndex,
|
545
|
+
findCellIndex: findCellIndex,
|
546
|
+
createBasicCell: createBasicCell,
|
547
|
+
findRowMergedLastIndex: findRowMergedLastIndex,
|
548
|
+
findColMergedLastIndex: findColMergedLastIndex,
|
549
|
+
findElementIndex: findElementIndex,
|
550
|
+
stuffCellsIntoIncompleteRow: stuffCellsIntoIncompleteRow,
|
551
|
+
addTbodyOrTheadIfNeed: addTbodyOrTheadIfNeed
|
552
|
+
};
|
553
|
+
|
554
|
+
/***/ }),
|
555
|
+
/* 4 */
|
556
|
+
/***/ (function(module, exports) {
|
557
|
+
|
558
|
+
if(typeof __WEBPACK_EXTERNAL_MODULE_4__ === 'undefined') {var e = new Error("Cannot find module \"undefined\""); e.code = 'MODULE_NOT_FOUND'; throw e;}
|
559
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_4__;
|
560
|
+
|
561
|
+
/***/ }),
|
562
|
+
/* 5 */
|
563
|
+
/***/ (function(module, exports) {
|
564
|
+
|
565
|
+
if(typeof __WEBPACK_EXTERNAL_MODULE_5__ === 'undefined') {var e = new Error("Cannot find module \"undefined\""); e.code = 'MODULE_NOT_FOUND'; throw e;}
|
566
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_5__;
|
567
|
+
|
568
|
+
/***/ }),
|
569
|
+
/* 6 */
|
570
|
+
/***/ (function(module, exports, __webpack_require__) {
|
571
|
+
|
572
|
+
"use strict";
|
573
|
+
|
574
|
+
|
575
|
+
Object.defineProperty(exports, "__esModule", {
|
576
|
+
value: true
|
577
|
+
});
|
578
|
+
|
579
|
+
var _jquery = __webpack_require__(0);
|
580
|
+
|
581
|
+
var _jquery2 = _interopRequireDefault(_jquery);
|
582
|
+
|
583
|
+
var _tableDataHandler = __webpack_require__(3);
|
584
|
+
|
585
|
+
var _tableDataHandler2 = _interopRequireDefault(_tableDataHandler);
|
586
|
+
|
587
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
588
|
+
|
589
|
+
/**
|
590
|
+
* Create cell html.
|
591
|
+
* @param {object} cell - cell data of table base data
|
592
|
+
* @returns {string}
|
593
|
+
* @private
|
594
|
+
*/
|
595
|
+
/**
|
596
|
+
* @fileoverview Implements tableRenderer
|
597
|
+
* @author NHN Ent. FE Development Lab <dl_javascript@nhnent.com>
|
598
|
+
*/
|
599
|
+
function _createCellHtml(cell) {
|
600
|
+
var attrs = cell.colspan > 1 ? ' colspan="' + cell.colspan + '"' : '';
|
601
|
+
attrs += cell.rowspan > 1 ? ' rowspan="' + cell.rowspan + '"' : '';
|
602
|
+
attrs += cell.align ? ' align="' + cell.align + '"' : '';
|
603
|
+
|
604
|
+
return '<' + cell.nodeName + attrs + '>' + cell.content + '</' + cell.nodeName + '>';
|
605
|
+
}
|
606
|
+
|
607
|
+
/**
|
608
|
+
* Create html for thead or tbody.
|
609
|
+
* @param {Array.<Array.<object>>} trs - tr list
|
610
|
+
* @param {string} wrapperNodeName - wrapper node name like THEAD, TBODY
|
611
|
+
* @returns {string}
|
612
|
+
* @private
|
613
|
+
*/
|
614
|
+
function _createTheadOrTbodyHtml(trs, wrapperNodeName) {
|
615
|
+
var html = '';
|
616
|
+
|
617
|
+
if (trs.length) {
|
618
|
+
html = trs.map(function (tr) {
|
619
|
+
var tdHtml = tr.map(_createCellHtml).join('');
|
620
|
+
|
621
|
+
return '<tr>' + tdHtml + '</tr>';
|
622
|
+
}).join('');
|
623
|
+
html = '<' + wrapperNodeName + '>' + html + '</' + wrapperNodeName + '>';
|
624
|
+
}
|
625
|
+
|
626
|
+
return html;
|
627
|
+
}
|
628
|
+
|
629
|
+
/**
|
630
|
+
* Create table html.
|
631
|
+
* @param {Array.<Array.<object>>} renderData - table data for render
|
632
|
+
* @returns {string}
|
633
|
+
* @private
|
634
|
+
*/
|
635
|
+
function createTableHtml(renderData) {
|
636
|
+
var thead = [renderData[0]];
|
637
|
+
var tbody = renderData.slice(1);
|
638
|
+
var theadHtml = _createTheadOrTbodyHtml(thead, 'THEAD');
|
639
|
+
var tbodyHtml = _createTheadOrTbodyHtml(tbody, 'TBODY');
|
640
|
+
var className = renderData.className ? ' class="' + renderData.className + '"' : '';
|
641
|
+
|
642
|
+
return '<table' + className + '>' + (theadHtml + tbodyHtml) + '</renderData>';
|
643
|
+
}
|
644
|
+
|
645
|
+
/**
|
646
|
+
* Replace table.
|
647
|
+
* @param {jQuery} $table - table jQuery element
|
648
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
649
|
+
* @returns {jQuery}
|
650
|
+
* @ignore
|
651
|
+
*/
|
652
|
+
function replaceTable($table, tableData) {
|
653
|
+
var cellIndexData = _tableDataHandler2.default.createCellIndexData(tableData);
|
654
|
+
var renderData = _tableDataHandler2.default.createRenderData(tableData, cellIndexData);
|
655
|
+
var $newTable = (0, _jquery2.default)(createTableHtml(renderData));
|
656
|
+
|
657
|
+
$table.replaceWith($newTable);
|
658
|
+
|
659
|
+
return $newTable;
|
660
|
+
}
|
661
|
+
|
662
|
+
/**
|
663
|
+
* Focus to cell.
|
664
|
+
* @param {squireext} sq - squire instance
|
665
|
+
* @param {range} range - range object
|
666
|
+
* @param {HTMLElement} targetCell - cell element for focus
|
667
|
+
* @ignore
|
668
|
+
*/
|
669
|
+
function focusToCell(sq, range, targetCell) {
|
670
|
+
range.selectNodeContents(targetCell);
|
671
|
+
range.collapse(true);
|
672
|
+
sq.setSelection(range);
|
673
|
+
}
|
674
|
+
|
675
|
+
exports.default = {
|
676
|
+
createTableHtml: createTableHtml,
|
677
|
+
replaceTable: replaceTable,
|
678
|
+
focusToCell: focusToCell
|
679
|
+
};
|
680
|
+
|
681
|
+
/***/ }),
|
682
|
+
/* 7 */
|
683
|
+
/***/ (function(module, exports, __webpack_require__) {
|
684
|
+
|
685
|
+
"use strict";
|
686
|
+
|
687
|
+
|
688
|
+
Object.defineProperty(exports, "__esModule", {
|
689
|
+
value: true
|
690
|
+
});
|
691
|
+
|
692
|
+
var _jquery = __webpack_require__(0);
|
693
|
+
|
694
|
+
var _jquery2 = _interopRequireDefault(_jquery);
|
695
|
+
|
696
|
+
var _tuiCodeSnippet = __webpack_require__(2);
|
697
|
+
|
698
|
+
var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet);
|
699
|
+
|
700
|
+
var _tableDataHandler = __webpack_require__(3);
|
701
|
+
|
702
|
+
var _tableDataHandler2 = _interopRequireDefault(_tableDataHandler);
|
703
|
+
|
704
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
705
|
+
|
706
|
+
/**
|
707
|
+
* Find unmerged table range.
|
708
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
709
|
+
* @param {jQuery} $start - start talbe cell jQuery element
|
710
|
+
* @param {jQuery} $end - end table cell jQuery element
|
711
|
+
* @returns {{
|
712
|
+
* start: {rowIndex: number, colIndex: number},
|
713
|
+
* end: {rowIndex: number, colIndex: number}
|
714
|
+
* }}
|
715
|
+
* @private
|
716
|
+
*/
|
717
|
+
function _findUnmergedRange(tableData, $start, $end) {
|
718
|
+
var cellIndexData = _tableDataHandler2.default.createCellIndexData(tableData);
|
719
|
+
var startCellIndex = _tableDataHandler2.default.findCellIndex(cellIndexData, $start);
|
720
|
+
var endCellIndex = _tableDataHandler2.default.findCellIndex(cellIndexData, $end);
|
721
|
+
var startRowIndex = void 0,
|
722
|
+
endRowIndex = void 0,
|
723
|
+
startColIndex = void 0,
|
724
|
+
endColIndex = void 0;
|
725
|
+
|
726
|
+
if (startCellIndex.rowIndex > endCellIndex.rowIndex) {
|
727
|
+
startRowIndex = endCellIndex.rowIndex;
|
728
|
+
endRowIndex = startCellIndex.rowIndex;
|
729
|
+
} else {
|
730
|
+
startRowIndex = startCellIndex.rowIndex;
|
731
|
+
endRowIndex = endCellIndex.rowIndex;
|
732
|
+
}
|
733
|
+
|
734
|
+
if (startCellIndex.colIndex > endCellIndex.colIndex) {
|
735
|
+
startColIndex = endCellIndex.colIndex;
|
736
|
+
endColIndex = startCellIndex.colIndex;
|
737
|
+
} else {
|
738
|
+
startColIndex = startCellIndex.colIndex;
|
739
|
+
endColIndex = endCellIndex.colIndex;
|
740
|
+
}
|
741
|
+
|
742
|
+
return {
|
743
|
+
start: {
|
744
|
+
rowIndex: startRowIndex,
|
745
|
+
colIndex: startColIndex
|
746
|
+
},
|
747
|
+
end: {
|
748
|
+
rowIndex: endRowIndex,
|
749
|
+
colIndex: endColIndex
|
750
|
+
}
|
751
|
+
};
|
752
|
+
}
|
753
|
+
|
754
|
+
/**
|
755
|
+
* Expand table range by row merge properties like rowspan, rowMergeWith.
|
756
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
757
|
+
* @param {{
|
758
|
+
* start: {rowIndex: number, colIndex: number},
|
759
|
+
* end: {rowIndex: number, colIndex: number}
|
760
|
+
* }} tableRange - table range
|
761
|
+
* @param {string} rangeType - range type like start, end
|
762
|
+
* @private
|
763
|
+
*/
|
764
|
+
/**
|
765
|
+
* @fileoverview Implements tableRangeHandler
|
766
|
+
* @author NHN Ent. FE Development Lab <dl_javascript@nhnent.com>
|
767
|
+
*/
|
768
|
+
function _expandRowMergedRange(tableData, tableRange, rangeType) {
|
769
|
+
var rowIndex = tableRange[rangeType].rowIndex;
|
770
|
+
|
771
|
+
var rowData = tableData[rowIndex];
|
772
|
+
|
773
|
+
_tuiCodeSnippet2.default.range(tableRange.start.colIndex, tableRange.end.colIndex + 1).forEach(function (colIndex) {
|
774
|
+
var cellData = rowData[colIndex];
|
775
|
+
var rowMergeWith = cellData.rowMergeWith;
|
776
|
+
|
777
|
+
var lastRowMergedIndex = -1;
|
778
|
+
|
779
|
+
if (_tuiCodeSnippet2.default.isExisty(rowMergeWith)) {
|
780
|
+
if (rowMergeWith < tableRange.start.rowIndex) {
|
781
|
+
tableRange.start.rowIndex = rowMergeWith;
|
782
|
+
}
|
783
|
+
|
784
|
+
lastRowMergedIndex = rowMergeWith + tableData[rowMergeWith][colIndex].rowspan - 1;
|
785
|
+
} else if (cellData.rowspan > 1) {
|
786
|
+
lastRowMergedIndex = rowIndex + cellData.rowspan - 1;
|
787
|
+
}
|
788
|
+
|
789
|
+
if (lastRowMergedIndex > tableRange.end.rowIndex) {
|
790
|
+
tableRange.end.rowIndex = lastRowMergedIndex;
|
791
|
+
}
|
792
|
+
});
|
793
|
+
}
|
794
|
+
|
795
|
+
/**
|
796
|
+
* Expand table range by column merge properties like colspan, colMergeWith.
|
797
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
798
|
+
* @param {{
|
799
|
+
* start: {rowIndex: number, colIndex: number},
|
800
|
+
* end: {rowIndex: number, colIndex: number}
|
801
|
+
* }} tableRange - table range
|
802
|
+
* @param {number} rowIndex - row index
|
803
|
+
* @param {number} colIndex - column index
|
804
|
+
* @private
|
805
|
+
*/
|
806
|
+
function _expandColMergedRange(tableData, tableRange, rowIndex, colIndex) {
|
807
|
+
var rowData = tableData[rowIndex];
|
808
|
+
var cellData = rowData[colIndex];
|
809
|
+
var colMergeWith = cellData.colMergeWith;
|
810
|
+
|
811
|
+
var lastColMergedIndex = -1;
|
812
|
+
|
813
|
+
if (_tuiCodeSnippet2.default.isExisty(colMergeWith)) {
|
814
|
+
if (colMergeWith < tableRange.start.colIndex) {
|
815
|
+
tableRange.start.colIndex = colMergeWith;
|
816
|
+
}
|
817
|
+
|
818
|
+
lastColMergedIndex = colMergeWith + rowData[colMergeWith].colspan - 1;
|
819
|
+
} else if (cellData.colspan > 1) {
|
820
|
+
lastColMergedIndex = colIndex + cellData.colspan - 1;
|
821
|
+
}
|
822
|
+
|
823
|
+
if (lastColMergedIndex > tableRange.end.colIndex) {
|
824
|
+
tableRange.end.colIndex = lastColMergedIndex;
|
825
|
+
}
|
826
|
+
}
|
827
|
+
|
828
|
+
/**
|
829
|
+
* Expand table range by merge properties like colspan, rowspan.
|
830
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
831
|
+
* @param {{
|
832
|
+
* start: {rowIndex: number, colIndex: number},
|
833
|
+
* end: {rowIndex: number, colIndex: number}
|
834
|
+
* }} tableRange - table range
|
835
|
+
* @returns {{
|
836
|
+
* start: {rowIndex: number, colIndex: number},
|
837
|
+
* end: {rowIndex: number, colIndex: number}
|
838
|
+
* }}
|
839
|
+
* @private
|
840
|
+
*/
|
841
|
+
function _expandMergedRange(tableData, tableRange) {
|
842
|
+
var rangeStr = '';
|
843
|
+
|
844
|
+
while (rangeStr !== JSON.stringify(tableRange)) {
|
845
|
+
rangeStr = JSON.stringify(tableRange);
|
846
|
+
|
847
|
+
_expandRowMergedRange(tableData, tableRange, 'start');
|
848
|
+
_expandRowMergedRange(tableData, tableRange, 'end');
|
849
|
+
|
850
|
+
_tuiCodeSnippet2.default.range(tableRange.start.rowIndex, tableRange.end.rowIndex + 1).forEach(function (rowIndex) {
|
851
|
+
_expandColMergedRange(tableData, tableRange, rowIndex, tableRange.start.colIndex);
|
852
|
+
_expandColMergedRange(tableData, tableRange, rowIndex, tableRange.end.colIndex);
|
853
|
+
});
|
854
|
+
}
|
855
|
+
|
856
|
+
return tableRange;
|
857
|
+
}
|
858
|
+
|
859
|
+
/**
|
860
|
+
* Find table range for selection.
|
861
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
862
|
+
* @param {jQuery} $start - start jQuery element
|
863
|
+
* @param {jQuery} $end - end jQuery element
|
864
|
+
* @returns {{
|
865
|
+
* start: {rowIndex: number, colIndex: number},
|
866
|
+
* end: {rowIndex: number, colIndex: number}
|
867
|
+
* }}
|
868
|
+
* @ignore
|
869
|
+
*/
|
870
|
+
function findSelectionRange(tableData, $start, $end) {
|
871
|
+
var unmergedRange = _findUnmergedRange(tableData, $start, $end);
|
872
|
+
|
873
|
+
return _expandMergedRange(tableData, unmergedRange);
|
874
|
+
}
|
875
|
+
|
876
|
+
/**
|
877
|
+
* Get table selection range.
|
878
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
879
|
+
* @param {jQuery} $selectedCells - selected cells jQuery elements
|
880
|
+
* @param {jQuery} $startContainer - start container jQuery element of text range
|
881
|
+
* @returns {{
|
882
|
+
* start: {rowIndex: number, colIndex: number},
|
883
|
+
* end: {rowIndex: number, colIndex: number}
|
884
|
+
*}}
|
885
|
+
* @ignore
|
886
|
+
*/
|
887
|
+
function getTableSelectionRange(tableData, $selectedCells, $startContainer) {
|
888
|
+
var cellIndexData = _tableDataHandler2.default.createCellIndexData(tableData);
|
889
|
+
var tableRange = {};
|
890
|
+
|
891
|
+
if ($selectedCells.length) {
|
892
|
+
var startRange = _tableDataHandler2.default.findCellIndex(cellIndexData, $selectedCells.first());
|
893
|
+
var endRange = _tuiCodeSnippet2.default.extend({}, startRange);
|
894
|
+
|
895
|
+
$selectedCells.each(function (index, cell) {
|
896
|
+
var cellIndex = _tableDataHandler2.default.findCellIndex(cellIndexData, (0, _jquery2.default)(cell));
|
897
|
+
var cellData = tableData[cellIndex.rowIndex][cellIndex.colIndex];
|
898
|
+
var lastRowMergedIndex = cellIndex.rowIndex + cellData.rowspan - 1;
|
899
|
+
var lastColMergedIndex = cellIndex.colIndex + cellData.colspan - 1;
|
900
|
+
|
901
|
+
endRange.rowIndex = Math.max(endRange.rowIndex, lastRowMergedIndex);
|
902
|
+
endRange.colIndex = Math.max(endRange.colIndex, lastColMergedIndex);
|
903
|
+
});
|
904
|
+
|
905
|
+
tableRange.start = startRange;
|
906
|
+
tableRange.end = endRange;
|
907
|
+
} else {
|
908
|
+
var cellIndex = _tableDataHandler2.default.findCellIndex(cellIndexData, $startContainer);
|
909
|
+
|
910
|
+
tableRange.start = cellIndex;
|
911
|
+
tableRange.end = _tuiCodeSnippet2.default.extend({}, cellIndex);
|
912
|
+
}
|
913
|
+
|
914
|
+
return tableRange;
|
915
|
+
}
|
916
|
+
|
917
|
+
exports.default = {
|
918
|
+
findSelectionRange: findSelectionRange,
|
919
|
+
getTableSelectionRange: getTableSelectionRange
|
920
|
+
};
|
921
|
+
|
922
|
+
/***/ }),
|
923
|
+
/* 8 */,
|
924
|
+
/* 9 */,
|
925
|
+
/* 10 */,
|
926
|
+
/* 11 */,
|
927
|
+
/* 12 */,
|
928
|
+
/* 13 */,
|
929
|
+
/* 14 */,
|
930
|
+
/* 15 */,
|
931
|
+
/* 16 */,
|
932
|
+
/* 17 */,
|
933
|
+
/* 18 */,
|
934
|
+
/* 19 */,
|
935
|
+
/* 20 */,
|
936
|
+
/* 21 */,
|
937
|
+
/* 22 */,
|
938
|
+
/* 23 */,
|
939
|
+
/* 24 */,
|
940
|
+
/* 25 */,
|
941
|
+
/* 26 */,
|
942
|
+
/* 27 */,
|
943
|
+
/* 28 */,
|
944
|
+
/* 29 */,
|
945
|
+
/* 30 */,
|
946
|
+
/* 31 */,
|
947
|
+
/* 32 */,
|
948
|
+
/* 33 */,
|
949
|
+
/* 34 */,
|
950
|
+
/* 35 */,
|
951
|
+
/* 36 */,
|
952
|
+
/* 37 */,
|
953
|
+
/* 38 */,
|
954
|
+
/* 39 */,
|
955
|
+
/* 40 */,
|
956
|
+
/* 41 */,
|
957
|
+
/* 42 */,
|
958
|
+
/* 43 */,
|
959
|
+
/* 44 */,
|
960
|
+
/* 45 */,
|
961
|
+
/* 46 */,
|
962
|
+
/* 47 */,
|
963
|
+
/* 48 */,
|
964
|
+
/* 49 */
|
965
|
+
/***/ (function(module, exports, __webpack_require__) {
|
966
|
+
|
967
|
+
"use strict";
|
968
|
+
|
969
|
+
|
970
|
+
var _jquery = __webpack_require__(0);
|
971
|
+
|
972
|
+
var _jquery2 = _interopRequireDefault(_jquery);
|
973
|
+
|
974
|
+
var _editorProxy = __webpack_require__(1);
|
975
|
+
|
976
|
+
var _editorProxy2 = _interopRequireDefault(_editorProxy);
|
977
|
+
|
978
|
+
__webpack_require__(50);
|
979
|
+
|
980
|
+
var _mergedTableCreator = __webpack_require__(51);
|
981
|
+
|
982
|
+
var _mergedTableCreator2 = _interopRequireDefault(_mergedTableCreator);
|
983
|
+
|
984
|
+
var _tableUnmergePreparer = __webpack_require__(52);
|
985
|
+
|
986
|
+
var _tableUnmergePreparer2 = _interopRequireDefault(_tableUnmergePreparer);
|
987
|
+
|
988
|
+
var _toMarkRenderer = __webpack_require__(53);
|
989
|
+
|
990
|
+
var _toMarkRenderer2 = _interopRequireDefault(_toMarkRenderer);
|
991
|
+
|
992
|
+
var _wwMergedTableManager = __webpack_require__(55);
|
993
|
+
|
994
|
+
var _wwMergedTableManager2 = _interopRequireDefault(_wwMergedTableManager);
|
995
|
+
|
996
|
+
var _wwMergedTableSelectionManager = __webpack_require__(56);
|
997
|
+
|
998
|
+
var _wwMergedTableSelectionManager2 = _interopRequireDefault(_wwMergedTableSelectionManager);
|
999
|
+
|
1000
|
+
var _mergedTableAddRow = __webpack_require__(57);
|
1001
|
+
|
1002
|
+
var _mergedTableAddRow2 = _interopRequireDefault(_mergedTableAddRow);
|
1003
|
+
|
1004
|
+
var _mergedTableAddCol = __webpack_require__(58);
|
1005
|
+
|
1006
|
+
var _mergedTableAddCol2 = _interopRequireDefault(_mergedTableAddCol);
|
1007
|
+
|
1008
|
+
var _mergedTableRemoveRow = __webpack_require__(59);
|
1009
|
+
|
1010
|
+
var _mergedTableRemoveRow2 = _interopRequireDefault(_mergedTableRemoveRow);
|
1011
|
+
|
1012
|
+
var _mergedTableRemoveCol = __webpack_require__(60);
|
1013
|
+
|
1014
|
+
var _mergedTableRemoveCol2 = _interopRequireDefault(_mergedTableRemoveCol);
|
1015
|
+
|
1016
|
+
var _mergedTableAlignCol = __webpack_require__(61);
|
1017
|
+
|
1018
|
+
var _mergedTableAlignCol2 = _interopRequireDefault(_mergedTableAlignCol);
|
1019
|
+
|
1020
|
+
var _mergeCell = __webpack_require__(62);
|
1021
|
+
|
1022
|
+
var _mergeCell2 = _interopRequireDefault(_mergeCell);
|
1023
|
+
|
1024
|
+
var _unmergeCell = __webpack_require__(63);
|
1025
|
+
|
1026
|
+
var _unmergeCell2 = _interopRequireDefault(_unmergeCell);
|
1027
|
+
|
1028
|
+
var _mergedTableUI = __webpack_require__(64);
|
1029
|
+
|
1030
|
+
var _mergedTableUI2 = _interopRequireDefault(_mergedTableUI);
|
1031
|
+
|
1032
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1033
|
+
|
1034
|
+
/**
|
1035
|
+
* table extension
|
1036
|
+
* @param {Editor} editor - editor instance
|
1037
|
+
* @ignore
|
1038
|
+
*/
|
1039
|
+
/**
|
1040
|
+
* @fileoverview Implements table extension
|
1041
|
+
* @author NHN Ent. FE Development Lab <dl_javascript@nhnent.com>
|
1042
|
+
*/
|
1043
|
+
function tableExtension(editor) {
|
1044
|
+
var eventManager = editor.eventManager;
|
1045
|
+
|
1046
|
+
|
1047
|
+
editor.toMarkOptions = editor.toMarkOptions || {};
|
1048
|
+
editor.toMarkOptions.renderer = _toMarkRenderer2.default;
|
1049
|
+
_bindEvents(eventManager);
|
1050
|
+
|
1051
|
+
if (editor.isViewer()) {
|
1052
|
+
return;
|
1053
|
+
}
|
1054
|
+
|
1055
|
+
var wwComponentManager = editor.wwEditor.componentManager;
|
1056
|
+
var popupTableUtils = editor._ui.popupTableUtils;
|
1057
|
+
|
1058
|
+
|
1059
|
+
_addCommands(editor);
|
1060
|
+
_changeWysiwygManagers(wwComponentManager);
|
1061
|
+
|
1062
|
+
if (editor._ui.popupTableUtils) {
|
1063
|
+
_mergedTableUI2.default.updateContextMenu(popupTableUtils, eventManager, wwComponentManager.getManager('tableSelection'));
|
1064
|
+
}
|
1065
|
+
}
|
1066
|
+
|
1067
|
+
/**
|
1068
|
+
* Add commands.
|
1069
|
+
* @param {object} editor - editor instance
|
1070
|
+
* @private
|
1071
|
+
*/
|
1072
|
+
function _addCommands(editor) {
|
1073
|
+
editor.addCommand(_mergeCell2.default);
|
1074
|
+
editor.addCommand(_unmergeCell2.default);
|
1075
|
+
}
|
1076
|
+
|
1077
|
+
/**
|
1078
|
+
* Change wysiwyg component managers.
|
1079
|
+
* @param {object} wwComponentManager - componentMananger instance
|
1080
|
+
* @private
|
1081
|
+
*/
|
1082
|
+
function _changeWysiwygManagers(wwComponentManager) {
|
1083
|
+
wwComponentManager.removeManager('table');
|
1084
|
+
wwComponentManager.removeManager('tableSelection');
|
1085
|
+
|
1086
|
+
wwComponentManager.addManager(_wwMergedTableManager2.default);
|
1087
|
+
wwComponentManager.addManager(_wwMergedTableSelectionManager2.default);
|
1088
|
+
}
|
1089
|
+
|
1090
|
+
/**
|
1091
|
+
* Change html by onChangeTable function.
|
1092
|
+
* @param {string} html - original html
|
1093
|
+
* @param {function} onChangeTable - function for changing html
|
1094
|
+
* @returns {string}
|
1095
|
+
* @private
|
1096
|
+
*/
|
1097
|
+
function _changeHtml(html, onChangeTable) {
|
1098
|
+
var $tempDiv = (0, _jquery2.default)('<div>' + html + '</div>');
|
1099
|
+
var $tables = $tempDiv.find('table');
|
1100
|
+
|
1101
|
+
if ($tables.length) {
|
1102
|
+
$tables.get().forEach(function (tableElement) {
|
1103
|
+
var changedTableElement = onChangeTable(tableElement);
|
1104
|
+
|
1105
|
+
(0, _jquery2.default)(tableElement).replaceWith(changedTableElement);
|
1106
|
+
});
|
1107
|
+
|
1108
|
+
html = $tempDiv.html();
|
1109
|
+
}
|
1110
|
+
|
1111
|
+
return html;
|
1112
|
+
}
|
1113
|
+
|
1114
|
+
/**
|
1115
|
+
* Snatch wysiwyg command.
|
1116
|
+
* @param {{command: object}} commandWrapper - wysiwyg command wrapper
|
1117
|
+
* @private
|
1118
|
+
*/
|
1119
|
+
function _snatchWysiwygCommand(commandWrapper) {
|
1120
|
+
var command = commandWrapper.command;
|
1121
|
+
|
1122
|
+
|
1123
|
+
if (!command.isWWType()) {
|
1124
|
+
return;
|
1125
|
+
}
|
1126
|
+
|
1127
|
+
switch (command.getName()) {
|
1128
|
+
case 'AddRow':
|
1129
|
+
commandWrapper.command = _mergedTableAddRow2.default;
|
1130
|
+
break;
|
1131
|
+
case 'AddCol':
|
1132
|
+
commandWrapper.command = _mergedTableAddCol2.default;
|
1133
|
+
break;
|
1134
|
+
case 'RemoveRow':
|
1135
|
+
commandWrapper.command = _mergedTableRemoveRow2.default;
|
1136
|
+
break;
|
1137
|
+
case 'RemoveCol':
|
1138
|
+
commandWrapper.command = _mergedTableRemoveCol2.default;
|
1139
|
+
break;
|
1140
|
+
case 'AlignCol':
|
1141
|
+
commandWrapper.command = _mergedTableAlignCol2.default;
|
1142
|
+
break;
|
1143
|
+
default:
|
1144
|
+
}
|
1145
|
+
}
|
1146
|
+
|
1147
|
+
/**
|
1148
|
+
* Bind events.
|
1149
|
+
* @param {object} eventManager - eventManager instance
|
1150
|
+
* @private
|
1151
|
+
*/
|
1152
|
+
function _bindEvents(eventManager) {
|
1153
|
+
eventManager.listen('convertorAfterMarkdownToHtmlConverted', function (html) {
|
1154
|
+
return _changeHtml(html, _mergedTableCreator2.default);
|
1155
|
+
});
|
1156
|
+
eventManager.listen('convertorBeforeHtmlToMarkdownConverted', function (html) {
|
1157
|
+
return _changeHtml(html, _tableUnmergePreparer2.default);
|
1158
|
+
});
|
1159
|
+
eventManager.listen('addCommandBefore', _snatchWysiwygCommand);
|
1160
|
+
}
|
1161
|
+
|
1162
|
+
_editorProxy2.default.defineExtension('table', tableExtension);
|
1163
|
+
|
1164
|
+
/***/ }),
|
1165
|
+
/* 50 */
|
1166
|
+
/***/ (function(module, exports, __webpack_require__) {
|
1167
|
+
|
1168
|
+
"use strict";
|
1169
|
+
|
1170
|
+
|
1171
|
+
var _editorProxy = __webpack_require__(1);
|
1172
|
+
|
1173
|
+
var _editorProxy2 = _interopRequireDefault(_editorProxy);
|
1174
|
+
|
1175
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1176
|
+
|
1177
|
+
var i18n = _editorProxy2.default.i18n; /**
|
1178
|
+
* @fileoverview i18n for table extension
|
1179
|
+
* @author NHN Ent. FE Development Lab <dl_javascript@nhnent.com>
|
1180
|
+
*/
|
1181
|
+
|
1182
|
+
if (i18n) {
|
1183
|
+
i18n.setLanguage(['ko', 'ko_KR'], {
|
1184
|
+
'Merge cells': '셀 병합',
|
1185
|
+
'Unmerge cells': '셀 병합해제',
|
1186
|
+
'Cannot change part of merged cell': '병합 된 셀의 일부를 변경할 수 없습니다.',
|
1187
|
+
'Cannot paste row merged cells into the table header': '테이블 헤더에는 행 병합된 셀을 붙여넣을 수 없습니다.'
|
1188
|
+
});
|
1189
|
+
|
1190
|
+
i18n.setLanguage(['en', 'en_US'], {
|
1191
|
+
'Merge cells': 'Merge cells',
|
1192
|
+
'Unmerge cells': 'Unmerge cells',
|
1193
|
+
'Cannot change part of merged cell': 'Cannot change part of merged cell.',
|
1194
|
+
'Cannot paste row merged cells into the table header': 'Cannot paste row merged cells into the table header.'
|
1195
|
+
});
|
1196
|
+
|
1197
|
+
i18n.setLanguage(['es', 'es_ES'], {
|
1198
|
+
'Merge cells': 'Combinar celdas',
|
1199
|
+
'Unmerge cells': 'Separar celdas',
|
1200
|
+
'Cannot change part of merged cell': 'No se puede cambiar parte de una celda combinada.',
|
1201
|
+
'Cannot paste row merged cells into the table header': 'No se pueden pegar celdas combinadas en el encabezado de tabla.'
|
1202
|
+
});
|
1203
|
+
|
1204
|
+
i18n.setLanguage(['ja', 'ja_JP'], {
|
1205
|
+
'Merge cells': 'セルの結合',
|
1206
|
+
'Unmerge cells': 'セルの結合を解除',
|
1207
|
+
'Cannot change part of merged cell': '結合されたセルの一部を変更することはできません。',
|
1208
|
+
'Cannot paste row merged cells into the table header': '行にマージされたセルをヘッダーに貼り付けることはできません。'
|
1209
|
+
});
|
1210
|
+
|
1211
|
+
i18n.setLanguage(['nl', 'nl_NL'], {
|
1212
|
+
'Merge cells': 'cellen samenvoegen',
|
1213
|
+
'Unmerge cells': 'Samenvoegen cellen ongedaan maken',
|
1214
|
+
'Cannot change part of merged cell': 'Kan geen deel uit van samengevoegde cel te veranderen.',
|
1215
|
+
'Cannot paste row merged cells into the table header': 'Kan niet plakken rij samengevoegde cellen in de koptekst. '
|
1216
|
+
});
|
1217
|
+
|
1218
|
+
i18n.setLanguage(['zh', 'zh_CN'], {
|
1219
|
+
'Merge cells': '合并单元格',
|
1220
|
+
'Unmerge cells': '取消合并单元格',
|
1221
|
+
'Cannot change part of merged cell': '无法更改合并单元格的一部分。',
|
1222
|
+
'Cannot paste row merged cells into the table header': '无法将行合并单元格粘贴到标题中。'
|
1223
|
+
});
|
1224
|
+
|
1225
|
+
i18n.setLanguage(['de', 'de_DE'], {
|
1226
|
+
'Merge cells': 'Zellen zusammenführen',
|
1227
|
+
'Unmerge cells': 'Zusammenführen rückgängig machen',
|
1228
|
+
'Cannot change part of merged cell': 'Der Teil der verbundenen Zelle kann nicht geändert werden.',
|
1229
|
+
'Cannot paste row merged cells into the table header': 'Die Zeile der verbundenen Zellen kann nicht in die Kopfzeile eingefügt werden.'
|
1230
|
+
});
|
1231
|
+
|
1232
|
+
i18n.setLanguage(['ru', 'ru_RU'], {
|
1233
|
+
'Merge cells': 'Объединить ячейки',
|
1234
|
+
'Unmerge cells': 'Разъединить ячейки',
|
1235
|
+
'Cannot change part of merged cell': 'Вы не можете изменять часть комбинированной ячейки.',
|
1236
|
+
'Cannot paste row merged cells into the table header': 'Вы не можете вставлять объединенные ячейки в заголовок таблицы.'
|
1237
|
+
});
|
1238
|
+
|
1239
|
+
i18n.setLanguage(['fr', 'fr_FR'], {
|
1240
|
+
'Merge cells': 'Fusionner les cellules',
|
1241
|
+
'Unmerge cells': 'Séparer les cellules',
|
1242
|
+
'Cannot change part of merged cell': 'Impossible de modifier une partie de la cellule fusionnée.',
|
1243
|
+
'Cannot paste row merged cells into the table header': 'Impossible de coller les cellules fusionnées dans l\'en-tête du tableau.'
|
1244
|
+
});
|
1245
|
+
}
|
1246
|
+
|
1247
|
+
/***/ }),
|
1248
|
+
/* 51 */
|
1249
|
+
/***/ (function(module, exports, __webpack_require__) {
|
1250
|
+
|
1251
|
+
"use strict";
|
1252
|
+
|
1253
|
+
|
1254
|
+
Object.defineProperty(exports, "__esModule", {
|
1255
|
+
value: true
|
1256
|
+
});
|
1257
|
+
exports._extractPropertiesForMerge = _extractPropertiesForMerge;
|
1258
|
+
exports._parseTableCell = _parseTableCell;
|
1259
|
+
exports._createTableObjectFrom$Table = _createTableObjectFrom$Table;
|
1260
|
+
exports._divideTrs = _divideTrs;
|
1261
|
+
exports._mergeByColspan = _mergeByColspan;
|
1262
|
+
exports._getRemovalTdCountsByRowspan = _getRemovalTdCountsByRowspan;
|
1263
|
+
exports._mergeByRowspan = _mergeByRowspan;
|
1264
|
+
exports.default = createMergedTable;
|
1265
|
+
|
1266
|
+
var _jquery = __webpack_require__(0);
|
1267
|
+
|
1268
|
+
var _jquery2 = _interopRequireDefault(_jquery);
|
1269
|
+
|
1270
|
+
var _tuiCodeSnippet = __webpack_require__(2);
|
1271
|
+
|
1272
|
+
var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet);
|
1273
|
+
|
1274
|
+
var _tableRenderer = __webpack_require__(6);
|
1275
|
+
|
1276
|
+
var _tableRenderer2 = _interopRequireDefault(_tableRenderer);
|
1277
|
+
|
1278
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1279
|
+
|
1280
|
+
/**
|
1281
|
+
* Extract properties for merge.
|
1282
|
+
* @param {string} value - value
|
1283
|
+
* @param {string} type - merge type like colspan, rowspan
|
1284
|
+
* @param {string} oppossitType - oppossit merge type
|
1285
|
+
* if merge type is colspan, opossit merge type is rowspan
|
1286
|
+
* @returns {Array.<number|string>} - returns merge count and value
|
1287
|
+
* @private
|
1288
|
+
*/
|
1289
|
+
function _extractPropertiesForMerge(value, type, oppossitType) {
|
1290
|
+
var regex = new RegExp('^((?:' + oppossitType + '=[0-9]+:)?)' + type + '=([0-9]+):(.*)');
|
1291
|
+
var regexResult = regex.exec(value);
|
1292
|
+
var mergeCount = 1;
|
1293
|
+
|
1294
|
+
if (regexResult) {
|
1295
|
+
mergeCount = parseInt(regexResult[2], 10);
|
1296
|
+
value = regexResult[1] + regexResult[3];
|
1297
|
+
}
|
1298
|
+
|
1299
|
+
return [mergeCount, value];
|
1300
|
+
}
|
1301
|
+
|
1302
|
+
/**
|
1303
|
+
* Parse table cell element like td, th.
|
1304
|
+
* @param {HTMLElement} cell - table cell element like td, th
|
1305
|
+
* @returns {{
|
1306
|
+
* nodeName: string,
|
1307
|
+
* colspan: number,
|
1308
|
+
* rowspan: number,
|
1309
|
+
* content: string,
|
1310
|
+
* align: string
|
1311
|
+
* }}
|
1312
|
+
* @private
|
1313
|
+
*/
|
1314
|
+
/**
|
1315
|
+
* @fileoverview Implements mergedTableCreator.
|
1316
|
+
* @author NHN Ent. FE Development Lab <dl_javascript@nhnent.com>
|
1317
|
+
*/
|
1318
|
+
function _parseTableCell(cell) {
|
1319
|
+
var nodeName = cell.nodeName;
|
1320
|
+
|
1321
|
+
var align = cell.align || '';
|
1322
|
+
var content = cell.innerHTML.trim();
|
1323
|
+
var colspan = null;
|
1324
|
+
var rowspan = null;
|
1325
|
+
|
1326
|
+
var _extractPropertiesFor = _extractPropertiesForMerge(content, '@cols', '@rows');
|
1327
|
+
|
1328
|
+
colspan = _extractPropertiesFor[0];
|
1329
|
+
content = _extractPropertiesFor[1];
|
1330
|
+
|
1331
|
+
var _extractPropertiesFor2 = _extractPropertiesForMerge(content, '@rows', '@cols');
|
1332
|
+
|
1333
|
+
rowspan = _extractPropertiesFor2[0];
|
1334
|
+
content = _extractPropertiesFor2[1];
|
1335
|
+
|
1336
|
+
|
1337
|
+
return {
|
1338
|
+
nodeName: nodeName,
|
1339
|
+
colspan: colspan,
|
1340
|
+
rowspan: rowspan,
|
1341
|
+
content: content,
|
1342
|
+
align: align
|
1343
|
+
};
|
1344
|
+
}
|
1345
|
+
|
1346
|
+
/**
|
1347
|
+
* Create table object from jQuery table.
|
1348
|
+
* @param {jQuery} $table - jQuery table
|
1349
|
+
* @returns {Array.<Array.<object>>}
|
1350
|
+
* @private
|
1351
|
+
*/
|
1352
|
+
function _createTableObjectFrom$Table($table) {
|
1353
|
+
return $table.find('tr').get().map(function (tr) {
|
1354
|
+
return (0, _jquery2.default)(tr).find('td, th').get().map(_parseTableCell);
|
1355
|
+
});
|
1356
|
+
}
|
1357
|
+
|
1358
|
+
/**
|
1359
|
+
* Find index by onFind function.
|
1360
|
+
* @param {Array} arr - target array
|
1361
|
+
* @param {function} onFind - find function
|
1362
|
+
* @returns {number}
|
1363
|
+
* @private
|
1364
|
+
*/
|
1365
|
+
function _findIndex(arr, onFind) {
|
1366
|
+
var foundIndex = -1;
|
1367
|
+
|
1368
|
+
_tuiCodeSnippet2.default.forEach(arr, function (item, index) {
|
1369
|
+
var nextFind = true;
|
1370
|
+
if (onFind(item, index)) {
|
1371
|
+
foundIndex = index;
|
1372
|
+
nextFind = false;
|
1373
|
+
}
|
1374
|
+
|
1375
|
+
return nextFind;
|
1376
|
+
});
|
1377
|
+
|
1378
|
+
return foundIndex;
|
1379
|
+
}
|
1380
|
+
|
1381
|
+
/**
|
1382
|
+
* Separate the trs according to the type of parent, such as thead and tbody.
|
1383
|
+
* @param {Array.<Array.<object>>} trs - tr list
|
1384
|
+
* @returns {Array.<Array.<Array.<object>>>} - returns thead and tbody
|
1385
|
+
* @private
|
1386
|
+
*/
|
1387
|
+
function _divideTrs(trs) {
|
1388
|
+
var tbodyStartIndex = _findIndex(trs, function (tr) {
|
1389
|
+
return tr[0].nodeName === 'TD';
|
1390
|
+
});
|
1391
|
+
|
1392
|
+
return [trs.slice(0, tbodyStartIndex), trs.slice(tbodyStartIndex)];
|
1393
|
+
}
|
1394
|
+
|
1395
|
+
/**
|
1396
|
+
* Merge by colspan.
|
1397
|
+
* @param {Array.<Array.<object>>} trs - tr list
|
1398
|
+
* @private
|
1399
|
+
*/
|
1400
|
+
function _mergeByColspan(trs) {
|
1401
|
+
trs.forEach(function (tr) {
|
1402
|
+
var tdCount = tr.length;
|
1403
|
+
var removalCount = 0;
|
1404
|
+
|
1405
|
+
tr.forEach(function (td) {
|
1406
|
+
removalCount += td.colspan - 1;
|
1407
|
+
});
|
1408
|
+
|
1409
|
+
tr.splice(tdCount - removalCount);
|
1410
|
+
});
|
1411
|
+
}
|
1412
|
+
|
1413
|
+
/**
|
1414
|
+
* Get removal td counts by rowspan.
|
1415
|
+
* @param {Array.<Array.<object>>} trs - tr list
|
1416
|
+
* @returns {number}
|
1417
|
+
* @private
|
1418
|
+
*/
|
1419
|
+
function _getRemovalTdCountsByRowspan(trs) {
|
1420
|
+
var trIndexes = trs.map(function (tr, index) {
|
1421
|
+
return index;
|
1422
|
+
});
|
1423
|
+
var removalCounts = trIndexes.map(function () {
|
1424
|
+
return 0;
|
1425
|
+
});
|
1426
|
+
|
1427
|
+
trs.forEach(function (tr, trIndex) {
|
1428
|
+
var rowspanTds = tr.filter(function (td) {
|
1429
|
+
return td.rowspan > 1;
|
1430
|
+
});
|
1431
|
+
var startTrIndexForRemoval = trIndex + 1;
|
1432
|
+
|
1433
|
+
rowspanTds.forEach(function (td) {
|
1434
|
+
var removeCount = td.colspan;
|
1435
|
+
var endTrIndexForRemoval = startTrIndexForRemoval + (td.rowspan - 1);
|
1436
|
+
|
1437
|
+
trIndexes.slice(startTrIndexForRemoval, endTrIndexForRemoval).forEach(function (removeIndex) {
|
1438
|
+
removalCounts[removeIndex] += removeCount;
|
1439
|
+
});
|
1440
|
+
});
|
1441
|
+
});
|
1442
|
+
|
1443
|
+
return removalCounts;
|
1444
|
+
}
|
1445
|
+
|
1446
|
+
/**
|
1447
|
+
* Merge by rowspan.
|
1448
|
+
* @param {Array.<Array.<object>>} trs - tr list
|
1449
|
+
* @private
|
1450
|
+
*/
|
1451
|
+
function _mergeByRowspan(trs) {
|
1452
|
+
var removalCounts = _getRemovalTdCountsByRowspan(trs);
|
1453
|
+
|
1454
|
+
trs.forEach(function (tr, trIndex) {
|
1455
|
+
tr.splice(tr.length - removalCounts[trIndex]);
|
1456
|
+
});
|
1457
|
+
}
|
1458
|
+
|
1459
|
+
/**
|
1460
|
+
* Create merged table by @cols, @rows value in td innerHTML.
|
1461
|
+
* @param {HTMLElement} tableElement - unmerged table
|
1462
|
+
* @returns {HTMLElement}
|
1463
|
+
*/
|
1464
|
+
function createMergedTable(tableElement) {
|
1465
|
+
var table = _createTableObjectFrom$Table((0, _jquery2.default)(tableElement));
|
1466
|
+
|
1467
|
+
var _divideTrs2 = _divideTrs(table),
|
1468
|
+
thead = _divideTrs2[0],
|
1469
|
+
tbody = _divideTrs2[1];
|
1470
|
+
|
1471
|
+
_mergeByColspan(thead);
|
1472
|
+
_mergeByColspan(tbody);
|
1473
|
+
_mergeByRowspan(tbody);
|
1474
|
+
|
1475
|
+
return (0, _jquery2.default)(_tableRenderer2.default.createTableHtml(table))[0];
|
1476
|
+
}
|
1477
|
+
|
1478
|
+
/***/ }),
|
1479
|
+
/* 52 */
|
1480
|
+
/***/ (function(module, exports, __webpack_require__) {
|
1481
|
+
|
1482
|
+
"use strict";
|
1483
|
+
|
1484
|
+
|
1485
|
+
Object.defineProperty(exports, "__esModule", {
|
1486
|
+
value: true
|
1487
|
+
});
|
1488
|
+
exports._prependMergeSyntaxToContent = _prependMergeSyntaxToContent;
|
1489
|
+
exports.default = prepareTableUnmerge;
|
1490
|
+
|
1491
|
+
var _jquery = __webpack_require__(0);
|
1492
|
+
|
1493
|
+
var _jquery2 = _interopRequireDefault(_jquery);
|
1494
|
+
|
1495
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1496
|
+
|
1497
|
+
/**
|
1498
|
+
* Prepend merge syntax to content.
|
1499
|
+
* @param {HTMLElement} cell - td or th
|
1500
|
+
* @private
|
1501
|
+
*/
|
1502
|
+
function _prependMergeSyntaxToContent(cell) {
|
1503
|
+
var $cell = (0, _jquery2.default)(cell);
|
1504
|
+
var colspan = $cell.attr('colspan') || '';
|
1505
|
+
var rowspan = $cell.attr('rowspan') || '';
|
1506
|
+
var content = $cell.html();
|
1507
|
+
|
1508
|
+
if (colspan) {
|
1509
|
+
content = '@cols=' + colspan + ':' + content;
|
1510
|
+
}
|
1511
|
+
|
1512
|
+
if (rowspan) {
|
1513
|
+
content = '@rows=' + rowspan + ':' + content;
|
1514
|
+
}
|
1515
|
+
|
1516
|
+
if (content) {
|
1517
|
+
$cell.html(content);
|
1518
|
+
}
|
1519
|
+
}
|
1520
|
+
|
1521
|
+
/**
|
1522
|
+
* Prepare table unmerge.
|
1523
|
+
* @param {HTMLElement} tableElement - table element
|
1524
|
+
* @returns {HTMLElement}
|
1525
|
+
*/
|
1526
|
+
/**
|
1527
|
+
* @fileoverview Implements tableUnmergePreparer.
|
1528
|
+
* @author NHN Ent. FE Development Lab <dl_javascript@nhnent.com>
|
1529
|
+
*/
|
1530
|
+
function prepareTableUnmerge(tableElement) {
|
1531
|
+
(0, _jquery2.default)(tableElement).find('td, th').get().forEach(_prependMergeSyntaxToContent);
|
1532
|
+
|
1533
|
+
return tableElement;
|
1534
|
+
}
|
1535
|
+
|
1536
|
+
/***/ }),
|
1537
|
+
/* 53 */
|
1538
|
+
/***/ (function(module, exports, __webpack_require__) {
|
1539
|
+
|
1540
|
+
"use strict";
|
1541
|
+
|
1542
|
+
|
1543
|
+
Object.defineProperty(exports, "__esModule", {
|
1544
|
+
value: true
|
1545
|
+
});
|
1546
|
+
exports._getAdditionalThCount = _getAdditionalThCount;
|
1547
|
+
exports._createTheadMarkdown = _createTheadMarkdown;
|
1548
|
+
|
1549
|
+
var _jquery = __webpack_require__(0);
|
1550
|
+
|
1551
|
+
var _jquery2 = _interopRequireDefault(_jquery);
|
1552
|
+
|
1553
|
+
var _tuiCodeSnippet = __webpack_require__(2);
|
1554
|
+
|
1555
|
+
var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet);
|
1556
|
+
|
1557
|
+
var _toMark = __webpack_require__(54);
|
1558
|
+
|
1559
|
+
var _toMark2 = _interopRequireDefault(_toMark);
|
1560
|
+
|
1561
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1562
|
+
|
1563
|
+
var RX_COLS = /@cols=[0-9]+:/g;
|
1564
|
+
|
1565
|
+
/**
|
1566
|
+
* Create repeat string.
|
1567
|
+
* @param {string} str - target string
|
1568
|
+
* @param {number} count - count
|
1569
|
+
* @returns {string}
|
1570
|
+
* @private
|
1571
|
+
*/
|
1572
|
+
/**
|
1573
|
+
* @fileoverview Implements toMarkRendererCreator.
|
1574
|
+
* @author NHN Ent. FE Development Lab <dl_javascript@nhnent.com>
|
1575
|
+
*/
|
1576
|
+
function _createRepeatString(str, count) {
|
1577
|
+
return _tuiCodeSnippet2.default.range(0, count).map(function () {
|
1578
|
+
return str;
|
1579
|
+
}).join('');
|
1580
|
+
}
|
1581
|
+
|
1582
|
+
/**
|
1583
|
+
* Make table head align text.
|
1584
|
+
* Copy from https://github.com/nhnent/to-mark/blob/develop/src/renderer.gfm.js
|
1585
|
+
* @param {HTMLElement} thElement - Table head cell element
|
1586
|
+
* @returns {string}
|
1587
|
+
* @private
|
1588
|
+
*/
|
1589
|
+
function _makeTableHeadAlignText(thElement) {
|
1590
|
+
var align = thElement.align;
|
1591
|
+
|
1592
|
+
var textContent = (thElement.textContent || thElement.innerText).replace(RX_COLS, '');
|
1593
|
+
var textLength = textContent.length;
|
1594
|
+
var leftAlignValue = '';
|
1595
|
+
var rightAlignValue = '';
|
1596
|
+
|
1597
|
+
if (align) {
|
1598
|
+
if (align === 'left') {
|
1599
|
+
leftAlignValue = ':';
|
1600
|
+
textLength -= 1;
|
1601
|
+
} else if (align === 'right') {
|
1602
|
+
rightAlignValue = ':';
|
1603
|
+
textLength -= 1;
|
1604
|
+
} else if (align === 'center') {
|
1605
|
+
rightAlignValue = ':';
|
1606
|
+
leftAlignValue = ':';
|
1607
|
+
textLength -= 2;
|
1608
|
+
}
|
1609
|
+
}
|
1610
|
+
|
1611
|
+
textLength = Math.max(textLength, 3);
|
1612
|
+
|
1613
|
+
return leftAlignValue + _createRepeatString('-', textLength) + rightAlignValue;
|
1614
|
+
}
|
1615
|
+
|
1616
|
+
/**
|
1617
|
+
* Get additional th element count.
|
1618
|
+
* @param {Array.<HTMLElement>} ths - th element list
|
1619
|
+
* @private
|
1620
|
+
* @returns {Number}
|
1621
|
+
*/
|
1622
|
+
function _getAdditionalThCount(ths) {
|
1623
|
+
var additionalThCount = 0;
|
1624
|
+
|
1625
|
+
ths.filter(function (th) {
|
1626
|
+
return (0, _jquery2.default)(th).attr('colspan');
|
1627
|
+
}).forEach(function (th) {
|
1628
|
+
additionalThCount += parseInt((0, _jquery2.default)(th).attr('colspan'), 10) - 1;
|
1629
|
+
});
|
1630
|
+
|
1631
|
+
return additionalThCount;
|
1632
|
+
}
|
1633
|
+
|
1634
|
+
/**
|
1635
|
+
* Create thead markdown.
|
1636
|
+
* @param {HTMLElement} theadElement - theadElement element
|
1637
|
+
* @param {string} theadContentMarkdown - thead markdown content
|
1638
|
+
* @returns {string}
|
1639
|
+
* @private
|
1640
|
+
*/
|
1641
|
+
function _createTheadMarkdown(theadElement, theadContentMarkdown) {
|
1642
|
+
var ths = (0, _jquery2.default)(theadElement).find('th').get();
|
1643
|
+
var align = ths.map(function (th) {
|
1644
|
+
return ' ' + _makeTableHeadAlignText(th) + ' |';
|
1645
|
+
}).join('');
|
1646
|
+
|
1647
|
+
align += _createRepeatString(' --- |', _getAdditionalThCount(ths));
|
1648
|
+
|
1649
|
+
return theadContentMarkdown ? theadContentMarkdown + '|' + align + '\n' : '';
|
1650
|
+
}
|
1651
|
+
|
1652
|
+
exports.default = _toMark2.default.Renderer.factory(_toMark2.default.gfmRenderer, {
|
1653
|
+
'THEAD': _createTheadMarkdown
|
1654
|
+
});
|
1655
|
+
|
1656
|
+
/***/ }),
|
1657
|
+
/* 54 */
|
1658
|
+
/***/ (function(module, exports) {
|
1659
|
+
|
1660
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_54__;
|
1661
|
+
|
1662
|
+
/***/ }),
|
1663
|
+
/* 55 */
|
1664
|
+
/***/ (function(module, exports, __webpack_require__) {
|
1665
|
+
|
1666
|
+
"use strict";
|
1667
|
+
|
1668
|
+
|
1669
|
+
Object.defineProperty(exports, "__esModule", {
|
1670
|
+
value: true
|
1671
|
+
});
|
1672
|
+
|
1673
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
1674
|
+
|
1675
|
+
var _jquery = __webpack_require__(0);
|
1676
|
+
|
1677
|
+
var _jquery2 = _interopRequireDefault(_jquery);
|
1678
|
+
|
1679
|
+
var _tuiCodeSnippet = __webpack_require__(2);
|
1680
|
+
|
1681
|
+
var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet);
|
1682
|
+
|
1683
|
+
var _editorProxy = __webpack_require__(1);
|
1684
|
+
|
1685
|
+
var _editorProxy2 = _interopRequireDefault(_editorProxy);
|
1686
|
+
|
1687
|
+
var _tableDataHandler = __webpack_require__(3);
|
1688
|
+
|
1689
|
+
var _tableDataHandler2 = _interopRequireDefault(_tableDataHandler);
|
1690
|
+
|
1691
|
+
var _tableRenderer = __webpack_require__(6);
|
1692
|
+
|
1693
|
+
var _tableRenderer2 = _interopRequireDefault(_tableRenderer);
|
1694
|
+
|
1695
|
+
var _tableRangeHandler = __webpack_require__(7);
|
1696
|
+
|
1697
|
+
var _tableRangeHandler2 = _interopRequireDefault(_tableRangeHandler);
|
1698
|
+
|
1699
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1700
|
+
|
1701
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
1702
|
+
|
1703
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
1704
|
+
|
1705
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**
|
1706
|
+
* @fileoverview Implements wysiwyg merged table manager
|
1707
|
+
* @author NHN Ent. FE Development Lab <dl_javascript@nhnent.com>
|
1708
|
+
*/
|
1709
|
+
|
1710
|
+
|
1711
|
+
var WwTableManager = _editorProxy2.default.WwTableManager,
|
1712
|
+
i18n = _editorProxy2.default.i18n;
|
1713
|
+
|
1714
|
+
var PASTE_TABLE_BOOKMARK = 'tui-paste-table-bookmark';
|
1715
|
+
var PASTE_TABLE_CELL_BOOKMARK = 'tui-paste-table-cell-bookmark';
|
1716
|
+
|
1717
|
+
/**
|
1718
|
+
* Class WwMergedTableManager
|
1719
|
+
* @extends {WwTableManager}
|
1720
|
+
*/
|
1721
|
+
|
1722
|
+
var WwMergedTableManager = function (_WwTableManager) {
|
1723
|
+
_inherits(WwMergedTableManager, _WwTableManager);
|
1724
|
+
|
1725
|
+
function WwMergedTableManager() {
|
1726
|
+
_classCallCheck(this, WwMergedTableManager);
|
1727
|
+
|
1728
|
+
return _possibleConstructorReturn(this, (WwMergedTableManager.__proto__ || Object.getPrototypeOf(WwMergedTableManager)).apply(this, arguments));
|
1729
|
+
}
|
1730
|
+
|
1731
|
+
_createClass(WwMergedTableManager, [{
|
1732
|
+
key: '_updateCopyDataMergeWith',
|
1733
|
+
|
1734
|
+
/**
|
1735
|
+
* Update mergeWidth property like rowMergeWith, colMergeWith of table data for copy.
|
1736
|
+
* @param {Array.<Array.<object>>} copyTableData - table data for copy
|
1737
|
+
* @param {{rowIndex: number, colIndex: number}} startRange - start range
|
1738
|
+
* @private
|
1739
|
+
*/
|
1740
|
+
value: function _updateCopyDataMergeWith(copyTableData, startRange) {
|
1741
|
+
copyTableData.forEach(function (rowData) {
|
1742
|
+
rowData.forEach(function (cellData) {
|
1743
|
+
if (_tuiCodeSnippet2.default.isExisty(cellData.rowMergeWith)) {
|
1744
|
+
cellData.rowMergeWith -= startRange.rowIndex;
|
1745
|
+
}
|
1746
|
+
|
1747
|
+
if (_tuiCodeSnippet2.default.isExisty(cellData.colMergeWith)) {
|
1748
|
+
cellData.colMergeWith -= startRange.colIndex;
|
1749
|
+
}
|
1750
|
+
});
|
1751
|
+
});
|
1752
|
+
}
|
1753
|
+
|
1754
|
+
/**
|
1755
|
+
* Create table data for copy.
|
1756
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
1757
|
+
* @param {{rowIndex: number, colIndex: number}} startRange - start range
|
1758
|
+
* @param {{rowIndex: number, colIndex: number}} endRange - end range
|
1759
|
+
* @returns {Array.<Array.<object>>}
|
1760
|
+
* @private
|
1761
|
+
*/
|
1762
|
+
|
1763
|
+
}, {
|
1764
|
+
key: '_createCopyTableData',
|
1765
|
+
value: function _createCopyTableData(tableData, startRange, endRange) {
|
1766
|
+
var copyTableData = tableData.slice(startRange.rowIndex, endRange.rowIndex + 1);
|
1767
|
+
|
1768
|
+
copyTableData = copyTableData.map(function (rowData) {
|
1769
|
+
return rowData.slice(startRange.colIndex, endRange.colIndex + 1);
|
1770
|
+
});
|
1771
|
+
|
1772
|
+
this._updateCopyDataMergeWith(copyTableData, startRange);
|
1773
|
+
|
1774
|
+
return copyTableData;
|
1775
|
+
}
|
1776
|
+
|
1777
|
+
/**
|
1778
|
+
* Update table html of clipboard data, if has selected cells.
|
1779
|
+
* @param {jQuery} $clipboardContainer - jQuery element
|
1780
|
+
* @override
|
1781
|
+
*/
|
1782
|
+
|
1783
|
+
}, {
|
1784
|
+
key: 'updateTableHtmlOfClipboardIfNeed',
|
1785
|
+
value: function updateTableHtmlOfClipboardIfNeed($clipboardContainer) {
|
1786
|
+
var $selectedCells = this.wwe.componentManager.getManager('tableSelection').getSelectedCells();
|
1787
|
+
|
1788
|
+
if ($selectedCells.length) {
|
1789
|
+
var tableData = _tableDataHandler2.default.createTableData((0, _jquery2.default)($selectedCells[0]).closest('TABLE'));
|
1790
|
+
|
1791
|
+
var _tableRangeHandler$ge = _tableRangeHandler2.default.getTableSelectionRange(tableData, $selectedCells),
|
1792
|
+
startRange = _tableRangeHandler$ge.start,
|
1793
|
+
endRange = _tableRangeHandler$ge.end;
|
1794
|
+
|
1795
|
+
var copyTableData = this._createCopyTableData(tableData, startRange, endRange);
|
1796
|
+
var cellIndexData = _tableDataHandler2.default.createCellIndexData(copyTableData);
|
1797
|
+
var renderData = _tableDataHandler2.default.createRenderData(copyTableData, cellIndexData);
|
1798
|
+
|
1799
|
+
$clipboardContainer.html(_tableRenderer2.default.createTableHtml(renderData));
|
1800
|
+
}
|
1801
|
+
}
|
1802
|
+
|
1803
|
+
/**
|
1804
|
+
* Prepare to table cell stuffing
|
1805
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
1806
|
+
* @returns {{maximumCellLength: *, needTableCellStuffingAid: boolean}}
|
1807
|
+
* @override
|
1808
|
+
*/
|
1809
|
+
|
1810
|
+
}, {
|
1811
|
+
key: 'prepareToTableCellStuffing',
|
1812
|
+
value: function prepareToTableCellStuffing(tableData) {
|
1813
|
+
var maximumCellLength = tableData[0].length;
|
1814
|
+
var needTableCellStuffingAid = false;
|
1815
|
+
|
1816
|
+
tableData.slice(1).forEach(function (rowData) {
|
1817
|
+
var cellCount = rowData.length;
|
1818
|
+
|
1819
|
+
if (maximumCellLength !== cellCount) {
|
1820
|
+
needTableCellStuffingAid = true;
|
1821
|
+
|
1822
|
+
if (maximumCellLength < cellCount) {
|
1823
|
+
maximumCellLength = cellCount;
|
1824
|
+
}
|
1825
|
+
}
|
1826
|
+
});
|
1827
|
+
|
1828
|
+
return {
|
1829
|
+
maximumCellLength: maximumCellLength,
|
1830
|
+
needTableCellStuffingAid: needTableCellStuffingAid
|
1831
|
+
};
|
1832
|
+
}
|
1833
|
+
|
1834
|
+
/**
|
1835
|
+
* Append table cells.
|
1836
|
+
* @param {HTMLElement} node Table element
|
1837
|
+
* @override
|
1838
|
+
*/
|
1839
|
+
|
1840
|
+
}, {
|
1841
|
+
key: 'tableCellAppendAidForTableElement',
|
1842
|
+
value: function tableCellAppendAidForTableElement(node) {
|
1843
|
+
var $table = (0, _jquery2.default)(node);
|
1844
|
+
var tableData = _tableDataHandler2.default.createTableData($table);
|
1845
|
+
var added = _tableDataHandler2.default.addTbodyOrTheadIfNeed(tableData);
|
1846
|
+
var tableAidInformation = this.prepareToTableCellStuffing(tableData);
|
1847
|
+
var needTableCellStuffingAid = tableAidInformation.needTableCellStuffingAid;
|
1848
|
+
|
1849
|
+
|
1850
|
+
if (needTableCellStuffingAid) {
|
1851
|
+
_tableDataHandler2.default.stuffCellsIntoIncompleteRow(tableData, tableAidInformation.maximumCellLength);
|
1852
|
+
}
|
1853
|
+
|
1854
|
+
if (added || needTableCellStuffingAid) {
|
1855
|
+
_tableRenderer2.default.replaceTable($table, tableData);
|
1856
|
+
}
|
1857
|
+
}
|
1858
|
+
|
1859
|
+
/**
|
1860
|
+
* Find start cell.
|
1861
|
+
* @param {jQuery} $selectedCells - jQuery elements like td, th
|
1862
|
+
* @returns {HTMLElement}
|
1863
|
+
* @private
|
1864
|
+
*/
|
1865
|
+
|
1866
|
+
}, {
|
1867
|
+
key: '_findStartCell',
|
1868
|
+
value: function _findStartCell($selectedCells) {
|
1869
|
+
var startCell = void 0;
|
1870
|
+
|
1871
|
+
if ($selectedCells.length === 1) {
|
1872
|
+
startCell = $selectedCells.get(0);
|
1873
|
+
} else {
|
1874
|
+
startCell = this.wwe.getEditor().getSelection().startContainer;
|
1875
|
+
}
|
1876
|
+
|
1877
|
+
return startCell;
|
1878
|
+
}
|
1879
|
+
|
1880
|
+
/**
|
1881
|
+
* Find start cell index.
|
1882
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
1883
|
+
* @param {jQuery} $startCell - start jQuery element like td, th
|
1884
|
+
* @returns {{rowIndex: number, colIndex: number}}
|
1885
|
+
* @private
|
1886
|
+
*/
|
1887
|
+
|
1888
|
+
}, {
|
1889
|
+
key: '_findStartCellIndex',
|
1890
|
+
value: function _findStartCellIndex(tableData, $startCell) {
|
1891
|
+
var cellIndexData = _tableDataHandler2.default.createCellIndexData(tableData);
|
1892
|
+
|
1893
|
+
return _tableDataHandler2.default.findCellIndex(cellIndexData, $startCell);
|
1894
|
+
}
|
1895
|
+
|
1896
|
+
/**
|
1897
|
+
* Whether has row merged header in clipboardTableData.
|
1898
|
+
* @param {Array.<Array.<object>>} clipboardTableData - table data of clipboard
|
1899
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
1900
|
+
* @param {{rowIndex: number, colIndex: number}} startCellIndex - start cell index
|
1901
|
+
* @returns {boolean}
|
1902
|
+
* @private
|
1903
|
+
*/
|
1904
|
+
|
1905
|
+
}, {
|
1906
|
+
key: '_hasRowMergedHeader',
|
1907
|
+
value: function _hasRowMergedHeader(clipboardTableData, tableData, startCellIndex) {
|
1908
|
+
var isHeader = tableData[startCellIndex.rowIndex][startCellIndex.colIndex].nodeName === 'TH';
|
1909
|
+
var hasHeaderMerge = any(clipboardTableData[0], function (cellData) {
|
1910
|
+
return cellData.rowspan && cellData.rowspan > 1;
|
1911
|
+
});
|
1912
|
+
|
1913
|
+
return isHeader && hasHeaderMerge;
|
1914
|
+
}
|
1915
|
+
|
1916
|
+
/**
|
1917
|
+
* Whether exactly fit table selection by clipboardTableData.
|
1918
|
+
* @param {Array.<Array.<object>>} clipboardTableData - table data of clipboard
|
1919
|
+
* @param {number} targetRowCount - target row count
|
1920
|
+
* @param {number} targetColCount - target col count
|
1921
|
+
* @returns {boolean}
|
1922
|
+
* @private
|
1923
|
+
*/
|
1924
|
+
|
1925
|
+
}, {
|
1926
|
+
key: '_isExactlyFit',
|
1927
|
+
value: function _isExactlyFit(clipboardTableData, targetRowCount, targetColCount) {
|
1928
|
+
return targetRowCount % clipboardTableData.length === 0 && targetColCount % clipboardTableData[0].length === 0;
|
1929
|
+
}
|
1930
|
+
|
1931
|
+
/**
|
1932
|
+
* Update clibpard table data.
|
1933
|
+
* @param {Array.<Array.<object>>} clipboardTableData - table data of clipboard
|
1934
|
+
* @param {number} targetRowCount - target row count
|
1935
|
+
* @param {number} targetColCount - target col count
|
1936
|
+
* @private
|
1937
|
+
*/
|
1938
|
+
|
1939
|
+
}, {
|
1940
|
+
key: '_updateClipboardTableData',
|
1941
|
+
value: function _updateClipboardTableData(clipboardTableData, targetRowCount, targetColCount) {
|
1942
|
+
var clipboardRowCount = clipboardTableData.length;
|
1943
|
+
var clipboardColCount = clipboardTableData[0].length;
|
1944
|
+
var increaseRowCount = parseInt(targetRowCount / clipboardRowCount, 10);
|
1945
|
+
var increaseColCount = parseInt(targetColCount / clipboardColCount, 10);
|
1946
|
+
|
1947
|
+
if (increaseRowCount > 1) {
|
1948
|
+
var originalData = JSON.parse(JSON.stringify(clipboardTableData));
|
1949
|
+
|
1950
|
+
_tuiCodeSnippet2.default.range(0, increaseRowCount - 1).forEach(function () {
|
1951
|
+
var newRows = JSON.parse(JSON.stringify(originalData));
|
1952
|
+
|
1953
|
+
clipboardTableData.push.apply(clipboardTableData, newRows);
|
1954
|
+
});
|
1955
|
+
}
|
1956
|
+
|
1957
|
+
if (increaseColCount > 1) {
|
1958
|
+
var _originalData = JSON.parse(JSON.stringify(clipboardTableData));
|
1959
|
+
|
1960
|
+
_tuiCodeSnippet2.default.range(0, increaseColCount - 1).forEach(function () {
|
1961
|
+
var newData = JSON.parse(JSON.stringify(_originalData));
|
1962
|
+
clipboardTableData.forEach(function (rowData, rowIndex) {
|
1963
|
+
rowData.push.apply(rowData, newData[rowIndex]);
|
1964
|
+
});
|
1965
|
+
});
|
1966
|
+
}
|
1967
|
+
}
|
1968
|
+
|
1969
|
+
/**
|
1970
|
+
* Update table data by cliboard table data.
|
1971
|
+
* @param {Array.<Array.<object>>} clipboardTableData - table data of clipboard
|
1972
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
1973
|
+
* @param {{rowIndex: number, colIndex: number}} startCellIndex - start cell index
|
1974
|
+
* @private
|
1975
|
+
*/
|
1976
|
+
|
1977
|
+
}, {
|
1978
|
+
key: '_updateTableDataByClipboardData',
|
1979
|
+
value: function _updateTableDataByClipboardData(clipboardTableData, tableData, startCellIndex) {
|
1980
|
+
var startRowIndex = startCellIndex.rowIndex;
|
1981
|
+
var startColIndex = startCellIndex.colIndex;
|
1982
|
+
|
1983
|
+
clipboardTableData.forEach(function (rowData, rowIndex) {
|
1984
|
+
var updateRowIndex = startRowIndex + rowIndex;
|
1985
|
+
|
1986
|
+
rowData.forEach(function (cellData, colIndex) {
|
1987
|
+
var updateColIndex = startColIndex + colIndex;
|
1988
|
+
var prevCellData = tableData[updateRowIndex][updateColIndex];
|
1989
|
+
|
1990
|
+
cellData.nodeName = prevCellData.nodeName;
|
1991
|
+
tableData[updateRowIndex][updateColIndex] = cellData;
|
1992
|
+
});
|
1993
|
+
});
|
1994
|
+
}
|
1995
|
+
|
1996
|
+
/**
|
1997
|
+
* Whether possible to paste or not.
|
1998
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
1999
|
+
* @param {{rowIndex: number, colIndex: number}} startCellIndex - start cell index
|
2000
|
+
* @param {{rowIndex: number, colIndex: number}} endCellIndex - end cell index
|
2001
|
+
* @returns {boolean}
|
2002
|
+
* @private
|
2003
|
+
*/
|
2004
|
+
|
2005
|
+
}, {
|
2006
|
+
key: '_isPossibleToPaste',
|
2007
|
+
value: function _isPossibleToPaste(tableData, startCellIndex, endCellIndex) {
|
2008
|
+
var startRowIndex = startCellIndex.rowIndex;
|
2009
|
+
var startColIndex = startCellIndex.colIndex;
|
2010
|
+
var endRowIndex = endCellIndex.rowIndex;
|
2011
|
+
var endColIndex = endCellIndex.colIndex;
|
2012
|
+
var filterdTableData = tableData.slice(startRowIndex, endRowIndex + 1);
|
2013
|
+
var firstRow = filterdTableData[0].slice(startColIndex, endColIndex + 1);
|
2014
|
+
var isPossible = !any(firstRow, function (cellData) {
|
2015
|
+
return _tuiCodeSnippet2.default.isExisty(cellData.rowMergeWith);
|
2016
|
+
});
|
2017
|
+
|
2018
|
+
if (isPossible) {
|
2019
|
+
var firstCells = _tuiCodeSnippet2.default.pluck(filterdTableData, startColIndex);
|
2020
|
+
|
2021
|
+
isPossible = !any(firstCells, function (cellData) {
|
2022
|
+
return _tuiCodeSnippet2.default.isExisty(cellData.colMergeWith);
|
2023
|
+
});
|
2024
|
+
}
|
2025
|
+
|
2026
|
+
if (isPossible && tableData.length > endRowIndex + 1) {
|
2027
|
+
var nextRow = tableData[endRowIndex + 1].slice(startColIndex, endColIndex + 1);
|
2028
|
+
|
2029
|
+
isPossible = !any(nextRow, function (cellData) {
|
2030
|
+
return _tuiCodeSnippet2.default.isExisty(cellData.rowMergeWith);
|
2031
|
+
});
|
2032
|
+
}
|
2033
|
+
|
2034
|
+
if (isPossible && tableData[0].length > endColIndex + 1) {
|
2035
|
+
var nextCells = _tuiCodeSnippet2.default.pluck(filterdTableData, endColIndex + 1);
|
2036
|
+
|
2037
|
+
isPossible = !any(nextCells, function (cellData) {
|
2038
|
+
return _tuiCodeSnippet2.default.isExisty(cellData.colMergeWith);
|
2039
|
+
});
|
2040
|
+
}
|
2041
|
+
|
2042
|
+
return isPossible;
|
2043
|
+
}
|
2044
|
+
|
2045
|
+
/**
|
2046
|
+
* Splice clipboardTableData by target row count and col count.
|
2047
|
+
* @param {Array.<Array.<object>>} clipboardTableData - table data of clipboard
|
2048
|
+
* @param {number} targetRowCount - target row count
|
2049
|
+
* @param {number} targetColCount - target col count
|
2050
|
+
* @private
|
2051
|
+
*/
|
2052
|
+
|
2053
|
+
}, {
|
2054
|
+
key: '_spliceClipboardData',
|
2055
|
+
value: function _spliceClipboardData(clipboardTableData, targetRowCount, targetColCount) {
|
2056
|
+
clipboardTableData.splice(targetRowCount);
|
2057
|
+
clipboardTableData.forEach(function (rowData) {
|
2058
|
+
rowData.splice(targetColCount);
|
2059
|
+
});
|
2060
|
+
}
|
2061
|
+
|
2062
|
+
/**
|
2063
|
+
* bookmark last td.
|
2064
|
+
* @param {number} endRowIndex - end row index
|
2065
|
+
* @param {number} endColIndex - end col index
|
2066
|
+
* @private
|
2067
|
+
*/
|
2068
|
+
|
2069
|
+
}, {
|
2070
|
+
key: '_bookmarkLastTd',
|
2071
|
+
value: function _bookmarkLastTd(_ref) {
|
2072
|
+
var endRowIndex = _ref.rowIndex,
|
2073
|
+
endColIndex = _ref.colIndex;
|
2074
|
+
|
2075
|
+
var sq = this.wwe.getEditor();
|
2076
|
+
var $bookmarkedTable = sq.get$Body().find('.' + PASTE_TABLE_BOOKMARK);
|
2077
|
+
var tableData = _tableDataHandler2.default.createTableData($bookmarkedTable);
|
2078
|
+
var lastCellData = tableData[endRowIndex][endColIndex];
|
2079
|
+
|
2080
|
+
endRowIndex = _tuiCodeSnippet2.default.isExisty(lastCellData.rowMergeWith) ? lastCellData.rowMergeWith : endRowIndex;
|
2081
|
+
endColIndex = _tuiCodeSnippet2.default.isExisty(lastCellData.colMergeWith) ? lastCellData.colMergeWith : endColIndex;
|
2082
|
+
|
2083
|
+
var lastCellIndex = tableData[endRowIndex][endColIndex].elementIndex;
|
2084
|
+
var lastTd = $bookmarkedTable.find('tr').eq(lastCellIndex.rowIndex).children()[lastCellIndex.colIndex];
|
2085
|
+
|
2086
|
+
$bookmarkedTable.removeClass(PASTE_TABLE_BOOKMARK);
|
2087
|
+
(0, _jquery2.default)(lastTd).addClass(PASTE_TABLE_CELL_BOOKMARK);
|
2088
|
+
}
|
2089
|
+
|
2090
|
+
/**
|
2091
|
+
* Update clipboard data for paste to smaller selection area than clipboard data.
|
2092
|
+
* @param {Array.<Array.<object>>} clipboardTableData - table data of clipboard
|
2093
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
2094
|
+
* @param {number} targetRowCount - target row count
|
2095
|
+
* @param {number} targetColCount - target col count
|
2096
|
+
* @param {{rowIndex: number, colIndex: number}} startRange - start table range
|
2097
|
+
* @returns {boolean}
|
2098
|
+
* @private
|
2099
|
+
*/
|
2100
|
+
|
2101
|
+
}, {
|
2102
|
+
key: '_updateClipboardDataForPasteToSamllerSelectedArea',
|
2103
|
+
value: function _updateClipboardDataForPasteToSamllerSelectedArea(clipboardTableData, tableData, targetRowCount, targetColCount, startRange) {
|
2104
|
+
var updated = true;
|
2105
|
+
var startCellIndex = {
|
2106
|
+
rowIndex: 0,
|
2107
|
+
colIndex: 0
|
2108
|
+
};
|
2109
|
+
|
2110
|
+
var endCellIndex = {
|
2111
|
+
rowIndex: targetRowCount - 1,
|
2112
|
+
colIndex: targetColCount - 1
|
2113
|
+
};
|
2114
|
+
|
2115
|
+
if (this._isPossibleToPaste(clipboardTableData, startCellIndex, endCellIndex)) {
|
2116
|
+
this._spliceClipboardData(clipboardTableData, targetRowCount, targetColCount);
|
2117
|
+
this._updateTableDataByClipboardData(clipboardTableData, tableData, startRange);
|
2118
|
+
} else {
|
2119
|
+
updated = false;
|
2120
|
+
}
|
2121
|
+
|
2122
|
+
return updated;
|
2123
|
+
}
|
2124
|
+
|
2125
|
+
/**
|
2126
|
+
* Paste to selected area.
|
2127
|
+
* @param {jQuery} $table - target jQuery table element
|
2128
|
+
* @param {Array.<Array.<object>>} clipboardTableData - table data of clipboard
|
2129
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
2130
|
+
* @param {jQuery} $selectedCells - selected jQuery elements like td, th
|
2131
|
+
* @private
|
2132
|
+
*/
|
2133
|
+
|
2134
|
+
}, {
|
2135
|
+
key: '_pasteToSelectedArea',
|
2136
|
+
value: function _pasteToSelectedArea($table, clipboardTableData, tableData, $selectedCells) {
|
2137
|
+
var _tableRangeHandler$ge2 = _tableRangeHandler2.default.getTableSelectionRange(tableData, $selectedCells),
|
2138
|
+
startRange = _tableRangeHandler$ge2.start,
|
2139
|
+
endRange = _tableRangeHandler$ge2.end;
|
2140
|
+
|
2141
|
+
var targetRowCount = endRange.rowIndex - startRange.rowIndex + 1;
|
2142
|
+
var targetColCount = endRange.colIndex - startRange.colIndex + 1;
|
2143
|
+
var clipboardRowCount = clipboardTableData.length;
|
2144
|
+
var clipboardColCount = clipboardTableData[0].length;
|
2145
|
+
var isSelectionLargerThanData = targetRowCount >= clipboardRowCount && targetColCount >= clipboardColCount;
|
2146
|
+
var alertMessage = i18n.get('Cannot change part of merged cell');
|
2147
|
+
var updated = true;
|
2148
|
+
var endCellIndex = void 0;
|
2149
|
+
|
2150
|
+
if (this._hasRowMergedHeader(clipboardTableData, tableData, startRange)) {
|
2151
|
+
alertMessage = i18n.get('Cannot paste row merged cells into the table header');
|
2152
|
+
updated = false;
|
2153
|
+
} else if (this._isExactlyFit(clipboardTableData, targetRowCount, targetColCount)) {
|
2154
|
+
endCellIndex = endRange;
|
2155
|
+
this._updateClipboardTableData(clipboardTableData, targetRowCount, targetColCount);
|
2156
|
+
this._updateTableDataByClipboardData(clipboardTableData, tableData, startRange);
|
2157
|
+
} else if (isSelectionLargerThanData) {
|
2158
|
+
endCellIndex = {
|
2159
|
+
rowIndex: startRange.rowIndex + clipboardRowCount - 1,
|
2160
|
+
colIndex: startRange.colIndex + clipboardColCount - 1
|
2161
|
+
};
|
2162
|
+
|
2163
|
+
if (this._isPossibleToPaste(tableData, startRange, endCellIndex)) {
|
2164
|
+
this._updateTableDataByClipboardData(clipboardTableData, tableData, startRange);
|
2165
|
+
} else {
|
2166
|
+
updated = false;
|
2167
|
+
}
|
2168
|
+
} else {
|
2169
|
+
// selected area is smaller then paste data
|
2170
|
+
endCellIndex = {
|
2171
|
+
rowIndex: startRange.rowIndex + targetRowCount - 1,
|
2172
|
+
colIndex: startRange.colIndex + targetColCount - 1
|
2173
|
+
};
|
2174
|
+
|
2175
|
+
updated = this._updateClipboardDataForPasteToSamllerSelectedArea(clipboardTableData, tableData, targetRowCount, targetColCount, startRange);
|
2176
|
+
}
|
2177
|
+
|
2178
|
+
if (updated) {
|
2179
|
+
tableData.className += ' ' + PASTE_TABLE_BOOKMARK;
|
2180
|
+
_tableRenderer2.default.replaceTable($table, tableData);
|
2181
|
+
this._bookmarkLastTd(endCellIndex);
|
2182
|
+
} else {
|
2183
|
+
alert(alertMessage);
|
2184
|
+
this.wwe.focus();
|
2185
|
+
}
|
2186
|
+
}
|
2187
|
+
|
2188
|
+
/**
|
2189
|
+
* Find end cell index.
|
2190
|
+
* @param {Array.<Array.<object>>} clipboardTableData - table data of clipboard
|
2191
|
+
* @param {number} startRowIndex - start row index
|
2192
|
+
* @param {number} startColIndex - start col index
|
2193
|
+
* @returns {{rowIndex: number, colIndex: number}}
|
2194
|
+
* @private
|
2195
|
+
*/
|
2196
|
+
|
2197
|
+
}, {
|
2198
|
+
key: '_findEndCellIndex',
|
2199
|
+
value: function _findEndCellIndex(clipboardTableData, _ref2) {
|
2200
|
+
var startRowIndex = _ref2.rowIndex,
|
2201
|
+
startColIndex = _ref2.colIndex;
|
2202
|
+
|
2203
|
+
return {
|
2204
|
+
rowIndex: startRowIndex + clipboardTableData.length - 1,
|
2205
|
+
colIndex: startColIndex + clipboardTableData[0].length - 1
|
2206
|
+
};
|
2207
|
+
}
|
2208
|
+
|
2209
|
+
/**
|
2210
|
+
* Expand row.
|
2211
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
2212
|
+
* @param {number} expandCount - expand count
|
2213
|
+
* @private
|
2214
|
+
*/
|
2215
|
+
|
2216
|
+
}, {
|
2217
|
+
key: '_expandRow',
|
2218
|
+
value: function _expandRow(tableData, expandCount) {
|
2219
|
+
var startRowIndex = tableData.length;
|
2220
|
+
var cellCount = tableData[0].length;
|
2221
|
+
var newRows = _tuiCodeSnippet2.default.range(startRowIndex, startRowIndex + expandCount).map(function (rowIndex) {
|
2222
|
+
return _tuiCodeSnippet2.default.range(0, cellCount).map(function (colIndex) {
|
2223
|
+
return _tableDataHandler2.default.createBasicCell(rowIndex, colIndex);
|
2224
|
+
});
|
2225
|
+
});
|
2226
|
+
|
2227
|
+
tableData.push.apply(tableData, newRows);
|
2228
|
+
}
|
2229
|
+
|
2230
|
+
/**
|
2231
|
+
* Expand column.
|
2232
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
2233
|
+
* @param {number} expandCount - expand count
|
2234
|
+
* @private
|
2235
|
+
*/
|
2236
|
+
|
2237
|
+
}, {
|
2238
|
+
key: '_expandCoumn',
|
2239
|
+
value: function _expandCoumn(tableData, expandCount) {
|
2240
|
+
var startCellIndex = tableData[0].length;
|
2241
|
+
var additionalCellRange = _tuiCodeSnippet2.default.range(startCellIndex, startCellIndex + expandCount);
|
2242
|
+
|
2243
|
+
tableData.forEach(function (rowData, rowIndex) {
|
2244
|
+
var nodeName = rowData[0].nodeName;
|
2245
|
+
|
2246
|
+
var newCells = additionalCellRange.map(function (colIndex) {
|
2247
|
+
return _tableDataHandler2.default.createBasicCell(rowIndex, colIndex, nodeName);
|
2248
|
+
});
|
2249
|
+
|
2250
|
+
rowData.push.apply(rowData, newCells);
|
2251
|
+
});
|
2252
|
+
}
|
2253
|
+
|
2254
|
+
/**
|
2255
|
+
* Expand table data, if need.
|
2256
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
2257
|
+
* @param {{rowIndex: number, colIndex: number}} startCellIndex - start cell index
|
2258
|
+
* @param {{rowIndex: number, colIndex: number}} endCellIndex - end cell index
|
2259
|
+
* @private
|
2260
|
+
*/
|
2261
|
+
|
2262
|
+
}, {
|
2263
|
+
key: '_expandTableDataIfNeed',
|
2264
|
+
value: function _expandTableDataIfNeed(tableData, startCellIndex, endCellIndex) {
|
2265
|
+
var expandRowCount = endCellIndex.rowIndex - tableData.length + 1;
|
2266
|
+
var expandCellCount = endCellIndex.colIndex - tableData[0].length + 1;
|
2267
|
+
|
2268
|
+
if (expandRowCount > 0) {
|
2269
|
+
this._expandRow(tableData, expandRowCount);
|
2270
|
+
}
|
2271
|
+
|
2272
|
+
if (expandCellCount > 0) {
|
2273
|
+
this._expandCoumn(tableData, expandCellCount);
|
2274
|
+
}
|
2275
|
+
}
|
2276
|
+
|
2277
|
+
/**
|
2278
|
+
* Paste all clipboard table data.
|
2279
|
+
* @param {jQuery} $table - jQuery table element
|
2280
|
+
* @param {Array.<Array.<object>>} clipboardTableData - table data of clipboard
|
2281
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
2282
|
+
* @param {{rowIndex: number, colIndex: number}} startCellIndex - start cell index
|
2283
|
+
* @private
|
2284
|
+
*/
|
2285
|
+
|
2286
|
+
}, {
|
2287
|
+
key: '_pasteAllClipboardTableData',
|
2288
|
+
value: function _pasteAllClipboardTableData($table, clipboardTableData, tableData, startCellIndex) {
|
2289
|
+
var endCellIndex = this._findEndCellIndex(clipboardTableData, startCellIndex);
|
2290
|
+
|
2291
|
+
if (this._hasRowMergedHeader(clipboardTableData, tableData, startCellIndex)) {
|
2292
|
+
alert(i18n.get('Cannot paste row merged cells into the table header'));
|
2293
|
+
this.wwe.focus();
|
2294
|
+
|
2295
|
+
return;
|
2296
|
+
}
|
2297
|
+
|
2298
|
+
this._expandTableDataIfNeed(tableData, startCellIndex, endCellIndex);
|
2299
|
+
|
2300
|
+
if (this._isPossibleToPaste(tableData, startCellIndex, endCellIndex)) {
|
2301
|
+
this._updateTableDataByClipboardData(clipboardTableData, tableData, startCellIndex);
|
2302
|
+
tableData.className += ' ' + PASTE_TABLE_BOOKMARK;
|
2303
|
+
_tableRenderer2.default.replaceTable($table, tableData);
|
2304
|
+
this._bookmarkLastTd(endCellIndex);
|
2305
|
+
} else {
|
2306
|
+
alert(i18n.get('Cannot change part of merged cell'));
|
2307
|
+
this.wwe.focus();
|
2308
|
+
}
|
2309
|
+
}
|
2310
|
+
|
2311
|
+
/**
|
2312
|
+
* Paste clibpard data.
|
2313
|
+
* @param {jQuery} $clipboardTable - jQuery table element of clipboard
|
2314
|
+
*/
|
2315
|
+
|
2316
|
+
}, {
|
2317
|
+
key: 'pasteClipboardData',
|
2318
|
+
value: function pasteClipboardData($clipboardTable) {
|
2319
|
+
var clipboardTableData = _tableDataHandler2.default.createTableData($clipboardTable);
|
2320
|
+
var tableSelectionManager = this.wwe.componentManager.getManager('tableSelection');
|
2321
|
+
var $selectedCells = tableSelectionManager.getSelectedCells();
|
2322
|
+
var $startCell = (0, _jquery2.default)(this._findStartCell($selectedCells));
|
2323
|
+
var $table = $startCell.closest('table');
|
2324
|
+
var tableData = _tableDataHandler2.default.createTableData($table);
|
2325
|
+
var startCellIndex = this._findStartCellIndex(tableData, $startCell);
|
2326
|
+
|
2327
|
+
if ($selectedCells.length > 1) {
|
2328
|
+
// selection
|
2329
|
+
this._pasteToSelectedArea($table, clipboardTableData, tableData, $selectedCells);
|
2330
|
+
} else {
|
2331
|
+
// cursor
|
2332
|
+
this._pasteAllClipboardTableData($table, clipboardTableData, tableData, startCellIndex);
|
2333
|
+
}
|
2334
|
+
}
|
2335
|
+
}]);
|
2336
|
+
|
2337
|
+
return WwMergedTableManager;
|
2338
|
+
}(WwTableManager);
|
2339
|
+
|
2340
|
+
/**
|
2341
|
+
* Whether one of them is true or not.
|
2342
|
+
* @param {Array} arr - target array
|
2343
|
+
* @param {function} contition - condition function
|
2344
|
+
* @returns {boolean}
|
2345
|
+
* @ignore
|
2346
|
+
*/
|
2347
|
+
|
2348
|
+
|
2349
|
+
function any(arr, contition) {
|
2350
|
+
var result = false;
|
2351
|
+
|
2352
|
+
_tuiCodeSnippet2.default.forEach(arr, function (item) {
|
2353
|
+
result = contition(item);
|
2354
|
+
|
2355
|
+
return !result;
|
2356
|
+
});
|
2357
|
+
|
2358
|
+
return result;
|
2359
|
+
}
|
2360
|
+
|
2361
|
+
exports.default = WwMergedTableManager;
|
2362
|
+
|
2363
|
+
/***/ }),
|
2364
|
+
/* 56 */
|
2365
|
+
/***/ (function(module, exports, __webpack_require__) {
|
2366
|
+
|
2367
|
+
"use strict";
|
2368
|
+
|
2369
|
+
|
2370
|
+
Object.defineProperty(exports, "__esModule", {
|
2371
|
+
value: true
|
2372
|
+
});
|
2373
|
+
|
2374
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
2375
|
+
|
2376
|
+
var _jquery = __webpack_require__(0);
|
2377
|
+
|
2378
|
+
var _jquery2 = _interopRequireDefault(_jquery);
|
2379
|
+
|
2380
|
+
var _tuiCodeSnippet = __webpack_require__(2);
|
2381
|
+
|
2382
|
+
var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet);
|
2383
|
+
|
2384
|
+
var _editorProxy = __webpack_require__(1);
|
2385
|
+
|
2386
|
+
var _editorProxy2 = _interopRequireDefault(_editorProxy);
|
2387
|
+
|
2388
|
+
var _tableDataHandler = __webpack_require__(3);
|
2389
|
+
|
2390
|
+
var _tableDataHandler2 = _interopRequireDefault(_tableDataHandler);
|
2391
|
+
|
2392
|
+
var _tableRangeHandler = __webpack_require__(7);
|
2393
|
+
|
2394
|
+
var _tableRangeHandler2 = _interopRequireDefault(_tableRangeHandler);
|
2395
|
+
|
2396
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2397
|
+
|
2398
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
2399
|
+
|
2400
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
2401
|
+
|
2402
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**
|
2403
|
+
* @fileoverview Implements wysiwyg merged table selection manager
|
2404
|
+
* @author NHN Ent. FE Development Lab <dl_javascript@nhnent.com>
|
2405
|
+
*/
|
2406
|
+
|
2407
|
+
|
2408
|
+
var WwTableSelectionManager = _editorProxy2.default.WwTableSelectionManager;
|
2409
|
+
|
2410
|
+
|
2411
|
+
var TABLE_CELL_SELECTED_CLASS_NAME = 'te-cell-selected';
|
2412
|
+
|
2413
|
+
/**
|
2414
|
+
* Class WwMergedTableSelectionManager
|
2415
|
+
*/
|
2416
|
+
|
2417
|
+
var WwMergedTableSelectionManager = function (_WwTableSelectionMana) {
|
2418
|
+
_inherits(WwMergedTableSelectionManager, _WwTableSelectionMana);
|
2419
|
+
|
2420
|
+
/**
|
2421
|
+
* Creates an instance of WwMergedTableSelectionManager.
|
2422
|
+
* @param {WysiwygEditor} wwe - WysiwygEditor instance
|
2423
|
+
* @memberof WwMergedTableSelectionManager
|
2424
|
+
*/
|
2425
|
+
function WwMergedTableSelectionManager(wwe) {
|
2426
|
+
_classCallCheck(this, WwMergedTableSelectionManager);
|
2427
|
+
|
2428
|
+
/**
|
2429
|
+
* table cache data
|
2430
|
+
* @type {Array.<Array.<Object>>}
|
2431
|
+
* @private
|
2432
|
+
*/
|
2433
|
+
var _this = _possibleConstructorReturn(this, (WwMergedTableSelectionManager.__proto__ || Object.getPrototypeOf(WwMergedTableSelectionManager)).call(this, wwe));
|
2434
|
+
|
2435
|
+
_this._tableData = null;
|
2436
|
+
|
2437
|
+
_this.mergedTableSelectionManager = true;
|
2438
|
+
return _this;
|
2439
|
+
}
|
2440
|
+
|
2441
|
+
/**
|
2442
|
+
* Add css class for selected cells.
|
2443
|
+
* @param {jQuery} $table - table jQuery element
|
2444
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
2445
|
+
* @param {{
|
2446
|
+
* start: {rowIndex: number, colIndex: number},
|
2447
|
+
* end: {rowIndex: number, colIndex: number}
|
2448
|
+
* }} tableRange - table selected range
|
2449
|
+
* @private
|
2450
|
+
*/
|
2451
|
+
|
2452
|
+
|
2453
|
+
_createClass(WwMergedTableSelectionManager, [{
|
2454
|
+
key: '_addClassToSelectedCells',
|
2455
|
+
value: function _addClassToSelectedCells($table, tableData, tableRange) {
|
2456
|
+
var startRange = tableRange.start;
|
2457
|
+
var endRange = tableRange.end;
|
2458
|
+
var cellIndexRange = _tuiCodeSnippet2.default.range(startRange.colIndex, endRange.colIndex + 1);
|
2459
|
+
var $trs = $table.find('tr');
|
2460
|
+
|
2461
|
+
_tuiCodeSnippet2.default.range(startRange.rowIndex, endRange.rowIndex + 1).forEach(function (rowIndex) {
|
2462
|
+
var rowData = tableData[rowIndex];
|
2463
|
+
var $cells = $trs.eq(rowIndex).find('td, th');
|
2464
|
+
|
2465
|
+
return cellIndexRange.forEach(function (colIndex) {
|
2466
|
+
var cellData = rowData[colIndex];
|
2467
|
+
|
2468
|
+
if (cellData.elementIndex) {
|
2469
|
+
$cells.eq(rowData[colIndex].elementIndex.colIndex).addClass(TABLE_CELL_SELECTED_CLASS_NAME);
|
2470
|
+
}
|
2471
|
+
});
|
2472
|
+
});
|
2473
|
+
}
|
2474
|
+
|
2475
|
+
/**
|
2476
|
+
* cache table data on drag start
|
2477
|
+
* @param {HTMLElement} selectionStart - start element
|
2478
|
+
*/
|
2479
|
+
|
2480
|
+
}, {
|
2481
|
+
key: 'onDragStart',
|
2482
|
+
value: function onDragStart(selectionStart) {
|
2483
|
+
var $table = (0, _jquery2.default)(selectionStart).closest('[contenteditable=true] table');
|
2484
|
+
this._tableData = _tableDataHandler2.default.createTableData($table);
|
2485
|
+
}
|
2486
|
+
|
2487
|
+
/**
|
2488
|
+
* clear table data in cache on drag end
|
2489
|
+
*/
|
2490
|
+
|
2491
|
+
}, {
|
2492
|
+
key: 'onDragEnd',
|
2493
|
+
value: function onDragEnd() {
|
2494
|
+
this._tableData = null;
|
2495
|
+
}
|
2496
|
+
|
2497
|
+
/**
|
2498
|
+
* Highlight selected table cells
|
2499
|
+
* @param {HTMLElement} selectionStart start element
|
2500
|
+
* @param {HTMLElement} selectionEnd end element
|
2501
|
+
* @override
|
2502
|
+
*/
|
2503
|
+
|
2504
|
+
}, {
|
2505
|
+
key: 'highlightTableCellsBy',
|
2506
|
+
value: function highlightTableCellsBy(selectionStart, selectionEnd) {
|
2507
|
+
var $start = (0, _jquery2.default)(selectionStart);
|
2508
|
+
var $end = (0, _jquery2.default)(selectionEnd);
|
2509
|
+
var $table = $start.closest('[contenteditable=true] table');
|
2510
|
+
var tableRange = _tableRangeHandler2.default.findSelectionRange(this._tableData, $start, $end);
|
2511
|
+
|
2512
|
+
this.removeClassAttrbuteFromAllCellsIfNeed();
|
2513
|
+
this._addClassToSelectedCells($table, this._tableData, tableRange);
|
2514
|
+
}
|
2515
|
+
|
2516
|
+
/**
|
2517
|
+
* Style to selected cells.
|
2518
|
+
* @param {function} onStyle - function for styling
|
2519
|
+
*/
|
2520
|
+
|
2521
|
+
}, {
|
2522
|
+
key: 'styleToSelectedCells',
|
2523
|
+
value: function styleToSelectedCells(onStyle) {
|
2524
|
+
var sq = this.wwe.getEditor();
|
2525
|
+
var range = sq.getSelection().cloneRange();
|
2526
|
+
var $table = (0, _jquery2.default)(range.startContainer).closest('[contenteditable=true] table');
|
2527
|
+
|
2528
|
+
$table.find('tr').get().forEach(function (tr) {
|
2529
|
+
var $cells = (0, _jquery2.default)(tr).find('.' + TABLE_CELL_SELECTED_CLASS_NAME);
|
2530
|
+
var firstSelectedCell = $cells.first().get(0);
|
2531
|
+
var lastSelectedCell = $cells.last().get(0);
|
2532
|
+
|
2533
|
+
if (!$cells.length) {
|
2534
|
+
return;
|
2535
|
+
}
|
2536
|
+
|
2537
|
+
range.setStart(firstSelectedCell, 0);
|
2538
|
+
range.setEnd(lastSelectedCell, lastSelectedCell.childNodes.length);
|
2539
|
+
sq.setSelection(range);
|
2540
|
+
onStyle(sq);
|
2541
|
+
});
|
2542
|
+
}
|
2543
|
+
|
2544
|
+
/**
|
2545
|
+
* Whether has selected both TH and TD.
|
2546
|
+
* @param {jQuery} $selectedCells - selected cells jQuery element
|
2547
|
+
* @returns {boolean}
|
2548
|
+
*/
|
2549
|
+
|
2550
|
+
}, {
|
2551
|
+
key: 'hasSelectedBothThAndTd',
|
2552
|
+
value: function hasSelectedBothThAndTd($selectedCells) {
|
2553
|
+
$selectedCells = $selectedCells || this.getSelectedCells();
|
2554
|
+
|
2555
|
+
return $selectedCells.first()[0].nodeName !== $selectedCells.last()[0].nodeName;
|
2556
|
+
}
|
2557
|
+
}]);
|
2558
|
+
|
2559
|
+
return WwMergedTableSelectionManager;
|
2560
|
+
}(WwTableSelectionManager);
|
2561
|
+
|
2562
|
+
exports.default = WwMergedTableSelectionManager;
|
2563
|
+
|
2564
|
+
/***/ }),
|
2565
|
+
/* 57 */
|
2566
|
+
/***/ (function(module, exports, __webpack_require__) {
|
2567
|
+
|
2568
|
+
"use strict";
|
2569
|
+
|
2570
|
+
|
2571
|
+
Object.defineProperty(exports, "__esModule", {
|
2572
|
+
value: true
|
2573
|
+
});
|
2574
|
+
exports._createNewRow = _createNewRow;
|
2575
|
+
exports._addRow = _addRow;
|
2576
|
+
|
2577
|
+
var _jquery = __webpack_require__(0);
|
2578
|
+
|
2579
|
+
var _jquery2 = _interopRequireDefault(_jquery);
|
2580
|
+
|
2581
|
+
var _tuiCodeSnippet = __webpack_require__(2);
|
2582
|
+
|
2583
|
+
var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet);
|
2584
|
+
|
2585
|
+
var _editorProxy = __webpack_require__(1);
|
2586
|
+
|
2587
|
+
var _editorProxy2 = _interopRequireDefault(_editorProxy);
|
2588
|
+
|
2589
|
+
var _tableDataHandler = __webpack_require__(3);
|
2590
|
+
|
2591
|
+
var _tableDataHandler2 = _interopRequireDefault(_tableDataHandler);
|
2592
|
+
|
2593
|
+
var _tableRangeHandler = __webpack_require__(7);
|
2594
|
+
|
2595
|
+
var _tableRangeHandler2 = _interopRequireDefault(_tableRangeHandler);
|
2596
|
+
|
2597
|
+
var _tableRenderer = __webpack_require__(6);
|
2598
|
+
|
2599
|
+
var _tableRenderer2 = _interopRequireDefault(_tableRenderer);
|
2600
|
+
|
2601
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2602
|
+
|
2603
|
+
/**
|
2604
|
+
* @fileoverview Implements mergedTableAddRow. Add Row to selected table
|
2605
|
+
* @author NHN Ent. FE Development Lab <dl_javascript@nhnent.com>
|
2606
|
+
*/
|
2607
|
+
var CommandManager = _editorProxy2.default.CommandManager;
|
2608
|
+
|
2609
|
+
|
2610
|
+
var AddRow = void 0;
|
2611
|
+
if (CommandManager) {
|
2612
|
+
AddRow = CommandManager.command('wysiwyg', /** @lends AddRow */{
|
2613
|
+
name: 'AddRow',
|
2614
|
+
/**
|
2615
|
+
* Command handler.
|
2616
|
+
* @param {WysiwygEditor} wwe - wysiwygEditor instance
|
2617
|
+
*/
|
2618
|
+
exec: function exec(wwe) {
|
2619
|
+
var sq = wwe.getEditor();
|
2620
|
+
var range = sq.getSelection().cloneRange();
|
2621
|
+
|
2622
|
+
wwe.focus();
|
2623
|
+
|
2624
|
+
if (!sq.hasFormat('TABLE')) {
|
2625
|
+
return;
|
2626
|
+
}
|
2627
|
+
|
2628
|
+
var $startContainer = (0, _jquery2.default)(range.startContainer);
|
2629
|
+
var $table = $startContainer.closest('table');
|
2630
|
+
var tableData = _tableDataHandler2.default.createTableData($table);
|
2631
|
+
var $selectedCells = wwe.componentManager.getManager('tableSelection').getSelectedCells();
|
2632
|
+
var tableRange = _tableRangeHandler2.default.getTableSelectionRange(tableData, $selectedCells, $startContainer);
|
2633
|
+
|
2634
|
+
sq.saveUndoState(range);
|
2635
|
+
_addRow(tableData, tableRange);
|
2636
|
+
|
2637
|
+
var $newTable = _tableRenderer2.default.replaceTable($table, tableData);
|
2638
|
+
var focusTd = _findFocusTd($newTable, tableRange.end.rowIndex, tableRange.start.colIndex);
|
2639
|
+
|
2640
|
+
_tableRenderer2.default.focusToCell(sq, range, focusTd);
|
2641
|
+
}
|
2642
|
+
});
|
2643
|
+
}
|
2644
|
+
|
2645
|
+
/**
|
2646
|
+
* Create row merged cell data.
|
2647
|
+
* @param {number} rowMergeWith - row merge with index
|
2648
|
+
* @returns {{
|
2649
|
+
* nodeName: string,
|
2650
|
+
* rowMergeWith: number
|
2651
|
+
* }}
|
2652
|
+
* @private
|
2653
|
+
*/
|
2654
|
+
function _createRowMergedCell(rowMergeWith) {
|
2655
|
+
return {
|
2656
|
+
nodeName: 'TD',
|
2657
|
+
rowMergeWith: rowMergeWith
|
2658
|
+
};
|
2659
|
+
}
|
2660
|
+
|
2661
|
+
/**
|
2662
|
+
* Create new row.
|
2663
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
2664
|
+
* @param {number} rowIndex - row index of table data
|
2665
|
+
* @returns {object}
|
2666
|
+
* @private
|
2667
|
+
*/
|
2668
|
+
function _createNewRow(tableData, rowIndex) {
|
2669
|
+
var prevCell = null;
|
2670
|
+
|
2671
|
+
return tableData[rowIndex].map(function (cellData, colIndex) {
|
2672
|
+
var newCell = void 0;
|
2673
|
+
|
2674
|
+
if (_tuiCodeSnippet2.default.isExisty(cellData.rowMergeWith)) {
|
2675
|
+
var rowMergeWith = cellData.rowMergeWith;
|
2676
|
+
|
2677
|
+
var merger = tableData[rowMergeWith][colIndex];
|
2678
|
+
var lastMergedRowIndex = rowMergeWith + merger.rowspan - 1;
|
2679
|
+
|
2680
|
+
if (_tuiCodeSnippet2.default.isExisty(merger.colMergeWith) && prevCell) {
|
2681
|
+
newCell = _tuiCodeSnippet2.default.extend({}, prevCell);
|
2682
|
+
} else if (lastMergedRowIndex > rowIndex) {
|
2683
|
+
merger.rowspan += 1;
|
2684
|
+
newCell = _tuiCodeSnippet2.default.extend({}, cellData);
|
2685
|
+
}
|
2686
|
+
} else if (cellData.rowspan > 1) {
|
2687
|
+
cellData.rowspan += 1;
|
2688
|
+
newCell = _createRowMergedCell(rowIndex);
|
2689
|
+
}
|
2690
|
+
|
2691
|
+
if (!newCell) {
|
2692
|
+
newCell = _tableDataHandler2.default.createBasicCell(rowIndex + 1, colIndex);
|
2693
|
+
}
|
2694
|
+
|
2695
|
+
prevCell = newCell;
|
2696
|
+
|
2697
|
+
return newCell;
|
2698
|
+
});
|
2699
|
+
}
|
2700
|
+
|
2701
|
+
/**
|
2702
|
+
* Add row.
|
2703
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
2704
|
+
* @param {{
|
2705
|
+
* start: {rowIndex: number, colIndex: number},
|
2706
|
+
* end: {rowIndex: number, colIndex: number}
|
2707
|
+
* }} tableRange - table selection range
|
2708
|
+
* @param {number} rowIndex - row index of table data
|
2709
|
+
* @param {number} colIndex - column index of tabld data
|
2710
|
+
* @private
|
2711
|
+
*/
|
2712
|
+
function _addRow(tableData, tableRange) {
|
2713
|
+
var startRowIndex = tableRange.start.rowIndex;
|
2714
|
+
var endRange = tableRange.end;
|
2715
|
+
var endRowIndex = _tableDataHandler2.default.findRowMergedLastIndex(tableData, endRange.rowIndex, endRange.colIndex);
|
2716
|
+
var newRows = _tuiCodeSnippet2.default.range(startRowIndex, endRowIndex + 1).map(function () {
|
2717
|
+
return _createNewRow(tableData, endRowIndex);
|
2718
|
+
});
|
2719
|
+
|
2720
|
+
tableData.splice.apply(tableData, [endRowIndex + 1, 0].concat(newRows));
|
2721
|
+
}
|
2722
|
+
|
2723
|
+
/**
|
2724
|
+
* Find focus td element.
|
2725
|
+
* @param {jQuery} $newTable - changed table jQuery element
|
2726
|
+
* @param {number} rowIndex - row index of table data
|
2727
|
+
* @param {number} colIndex - column index of tabld data
|
2728
|
+
* @returns {HTMLElement}
|
2729
|
+
* @private
|
2730
|
+
*/
|
2731
|
+
function _findFocusTd($newTable, rowIndex, colIndex) {
|
2732
|
+
var tableData = _tableDataHandler2.default.createTableData($newTable);
|
2733
|
+
var newRowIndex = _tableDataHandler2.default.findRowMergedLastIndex(tableData, rowIndex, colIndex) + 1;
|
2734
|
+
var cellElementIndex = _tableDataHandler2.default.findElementIndex(tableData, newRowIndex, colIndex);
|
2735
|
+
|
2736
|
+
return $newTable.find('tr').eq(cellElementIndex.rowIndex).find('td')[cellElementIndex.colIndex];
|
2737
|
+
}
|
2738
|
+
|
2739
|
+
exports.default = AddRow;
|
2740
|
+
|
2741
|
+
/***/ }),
|
2742
|
+
/* 58 */
|
2743
|
+
/***/ (function(module, exports, __webpack_require__) {
|
2744
|
+
|
2745
|
+
"use strict";
|
2746
|
+
|
2747
|
+
|
2748
|
+
Object.defineProperty(exports, "__esModule", {
|
2749
|
+
value: true
|
2750
|
+
});
|
2751
|
+
exports._createNewColumns = _createNewColumns;
|
2752
|
+
exports._addColumns = _addColumns;
|
2753
|
+
|
2754
|
+
var _jquery = __webpack_require__(0);
|
2755
|
+
|
2756
|
+
var _jquery2 = _interopRequireDefault(_jquery);
|
2757
|
+
|
2758
|
+
var _tuiCodeSnippet = __webpack_require__(2);
|
2759
|
+
|
2760
|
+
var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet);
|
2761
|
+
|
2762
|
+
var _editorProxy = __webpack_require__(1);
|
2763
|
+
|
2764
|
+
var _editorProxy2 = _interopRequireDefault(_editorProxy);
|
2765
|
+
|
2766
|
+
var _tableDataHandler = __webpack_require__(3);
|
2767
|
+
|
2768
|
+
var _tableDataHandler2 = _interopRequireDefault(_tableDataHandler);
|
2769
|
+
|
2770
|
+
var _tableRangeHandler = __webpack_require__(7);
|
2771
|
+
|
2772
|
+
var _tableRangeHandler2 = _interopRequireDefault(_tableRangeHandler);
|
2773
|
+
|
2774
|
+
var _tableRenderer = __webpack_require__(6);
|
2775
|
+
|
2776
|
+
var _tableRenderer2 = _interopRequireDefault(_tableRenderer);
|
2777
|
+
|
2778
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2779
|
+
|
2780
|
+
/**
|
2781
|
+
* @fileoverview Implements mergedTableAddCol. Add Row to selected table.
|
2782
|
+
* @author NHN Ent. FE Development Lab <dl_javascript@nhnent.com>
|
2783
|
+
*/
|
2784
|
+
var CommandManager = _editorProxy2.default.CommandManager;
|
2785
|
+
|
2786
|
+
|
2787
|
+
var AddCol = void 0;
|
2788
|
+
if (CommandManager) {
|
2789
|
+
AddCol = CommandManager.command('wysiwyg', /** @lends AddCol */{
|
2790
|
+
name: 'AddCol',
|
2791
|
+
/**
|
2792
|
+
* Command handler.
|
2793
|
+
* @param {WysiwygEditor} wwe - wysiwygEditor instance
|
2794
|
+
*/
|
2795
|
+
exec: function exec(wwe) {
|
2796
|
+
var sq = wwe.getEditor();
|
2797
|
+
var range = sq.getSelection().cloneRange();
|
2798
|
+
|
2799
|
+
wwe.focus();
|
2800
|
+
|
2801
|
+
if (!sq.hasFormat('TABLE')) {
|
2802
|
+
return;
|
2803
|
+
}
|
2804
|
+
|
2805
|
+
var $startContainer = (0, _jquery2.default)(range.startContainer);
|
2806
|
+
var $table = $startContainer.closest('table');
|
2807
|
+
var tableData = _tableDataHandler2.default.createTableData($table);
|
2808
|
+
var $selectedCells = wwe.componentManager.getManager('tableSelection').getSelectedCells();
|
2809
|
+
var tableRange = _tableRangeHandler2.default.getTableSelectionRange(tableData, $selectedCells, $startContainer);
|
2810
|
+
|
2811
|
+
sq.saveUndoState(range);
|
2812
|
+
_addColumns(tableData, tableRange);
|
2813
|
+
|
2814
|
+
var $newTable = _tableRenderer2.default.replaceTable($table, tableData);
|
2815
|
+
var focusCell = _findFocusCell($newTable, tableRange.start.rowIndex, tableRange.end.colIndex);
|
2816
|
+
|
2817
|
+
_tableRenderer2.default.focusToCell(sq, range, focusCell);
|
2818
|
+
}
|
2819
|
+
});
|
2820
|
+
}
|
2821
|
+
|
2822
|
+
/**
|
2823
|
+
* Create column merged cell.
|
2824
|
+
* @param {number} colMergeWith - column merge start index
|
2825
|
+
* @param {string} nodeName - node name
|
2826
|
+
* @returns {{
|
2827
|
+
* nodeName: string,
|
2828
|
+
* colMerged: boolean,
|
2829
|
+
* colMergeWith: number
|
2830
|
+
* }}
|
2831
|
+
* @private
|
2832
|
+
*/
|
2833
|
+
function _createColMergedCell(colMergeWith, nodeName) {
|
2834
|
+
return {
|
2835
|
+
nodeName: nodeName,
|
2836
|
+
colMergeWith: colMergeWith
|
2837
|
+
};
|
2838
|
+
}
|
2839
|
+
|
2840
|
+
/**
|
2841
|
+
* Create new cell data.
|
2842
|
+
* @param {Array.<object>} rowData - row data of table data
|
2843
|
+
* @param {number} rowIndex - row index of table data
|
2844
|
+
* @param {number} colIndex - column index of table data
|
2845
|
+
* @param {object | null} prevCell - previous cell data
|
2846
|
+
* @returns {object}
|
2847
|
+
* @private
|
2848
|
+
*/
|
2849
|
+
function _createNewCell(rowData, rowIndex, colIndex, prevCell) {
|
2850
|
+
var cellData = rowData[colIndex];
|
2851
|
+
var newCell = void 0;
|
2852
|
+
|
2853
|
+
if (_tuiCodeSnippet2.default.isExisty(cellData.colMergeWith)) {
|
2854
|
+
var colMergeWith = cellData.colMergeWith;
|
2855
|
+
|
2856
|
+
var merger = rowData[colMergeWith];
|
2857
|
+
var lastMergedCellIndex = colMergeWith + merger.colspan - 1;
|
2858
|
+
|
2859
|
+
if (_tuiCodeSnippet2.default.isExisty(merger.rowMergeWith) && prevCell) {
|
2860
|
+
newCell = _tuiCodeSnippet2.default.extend({}, prevCell);
|
2861
|
+
} else if (lastMergedCellIndex > colIndex) {
|
2862
|
+
merger.colspan += 1;
|
2863
|
+
newCell = _tuiCodeSnippet2.default.extend({}, cellData);
|
2864
|
+
}
|
2865
|
+
} else if (cellData.colspan > 1) {
|
2866
|
+
cellData.colspan += 1;
|
2867
|
+
newCell = _createColMergedCell(colIndex, cellData.nodeName);
|
2868
|
+
}
|
2869
|
+
|
2870
|
+
if (!newCell) {
|
2871
|
+
newCell = _tableDataHandler2.default.createBasicCell(rowIndex, colIndex + 1, cellData.nodeName);
|
2872
|
+
}
|
2873
|
+
|
2874
|
+
return newCell;
|
2875
|
+
}
|
2876
|
+
|
2877
|
+
/**
|
2878
|
+
* Create new columns.
|
2879
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
2880
|
+
* @param {number} startColIndex - start column index
|
2881
|
+
* @param {number} endColIndex - end column index
|
2882
|
+
* @returns {Array.<Array.<object>>}
|
2883
|
+
* @private
|
2884
|
+
*/
|
2885
|
+
function _createNewColumns(tableData, startColIndex, endColIndex) {
|
2886
|
+
var colIndexes = _tuiCodeSnippet2.default.range(startColIndex, endColIndex + 1);
|
2887
|
+
var newColumns = [];
|
2888
|
+
var prevCells = null;
|
2889
|
+
|
2890
|
+
tableData.forEach(function (rowData, rowIndex) {
|
2891
|
+
var newCells = colIndexes.map(function (colIndex, index) {
|
2892
|
+
var prevCell = prevCells ? prevCells[index - 1] : null;
|
2893
|
+
|
2894
|
+
return _createNewCell(rowData, rowIndex, endColIndex, prevCell);
|
2895
|
+
});
|
2896
|
+
|
2897
|
+
prevCells = newCells;
|
2898
|
+
newColumns.push(newCells);
|
2899
|
+
});
|
2900
|
+
|
2901
|
+
return newColumns;
|
2902
|
+
}
|
2903
|
+
|
2904
|
+
/**
|
2905
|
+
* Add columns.
|
2906
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
2907
|
+
* @param {{
|
2908
|
+
* start: {rowIndex: number, colIndex: number},
|
2909
|
+
* end: {rowIndex: number, colIndex: number}
|
2910
|
+
* }} tableRange - table selection range
|
2911
|
+
* @private
|
2912
|
+
*/
|
2913
|
+
function _addColumns(tableData, tableRange) {
|
2914
|
+
var endRange = tableRange.end;
|
2915
|
+
var endColIndex = _tableDataHandler2.default.findColMergedLastIndex(tableData, endRange.rowIndex, endRange.colIndex);
|
2916
|
+
var newColumns = _createNewColumns(tableData, tableRange.start.colIndex, endColIndex);
|
2917
|
+
var newColIndex = endColIndex + 1;
|
2918
|
+
|
2919
|
+
tableData.forEach(function (rowData, rowIndex) {
|
2920
|
+
rowData.splice.apply(rowData, [newColIndex, 0].concat(newColumns[rowIndex]));
|
2921
|
+
});
|
2922
|
+
}
|
2923
|
+
|
2924
|
+
/**
|
2925
|
+
* Find focus cell element like td or th.
|
2926
|
+
* @param {jQuery} $newTable - changed table jQuery element
|
2927
|
+
* @param {number} rowIndex - row index of table data
|
2928
|
+
* @param {number} colIndex - column index of tabld data
|
2929
|
+
* @returns {HTMLElement}
|
2930
|
+
* @private
|
2931
|
+
*/
|
2932
|
+
function _findFocusCell($newTable, rowIndex, colIndex) {
|
2933
|
+
var tableData = _tableDataHandler2.default.createTableData($newTable);
|
2934
|
+
var newColIndex = _tableDataHandler2.default.findColMergedLastIndex(tableData, rowIndex, colIndex) + 1;
|
2935
|
+
var cellElementIndex = _tableDataHandler2.default.findElementIndex(tableData, rowIndex, newColIndex);
|
2936
|
+
|
2937
|
+
return $newTable.find('tr').eq(cellElementIndex.rowIndex).find('td, th')[cellElementIndex.colIndex];
|
2938
|
+
}
|
2939
|
+
|
2940
|
+
exports.default = AddCol;
|
2941
|
+
|
2942
|
+
/***/ }),
|
2943
|
+
/* 59 */
|
2944
|
+
/***/ (function(module, exports, __webpack_require__) {
|
2945
|
+
|
2946
|
+
"use strict";
|
2947
|
+
|
2948
|
+
|
2949
|
+
Object.defineProperty(exports, "__esModule", {
|
2950
|
+
value: true
|
2951
|
+
});
|
2952
|
+
exports._removeRow = _removeRow;
|
2953
|
+
|
2954
|
+
var _jquery = __webpack_require__(0);
|
2955
|
+
|
2956
|
+
var _jquery2 = _interopRequireDefault(_jquery);
|
2957
|
+
|
2958
|
+
var _tuiCodeSnippet = __webpack_require__(2);
|
2959
|
+
|
2960
|
+
var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet);
|
2961
|
+
|
2962
|
+
var _editorProxy = __webpack_require__(1);
|
2963
|
+
|
2964
|
+
var _editorProxy2 = _interopRequireDefault(_editorProxy);
|
2965
|
+
|
2966
|
+
var _tableDataHandler = __webpack_require__(3);
|
2967
|
+
|
2968
|
+
var _tableDataHandler2 = _interopRequireDefault(_tableDataHandler);
|
2969
|
+
|
2970
|
+
var _tableRangeHandler = __webpack_require__(7);
|
2971
|
+
|
2972
|
+
var _tableRangeHandler2 = _interopRequireDefault(_tableRangeHandler);
|
2973
|
+
|
2974
|
+
var _tableRenderer = __webpack_require__(6);
|
2975
|
+
|
2976
|
+
var _tableRenderer2 = _interopRequireDefault(_tableRenderer);
|
2977
|
+
|
2978
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2979
|
+
|
2980
|
+
/**
|
2981
|
+
* @fileoverview Implements mergedTableRemoveRow
|
2982
|
+
* @author NHN Ent. FE Development Lab <dl_javascript@nhnent.com>
|
2983
|
+
*/
|
2984
|
+
var CommandManager = _editorProxy2.default.CommandManager;
|
2985
|
+
|
2986
|
+
|
2987
|
+
var RemoveRow = void 0;
|
2988
|
+
if (CommandManager) {
|
2989
|
+
RemoveRow = CommandManager.command('wysiwyg', /** @lends RemoveRow */{
|
2990
|
+
name: 'RemoveRow',
|
2991
|
+
/**
|
2992
|
+
* Command handler.
|
2993
|
+
* @param {WysiwygEditor} wwe - wysiwygEditor instance
|
2994
|
+
*/
|
2995
|
+
exec: function exec(wwe) {
|
2996
|
+
var sq = wwe.getEditor();
|
2997
|
+
var range = sq.getSelection().cloneRange();
|
2998
|
+
|
2999
|
+
wwe.focus();
|
3000
|
+
|
3001
|
+
if (!sq.hasFormat('TABLE')) {
|
3002
|
+
return;
|
3003
|
+
}
|
3004
|
+
|
3005
|
+
var $startContainer = (0, _jquery2.default)(range.startContainer);
|
3006
|
+
var $table = $startContainer.closest('table');
|
3007
|
+
var tableData = _tableDataHandler2.default.createTableData($table);
|
3008
|
+
var beforeRowLength = tableData.length;
|
3009
|
+
var $selectedCells = wwe.componentManager.getManager('tableSelection').getSelectedCells();
|
3010
|
+
var tableRange = _tableRangeHandler2.default.getTableSelectionRange(tableData, $selectedCells, $startContainer);
|
3011
|
+
|
3012
|
+
sq.saveUndoState(range);
|
3013
|
+
_removeRow(tableData, tableRange);
|
3014
|
+
|
3015
|
+
if (tableData.length < 2) {
|
3016
|
+
$table.remove();
|
3017
|
+
} else if (beforeRowLength !== tableData.length) {
|
3018
|
+
var $newTable = _tableRenderer2.default.replaceTable($table, tableData);
|
3019
|
+
|
3020
|
+
var startRowIndex = tableRange.start.rowIndex;
|
3021
|
+
var focusRowIndex = startRowIndex < tableData.length ? startRowIndex : startRowIndex - 1;
|
3022
|
+
var focusCell = _findFocusTd($newTable, focusRowIndex, tableRange.start.colIndex);
|
3023
|
+
_tableRenderer2.default.focusToCell(sq, range, focusCell);
|
3024
|
+
}
|
3025
|
+
}
|
3026
|
+
});
|
3027
|
+
}
|
3028
|
+
|
3029
|
+
/**
|
3030
|
+
* Update rowspan to row merger.
|
3031
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
3032
|
+
* @param {number} startRowIndex - start row index
|
3033
|
+
* @param {number} endRowIndex - end row index
|
3034
|
+
* @private
|
3035
|
+
*/
|
3036
|
+
function _updateRowspan(tableData, startRowIndex, endRowIndex) {
|
3037
|
+
_tuiCodeSnippet2.default.range(startRowIndex, endRowIndex + 1).forEach(function (rowIndex) {
|
3038
|
+
tableData[rowIndex].forEach(function (cell, cellIndex) {
|
3039
|
+
if (_tuiCodeSnippet2.default.isExisty(cell.rowMergeWith)) {
|
3040
|
+
var merger = tableData[cell.rowMergeWith][cellIndex];
|
3041
|
+
|
3042
|
+
if (merger.rowspan) {
|
3043
|
+
merger.rowspan -= 1;
|
3044
|
+
}
|
3045
|
+
} else if (cell.rowspan > 1) {
|
3046
|
+
var lastMergedRowIndex = rowIndex + cell.rowspan - 1;
|
3047
|
+
|
3048
|
+
cell.rowspan -= endRowIndex - rowIndex + 1;
|
3049
|
+
|
3050
|
+
if (lastMergedRowIndex > endRowIndex) {
|
3051
|
+
tableData[endRowIndex + 1][cellIndex] = _tuiCodeSnippet2.default.extend({}, cell);
|
3052
|
+
}
|
3053
|
+
}
|
3054
|
+
});
|
3055
|
+
});
|
3056
|
+
}
|
3057
|
+
|
3058
|
+
/**
|
3059
|
+
* Update row merge start index to merged cell.
|
3060
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
3061
|
+
* @param {number} startRowIndex - start row index
|
3062
|
+
* @param {number} endRowIndex - end row index
|
3063
|
+
* @private
|
3064
|
+
*/
|
3065
|
+
function _updateMergeStartIndex(tableData, startRowIndex, endRowIndex) {
|
3066
|
+
tableData.slice(endRowIndex + 1).forEach(function (row) {
|
3067
|
+
row.forEach(function (cell) {
|
3068
|
+
if (_tuiCodeSnippet2.default.isExisty(cell.rowMergeWith) && cell.rowMergeWith >= startRowIndex) {
|
3069
|
+
cell.rowMergeWith = endRowIndex + 1;
|
3070
|
+
}
|
3071
|
+
});
|
3072
|
+
});
|
3073
|
+
}
|
3074
|
+
|
3075
|
+
/**
|
3076
|
+
* Remove row.
|
3077
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
3078
|
+
* @param {{
|
3079
|
+
* start: {rowIndex: number, colIndex: number},
|
3080
|
+
* end: {rowIndex: number, colIndex: number}
|
3081
|
+
* }} tableRange - table selection range
|
3082
|
+
* @private
|
3083
|
+
*/
|
3084
|
+
function _removeRow(tableData, tableRange) {
|
3085
|
+
var startRowIndex = tableRange.start.rowIndex;
|
3086
|
+
var endRange = tableRange.end;
|
3087
|
+
var endRowIndex = _tableDataHandler2.default.findRowMergedLastIndex(tableData, endRange.rowIndex, endRange.colIndex);
|
3088
|
+
if (startRowIndex === 0 && endRowIndex === 0) {
|
3089
|
+
return;
|
3090
|
+
}
|
3091
|
+
|
3092
|
+
startRowIndex = Math.max(startRowIndex, 1);
|
3093
|
+
endRowIndex = Math.max(endRowIndex, 1);
|
3094
|
+
var removeCount = endRowIndex - startRowIndex + 1;
|
3095
|
+
|
3096
|
+
// if only table body or table header left, remove table
|
3097
|
+
if (tableData.length - removeCount < 2) {
|
3098
|
+
tableData.splice(0, tableData.length);
|
3099
|
+
} else {
|
3100
|
+
_updateRowspan(tableData, startRowIndex, endRowIndex);
|
3101
|
+
_updateMergeStartIndex(tableData, startRowIndex, endRowIndex);
|
3102
|
+
|
3103
|
+
tableData.splice(startRowIndex, removeCount);
|
3104
|
+
}
|
3105
|
+
}
|
3106
|
+
|
3107
|
+
/**
|
3108
|
+
* Find focus td element.
|
3109
|
+
* @param {jQuery} $newTable - changed table jQuery element
|
3110
|
+
* @param {number} rowIndex - row index of table data
|
3111
|
+
* @param {number} colIndex - column index of tabld data
|
3112
|
+
* @returns {HTMLElement}
|
3113
|
+
* @private
|
3114
|
+
*/
|
3115
|
+
function _findFocusTd($newTable, rowIndex, colIndex) {
|
3116
|
+
var tableData = _tableDataHandler2.default.createTableData($newTable);
|
3117
|
+
|
3118
|
+
if (tableData.length - 1 < rowIndex) {
|
3119
|
+
rowIndex -= 1;
|
3120
|
+
}
|
3121
|
+
|
3122
|
+
var cellElementIndex = _tableDataHandler2.default.findElementIndex(tableData, rowIndex, colIndex);
|
3123
|
+
|
3124
|
+
return $newTable.find('tr').eq(cellElementIndex.rowIndex).find('th,td')[cellElementIndex.colIndex];
|
3125
|
+
}
|
3126
|
+
|
3127
|
+
exports.default = RemoveRow;
|
3128
|
+
|
3129
|
+
/***/ }),
|
3130
|
+
/* 60 */
|
3131
|
+
/***/ (function(module, exports, __webpack_require__) {
|
3132
|
+
|
3133
|
+
"use strict";
|
3134
|
+
|
3135
|
+
|
3136
|
+
Object.defineProperty(exports, "__esModule", {
|
3137
|
+
value: true
|
3138
|
+
});
|
3139
|
+
exports._removeColumns = _removeColumns;
|
3140
|
+
|
3141
|
+
var _jquery = __webpack_require__(0);
|
3142
|
+
|
3143
|
+
var _jquery2 = _interopRequireDefault(_jquery);
|
3144
|
+
|
3145
|
+
var _tuiCodeSnippet = __webpack_require__(2);
|
3146
|
+
|
3147
|
+
var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet);
|
3148
|
+
|
3149
|
+
var _editorProxy = __webpack_require__(1);
|
3150
|
+
|
3151
|
+
var _editorProxy2 = _interopRequireDefault(_editorProxy);
|
3152
|
+
|
3153
|
+
var _tableDataHandler = __webpack_require__(3);
|
3154
|
+
|
3155
|
+
var _tableDataHandler2 = _interopRequireDefault(_tableDataHandler);
|
3156
|
+
|
3157
|
+
var _tableRangeHandler = __webpack_require__(7);
|
3158
|
+
|
3159
|
+
var _tableRangeHandler2 = _interopRequireDefault(_tableRangeHandler);
|
3160
|
+
|
3161
|
+
var _tableRenderer = __webpack_require__(6);
|
3162
|
+
|
3163
|
+
var _tableRenderer2 = _interopRequireDefault(_tableRenderer);
|
3164
|
+
|
3165
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3166
|
+
|
3167
|
+
/**
|
3168
|
+
* @fileoverview Implements mergedTableRemoveCol. Remove col to selected table
|
3169
|
+
* @author NHN Ent. FE Development Lab <dl_javascript@nhnent.com>
|
3170
|
+
*/
|
3171
|
+
var CommandManager = _editorProxy2.default.CommandManager;
|
3172
|
+
|
3173
|
+
|
3174
|
+
var RemoveCol = void 0;
|
3175
|
+
if (CommandManager) {
|
3176
|
+
RemoveCol = CommandManager.command('wysiwyg', /** @lends RemoveCol */{
|
3177
|
+
name: 'RemoveCol',
|
3178
|
+
/**
|
3179
|
+
* Command handler.
|
3180
|
+
* @param {WysiwygEditor} wwe - wysiwygEditor instance
|
3181
|
+
*/
|
3182
|
+
exec: function exec(wwe) {
|
3183
|
+
var sq = wwe.getEditor();
|
3184
|
+
var range = sq.getSelection().cloneRange();
|
3185
|
+
|
3186
|
+
wwe.focus();
|
3187
|
+
|
3188
|
+
if (!sq.hasFormat('TABLE')) {
|
3189
|
+
return;
|
3190
|
+
}
|
3191
|
+
|
3192
|
+
var $startContainer = (0, _jquery2.default)(range.startContainer);
|
3193
|
+
var $table = $startContainer.closest('table');
|
3194
|
+
var tableData = _tableDataHandler2.default.createTableData($table);
|
3195
|
+
var $selectedCells = wwe.componentManager.getManager('tableSelection').getSelectedCells();
|
3196
|
+
var tableRange = _tableRangeHandler2.default.getTableSelectionRange(tableData, $selectedCells, $startContainer);
|
3197
|
+
var beforeCellLength = tableData[0].length;
|
3198
|
+
|
3199
|
+
sq.saveUndoState(range);
|
3200
|
+
_removeColumns(tableData, tableRange);
|
3201
|
+
|
3202
|
+
if (tableData[0].length === 0) {
|
3203
|
+
$table.remove();
|
3204
|
+
} else if (beforeCellLength !== tableData[0].length) {
|
3205
|
+
var $newTable = _tableRenderer2.default.replaceTable($table, tableData);
|
3206
|
+
|
3207
|
+
var startColIndex = tableRange.start.colIndex;
|
3208
|
+
var focusColIndex = startColIndex >= tableData[0].length ? startColIndex - 1 : startColIndex;
|
3209
|
+
var focusCell = _findFocusCell($newTable, tableRange.start.rowIndex, focusColIndex);
|
3210
|
+
_tableRenderer2.default.focusToCell(sq, range, focusCell);
|
3211
|
+
}
|
3212
|
+
}
|
3213
|
+
});
|
3214
|
+
}
|
3215
|
+
|
3216
|
+
/**
|
3217
|
+
* Update colspan to col merger.
|
3218
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
3219
|
+
* @param {number} startColIndex - start col index
|
3220
|
+
* @param {number} endColIndex - end col index
|
3221
|
+
* @private
|
3222
|
+
*/
|
3223
|
+
function _updateColspan(tableData, startColIndex, endColIndex) {
|
3224
|
+
tableData.forEach(function (rowData) {
|
3225
|
+
_tuiCodeSnippet2.default.range(startColIndex, endColIndex + 1).forEach(function (colIndex) {
|
3226
|
+
var cellData = rowData[colIndex];
|
3227
|
+
|
3228
|
+
if (_tuiCodeSnippet2.default.isExisty(cellData.colMergeWith)) {
|
3229
|
+
var merger = rowData[cellData.colMergeWith];
|
3230
|
+
|
3231
|
+
if (merger.colspan) {
|
3232
|
+
merger.colspan -= 1;
|
3233
|
+
}
|
3234
|
+
} else if (cellData.colspan > 1) {
|
3235
|
+
var lastMergedCellIndex = colIndex + cellData.colspan - 1;
|
3236
|
+
|
3237
|
+
cellData.colspan -= endColIndex - colIndex + 1;
|
3238
|
+
|
3239
|
+
if (lastMergedCellIndex > endColIndex) {
|
3240
|
+
rowData[endColIndex + 1] = _tuiCodeSnippet2.default.extend({}, cellData);
|
3241
|
+
}
|
3242
|
+
}
|
3243
|
+
});
|
3244
|
+
});
|
3245
|
+
}
|
3246
|
+
|
3247
|
+
/**
|
3248
|
+
* Update row merge start index to merged cell.
|
3249
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
3250
|
+
* @param {number} startColIndex - start col index
|
3251
|
+
* @param {number} endColIndex - end col index
|
3252
|
+
* @private
|
3253
|
+
*/
|
3254
|
+
function _updateMergeStartIndex(tableData, startColIndex, endColIndex) {
|
3255
|
+
tableData.forEach(function (rowData) {
|
3256
|
+
rowData.slice(endColIndex + 1).forEach(function (cellData) {
|
3257
|
+
if (_tuiCodeSnippet2.default.isExisty(cellData.colMergeWith) && cellData.colMergeWith >= startColIndex) {
|
3258
|
+
cellData.colMergeWith = endColIndex + 1;
|
3259
|
+
}
|
3260
|
+
});
|
3261
|
+
});
|
3262
|
+
}
|
3263
|
+
|
3264
|
+
/**
|
3265
|
+
* Remove columns.
|
3266
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
3267
|
+
* @param {{
|
3268
|
+
* start: {rowIndex: number, colIndex: number},
|
3269
|
+
* end: {rowIndex: number, colIndex: number}
|
3270
|
+
* }} tableRange - table selection range
|
3271
|
+
* @private
|
3272
|
+
*/
|
3273
|
+
function _removeColumns(tableData, tableRange) {
|
3274
|
+
var startColIndex = tableRange.start.colIndex;
|
3275
|
+
var endRange = tableRange.end;
|
3276
|
+
var endColIndex = _tableDataHandler2.default.findColMergedLastIndex(tableData, endRange.rowIndex, endRange.colIndex);
|
3277
|
+
var removeCount = endColIndex - startColIndex + 1;
|
3278
|
+
|
3279
|
+
_updateColspan(tableData, startColIndex, endColIndex);
|
3280
|
+
_updateMergeStartIndex(tableData, startColIndex, endColIndex);
|
3281
|
+
|
3282
|
+
tableData.forEach(function (row) {
|
3283
|
+
row.splice(startColIndex, removeCount);
|
3284
|
+
});
|
3285
|
+
}
|
3286
|
+
|
3287
|
+
/**
|
3288
|
+
* Find focus cell element like td or th.
|
3289
|
+
* @param {jQuery} $newTable - changed table jQuery element
|
3290
|
+
* @param {number} rowIndex - row index of table data
|
3291
|
+
* @param {number} colIndex - column index of tabld data
|
3292
|
+
* @returns {HTMLElement}
|
3293
|
+
* @private
|
3294
|
+
*/
|
3295
|
+
function _findFocusCell($newTable, rowIndex, colIndex) {
|
3296
|
+
var tableData = _tableDataHandler2.default.createTableData($newTable);
|
3297
|
+
|
3298
|
+
if (tableData[0].length - 1 < colIndex) {
|
3299
|
+
colIndex -= 1;
|
3300
|
+
}
|
3301
|
+
|
3302
|
+
var cellElementIndex = _tableDataHandler2.default.findElementIndex(tableData, rowIndex, colIndex);
|
3303
|
+
|
3304
|
+
return $newTable.find('tr').eq(cellElementIndex.rowIndex).find('td, th')[cellElementIndex.colIndex];
|
3305
|
+
}
|
3306
|
+
|
3307
|
+
exports.default = RemoveCol;
|
3308
|
+
|
3309
|
+
/***/ }),
|
3310
|
+
/* 61 */
|
3311
|
+
/***/ (function(module, exports, __webpack_require__) {
|
3312
|
+
|
3313
|
+
"use strict";
|
3314
|
+
|
3315
|
+
|
3316
|
+
Object.defineProperty(exports, "__esModule", {
|
3317
|
+
value: true
|
3318
|
+
});
|
3319
|
+
|
3320
|
+
var _jquery = __webpack_require__(0);
|
3321
|
+
|
3322
|
+
var _jquery2 = _interopRequireDefault(_jquery);
|
3323
|
+
|
3324
|
+
var _tuiCodeSnippet = __webpack_require__(2);
|
3325
|
+
|
3326
|
+
var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet);
|
3327
|
+
|
3328
|
+
var _editorProxy = __webpack_require__(1);
|
3329
|
+
|
3330
|
+
var _editorProxy2 = _interopRequireDefault(_editorProxy);
|
3331
|
+
|
3332
|
+
var _tableDataHandler = __webpack_require__(3);
|
3333
|
+
|
3334
|
+
var _tableDataHandler2 = _interopRequireDefault(_tableDataHandler);
|
3335
|
+
|
3336
|
+
var _tableRangeHandler = __webpack_require__(7);
|
3337
|
+
|
3338
|
+
var _tableRangeHandler2 = _interopRequireDefault(_tableRangeHandler);
|
3339
|
+
|
3340
|
+
var _tableRenderer = __webpack_require__(6);
|
3341
|
+
|
3342
|
+
var _tableRenderer2 = _interopRequireDefault(_tableRenderer);
|
3343
|
+
|
3344
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3345
|
+
|
3346
|
+
/**
|
3347
|
+
* @fileoverview Implements mergedTableAlignCol. Align selected column's text content to given direction
|
3348
|
+
* @author NHN Ent. FE Development Lab <dl_javascript@nhnent.com>
|
3349
|
+
*/
|
3350
|
+
var CommandManager = _editorProxy2.default.CommandManager;
|
3351
|
+
|
3352
|
+
|
3353
|
+
var AlignCol = void 0;
|
3354
|
+
if (CommandManager) {
|
3355
|
+
AlignCol = CommandManager.command('wysiwyg', /** @lends AlignCol */{
|
3356
|
+
name: 'AlignCol',
|
3357
|
+
/**
|
3358
|
+
* Command handler.
|
3359
|
+
* @param {WysiwygEditor} wwe - wysiwygEditor instance
|
3360
|
+
* @param {string} alignDirection - align direction for table header
|
3361
|
+
*/
|
3362
|
+
exec: function exec(wwe, alignDirection) {
|
3363
|
+
var sq = wwe.getEditor();
|
3364
|
+
var range = sq.getSelection().cloneRange();
|
3365
|
+
|
3366
|
+
wwe.focus();
|
3367
|
+
|
3368
|
+
if (!sq.hasFormat('TABLE')) {
|
3369
|
+
return;
|
3370
|
+
}
|
3371
|
+
|
3372
|
+
var $startContainer = (0, _jquery2.default)(range.startContainer);
|
3373
|
+
var $table = $startContainer.closest('table');
|
3374
|
+
var tableData = _tableDataHandler2.default.createTableData($table);
|
3375
|
+
var $selectedCells = wwe.componentManager.getManager('tableSelection').getSelectedCells();
|
3376
|
+
var tableRange = _tableRangeHandler2.default.getTableSelectionRange(tableData, $selectedCells, $startContainer);
|
3377
|
+
|
3378
|
+
_align(tableData[0], tableRange.start.colIndex, tableRange.end.colIndex, alignDirection);
|
3379
|
+
|
3380
|
+
var $newTable = _tableRenderer2.default.replaceTable($table, tableData);
|
3381
|
+
var focusCell = _findFocusCell($newTable, $startContainer);
|
3382
|
+
|
3383
|
+
_tableRenderer2.default.focusToCell(sq, range, focusCell);
|
3384
|
+
}
|
3385
|
+
});
|
3386
|
+
}
|
3387
|
+
|
3388
|
+
/**
|
3389
|
+
* Align to table header.
|
3390
|
+
* @param {Array.<object>} headRowData - head row data
|
3391
|
+
* @param {number} startColIndex - start column index for styling align
|
3392
|
+
* @param {number} endColIndex - end column index for styling align
|
3393
|
+
* @param {string} alignDirection - align direction
|
3394
|
+
* @private
|
3395
|
+
*/
|
3396
|
+
function _align(headRowData, startColIndex, endColIndex, alignDirection) {
|
3397
|
+
_tuiCodeSnippet2.default.range(startColIndex, endColIndex + 1).forEach(function (colIndex) {
|
3398
|
+
var headCellData = headRowData[colIndex];
|
3399
|
+
|
3400
|
+
if (_tuiCodeSnippet2.default.isExisty(headCellData.colMergeWith)) {
|
3401
|
+
headRowData[headCellData.colMergeWith].align = alignDirection;
|
3402
|
+
} else {
|
3403
|
+
headCellData.align = alignDirection;
|
3404
|
+
}
|
3405
|
+
});
|
3406
|
+
}
|
3407
|
+
|
3408
|
+
/**
|
3409
|
+
* Find focus cell element like td or th.
|
3410
|
+
* @param {jQuery} $newTable - changed table jQuery element
|
3411
|
+
* @param {jQuery} $startContainer - start container jQuery element of text range
|
3412
|
+
* @returns {HTMLElement}
|
3413
|
+
* @private
|
3414
|
+
*/
|
3415
|
+
function _findFocusCell($newTable, $startContainer) {
|
3416
|
+
var elementRowIndex = _tableDataHandler2.default.findElementRowIndex($startContainer);
|
3417
|
+
var elementColIndex = _tableDataHandler2.default.findElementColIndex($startContainer);
|
3418
|
+
|
3419
|
+
return $newTable.find('tr').eq(elementRowIndex).find('td, th')[elementColIndex];
|
3420
|
+
}
|
3421
|
+
|
3422
|
+
exports.default = AlignCol;
|
3423
|
+
|
3424
|
+
/***/ }),
|
3425
|
+
/* 62 */
|
3426
|
+
/***/ (function(module, exports, __webpack_require__) {
|
3427
|
+
|
3428
|
+
"use strict";
|
3429
|
+
|
3430
|
+
|
3431
|
+
Object.defineProperty(exports, "__esModule", {
|
3432
|
+
value: true
|
3433
|
+
});
|
3434
|
+
exports._mergeCells = _mergeCells;
|
3435
|
+
|
3436
|
+
var _jquery = __webpack_require__(0);
|
3437
|
+
|
3438
|
+
var _jquery2 = _interopRequireDefault(_jquery);
|
3439
|
+
|
3440
|
+
var _tuiCodeSnippet = __webpack_require__(2);
|
3441
|
+
|
3442
|
+
var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet);
|
3443
|
+
|
3444
|
+
var _editorProxy = __webpack_require__(1);
|
3445
|
+
|
3446
|
+
var _editorProxy2 = _interopRequireDefault(_editorProxy);
|
3447
|
+
|
3448
|
+
var _tableDataHandler = __webpack_require__(3);
|
3449
|
+
|
3450
|
+
var _tableDataHandler2 = _interopRequireDefault(_tableDataHandler);
|
3451
|
+
|
3452
|
+
var _tableRangeHandler = __webpack_require__(7);
|
3453
|
+
|
3454
|
+
var _tableRangeHandler2 = _interopRequireDefault(_tableRangeHandler);
|
3455
|
+
|
3456
|
+
var _tableRenderer = __webpack_require__(6);
|
3457
|
+
|
3458
|
+
var _tableRenderer2 = _interopRequireDefault(_tableRenderer);
|
3459
|
+
|
3460
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3461
|
+
|
3462
|
+
/**
|
3463
|
+
* @fileoverview Implements MergeCell
|
3464
|
+
* @author NHN Ent. FE Development Lab <dl_javascript@nhnent.com>
|
3465
|
+
*/
|
3466
|
+
var CommandManager = _editorProxy2.default.CommandManager;
|
3467
|
+
|
3468
|
+
var BASIC_CELL_CONTENT = _tuiCodeSnippet2.default.browser.msie ? '' : '<br>';
|
3469
|
+
|
3470
|
+
var MergeCell = void 0;
|
3471
|
+
if (CommandManager) {
|
3472
|
+
MergeCell = CommandManager.command('wysiwyg', /** @lends MergeCell */{
|
3473
|
+
name: 'MergeCells',
|
3474
|
+
/**
|
3475
|
+
* Command handler.
|
3476
|
+
* @param {WysiwygEditor} wwe - wysiwygEditor instance
|
3477
|
+
*/
|
3478
|
+
exec: function exec(wwe) {
|
3479
|
+
var sq = wwe.getEditor();
|
3480
|
+
|
3481
|
+
wwe.focus();
|
3482
|
+
|
3483
|
+
if (!sq.hasFormat('TABLE')) {
|
3484
|
+
return;
|
3485
|
+
}
|
3486
|
+
|
3487
|
+
var selectionManager = wwe.componentManager.getManager('tableSelection');
|
3488
|
+
var $selectedCells = selectionManager.getSelectedCells();
|
3489
|
+
|
3490
|
+
if ($selectedCells.length < 2 || selectionManager.hasSelectedBothThAndTd($selectedCells)) {
|
3491
|
+
return;
|
3492
|
+
}
|
3493
|
+
|
3494
|
+
var range = sq.getSelection().cloneRange();
|
3495
|
+
var $startContainer = (0, _jquery2.default)(range.startContainer);
|
3496
|
+
var $table = $startContainer.closest('table');
|
3497
|
+
var tableData = _tableDataHandler2.default.createTableData($table);
|
3498
|
+
var tableRange = _tableRangeHandler2.default.getTableSelectionRange(tableData, $selectedCells, $startContainer);
|
3499
|
+
|
3500
|
+
_mergeCells(tableData, tableRange);
|
3501
|
+
|
3502
|
+
var $newTable = _tableRenderer2.default.replaceTable($table, tableData);
|
3503
|
+
var focusCell = _findFocusCell($newTable, tableRange.start.rowIndex, tableRange.start.colIndex);
|
3504
|
+
|
3505
|
+
_tableRenderer2.default.focusToCell(sq, range, focusCell);
|
3506
|
+
}
|
3507
|
+
});
|
3508
|
+
}
|
3509
|
+
|
3510
|
+
/**
|
3511
|
+
* Pick merger content from selected cells.
|
3512
|
+
* @param {Array.<Array.<object>>} targetRows - target rows
|
3513
|
+
* @param {number} startColIndex - start column index
|
3514
|
+
* @param {number} endColIndex - end column index
|
3515
|
+
* @returns {string}
|
3516
|
+
* @private
|
3517
|
+
*/
|
3518
|
+
function _pickContent(targetRows, startColIndex, endColIndex) {
|
3519
|
+
var _ref;
|
3520
|
+
|
3521
|
+
var limitColIndex = endColIndex + 1;
|
3522
|
+
var cells = (_ref = []).concat.apply(_ref, targetRows.map(function (rowData) {
|
3523
|
+
return rowData.slice(startColIndex, limitColIndex);
|
3524
|
+
}));
|
3525
|
+
var foundCellData = cells.filter(function (_ref2) {
|
3526
|
+
var content = _ref2.content;
|
3527
|
+
return content && content !== BASIC_CELL_CONTENT;
|
3528
|
+
});
|
3529
|
+
|
3530
|
+
return foundCellData.length ? foundCellData[0].content : BASIC_CELL_CONTENT;
|
3531
|
+
}
|
3532
|
+
|
3533
|
+
/**
|
3534
|
+
* Initialize cell data of target rows.
|
3535
|
+
* @param {Array.<Array.<object>>} targetRows - target rows
|
3536
|
+
* @param {number} startColIndex - start column index
|
3537
|
+
* @param {number} endColIndex - end column index
|
3538
|
+
* @private
|
3539
|
+
*/
|
3540
|
+
function _initCellData(targetRows, startColIndex, endColIndex) {
|
3541
|
+
var _ref3;
|
3542
|
+
|
3543
|
+
var limitColIndex = endColIndex + 1;
|
3544
|
+
var targetCells = targetRows.map(function (rowData) {
|
3545
|
+
return rowData.slice(startColIndex, limitColIndex);
|
3546
|
+
});
|
3547
|
+
|
3548
|
+
(_ref3 = []).concat.apply(_ref3, targetCells).slice(1).forEach(function (cellData) {
|
3549
|
+
var nodeName = cellData.nodeName;
|
3550
|
+
|
3551
|
+
|
3552
|
+
_tuiCodeSnippet2.default.forEach(cellData, function (value, name) {
|
3553
|
+
return delete cellData[name];
|
3554
|
+
});
|
3555
|
+
cellData.nodeName = nodeName;
|
3556
|
+
});
|
3557
|
+
}
|
3558
|
+
|
3559
|
+
/**
|
3560
|
+
* Update rowMergeWith property of target rows for row merge.
|
3561
|
+
* @param {Array.<Array.<object>>} targetRows - target rows
|
3562
|
+
* @param {number} startColIndex - start column index
|
3563
|
+
* @param {number} endColIndex - end column index
|
3564
|
+
* @param {number} rowMergeWith - index of row merger
|
3565
|
+
* @private
|
3566
|
+
*/
|
3567
|
+
function _updateRowMergeWith(targetRows, startColIndex, endColIndex, rowMergeWith) {
|
3568
|
+
var limitColIndex = endColIndex + 1;
|
3569
|
+
|
3570
|
+
targetRows.forEach(function (rowData) {
|
3571
|
+
rowData.slice(startColIndex, limitColIndex).forEach(function (cellData) {
|
3572
|
+
cellData.rowMergeWith = rowMergeWith;
|
3573
|
+
});
|
3574
|
+
});
|
3575
|
+
}
|
3576
|
+
|
3577
|
+
/**
|
3578
|
+
* Update colMergeWith property of target rows for column merge.
|
3579
|
+
* @param {Array.<Array.<object>>} targetRows - target rows
|
3580
|
+
* @param {number} startColIndex - start column index
|
3581
|
+
* @param {number} endColIndex - end column index
|
3582
|
+
* @param {number} colMergeWith - index of column merger
|
3583
|
+
* @private
|
3584
|
+
*/
|
3585
|
+
function _updateColMergeWith(targetRows, startColIndex, endColIndex, colMergeWith) {
|
3586
|
+
var limitColIndex = endColIndex + 1;
|
3587
|
+
|
3588
|
+
targetRows.forEach(function (rowData) {
|
3589
|
+
rowData.slice(startColIndex, limitColIndex).forEach(function (cellData) {
|
3590
|
+
cellData.colMergeWith = colMergeWith;
|
3591
|
+
});
|
3592
|
+
});
|
3593
|
+
}
|
3594
|
+
|
3595
|
+
/**
|
3596
|
+
* Merge selected cells.
|
3597
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
3598
|
+
* @param {{rowIndex: number, colIndex: number}} startRange - start table selection range
|
3599
|
+
* @param {{rowIndex: number, colIndex: number}} endRange - end table selection range
|
3600
|
+
* @private
|
3601
|
+
*/
|
3602
|
+
function _mergeCells(tableData, _ref4) {
|
3603
|
+
var startRange = _ref4.start,
|
3604
|
+
endRange = _ref4.end;
|
3605
|
+
|
3606
|
+
var startRowIndex = startRange.rowIndex;
|
3607
|
+
var startColIndex = startRange.colIndex;
|
3608
|
+
var endRowIndex = endRange.rowIndex;
|
3609
|
+
var endColIndex = endRange.colIndex;
|
3610
|
+
var merger = tableData[startRowIndex][startColIndex];
|
3611
|
+
var targetRows = tableData.slice(startRowIndex, endRowIndex + 1);
|
3612
|
+
var rowspan = endRowIndex - startRowIndex + 1;
|
3613
|
+
var colspan = endColIndex - startColIndex + 1;
|
3614
|
+
|
3615
|
+
merger.rowspan = rowspan;
|
3616
|
+
merger.colspan = colspan;
|
3617
|
+
merger.content = _pickContent(targetRows, startColIndex, endColIndex);
|
3618
|
+
_initCellData(targetRows, startColIndex, endColIndex);
|
3619
|
+
|
3620
|
+
if (rowspan > 1) {
|
3621
|
+
_updateRowMergeWith(targetRows.slice(1), startColIndex, endColIndex, startRowIndex);
|
3622
|
+
}
|
3623
|
+
|
3624
|
+
if (colspan > 1) {
|
3625
|
+
_updateColMergeWith(targetRows, startColIndex + 1, endColIndex, startColIndex);
|
3626
|
+
}
|
3627
|
+
}
|
3628
|
+
|
3629
|
+
/**
|
3630
|
+
* Find focus cell element like td or th.
|
3631
|
+
* @param {jQuery} $newTable - changed table jQuery element
|
3632
|
+
* @param {number} rowIndex - row index of table data
|
3633
|
+
* @param {number} colIndex - column index of tabld data
|
3634
|
+
* @returns {HTMLElement}
|
3635
|
+
* @private
|
3636
|
+
*/
|
3637
|
+
function _findFocusCell($newTable, rowIndex, colIndex) {
|
3638
|
+
var tableData = _tableDataHandler2.default.createTableData($newTable);
|
3639
|
+
var cellElementIndex = _tableDataHandler2.default.findElementIndex(tableData, rowIndex, colIndex);
|
3640
|
+
|
3641
|
+
return $newTable.find('tr').eq(cellElementIndex.rowIndex).find('td, th')[cellElementIndex.colIndex];
|
3642
|
+
}
|
3643
|
+
|
3644
|
+
exports.default = MergeCell;
|
3645
|
+
|
3646
|
+
/***/ }),
|
3647
|
+
/* 63 */
|
3648
|
+
/***/ (function(module, exports, __webpack_require__) {
|
3649
|
+
|
3650
|
+
"use strict";
|
3651
|
+
|
3652
|
+
|
3653
|
+
Object.defineProperty(exports, "__esModule", {
|
3654
|
+
value: true
|
3655
|
+
});
|
3656
|
+
exports._hasMergedCell = _hasMergedCell;
|
3657
|
+
exports._unmergeCells = _unmergeCells;
|
3658
|
+
|
3659
|
+
var _jquery = __webpack_require__(0);
|
3660
|
+
|
3661
|
+
var _jquery2 = _interopRequireDefault(_jquery);
|
3662
|
+
|
3663
|
+
var _tuiCodeSnippet = __webpack_require__(2);
|
3664
|
+
|
3665
|
+
var _tuiCodeSnippet2 = _interopRequireDefault(_tuiCodeSnippet);
|
3666
|
+
|
3667
|
+
var _editorProxy = __webpack_require__(1);
|
3668
|
+
|
3669
|
+
var _editorProxy2 = _interopRequireDefault(_editorProxy);
|
3670
|
+
|
3671
|
+
var _tableDataHandler = __webpack_require__(3);
|
3672
|
+
|
3673
|
+
var _tableDataHandler2 = _interopRequireDefault(_tableDataHandler);
|
3674
|
+
|
3675
|
+
var _tableRangeHandler = __webpack_require__(7);
|
3676
|
+
|
3677
|
+
var _tableRangeHandler2 = _interopRequireDefault(_tableRangeHandler);
|
3678
|
+
|
3679
|
+
var _tableRenderer = __webpack_require__(6);
|
3680
|
+
|
3681
|
+
var _tableRenderer2 = _interopRequireDefault(_tableRenderer);
|
3682
|
+
|
3683
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3684
|
+
|
3685
|
+
/**
|
3686
|
+
* @fileoverview Implements UnmergeCell
|
3687
|
+
* @author NHN Ent. FE Development Lab <dl_javascript@nhnent.com>
|
3688
|
+
*/
|
3689
|
+
var CommandManager = _editorProxy2.default.CommandManager;
|
3690
|
+
|
3691
|
+
|
3692
|
+
var UnmergeCell = void 0;
|
3693
|
+
if (CommandManager) {
|
3694
|
+
UnmergeCell = CommandManager.command('wysiwyg', /** @lends UnmergeCell */{
|
3695
|
+
name: 'UnmergeCells',
|
3696
|
+
/**
|
3697
|
+
* Command handler.
|
3698
|
+
* @param {WysiwygEditor} wwe - wysiwygEditor instance
|
3699
|
+
*/
|
3700
|
+
exec: function exec(wwe) {
|
3701
|
+
var sq = wwe.getEditor();
|
3702
|
+
var range = sq.getSelection().cloneRange();
|
3703
|
+
|
3704
|
+
wwe.focus();
|
3705
|
+
|
3706
|
+
if (!sq.hasFormat('TABLE')) {
|
3707
|
+
return;
|
3708
|
+
}
|
3709
|
+
|
3710
|
+
var $startContainer = (0, _jquery2.default)(range.startContainer);
|
3711
|
+
var $table = $startContainer.closest('table');
|
3712
|
+
var tableData = _tableDataHandler2.default.createTableData($table);
|
3713
|
+
var $selectedCells = wwe.componentManager.getManager('tableSelection').getSelectedCells();
|
3714
|
+
var tableRange = _tableRangeHandler2.default.getTableSelectionRange(tableData, $selectedCells, $startContainer);
|
3715
|
+
|
3716
|
+
if (!_hasMergedCell(tableData, tableRange)) {
|
3717
|
+
return;
|
3718
|
+
}
|
3719
|
+
|
3720
|
+
_unmergeCells(tableData, tableRange);
|
3721
|
+
|
3722
|
+
var $newTable = _tableRenderer2.default.replaceTable($table, tableData);
|
3723
|
+
var focusCell = _findFocusCell($newTable, tableRange.start.rowIndex, tableRange.start.colIndex);
|
3724
|
+
|
3725
|
+
_tableRenderer2.default.focusToCell(sq, range, focusCell);
|
3726
|
+
}
|
3727
|
+
});
|
3728
|
+
}
|
3729
|
+
|
3730
|
+
/**
|
3731
|
+
* Whether has merged cell.
|
3732
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
3733
|
+
* @param {{rowIndex: number, colIndex: number}} startRange - start table selection range
|
3734
|
+
* @param {{rowIndex: number, colIndex: number}} endRange - end table selection range
|
3735
|
+
* @returns {boolean}
|
3736
|
+
* @private
|
3737
|
+
*/
|
3738
|
+
function _hasMergedCell(tableData, _ref) {
|
3739
|
+
var _ref2;
|
3740
|
+
|
3741
|
+
var startRange = _ref.start,
|
3742
|
+
endRange = _ref.end;
|
3743
|
+
|
3744
|
+
var startColIndex = startRange.colIndex;
|
3745
|
+
var limitColIndex = endRange.colIndex + 1;
|
3746
|
+
var targetRows = tableData.slice(startRange.rowIndex, endRange.rowIndex + 1);
|
3747
|
+
var targetCells = targetRows.map(function (rowData) {
|
3748
|
+
return rowData.slice(startColIndex, limitColIndex);
|
3749
|
+
});
|
3750
|
+
|
3751
|
+
return !!(_ref2 = []).concat.apply(_ref2, targetCells).filter(function (cellData) {
|
3752
|
+
return cellData.colspan > 1 || cellData.rowspan > 1;
|
3753
|
+
}).length;
|
3754
|
+
}
|
3755
|
+
|
3756
|
+
/**
|
3757
|
+
* Update merged cell data to basic cell data.
|
3758
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
3759
|
+
* @param {number} startRowIndex - start row index
|
3760
|
+
* @param {number} startColIndex - start col index
|
3761
|
+
* @param {number} rowspan - rowspan property of merger cell
|
3762
|
+
* @param {number} colspan - colspan property of merger cell
|
3763
|
+
* @private
|
3764
|
+
*/
|
3765
|
+
function _updateMergedCells(tableData, startRowIndex, startColIndex, rowspan, colspan) {
|
3766
|
+
var limitRowIndex = startRowIndex + rowspan;
|
3767
|
+
var limitColIndex = startColIndex + colspan;
|
3768
|
+
var colRange = _tuiCodeSnippet2.default.range(startColIndex, limitColIndex);
|
3769
|
+
|
3770
|
+
_tuiCodeSnippet2.default.range(startRowIndex, limitRowIndex).forEach(function (rowIndex) {
|
3771
|
+
var rowData = tableData[rowIndex];
|
3772
|
+
var startIndex = rowIndex === startRowIndex ? 1 : 0;
|
3773
|
+
|
3774
|
+
colRange.slice(startIndex).forEach(function (colIndex) {
|
3775
|
+
rowData[colIndex] = _tableDataHandler2.default.createBasicCell(rowIndex, colIndex, rowData[colIndex].nodeName);
|
3776
|
+
});
|
3777
|
+
});
|
3778
|
+
}
|
3779
|
+
|
3780
|
+
/**
|
3781
|
+
* Unmerge selected cells.
|
3782
|
+
* @param {Array.<Array.<object>>} tableData - table data
|
3783
|
+
* @param {{rowIndex: number, colIndex: number}} startRange - start table selection range
|
3784
|
+
* @param {{rowIndex: number, colIndex: number}} endRange - end table selection range
|
3785
|
+
* @private
|
3786
|
+
*/
|
3787
|
+
function _unmergeCells(tableData, _ref3) {
|
3788
|
+
var startRange = _ref3.start,
|
3789
|
+
endRange = _ref3.end;
|
3790
|
+
|
3791
|
+
var colRange = _tuiCodeSnippet2.default.range(startRange.colIndex, endRange.colIndex + 1);
|
3792
|
+
|
3793
|
+
_tuiCodeSnippet2.default.range(startRange.rowIndex, endRange.rowIndex + 1).forEach(function (rowIndex) {
|
3794
|
+
colRange.forEach(function (colIndex) {
|
3795
|
+
var cellData = tableData[rowIndex][colIndex];
|
3796
|
+
var colspan = cellData.colspan,
|
3797
|
+
rowspan = cellData.rowspan;
|
3798
|
+
|
3799
|
+
|
3800
|
+
if (colspan > 1 || rowspan > 1) {
|
3801
|
+
cellData.colspan = 1;
|
3802
|
+
cellData.rowspan = 1;
|
3803
|
+
_updateMergedCells(tableData, rowIndex, colIndex, rowspan, colspan);
|
3804
|
+
}
|
3805
|
+
});
|
3806
|
+
});
|
3807
|
+
}
|
3808
|
+
|
3809
|
+
/**
|
3810
|
+
* Find focus cell element like td or th.
|
3811
|
+
* @param {jQuery} $newTable - changed table jQuery element
|
3812
|
+
* @param {number} rowIndex - row index of table data
|
3813
|
+
* @param {number} colIndex - column index of tabld data
|
3814
|
+
* @returns {HTMLElement}
|
3815
|
+
* @private
|
3816
|
+
*/
|
3817
|
+
function _findFocusCell($newTable, rowIndex, colIndex) {
|
3818
|
+
var tableData = _tableDataHandler2.default.createTableData($newTable);
|
3819
|
+
var cellElementIndex = _tableDataHandler2.default.findElementIndex(tableData, rowIndex, colIndex);
|
3820
|
+
|
3821
|
+
return $newTable.find('tr').eq(cellElementIndex.rowIndex).find('td, th')[cellElementIndex.colIndex];
|
3822
|
+
}
|
3823
|
+
|
3824
|
+
exports.default = UnmergeCell;
|
3825
|
+
|
3826
|
+
/***/ }),
|
3827
|
+
/* 64 */
|
3828
|
+
/***/ (function(module, exports, __webpack_require__) {
|
3829
|
+
|
3830
|
+
"use strict";
|
3831
|
+
|
3832
|
+
|
3833
|
+
Object.defineProperty(exports, "__esModule", {
|
3834
|
+
value: true
|
3835
|
+
});
|
3836
|
+
|
3837
|
+
var _jquery = __webpack_require__(0);
|
3838
|
+
|
3839
|
+
var _jquery2 = _interopRequireDefault(_jquery);
|
3840
|
+
|
3841
|
+
var _editorProxy = __webpack_require__(1);
|
3842
|
+
|
3843
|
+
var _editorProxy2 = _interopRequireDefault(_editorProxy);
|
3844
|
+
|
3845
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3846
|
+
|
3847
|
+
/**
|
3848
|
+
* @fileoverview Implements table extension ui
|
3849
|
+
* @author NHN Ent. FE Development Lab <dl_javascript@nhnent.com>
|
3850
|
+
*/
|
3851
|
+
var i18n = _editorProxy2.default.i18n;
|
3852
|
+
|
3853
|
+
/**
|
3854
|
+
* Change contextmenu content.
|
3855
|
+
* @param {object} popupTableUtils - PopupTableUtils instance for managing contextmenu of table
|
3856
|
+
* @private
|
3857
|
+
*/
|
3858
|
+
|
3859
|
+
function _changeContent(popupTableUtils) {
|
3860
|
+
var POPUP_CONTENT = ['<button type="button" class="te-table-add-row">' + i18n.get('Add row') + '</button>', '<button type="button" class="te-table-add-col">' + i18n.get('Add col') + '</button>', '<button type="button" class="te-table-remove-row">' + i18n.get('Remove row') + '</button>', '<button type="button" class="te-table-remove-col">' + i18n.get('Remove col') + '</button>', '<hr/>', '<button type="button" class="te-table-merge">' + i18n.get('Merge cells') + '</button>', '<button type="button" class="te-table-unmerge">' + i18n.get('Unmerge cells') + '</button>', '<hr/>', '<button type="button" class="te-table-col-align-left">' + i18n.get('Align left') + '</button>', '<button type="button" class="te-table-col-align-center">' + i18n.get('Align center') + '</button>', '<button type="button" class="te-table-col-align-right">' + i18n.get('Align right') + '</button>', '<hr/>', '<button type="button" class="te-table-remove">' + i18n.get('Remove table') + '</button>'].join('');
|
3861
|
+
var $popupContent = (0, _jquery2.default)(POPUP_CONTENT);
|
3862
|
+
|
3863
|
+
popupTableUtils.setContent($popupContent);
|
3864
|
+
}
|
3865
|
+
|
3866
|
+
/**
|
3867
|
+
* Bind events for merge feature of contextmenu.
|
3868
|
+
* @param {object} popupTableUtils - PopupTableUtils instance for managing contextmenu of table
|
3869
|
+
* @param {object} eventManager - event manager instance of editor
|
3870
|
+
* @param {object} selectionManager - table selection manager instance
|
3871
|
+
* @private
|
3872
|
+
*/
|
3873
|
+
function _bindEvents(popupTableUtils, eventManager, selectionManager) {
|
3874
|
+
var $popupContent = popupTableUtils.$content;
|
3875
|
+
var $mergeBtn = (0, _jquery2.default)($popupContent[5]);
|
3876
|
+
var $unmergeBtn = (0, _jquery2.default)($popupContent[6]);
|
3877
|
+
var $separator = (0, _jquery2.default)($popupContent[7]);
|
3878
|
+
|
3879
|
+
popupTableUtils.on('click .te-table-merge', function () {
|
3880
|
+
eventManager.emit('command', 'MergeCells');
|
3881
|
+
});
|
3882
|
+
|
3883
|
+
popupTableUtils.on('click .te-table-unmerge', function () {
|
3884
|
+
eventManager.emit('command', 'UnmergeCells');
|
3885
|
+
});
|
3886
|
+
|
3887
|
+
eventManager.listen('openPopupTableUtils', function () {
|
3888
|
+
var $selectedCells = selectionManager.getSelectedCells();
|
3889
|
+
var selectedCellCount = $selectedCells.length;
|
3890
|
+
|
3891
|
+
if (selectedCellCount) {
|
3892
|
+
if (selectedCellCount < 2 || selectionManager.hasSelectedBothThAndTd($selectedCells)) {
|
3893
|
+
$mergeBtn.hide();
|
3894
|
+
} else {
|
3895
|
+
$mergeBtn.show();
|
3896
|
+
}
|
3897
|
+
|
3898
|
+
if ($selectedCells.is('[rowspan], [colspan]')) {
|
3899
|
+
$unmergeBtn.show();
|
3900
|
+
} else {
|
3901
|
+
$unmergeBtn.hide();
|
3902
|
+
}
|
3903
|
+
$separator.show();
|
3904
|
+
} else {
|
3905
|
+
$mergeBtn.hide();
|
3906
|
+
$unmergeBtn.hide();
|
3907
|
+
$separator.hide();
|
3908
|
+
}
|
3909
|
+
});
|
3910
|
+
}
|
3911
|
+
|
3912
|
+
/**
|
3913
|
+
* Update contextmenu UI.
|
3914
|
+
* @param {object} popupTableUtils - PopupTableUtils instance for managing contextmenu of table
|
3915
|
+
* @param {object} eventManager - event manager instance of editor
|
3916
|
+
* @param {object} selectionManager - table selection manager instance
|
3917
|
+
* @ignore
|
3918
|
+
*/
|
3919
|
+
function updateContextMenu(popupTableUtils, eventManager, selectionManager) {
|
3920
|
+
_changeContent(popupTableUtils);
|
3921
|
+
_bindEvents(popupTableUtils, eventManager, selectionManager);
|
3922
|
+
}
|
3923
|
+
|
3924
|
+
exports.default = {
|
3925
|
+
updateContextMenu: updateContextMenu
|
3926
|
+
};
|
3927
|
+
|
3928
|
+
/***/ })
|
3929
|
+
/******/ ]);
|
3930
|
+
});
|