tylerecouture / summernote-table-styles

A Summernote plugin that adds a button to the table popover allowing the user to apply Bootstrap table styles.
MIT License
8 stars 14 forks source link

Hi there, I am getting: Cannot read property 'ancestor' of undefined #2

Open sogrbilja opened 5 years ago

sogrbilja commented 5 years ago

Sorry, this is not an issue (I think), because on one project I've successfully integrated table styles already, but now I am getting this error on another project.

I am using: in head:

  | <link rel="stylesheet" href="/css/bootstrap.min.css" />
  | <link rel="stylesheet" href="/css/thickbox.css" media="screen" />
  | <link rel="stylesheet" href="/codemirror-5.40.0/lib/codemirror.css">
  | <link rel="stylesheet" href="/codemirror-5.40.0/theme/zenburn.css">
  | <link rel="stylesheet" href="/summernote/summernote-lite.css" type="text/css"/>
  | <link rel="stylesheet" href="/css/normalize.css" type="text/css"/>
  | <link href="https://fonts.googleapis.com/css?family=Dancing+Script" rel="stylesheet">
  | <link rel="stylesheet" href="/css/common.css"  type="text/css"/>
  | <link rel="stylesheet" href="/css/font-size.css" type="text/css"/>
  | <link rel="stylesheet" href="/css/custom.css"  type="text/css"/>
  | <script src="/javascript/jquery-3.3.1.min.js"></script>

in body:

<script src="/codemirror-5.40.0/lib/codemirror.js"></script>
--
  | <script src="/codemirror-5.40.0/mode/javascript/javascript.js"></script>
  | <script src="/codemirror-5.40.0/addon/edit/matchbrackets.js"></script>
  | <script src="/codemirror-5.40.0/mode/htmlmixed/htmlmixed.js"></script>
  | <script src="/codemirror-5.40.0/mode/xml/xml.js"></script>
  | <script src="/codemirror-5.40.0/mode/css/css.js"></script>
  | <script src="/codemirror-5.40.0/mode/clike/clike.js"></script>
  | <script src="/codemirror-5.40.0/mode/php/php.js"></script>
  | <script src="/codemirror-5.40.0/lib/util/formatting.js"></script>
  | <script src="/summernote/summernote-lite.js"></script>
  | <script src="/summernote/lang/summernote-sr-RS.js"></script>
  | <script src="/summernote/summernote-image-attributes.js"></script>
  | <script src="/summernote/summernote-table-styles.js"></script>
  | <script src="/summernote/summernote-cleaner.js"></script>

<script src="/javascript/custom.js" async defer></script>
--
  | <script src="/javascript/common.js" async defer></script>
  | <script src="/javascript/moment-with-locales.js" async defer></script>
  | <script src="/javascript/popper.min.js" async defer></script>
  | <script src="/javascript/bootstrap.min.js" async defer></script>
  | <script src="/javascript/select2.min.js"></script>
  | <script src="/javascript/thickbox.js"></script>

In chrome it is here: image

Thanks

osworx commented 4 years ago

As mentioned in another summernote plugin https://github.com/tylerecouture/summernote-table-headers/issues/2 it is maybe the dom. The solution there is to use var $table = $(rng.commonAncestor())

tylerecouture commented 4 years ago

@sogrbilja I'm finally getting around to updating all of these summernote plugins! This one now works with upto summernote version 0.8.12 (https://github.com/tylerecouture/summernote-table-styles/releases/tag/summernote%3C%3D0.8.12) Now working on 0.8.13 which seems to break it quite a bit.