pagebreak.js 979 B

12345678910111213141516171819202122232425262728
  1. /*******************************************************************************
  2. * KindEditor - WYSIWYG HTML Editor for Internet
  3. * Copyright (C) 2006-2011 kindsoft.net
  4. *
  5. * @author Roddy <luolonghao@gmail.com>
  6. * @site http://www.kindsoft.net/
  7. * @licence http://www.kindsoft.net/license.php
  8. *******************************************************************************/
  9. KindEditor.plugin('pagebreak', function(K) {
  10. var self = this;
  11. var name = 'pagebreak';
  12. var pagebreakHtml = K.undef(self.pagebreakHtml, '<hr style="page-break-after: always;" class="ke-pagebreak" />');
  13. self.clickToolbar(name, function() {
  14. var cmd = self.cmd, range = cmd.range;
  15. self.focus();
  16. var tail = self.newlineTag == 'br' || K.WEBKIT ? '' : '<span id="__kindeditor_tail_tag__"></span>';
  17. self.insertHtml(pagebreakHtml + tail);
  18. if (tail !== '') {
  19. var p = K('#__kindeditor_tail_tag__', self.edit.doc);
  20. range.selectNodeContents(p[0]);
  21. p.removeAttr('id');
  22. cmd.select();
  23. }
  24. });
  25. });