Version Description
- Significantly update TinyMCE plugin from 4.1.x to 4.7.11
- Drop support for WordPress 3.x, which means dropping TinyMCE 3.x and 4.0.x
Download this release
Release Info
| Developer | helen |
| Plugin | |
| Version | 3.3 |
| Comparing to | |
| See all releases | |
Code changes from version 3.2 to 3.3
- mce_table_buttons.php +33 -46
- readme.txt +10 -7
- tinymce3-assets/mce-table-buttons-2x.png +0 -0
- tinymce3-assets/mce-table-buttons.css +0 -106
- tinymce3-assets/mce-table-buttons.js +0 -32
- tinymce3-assets/mce-table-buttons.png +0 -0
- tinymce3-table/cell.htm +0 -180
- tinymce3-table/css/cell.css +0 -17
- tinymce3-table/css/row.css +0 -25
- tinymce3-table/css/table.css +0 -13
- tinymce3-table/editor_plugin.js +0 -1
- tinymce3-table/editor_plugin_src.js +0 -1452
- tinymce3-table/js/cell.js +0 -319
- tinymce3-table/js/merge_cells.js +0 -27
- tinymce3-table/js/row.js +0 -237
- tinymce3-table/js/table.js +0 -501
- tinymce3-table/langs/en_dlg.js +0 -1
- tinymce3-table/merge_cells.htm +0 -32
- tinymce3-table/row.htm +0 -158
- tinymce3-table/table.htm +0 -188
- tinymce4-table/plugin.js +0 -2293
- tinymce4-table/plugin.min.js +0 -1
- tinymce47-table/plugin.js +10450 -0
- tinymce47-table/plugin.min.js +1 -0
mce_table_buttons.php
CHANGED
|
@@ -1,13 +1,13 @@
|
|
| 1 |
<?php
|
| 2 |
/**
|
| 3 |
-
Plugin Name: MCE Table Buttons
|
| 4 |
-
Plugin URI: http://10up.com/plugins-modules/wordpress-mce-table-buttons/
|
| 5 |
-
Description: Add <strong>controls for table editing</strong> to the visual content editor with this <strong>light weight</strong> plug-in.
|
| 6 |
-
Version: 3.
|
| 7 |
-
Author: Jake Goldman, 10up, Oomph
|
| 8 |
-
Author URI: http://10up.com
|
| 9 |
-
License: GPLv2 or later
|
| 10 |
-
*/
|
| 11 |
|
| 12 |
class MCE_Table_Buttons {
|
| 13 |
|
|
@@ -40,6 +40,7 @@ class MCE_Table_Buttons {
|
|
| 40 |
add_filter( 'mce_external_plugins', array( __CLASS__, 'mce_external_plugins' ) );
|
| 41 |
add_filter( 'mce_buttons_2', array( __CLASS__, 'mce_buttons_2' ) );
|
| 42 |
add_filter( 'content_save_pre', array( __CLASS__, 'content_save_pre' ), 20 );
|
|
|
|
| 43 |
}
|
| 44 |
|
| 45 |
/**
|
|
@@ -52,22 +53,13 @@ class MCE_Table_Buttons {
|
|
| 52 |
global $tinymce_version;
|
| 53 |
$variant = ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) ? '' : '.min';
|
| 54 |
|
| 55 |
-
if ( version_compare( $tinymce_version, '
|
| 56 |
|
| 57 |
-
|
| 58 |
-
wp_print_styles( 'mce-table-buttons' );
|
| 59 |
-
|
| 60 |
-
$plugin_dir_url = plugin_dir_url( __FILE__ );
|
| 61 |
-
$plugin_array['table'] = $plugin_dir_url . 'tinymce3-table/editor_plugin.js';
|
| 62 |
-
$plugin_array['mcetablebuttons'] = $plugin_dir_url . 'tinymce3-assets/mce-table-buttons.js';
|
| 63 |
-
|
| 64 |
-
} elseif ( version_compare( $tinymce_version, '4100', '<' ) ) {
|
| 65 |
-
|
| 66 |
-
$plugin_array['table'] = plugin_dir_url( __FILE__ ) . 'tinymce4-table/plugin' . $variant . '.js';
|
| 67 |
|
| 68 |
} else {
|
| 69 |
|
| 70 |
-
$plugin_array['table'] = plugin_dir_url( __FILE__ ) . '
|
| 71 |
|
| 72 |
}
|
| 73 |
|
|
@@ -81,35 +73,14 @@ class MCE_Table_Buttons {
|
|
| 81 |
* @return array Buttons for the second row
|
| 82 |
*/
|
| 83 |
public static function mce_buttons_2( $buttons ) {
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
add_filter( 'mce_buttons_3', array( __CLASS__, 'mce_buttons_3' ) );
|
| 89 |
-
|
| 90 |
-
} else {
|
| 91 |
-
|
| 92 |
-
// in case someone is manipulating other buttons, drop table controls at the end of the row
|
| 93 |
-
if ( ! $pos = array_search( 'undo', $buttons ) ) {
|
| 94 |
-
array_push( $buttons, 'table' );
|
| 95 |
-
return $buttons;
|
| 96 |
-
}
|
| 97 |
-
|
| 98 |
-
$buttons = array_merge( array_slice( $buttons, 0, $pos ), array( 'table' ), array_slice( $buttons, $pos ) );
|
| 99 |
-
|
| 100 |
}
|
| 101 |
|
| 102 |
-
|
| 103 |
-
}
|
| 104 |
|
| 105 |
-
/**
|
| 106 |
-
* Add TinyMCE 3.x table control to the second row, after other formatting controls
|
| 107 |
-
*
|
| 108 |
-
* @param array $buttons Buttons for the second row
|
| 109 |
-
* @return array Buttons for the second row
|
| 110 |
-
*/
|
| 111 |
-
public static function mce_buttons_3( $buttons ) {
|
| 112 |
-
array_push( $buttons, 'tablecontrols' );
|
| 113 |
return $buttons;
|
| 114 |
}
|
| 115 |
|
|
@@ -132,6 +103,22 @@ class MCE_Table_Buttons {
|
|
| 132 |
|
| 133 |
return $content;
|
| 134 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
}
|
| 136 |
|
| 137 |
MCE_Table_Buttons::get_instance();
|
| 1 |
<?php
|
| 2 |
/**
|
| 3 |
+
* Plugin Name: MCE Table Buttons
|
| 4 |
+
* Plugin URI: http://10up.com/plugins-modules/wordpress-mce-table-buttons/
|
| 5 |
+
* Description: Add <strong>controls for table editing</strong> to the visual content editor with this <strong>light weight</strong> plug-in.
|
| 6 |
+
* Version: 3.3
|
| 7 |
+
* Author: Jake Goldman, 10up, Oomph
|
| 8 |
+
* Author URI: http://10up.com
|
| 9 |
+
* License: GPLv2 or later
|
| 10 |
+
*/
|
| 11 |
|
| 12 |
class MCE_Table_Buttons {
|
| 13 |
|
| 40 |
add_filter( 'mce_external_plugins', array( __CLASS__, 'mce_external_plugins' ) );
|
| 41 |
add_filter( 'mce_buttons_2', array( __CLASS__, 'mce_buttons_2' ) );
|
| 42 |
add_filter( 'content_save_pre', array( __CLASS__, 'content_save_pre' ), 20 );
|
| 43 |
+
add_filter( 'tiny_mce_before_init', array( __CLASS__, 'tiny_mce_before_init' ), 10, 2 );
|
| 44 |
}
|
| 45 |
|
| 46 |
/**
|
| 53 |
global $tinymce_version;
|
| 54 |
$variant = ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) ? '' : '.min';
|
| 55 |
|
| 56 |
+
if ( version_compare( $tinymce_version, '4700', '<' ) ) {
|
| 57 |
|
| 58 |
+
$plugin_array['table'] = plugin_dir_url( __FILE__ ) . 'tinymce41-table/plugin' . $variant . '.js';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
} else {
|
| 61 |
|
| 62 |
+
$plugin_array['table'] = plugin_dir_url( __FILE__ ) . 'tinymce47-table/plugin' . $variant . '.js';
|
| 63 |
|
| 64 |
}
|
| 65 |
|
| 73 |
* @return array Buttons for the second row
|
| 74 |
*/
|
| 75 |
public static function mce_buttons_2( $buttons ) {
|
| 76 |
+
// in case someone is manipulating other buttons, drop table controls at the end of the row
|
| 77 |
+
if ( ! $pos = array_search( 'undo', $buttons ) ) {
|
| 78 |
+
array_push( $buttons, 'table' );
|
| 79 |
+
return $buttons;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
}
|
| 81 |
|
| 82 |
+
$buttons = array_merge( array_slice( $buttons, 0, $pos ), array( 'table' ), array_slice( $buttons, $pos ) );
|
|
|
|
| 83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
return $buttons;
|
| 85 |
}
|
| 86 |
|
| 103 |
|
| 104 |
return $content;
|
| 105 |
}
|
| 106 |
+
|
| 107 |
+
/**
|
| 108 |
+
* Remove the table toolbar introduced in TinyMCE 4.3.0.
|
| 109 |
+
*
|
| 110 |
+
* Its positioning does not work correctly inside WordPress and blocks editing.
|
| 111 |
+
*
|
| 112 |
+
* @param array $mceInit An array with TinyMCE config.
|
| 113 |
+
* @param string $editor_id Unique editor identifier, e.g. 'content'.
|
| 114 |
+
*
|
| 115 |
+
* @return array TinyMCE config array
|
| 116 |
+
*/
|
| 117 |
+
public static function tiny_mce_before_init ( $mceInit, $editor_id ) {
|
| 118 |
+
$mceInit['table_toolbar'] = '';
|
| 119 |
+
|
| 120 |
+
return $mceInit;
|
| 121 |
+
}
|
| 122 |
}
|
| 123 |
|
| 124 |
MCE_Table_Buttons::get_instance();
|
readme.txt
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
=== MCE Table Buttons ===
|
| 2 |
-
Contributors: jakemgold,
|
| 3 |
Donate link: http://10up.com/plugins-modules/wordpress-mce-table-buttons/
|
| 4 |
Tags: tables, table, editor, WYSIWYG, buttons, tinymce
|
| 5 |
-
Requires at least:
|
| 6 |
-
Tested up to: 4.
|
| 7 |
-
Stable tag: 3.
|
| 8 |
|
| 9 |
Adds table editing controls to the visual content editor (TinyMCE).
|
| 10 |
|
|
@@ -18,18 +18,21 @@ Note that the table controls are contained in the “kitchen sink” toolbar, to
|
|
| 18 |
|
| 19 |
== Installation ==
|
| 20 |
|
| 21 |
-
1. Install easily with the WordPress plugin control panel or manually download the plugin and upload the folder
|
| 22 |
`mce-table-buttons` to the `/wp-content/plugins/` directory
|
| 23 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
| 24 |
1. Show the toolbar in the editor by opening the "kitchen sink" (the last button in the first row)
|
| 25 |
|
| 26 |
== Screenshots ==
|
| 27 |
|
| 28 |
-
1. The editor with the
|
| 29 |
-
1. The editor with the new table editing controls in WordPress 3.4 through 3.8.
|
| 30 |
|
| 31 |
== Changelog ==
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
= 3.2 =
|
| 34 |
* WordPress 4.0 support, including a much newer TinyMCE plugin, with many new features, including background color and horizontal alignment
|
| 35 |
* Dramatically improved support for paragraphed content inside of a cell (paragraph breaks no longer disappear on save)
|
| 1 |
=== MCE Table Buttons ===
|
| 2 |
+
Contributors: 10up, jakemgold, helen, thinkoomph
|
| 3 |
Donate link: http://10up.com/plugins-modules/wordpress-mce-table-buttons/
|
| 4 |
Tags: tables, table, editor, WYSIWYG, buttons, tinymce
|
| 5 |
+
Requires at least: 4.0
|
| 6 |
+
Tested up to: 4.9.6
|
| 7 |
+
Stable tag: 3.3
|
| 8 |
|
| 9 |
Adds table editing controls to the visual content editor (TinyMCE).
|
| 10 |
|
| 18 |
|
| 19 |
== Installation ==
|
| 20 |
|
| 21 |
+
1. Install easily with the WordPress plugin control panel or manually download the plugin and upload the folder
|
| 22 |
`mce-table-buttons` to the `/wp-content/plugins/` directory
|
| 23 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
| 24 |
1. Show the toolbar in the editor by opening the "kitchen sink" (the last button in the first row)
|
| 25 |
|
| 26 |
== Screenshots ==
|
| 27 |
|
| 28 |
+
1. The editor with the added table editing controls.
|
|
|
|
| 29 |
|
| 30 |
== Changelog ==
|
| 31 |
|
| 32 |
+
= 3.3 =
|
| 33 |
+
* Significantly update TinyMCE plugin from 4.1.x to 4.7.11
|
| 34 |
+
* Drop support for WordPress 3.x, which means dropping TinyMCE 3.x and 4.0.x
|
| 35 |
+
|
| 36 |
= 3.2 =
|
| 37 |
* WordPress 4.0 support, including a much newer TinyMCE plugin, with many new features, including background color and horizontal alignment
|
| 38 |
* Dramatically improved support for paragraphed content inside of a cell (paragraph breaks no longer disappear on save)
|
tinymce3-assets/mce-table-buttons-2x.png
DELETED
|
Binary file
|
tinymce3-assets/mce-table-buttons.css
DELETED
|
@@ -1,106 +0,0 @@
|
|
| 1 |
-
.wp_themeSkin .mceButton span.mce_table,
|
| 2 |
-
.wp_themeSkin .mceButton span.mce_row_props,
|
| 3 |
-
.wp_themeSkin .mceButton span.mce_cell_props,
|
| 4 |
-
.wp_themeSkin .mceButton span.mce_row_before,
|
| 5 |
-
.wp_themeSkin .mceButton span.mce_row_after,
|
| 6 |
-
.wp_themeSkin .mceButton span.mce_delete_row,
|
| 7 |
-
.wp_themeSkin .mceButton span.mce_col_before,
|
| 8 |
-
.wp_themeSkin .mceButton span.mce_col_after,
|
| 9 |
-
.wp_themeSkin .mceButton span.mce_delete_col,
|
| 10 |
-
.wp_themeSkin .mceButton span.mce_split_cells,
|
| 11 |
-
.wp_themeSkin .mceButton span.mce_merge_cells {
|
| 12 |
-
background: url('mce-table-buttons.png') 2px -16px no-repeat;
|
| 13 |
-
}
|
| 14 |
-
.wp_themeSkin .mceButtonEnabled:hover span.mce_table, .wp_themeSkin .mceButtonActive span.mce_table {
|
| 15 |
-
background-position: 2px 2px;
|
| 16 |
-
}
|
| 17 |
-
|
| 18 |
-
.wp_themeSkin .mceButton span.mce_row_props {
|
| 19 |
-
background-position: -198px -16px;
|
| 20 |
-
}
|
| 21 |
-
.wp_themeSkin .mceButtonEnabled:hover span.mce_row_props, .wp_themeSkin .mceButtonActive span.mce_row_props {
|
| 22 |
-
background-position: -198px 2px;
|
| 23 |
-
}
|
| 24 |
-
|
| 25 |
-
.wp_themeSkin .mceButton span.mce_cell_props {
|
| 26 |
-
background-position: -18px -16px;
|
| 27 |
-
}
|
| 28 |
-
.wp_themeSkin .mceButtonEnabled:hover span.mce_cell_props, .wp_themeSkin .mceButtonActive span.mce_cell_props {
|
| 29 |
-
background-position: -18px 2px;
|
| 30 |
-
}
|
| 31 |
-
|
| 32 |
-
.wp_themeSkin .mceButton span.mce_row_before {
|
| 33 |
-
background-position: -158px -16px;
|
| 34 |
-
}
|
| 35 |
-
.wp_themeSkin .mceButtonEnabled:hover span.mce_row_before, .wp_themeSkin .mceButtonActive span.mce_row_before {
|
| 36 |
-
background-position: -158px 2px;
|
| 37 |
-
}
|
| 38 |
-
|
| 39 |
-
.wp_themeSkin .mceButton span.mce_row_after {
|
| 40 |
-
background-position: -138px -16px;
|
| 41 |
-
}
|
| 42 |
-
.wp_themeSkin .mceButtonEnabled:hover span.mce_row_after, .wp_themeSkin .mceButtonActive span.mce_row_after {
|
| 43 |
-
background-position: -138px 2px;
|
| 44 |
-
}
|
| 45 |
-
|
| 46 |
-
.wp_themeSkin .mceButton span.mce_delete_row {
|
| 47 |
-
background-position: -78px -16px;
|
| 48 |
-
}
|
| 49 |
-
.wp_themeSkin .mceButtonEnabled:hover span.mce_delete_row, .wp_themeSkin .mceButtonActive span.mce_delete_row {
|
| 50 |
-
background-position: -78px 2px;
|
| 51 |
-
}
|
| 52 |
-
|
| 53 |
-
.wp_themeSkin .mceButton span.mce_col_before {
|
| 54 |
-
background-position: -118px -16px;
|
| 55 |
-
}
|
| 56 |
-
.wp_themeSkin .mceButtonEnabled:hover span.mce_col_before, .wp_themeSkin .mceButtonActive span.mce_col_before {
|
| 57 |
-
background-position: -118px 2px;
|
| 58 |
-
}
|
| 59 |
-
|
| 60 |
-
.wp_themeSkin .mceButton span.mce_col_after {
|
| 61 |
-
background-position: -98px -16px;
|
| 62 |
-
}
|
| 63 |
-
.wp_themeSkin .mceButtonEnabled:hover span.mce_col_after, .wp_themeSkin .mceButtonActive span.mce_col_after {
|
| 64 |
-
background-position: -98px 2px;
|
| 65 |
-
}
|
| 66 |
-
|
| 67 |
-
.wp_themeSkin .mceButton span.mce_delete_col {
|
| 68 |
-
background-position: -58px -16px;
|
| 69 |
-
}
|
| 70 |
-
.wp_themeSkin .mceButtonEnabled:hover span.mce_delete_col, .wp_themeSkin .mceButtonActive span.mce_delete_col {
|
| 71 |
-
background-position: -58px 2px;
|
| 72 |
-
}
|
| 73 |
-
|
| 74 |
-
.wp_themeSkin .mceButton span.mce_split_cells {
|
| 75 |
-
background-position: -218px -16px;
|
| 76 |
-
}
|
| 77 |
-
.wp_themeSkin .mceButtonEnabled:hover span.mce_split_cells, .wp_themeSkin .mceButtonActive span.mce_split_cells {
|
| 78 |
-
background-position: -218px 2px;
|
| 79 |
-
}
|
| 80 |
-
|
| 81 |
-
.wp_themeSkin .mceButton span.mce_merge_cells {
|
| 82 |
-
background-position: -178px -16px;
|
| 83 |
-
}
|
| 84 |
-
.wp_themeSkin .mceButtonEnabled:hover span.mce_merge_cells, .wp_themeSkin .mceButtonActive span.mce_merge_cells {
|
| 85 |
-
background-position: -178px 2px;
|
| 86 |
-
}
|
| 87 |
-
|
| 88 |
-
@media print,
|
| 89 |
-
(-o-min-device-pixel-ratio: 5/4),
|
| 90 |
-
(-webkit-min-device-pixel-ratio: 1.25),
|
| 91 |
-
(min-resolution: 120dpi) {
|
| 92 |
-
.wp_themeSkin .mceButton span.mce_table,
|
| 93 |
-
.wp_themeSkin .mceButton span.mce_row_props,
|
| 94 |
-
.wp_themeSkin .mceButton span.mce_cell_props,
|
| 95 |
-
.wp_themeSkin .mceButton span.mce_row_before,
|
| 96 |
-
.wp_themeSkin .mceButton span.mce_row_after,
|
| 97 |
-
.wp_themeSkin .mceButton span.mce_delete_row,
|
| 98 |
-
.wp_themeSkin .mceButton span.mce_col_before,
|
| 99 |
-
.wp_themeSkin .mceButton span.mce_col_after,
|
| 100 |
-
.wp_themeSkin .mceButton span.mce_delete_col,
|
| 101 |
-
.wp_themeSkin .mceButton span.mce_split_cells,
|
| 102 |
-
.wp_themeSkin .mceButton span.mce_merge_cells {
|
| 103 |
-
background-image: url('mce-table-buttons-2x.png');
|
| 104 |
-
background-size: 235px 34px;
|
| 105 |
-
}
|
| 106 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tinymce3-assets/mce-table-buttons.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
| 1 |
-
/**
|
| 2 |
-
* WordPress plugin.
|
| 3 |
-
*/
|
| 4 |
-
|
| 5 |
-
(function() {
|
| 6 |
-
var DOM = tinymce.DOM;
|
| 7 |
-
|
| 8 |
-
tinymce.create('tinymce.plugins.mcetablebuttons', {
|
| 9 |
-
init : function(ed, url) {
|
| 10 |
-
var mce_table_toolbar;
|
| 11 |
-
|
| 12 |
-
// Hides the specified toolbar and resizes the iframe
|
| 13 |
-
ed.onPostRender.add(function() {
|
| 14 |
-
mce_table_toolbar = ed.controlManager.get('toolbar3');
|
| 15 |
-
if ( ed.getParam('wordpress_adv_hidden', 1) && mce_table_toolbar )
|
| 16 |
-
DOM.hide(mce_table_toolbar.id);
|
| 17 |
-
});
|
| 18 |
-
|
| 19 |
-
ed.onExecCommand.add(function(ed, cmd, ui, val) {
|
| 20 |
-
if ( cmd == 'WP_Adv' ) {
|
| 21 |
-
if ( ed.settings.wordpress_adv_hidden == 1 )
|
| 22 |
-
DOM.hide( mce_table_toolbar.id );
|
| 23 |
-
else
|
| 24 |
-
DOM.show( mce_table_toolbar.id );
|
| 25 |
-
}
|
| 26 |
-
});
|
| 27 |
-
}
|
| 28 |
-
});
|
| 29 |
-
|
| 30 |
-
// Register plugin
|
| 31 |
-
tinymce.PluginManager.add('mcetablebuttons', tinymce.plugins.mcetablebuttons);
|
| 32 |
-
})();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tinymce3-assets/mce-table-buttons.png
DELETED
|
Binary file
|
tinymce3-table/cell.htm
DELETED
|
@@ -1,180 +0,0 @@
|
|
| 1 |
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
| 2 |
-
<html xmlns="http://www.w3.org/1999/xhtml">
|
| 3 |
-
<head>
|
| 4 |
-
<title>{#table_dlg.cell_title}</title>
|
| 5 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
| 6 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/mctabs.js"></script>
|
| 7 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/form_utils.js"></script>
|
| 8 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/validate.js"></script>
|
| 9 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/editable_selects.js"></script>
|
| 10 |
-
<script type="text/javascript" src="js/cell.js"></script>
|
| 11 |
-
<link href="css/cell.css" rel="stylesheet" type="text/css" />
|
| 12 |
-
</head>
|
| 13 |
-
<body id="tablecell" style="display: none" role="application">
|
| 14 |
-
<form onsubmit="updateAction();return false;" action="#">
|
| 15 |
-
<div class="tabs">
|
| 16 |
-
<ul>
|
| 17 |
-
<li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li>
|
| 18 |
-
<li id="advanced_tab" aria-controls="advanced_panel"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>
|
| 19 |
-
</ul>
|
| 20 |
-
</div>
|
| 21 |
-
|
| 22 |
-
<div class="panel_wrapper">
|
| 23 |
-
<div id="general_panel" class="panel current">
|
| 24 |
-
<fieldset>
|
| 25 |
-
<legend>{#table_dlg.general_props}</legend>
|
| 26 |
-
|
| 27 |
-
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
|
| 28 |
-
<tr>
|
| 29 |
-
<td><label for="align">{#table_dlg.align}</label></td>
|
| 30 |
-
<td>
|
| 31 |
-
<select id="align" name="align" class="mceFocus">
|
| 32 |
-
<option value="">{#not_set}</option>
|
| 33 |
-
<option value="center">{#table_dlg.align_middle}</option>
|
| 34 |
-
<option value="left">{#table_dlg.align_left}</option>
|
| 35 |
-
<option value="right">{#table_dlg.align_right}</option>
|
| 36 |
-
</select>
|
| 37 |
-
</td>
|
| 38 |
-
|
| 39 |
-
<td><label for="celltype">{#table_dlg.cell_type}</label></td>
|
| 40 |
-
<td>
|
| 41 |
-
<select id="celltype" name="celltype">
|
| 42 |
-
<option value="td">{#table_dlg.td}</option>
|
| 43 |
-
<option value="th">{#table_dlg.th}</option>
|
| 44 |
-
</select>
|
| 45 |
-
</td>
|
| 46 |
-
</tr>
|
| 47 |
-
|
| 48 |
-
<tr>
|
| 49 |
-
<td><label for="valign">{#table_dlg.valign}</label></td>
|
| 50 |
-
<td>
|
| 51 |
-
<select id="valign" name="valign">
|
| 52 |
-
<option value="">{#not_set}</option>
|
| 53 |
-
<option value="top">{#table_dlg.align_top}</option>
|
| 54 |
-
<option value="middle">{#table_dlg.align_middle}</option>
|
| 55 |
-
<option value="bottom">{#table_dlg.align_bottom}</option>
|
| 56 |
-
</select>
|
| 57 |
-
</td>
|
| 58 |
-
|
| 59 |
-
<td><label for="scope">{#table_dlg.scope}</label></td>
|
| 60 |
-
<td>
|
| 61 |
-
<select id="scope" name="scope">
|
| 62 |
-
<option value="">{#not_set}</option>
|
| 63 |
-
<option value="col">{#table.col}</option>
|
| 64 |
-
<option value="row">{#table.row}</option>
|
| 65 |
-
<option value="rowgroup">{#table_dlg.rowgroup}</option>
|
| 66 |
-
<option value="colgroup">{#table_dlg.colgroup}</option>
|
| 67 |
-
</select>
|
| 68 |
-
</td>
|
| 69 |
-
|
| 70 |
-
</tr>
|
| 71 |
-
|
| 72 |
-
<tr>
|
| 73 |
-
<td><label for="width">{#table_dlg.width}</label></td>
|
| 74 |
-
<td><input id="width" name="width" type="text" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>
|
| 75 |
-
|
| 76 |
-
<td><label for="height">{#table_dlg.height}</label></td>
|
| 77 |
-
<td><input id="height" name="height" type="text" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>
|
| 78 |
-
</tr>
|
| 79 |
-
|
| 80 |
-
<tr id="styleSelectRow">
|
| 81 |
-
<td><label for="class">{#class_name}</label></td>
|
| 82 |
-
<td colspan="3">
|
| 83 |
-
<select id="class" name="class" class="mceEditableSelect">
|
| 84 |
-
<option value="" selected="selected">{#not_set}</option>
|
| 85 |
-
</select>
|
| 86 |
-
</td>
|
| 87 |
-
</tr>
|
| 88 |
-
</table>
|
| 89 |
-
</fieldset>
|
| 90 |
-
</div>
|
| 91 |
-
|
| 92 |
-
<div id="advanced_panel" class="panel">
|
| 93 |
-
<fieldset>
|
| 94 |
-
<legend>{#table_dlg.advanced_props}</legend>
|
| 95 |
-
|
| 96 |
-
<table role="presentation" border="0" cellpadding="0" cellspacing="4">
|
| 97 |
-
<tr>
|
| 98 |
-
<td class="column1"><label for="id">{#table_dlg.id}</label></td>
|
| 99 |
-
<td><input id="id" name="id" type="text" value="" style="width: 200px" /></td>
|
| 100 |
-
</tr>
|
| 101 |
-
|
| 102 |
-
<tr>
|
| 103 |
-
<td><label for="style">{#table_dlg.style}</label></td>
|
| 104 |
-
<td><input type="text" id="style" name="style" value="" style="width: 200px;" onchange="changedStyle();" /></td>
|
| 105 |
-
</tr>
|
| 106 |
-
|
| 107 |
-
<tr>
|
| 108 |
-
<td class="column1"><label for="dir">{#table_dlg.langdir}</label></td>
|
| 109 |
-
<td>
|
| 110 |
-
<select id="dir" name="dir" style="width: 200px">
|
| 111 |
-
<option value="">{#not_set}</option>
|
| 112 |
-
<option value="ltr">{#table_dlg.ltr}</option>
|
| 113 |
-
<option value="rtl">{#table_dlg.rtl}</option>
|
| 114 |
-
</select>
|
| 115 |
-
</td>
|
| 116 |
-
</tr>
|
| 117 |
-
|
| 118 |
-
<tr>
|
| 119 |
-
<td class="column1"><label for="lang">{#table_dlg.langcode}</label></td>
|
| 120 |
-
<td>
|
| 121 |
-
<input id="lang" name="lang" type="text" value="" style="width: 200px" />
|
| 122 |
-
</td>
|
| 123 |
-
</tr>
|
| 124 |
-
|
| 125 |
-
<tr>
|
| 126 |
-
<td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td>
|
| 127 |
-
<td>
|
| 128 |
-
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
| 129 |
-
<tr>
|
| 130 |
-
<td><input id="backgroundimage" name="backgroundimage" type="text" value="" style="width: 200px" onchange="changedBackgroundImage();" /></td>
|
| 131 |
-
<td id="backgroundimagebrowsercontainer"> </td>
|
| 132 |
-
</tr>
|
| 133 |
-
</table>
|
| 134 |
-
</td>
|
| 135 |
-
</tr>
|
| 136 |
-
|
| 137 |
-
<tr role="group" aria-labelledby="bordercolor_label">
|
| 138 |
-
<td class="column1"><label id="bordercolor_label" for="bordercolor">{#table_dlg.bordercolor}</label></td>
|
| 139 |
-
<td>
|
| 140 |
-
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
| 141 |
-
<tr>
|
| 142 |
-
<td><input id="bordercolor" name="bordercolor" type="text" value="" size="9" onchange="updateColor('bordercolor_pick','bordercolor');changedColor();" /></td>
|
| 143 |
-
<td id="bordercolor_pickcontainer"> </td>
|
| 144 |
-
</tr>
|
| 145 |
-
</table>
|
| 146 |
-
</td>
|
| 147 |
-
</tr>
|
| 148 |
-
|
| 149 |
-
<tr role="group" aria-labelledby="bgcolor_label">
|
| 150 |
-
<td class="column1"><label id="bgcolor_label" for="bgcolor">{#table_dlg.bgcolor}</label></td>
|
| 151 |
-
<td>
|
| 152 |
-
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
| 153 |
-
<tr>
|
| 154 |
-
<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>
|
| 155 |
-
<td id="bgcolor_pickcontainer"> </td>
|
| 156 |
-
</tr>
|
| 157 |
-
</table>
|
| 158 |
-
</td>
|
| 159 |
-
</tr>
|
| 160 |
-
</table>
|
| 161 |
-
</fieldset>
|
| 162 |
-
</div>
|
| 163 |
-
</div>
|
| 164 |
-
|
| 165 |
-
<div class="mceActionPanel">
|
| 166 |
-
<div>
|
| 167 |
-
<select id="action" name="action">
|
| 168 |
-
<option value="cell">{#table_dlg.cell_cell}</option>
|
| 169 |
-
<option value="row">{#table_dlg.cell_row}</option>
|
| 170 |
-
<option value="col">{#table_dlg.cell_col}</option>
|
| 171 |
-
<option value="all">{#table_dlg.cell_all}</option>
|
| 172 |
-
</select>
|
| 173 |
-
</div>
|
| 174 |
-
|
| 175 |
-
<input type="submit" id="insert" name="insert" value="{#update}" />
|
| 176 |
-
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
| 177 |
-
</div>
|
| 178 |
-
</form>
|
| 179 |
-
</body>
|
| 180 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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2 |
-
|
| 3 |
-
.panel_wrapper div.current {
|
| 4 |
-
height: 200px;
|
| 5 |
-
}
|
| 6 |
-
|
| 7 |
-
.advfield {
|
| 8 |
-
width: 200px;
|
| 9 |
-
}
|
| 10 |
-
|
| 11 |
-
#action {
|
| 12 |
-
margin-bottom: 3px;
|
| 13 |
-
}
|
| 14 |
-
|
| 15 |
-
#class {
|
| 16 |
-
width: 150px;
|
| 17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tinymce3-table/css/row.css
DELETED
|
@@ -1,25 +0,0 @@
|
|
| 1 |
-
/* CSS file for row dialog in the table plugin */
|
| 2 |
-
|
| 3 |
-
.panel_wrapper div.current {
|
| 4 |
-
height: 200px;
|
| 5 |
-
}
|
| 6 |
-
|
| 7 |
-
.advfield {
|
| 8 |
-
width: 200px;
|
| 9 |
-
}
|
| 10 |
-
|
| 11 |
-
#action {
|
| 12 |
-
margin-bottom: 3px;
|
| 13 |
-
}
|
| 14 |
-
|
| 15 |
-
#rowtype,#align,#valign,#class,#height {
|
| 16 |
-
width: 150px;
|
| 17 |
-
}
|
| 18 |
-
|
| 19 |
-
#height {
|
| 20 |
-
width: 50px;
|
| 21 |
-
}
|
| 22 |
-
|
| 23 |
-
.col2 {
|
| 24 |
-
padding-left: 20px;
|
| 25 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tinymce3-table/css/table.css
DELETED
|
@@ -1,13 +0,0 @@
|
|
| 1 |
-
/* CSS file for table dialog in the table plugin */
|
| 2 |
-
|
| 3 |
-
.panel_wrapper div.current {
|
| 4 |
-
height: 245px;
|
| 5 |
-
}
|
| 6 |
-
|
| 7 |
-
.advfield {
|
| 8 |
-
width: 200px;
|
| 9 |
-
}
|
| 10 |
-
|
| 11 |
-
#class {
|
| 12 |
-
width: 150px;
|
| 13 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tinymce3-table/editor_plugin.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
(function(d){var e=d.each;function c(g,h){var j=h.ownerDocument,f=j.createRange(),k;f.setStartBefore(h);f.setEnd(g.endContainer,g.endOffset);k=j.createElement("body");k.appendChild(f.cloneContents());return k.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi,"-").replace(/<[^>]+>/g,"").length==0}function a(g,f){return parseInt(g.getAttribute(f)||1)}function b(H,G,K){var g,L,D,o;t();o=G.getParent(K.getStart(),"th,td");if(o){L=F(o);D=I();o=z(L.x,L.y)}function A(N,M){N=N.cloneNode(M);N.removeAttribute("id");return N}function t(){var M=0;g=[];e(["thead","tbody","tfoot"],function(N){var O=G.select("> "+N+" tr",H);e(O,function(P,Q){Q+=M;e(G.select("> td, > th",P),function(W,R){var S,T,U,V;if(g[Q]){while(g[Q][R]){R++}}U=a(W,"rowspan");V=a(W,"colspan");for(T=Q;T<Q+U;T++){if(!g[T]){g[T]=[]}for(S=R;S<R+V;S++){g[T][S]={part:N,real:T==Q&&S==R,elm:W,rowspan:U,colspan:V}}}})});M+=O.length})}function z(M,O){var N;N=g[O];if(N){return N[M]}}function s(O,M,N){if(O){N=parseInt(N);if(N===1){O.removeAttribute(M,1)}else{O.setAttribute(M,N,1)}}}function j(M){return M&&(G.hasClass(M.elm,"mceSelected")||M==o)}function k(){var M=[];e(H.rows,function(N){e(N.cells,function(O){if(G.hasClass(O,"mceSelected")||O==o.elm){M.push(N);return false}})});return M}function r(){var M=G.createRng();M.setStartAfter(H);M.setEndAfter(H);K.setRng(M);G.remove(H)}function f(M){var N;d.walk(M,function(P){var O;if(P.nodeType==3){e(G.getParents(P.parentNode,null,M).reverse(),function(Q){Q=A(Q,false);if(!N){N=O=Q}else{if(O){O.appendChild(Q)}}O=Q});if(O){O.innerHTML=d.isIE?" ":'<br data-mce-bogus="1" />'}return false}},"childNodes");M=A(M,false);s(M,"rowSpan",1);s(M,"colSpan",1);if(N){M.appendChild(N)}else{if(!d.isIE){M.innerHTML='<br data-mce-bogus="1" />'}}return M}function q(){var M=G.createRng();e(G.select("tr",H),function(N){if(N.cells.length==0){G.remove(N)}});if(G.select("tr",H).length==0){M.setStartAfter(H);M.setEndAfter(H);K.setRng(M);G.remove(H);return}e(G.select("thead,tbody,tfoot",H),function(N){if(N.rows.length==0){G.remove(N)}});t();row=g[Math.min(g.length-1,L.y)];if(row){K.select(row[Math.min(row.length-1,L.x)].elm,true);K.collapse(true)}}function u(S,Q,U,R){var P,N,M,O,T;P=g[Q][S].elm.parentNode;for(M=1;M<=U;M++){P=G.getNext(P,"tr");if(P){for(N=S;N>=0;N--){T=g[Q+M][N].elm;if(T.parentNode==P){for(O=1;O<=R;O++){G.insertAfter(f(T),T)}break}}if(N==-1){for(O=1;O<=R;O++){P.insertBefore(f(P.cells[0]),P.cells[0])}}}}}function C(){e(g,function(M,N){e(M,function(P,O){var S,R,T,Q;if(j(P)){P=P.elm;S=a(P,"colspan");R=a(P,"rowspan");if(S>1||R>1){s(P,"rowSpan",1);s(P,"colSpan",1);for(Q=0;Q<S-1;Q++){G.insertAfter(f(P),P)}u(O,N,R-1,S)}}})})}function p(V,S,Y){var P,O,X,W,U,R,T,M,V,N,Q;if(V){pos=F(V);P=pos.x;O=pos.y;X=P+(S-1);W=O+(Y-1)}else{L=D=null;e(g,function(Z,aa){e(Z,function(ac,ab){if(j(ac)){if(!L){L={x:ab,y:aa}}D={x:ab,y:aa}}})});P=L.x;O=L.y;X=D.x;W=D.y}T=z(P,O);M=z(X,W);if(T&&M&&T.part==M.part){C();t();T=z(P,O).elm;s(T,"colSpan",(X-P)+1);s(T,"rowSpan",(W-O)+1);for(R=O;R<=W;R++){for(U=P;U<=X;U++){if(!g[R]||!g[R][U]){continue}V=g[R][U].elm;if(V!=T){N=d.grep(V.childNodes);e(N,function(Z){T.appendChild(Z)});if(N.length){N=d.grep(T.childNodes);Q=0;e(N,function(Z){if(Z.nodeName=="BR"&&G.getAttrib(Z,"data-mce-bogus")&&Q++<N.length-1){T.removeChild(Z)}})}G.remove(V)}}}q()}}function l(Q){var M,S,P,R,T,U,N,V,O;e(g,function(W,X){e(W,function(Z,Y){if(j(Z)){Z=Z.elm;T=Z.parentNode;U=A(T,false);M=X;if(Q){return false}}});if(Q){return !M}});for(R=0;R<g[0].length;R++){if(!g[M][R]){continue}S=g[M][R].elm;if(S!=P){if(!Q){O=a(S,"rowspan");if(O>1){s(S,"rowSpan",O+1);continue}}else{if(M>0&&g[M-1][R]){V=g[M-1][R].elm;O=a(V,"rowSpan");if(O>1){s(V,"rowSpan",O+1);continue}}}N=f(S);s(N,"colSpan",S.colSpan);U.appendChild(N);P=S}}if(U.hasChildNodes()){if(!Q){G.insertAfter(U,T)}else{T.parentNode.insertBefore(U,T)}}}function h(N){var O,M;e(g,function(P,Q){e(P,function(S,R){if(j(S)){O=R;if(N){return false}}});if(N){return !O}});e(g,function(S,T){var P,Q,R;if(!S[O]){return}P=S[O].elm;if(P!=M){R=a(P,"colspan");Q=a(P,"rowspan");if(R==1){if(!N){G.insertAfter(f(P),P);u(O,T,Q-1,R)}else{P.parentNode.insertBefore(f(P),P);u(O,T,Q-1,R)}}else{s(P,"colSpan",P.colSpan+1)}M=P}})}function n(){var M=[];e(g,function(N,O){e(N,function(Q,P){if(j(Q)&&d.inArray(M,P)===-1){e(g,function(T){var R=T[P].elm,S;S=a(R,"colSpan");if(S>1){s(R,"colSpan",S-1)}else{G.remove(R)}});M.push(P)}})});q()}function m(){var N;function M(Q){var P,R,O;P=G.getNext(Q,"tr");e(Q.cells,function(S){var T=a(S,"rowSpan");if(T>1){s(S,"rowSpan",T-1);R=F(S);u(R.x,R.y,1,1)}});R=F(Q.cells[0]);e(g[R.y],function(S){var T;S=S.elm;if(S!=O){T=a(S,"rowSpan");if(T<=1){G.remove(S)}else{s(S,"rowSpan",T-1)}O=S}})}N=k();e(N.reverse(),function(O){M(O)});q()}function E(){var M=k();G.remove(M);q();return M}function J(){var M=k();e(M,function(O,N){M[N]=A(O,true)});return M}function B(O,N){var P=k(),M=P[N?0:P.length-1],Q=M.cells.length;e(g,function(S){var R;Q=0;e(S,function(U,T){if(U.real){Q+=U.colspan}if(U.elm.parentNode==M){R=1}});if(R){return false}});if(!N){O.reverse()}e(O,function(T){var S=T.cells.length,R;for(i=0;i<S;i++){R=T.cells[i];s(R,"colSpan",1);s(R,"rowSpan",1)}for(i=S;i<Q;i++){T.appendChild(f(T.cells[S-1]))}for(i=Q;i<S;i++){G.remove(T.cells[i])}if(N){M.parentNode.insertBefore(T,M)}else{G.insertAfter(T,M)}});G.removeClass(G.select("td.mceSelected,th.mceSelected"),"mceSelected")}function F(M){var N;e(g,function(O,P){e(O,function(R,Q){if(R.elm==M){N={x:Q,y:P};return false}});return !N});return N}function w(M){L=F(M)}function I(){var O,N,M;N=M=0;e(g,function(P,Q){e(P,function(S,R){var U,T;if(j(S)){S=g[Q][R];if(R>N){N=R}if(Q>M){M=Q}if(S.real){U=S.colspan-1;T=S.rowspan-1;if(U){if(R+U>N){N=R+U}}if(T){if(Q+T>M){M=Q+T}}}}})});return{x:N,y:M}}function v(S){var P,O,U,T,N,M,Q,R;D=F(S);if(L&&D){P=Math.min(L.x,D.x);O=Math.min(L.y,D.y);U=Math.max(L.x,D.x);T=Math.max(L.y,D.y);N=U;M=T;for(y=O;y<=M;y++){S=g[y][P];if(!S.real){if(P-(S.colspan-1)<P){P-=S.colspan-1}}}for(x=P;x<=N;x++){S=g[O][x];if(!S.real){if(O-(S.rowspan-1)<O){O-=S.rowspan-1}}}for(y=O;y<=T;y++){for(x=P;x<=U;x++){S=g[y][x];if(S.real){Q=S.colspan-1;R=S.rowspan-1;if(Q){if(x+Q>N){N=x+Q}}if(R){if(y+R>M){M=y+R}}}}}G.removeClass(G.select("td.mceSelected,th.mceSelected"),"mceSelected");for(y=O;y<=M;y++){for(x=P;x<=N;x++){if(g[y][x]){G.addClass(g[y][x].elm,"mceSelected")}}}}}d.extend(this,{deleteTable:r,split:C,merge:p,insertRow:l,insertCol:h,deleteCols:n,deleteRows:m,cutRows:E,copyRows:J,pasteRows:B,getPos:F,setStartCell:w,setEndCell:v})}d.create("tinymce.plugins.TablePlugin",{init:function(g,h){var f,m,j=true;function l(p){var o=g.selection,n=g.dom.getParent(p||o.getNode(),"table");if(n){return new b(n,g.dom,o)}}function k(){g.getBody().style.webkitUserSelect="";if(j){g.dom.removeClass(g.dom.select("td.mceSelected,th.mceSelected"),"mceSelected");j=false}}e([["table","table.desc","mceInsertTable",true],["delete_table","table.del","mceTableDelete"],["delete_col","table.delete_col_desc","mceTableDeleteCol"],["delete_row","table.delete_row_desc","mceTableDeleteRow"],["col_after","table.col_after_desc","mceTableInsertColAfter"],["col_before","table.col_before_desc","mceTableInsertColBefore"],["row_after","table.row_after_desc","mceTableInsertRowAfter"],["row_before","table.row_before_desc","mceTableInsertRowBefore"],["row_props","table.row_desc","mceTableRowProps",true],["cell_props","table.cell_desc","mceTableCellProps",true],["split_cells","table.split_cells_desc","mceTableSplitCells",true],["merge_cells","table.merge_cells_desc","mceTableMergeCells",true]],function(n){g.addButton(n[0],{title:n[1],cmd:n[2],ui:n[3]})});if(!d.isIE){g.onClick.add(function(n,o){o=o.target;if(o.nodeName==="TABLE"){n.selection.select(o);n.nodeChanged()}})}g.onPreProcess.add(function(o,p){var n,q,r,t=o.dom,s;n=t.select("table",p.node);q=n.length;while(q--){r=n[q];t.setAttrib(r,"data-mce-style","");if((s=t.getAttrib(r,"width"))){t.setStyle(r,"width",s);t.setAttrib(r,"width","")}if((s=t.getAttrib(r,"height"))){t.setStyle(r,"height",s);t.setAttrib(r,"height","")}}});g.onNodeChange.add(function(q,o,s){var r;s=q.selection.getStart();r=q.dom.getParent(s,"td,th,caption");o.setActive("table",s.nodeName==="TABLE"||!!r);if(r&&r.nodeName==="CAPTION"){r=0}o.setDisabled("delete_table",!r);o.setDisabled("delete_col",!r);o.setDisabled("delete_table",!r);o.setDisabled("delete_row",!r);o.setDisabled("col_after",!r);o.setDisabled("col_before",!r);o.setDisabled("row_after",!r);o.setDisabled("row_before",!r);o.setDisabled("row_props",!r);o.setDisabled("cell_props",!r);o.setDisabled("split_cells",!r);o.setDisabled("merge_cells",!r)});g.onInit.add(function(r){var p,t,q=r.dom,u;f=r.windowManager;r.onMouseDown.add(function(w,z){if(z.button!=2){k();t=q.getParent(z.target,"td,th");p=q.getParent(t,"table")}});q.bind(r.getDoc(),"mouseover",function(C){var A,z,B=C.target;if(t&&(u||B!=t)&&(B.nodeName=="TD"||B.nodeName=="TH")){z=q.getParent(B,"table");if(z==p){if(!u){u=l(z);u.setStartCell(t);r.getBody().style.webkitUserSelect="none"}u.setEndCell(B);j=true}A=r.selection.getSel();try{if(A.removeAllRanges){A.removeAllRanges()}else{A.empty()}}catch(w){}C.preventDefault()}});r.onMouseUp.add(function(F,G){var z,B=F.selection,H,I=B.getSel(),w,C,A,E;if(t){if(u){F.getBody().style.webkitUserSelect=""}function D(J,L){var K=new d.dom.TreeWalker(J,J);do{if(J.nodeType==3&&d.trim(J.nodeValue).length!=0){if(L){z.setStart(J,0)}else{z.setEnd(J,J.nodeValue.length)}return}if(J.nodeName=="BR"){if(L){z.setStartBefore(J)}else{z.setEndBefore(J)}return}}while(J=(L?K.next():K.prev()))}H=q.select("td.mceSelected,th.mceSelected");if(H.length>0){z=q.createRng();C=H[0];E=H[H.length-1];z.setStartBefore(C);z.setEndAfter(C);D(C,1);w=new d.dom.TreeWalker(C,q.getParent(H[0],"table"));do{if(C.nodeName=="TD"||C.nodeName=="TH"){if(!q.hasClass(C,"mceSelected")){break}A=C}}while(C=w.next());D(A);B.setRng(z)}F.nodeChanged();t=u=p=null}});r.onKeyUp.add(function(w,z){k()});r.onKeyDown.add(function(w,z){n(w)});r.onMouseDown.add(function(w,z){if(z.button!=2){n(w)}});function o(D,z,A,F){var B=3,G=D.dom.getParent(z.startContainer,"TABLE"),C,w,E;if(G){C=G.parentNode}w=z.startContainer.nodeType==B&&z.startOffset==0&&z.endOffset==0&&F&&(A.nodeName=="TR"||A==C);E=(A.nodeName=="TD"||A.nodeName=="TH")&&!F;return w||E}function n(A){if(!d.isWebKit){return}var z=A.selection.getRng();var C=A.selection.getNode();var B=A.dom.getParent(z.startContainer,"TD,TH");if(!o(A,z,C,B)){return}if(!B){B=C}var w=B.lastChild;while(w.lastChild){w=w.lastChild}z.setEnd(w,w.nodeValue.length);A.selection.setRng(z)}r.plugins.table.fixTableCellSelection=n;if(r&&r.plugins.contextmenu){r.plugins.contextmenu.onContextMenu.add(function(A,w,C){var D,B=r.selection,z=B.getNode()||r.getBody();if(r.dom.getParent(C,"td")||r.dom.getParent(C,"th")||r.dom.select("td.mceSelected,th.mceSelected").length){w.removeAll();if(z.nodeName=="A"&&!r.dom.getAttrib(z,"name")){w.add({title:"advanced.link_desc",icon:"link",cmd:r.plugins.advlink?"mceAdvLink":"mceLink",ui:true});w.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"});w.addSeparator()}if(z.nodeName=="IMG"&&z.className.indexOf("mceItem")==-1){w.add({title:"advanced.image_desc",icon:"image",cmd:r.plugins.advimage?"mceAdvImage":"mceImage",ui:true});w.addSeparator()}w.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",value:{action:"insert"}});w.add({title:"table.props_desc",icon:"table_props",cmd:"mceInsertTable"});w.add({title:"table.del",icon:"delete_table",cmd:"mceTableDelete"});w.addSeparator();D=w.addMenu({title:"table.cell"});D.add({title:"table.cell_desc",icon:"cell_props",cmd:"mceTableCellProps"});D.add({title:"table.split_cells_desc",icon:"split_cells",cmd:"mceTableSplitCells"});D.add({title:"table.merge_cells_desc",icon:"merge_cells",cmd:"mceTableMergeCells"});D=w.addMenu({title:"table.row"});D.add({title:"table.row_desc",icon:"row_props",cmd:"mceTableRowProps"});D.add({title:"table.row_before_desc",icon:"row_before",cmd:"mceTableInsertRowBefore"});D.add({title:"table.row_after_desc",icon:"row_after",cmd:"mceTableInsertRowAfter"});D.add({title:"table.delete_row_desc",icon:"delete_row",cmd:"mceTableDeleteRow"});D.addSeparator();D.add({title:"table.cut_row_desc",icon:"cut",cmd:"mceTableCutRow"});D.add({title:"table.copy_row_desc",icon:"copy",cmd:"mceTableCopyRow"});D.add({title:"table.paste_row_before_desc",icon:"paste",cmd:"mceTablePasteRowBefore"}).setDisabled(!m);D.add({title:"table.paste_row_after_desc",icon:"paste",cmd:"mceTablePasteRowAfter"}).setDisabled(!m);D=w.addMenu({title:"table.col"});D.add({title:"table.col_before_desc",icon:"col_before",cmd:"mceTableInsertColBefore"});D.add({title:"table.col_after_desc",icon:"col_after",cmd:"mceTableInsertColAfter"});D.add({title:"table.delete_col_desc",icon:"delete_col",cmd:"mceTableDeleteCol"})}else{w.add({title:"table.desc",icon:"table",cmd:"mceInsertTable"})}})}if(d.isWebKit){function v(C,N){var L=d.VK;var Q=N.keyCode;function O(Y,U,S){var T=Y?"previousSibling":"nextSibling";var Z=C.dom.getParent(U,"tr");var X=Z[T];if(X){z(C,U,X,Y);d.dom.Event.cancel(S);return true}else{var aa=C.dom.getParent(Z,"table");var W=Z.parentNode;var R=W.nodeName.toLowerCase();if(R==="tbody"||R===(Y?"tfoot":"thead")){var V=w(Y,aa,W,"tbody");if(V!==null){return K(Y,V,U,S)}}return M(Y,Z,T,aa,S)}}function w(V,T,U,X){var S=C.dom.select(">"+X,T);var R=S.indexOf(U);if(V&&R===0||!V&&R===S.length-1){return B(V,T)}else{if(R===-1){var W=U.tagName.toLowerCase()==="thead"?0:S.length-1;return S[W]}else{return S[R+(V?-1:1)]}}}function B(U,T){var S=U?"thead":"tfoot";var R=C.dom.select(">"+S,T);return R.length!==0?R[0]:null}function K(V,T,S,U){var R=J(T,V);R&&z(C,S,R,V);d.dom.Event.cancel(U);return true}function M(Y,U,R,X,W){var S=X[R];if(S){F(S);return true}else{var V=C.dom.getParent(X,"td,th");if(V){return O(Y,V,W)}else{var T=J(U,!Y);F(T);return d.dom.Event.cancel(W)}}}function J(S,R){var T=S&&S[R?"lastChild":"firstChild"];return T&&T.nodeName==="BR"?C.dom.getParent(T,"td,th"):T}function F(R){C.selection.setCursorLocation(R,0)}function A(){return Q==L.UP||Q==L.DOWN}function D(R){var T=R.selection.getNode();var S=R.dom.getParent(T,"tr");return S!==null}function P(S){var R=0;var T=S;while(T.previousSibling){T=T.previousSibling;R=R+a(T,"colspan")}return R}function E(T,R){var U=0;var S=0;e(T.children,function(V,W){U=U+a(V,"colspan");S=W;if(U>R){return false}});return S}function z(T,W,Y,V){var X=P(T.dom.getParent(W,"td,th"));var S=E(Y,X);var R=Y.childNodes[S];var U=J(R,V);F(U||R)}function H(R){var T=C.selection.getNode();var U=C.dom.getParent(T,"td,th");var S=C.dom.getParent(R,"td,th");return U&&U!==S&&I(U,S)}function I(S,R){return C.dom.getParent(S,"TABLE")===C.dom.getParent(R,"TABLE")}if(A()&&D(C)){var G=C.selection.getNode();setTimeout(function(){if(H(G)){O(!N.shiftKey&&Q===L.UP,G,N)}},0)}}r.onKeyDown.add(v)}function s(){var w;for(w=r.getBody().lastChild;w&&w.nodeType==3&&!w.nodeValue.length;w=w.previousSibling){}if(w&&w.nodeName=="TABLE"){if(r.settings.forced_root_block){r.dom.add(r.getBody(),r.settings.forced_root_block,null,d.isIE?" ":'<br data-mce-bogus="1" />')}else{r.dom.add(r.getBody(),"br",{"data-mce-bogus":"1"})}}}if(d.isGecko){r.onKeyDown.add(function(z,B){var w,A,C=z.dom;if(B.keyCode==37||B.keyCode==38){w=z.selection.getRng();A=C.getParent(w.startContainer,"table");if(A&&z.getBody().firstChild==A){if(c(w,A)){w=C.createRng();w.setStartBefore(A);w.setEndBefore(A);z.selection.setRng(w);B.preventDefault()}}}})}r.onKeyUp.add(s);r.onSetContent.add(s);r.onVisualAid.add(s);r.onPreProcess.add(function(w,A){var z=A.node.lastChild;if(z&&(z.nodeName=="BR"||(z.childNodes.length==1&&(z.firstChild.nodeName=="BR"||z.firstChild.nodeValue=="\u00a0")))&&z.previousSibling&&z.previousSibling.nodeName=="TABLE"){w.dom.remove(z)}});s();r.startContent=r.getContent({format:"raw"})});e({mceTableSplitCells:function(n){n.split()},mceTableMergeCells:function(o){var p,q,n;n=g.dom.getParent(g.selection.getNode(),"th,td");if(n){p=n.rowSpan;q=n.colSpan}if(!g.dom.select("td.mceSelected,th.mceSelected").length){f.open({url:h+"/merge_cells.htm",width:240+parseInt(g.getLang("table.merge_cells_delta_width",0)),height:110+parseInt(g.getLang("table.merge_cells_delta_height",0)),inline:1},{rows:p,cols:q,onaction:function(r){o.merge(n,r.cols,r.rows)},plugin_url:h})}else{o.merge()}},mceTableInsertRowBefore:function(n){n.insertRow(true)},mceTableInsertRowAfter:function(n){n.insertRow()},mceTableInsertColBefore:function(n){n.insertCol(true)},mceTableInsertColAfter:function(n){n.insertCol()},mceTableDeleteCol:function(n){n.deleteCols()},mceTableDeleteRow:function(n){n.deleteRows()},mceTableCutRow:function(n){m=n.cutRows()},mceTableCopyRow:function(n){m=n.copyRows()},mceTablePasteRowBefore:function(n){n.pasteRows(m,true)},mceTablePasteRowAfter:function(n){n.pasteRows(m)},mceTableDelete:function(n){n.deleteTable()}},function(o,n){g.addCommand(n,function(){var p=l();if(p){o(p);g.execCommand("mceRepaint");k()}})});e({mceInsertTable:function(n){f.open({url:h+"/table.htm",width:400+parseInt(g.getLang("table.table_delta_width",0)),height:320+parseInt(g.getLang("table.table_delta_height",0)),inline:1},{plugin_url:h,action:n?n.action:0})},mceTableRowProps:function(){f.open({url:h+"/row.htm",width:400+parseInt(g.getLang("table.rowprops_delta_width",0)),height:295+parseInt(g.getLang("table.rowprops_delta_height",0)),inline:1},{plugin_url:h})},mceTableCellProps:function(){f.open({url:h+"/cell.htm",width:400+parseInt(g.getLang("table.cellprops_delta_width",0)),height:295+parseInt(g.getLang("table.cellprops_delta_height",0)),inline:1},{plugin_url:h})}},function(o,n){g.addCommand(n,function(p,q){o(q)})})}});d.PluginManager.add("table",d.plugins.TablePlugin)})(tinymce);
|
|
|
tinymce3-table/editor_plugin_src.js
DELETED
|
@@ -1,1452 +0,0 @@
|
|
| 1 |
-
/**
|
| 2 |
-
* editor_plugin_src.js
|
| 3 |
-
*
|
| 4 |
-
* Copyright 2009, Moxiecode Systems AB
|
| 5 |
-
* Released under LGPL License.
|
| 6 |
-
*
|
| 7 |
-
* License: http://tinymce.moxiecode.com/license
|
| 8 |
-
* Contributing: http://tinymce.moxiecode.com/contributing
|
| 9 |
-
*/
|
| 10 |
-
|
| 11 |
-
(function(tinymce) {
|
| 12 |
-
var each = tinymce.each;
|
| 13 |
-
|
| 14 |
-
// Checks if the selection/caret is at the start of the specified block element
|
| 15 |
-
function isAtStart(rng, par) {
|
| 16 |
-
var doc = par.ownerDocument, rng2 = doc.createRange(), elm;
|
| 17 |
-
|
| 18 |
-
rng2.setStartBefore(par);
|
| 19 |
-
rng2.setEnd(rng.endContainer, rng.endOffset);
|
| 20 |
-
|
| 21 |
-
elm = doc.createElement('body');
|
| 22 |
-
elm.appendChild(rng2.cloneContents());
|
| 23 |
-
|
| 24 |
-
// Check for text characters of other elements that should be treated as content
|
| 25 |
-
return elm.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi, '-').replace(/<[^>]+>/g, '').length == 0;
|
| 26 |
-
};
|
| 27 |
-
|
| 28 |
-
function getSpanVal(td, name) {
|
| 29 |
-
return parseInt(td.getAttribute(name) || 1);
|
| 30 |
-
}
|
| 31 |
-
|
| 32 |
-
/**
|
| 33 |
-
* Table Grid class.
|
| 34 |
-
*/
|
| 35 |
-
function TableGrid(table, dom, selection) {
|
| 36 |
-
var grid, startPos, endPos, selectedCell;
|
| 37 |
-
|
| 38 |
-
buildGrid();
|
| 39 |
-
selectedCell = dom.getParent(selection.getStart(), 'th,td');
|
| 40 |
-
if (selectedCell) {
|
| 41 |
-
startPos = getPos(selectedCell);
|
| 42 |
-
endPos = findEndPos();
|
| 43 |
-
selectedCell = getCell(startPos.x, startPos.y);
|
| 44 |
-
}
|
| 45 |
-
|
| 46 |
-
function cloneNode(node, children) {
|
| 47 |
-
node = node.cloneNode(children);
|
| 48 |
-
node.removeAttribute('id');
|
| 49 |
-
|
| 50 |
-
return node;
|
| 51 |
-
}
|
| 52 |
-
|
| 53 |
-
function buildGrid() {
|
| 54 |
-
var startY = 0;
|
| 55 |
-
|
| 56 |
-
grid = [];
|
| 57 |
-
|
| 58 |
-
each(['thead', 'tbody', 'tfoot'], function(part) {
|
| 59 |
-
var rows = dom.select('> ' + part + ' tr', table);
|
| 60 |
-
|
| 61 |
-
each(rows, function(tr, y) {
|
| 62 |
-
y += startY;
|
| 63 |
-
|
| 64 |
-
each(dom.select('> td, > th', tr), function(td, x) {
|
| 65 |
-
var x2, y2, rowspan, colspan;
|
| 66 |
-
|
| 67 |
-
// Skip over existing cells produced by rowspan
|
| 68 |
-
if (grid[y]) {
|
| 69 |
-
while (grid[y][x])
|
| 70 |
-
x++;
|
| 71 |
-
}
|
| 72 |
-
|
| 73 |
-
// Get col/rowspan from cell
|
| 74 |
-
rowspan = getSpanVal(td, 'rowspan');
|
| 75 |
-
colspan = getSpanVal(td, 'colspan');
|
| 76 |
-
|
| 77 |
-
// Fill out rowspan/colspan right and down
|
| 78 |
-
for (y2 = y; y2 < y + rowspan; y2++) {
|
| 79 |
-
if (!grid[y2])
|
| 80 |
-
grid[y2] = [];
|
| 81 |
-
|
| 82 |
-
for (x2 = x; x2 < x + colspan; x2++) {
|
| 83 |
-
grid[y2][x2] = {
|
| 84 |
-
part : part,
|
| 85 |
-
real : y2 == y && x2 == x,
|
| 86 |
-
elm : td,
|
| 87 |
-
rowspan : rowspan,
|
| 88 |
-
colspan : colspan
|
| 89 |
-
};
|
| 90 |
-
}
|
| 91 |
-
}
|
| 92 |
-
});
|
| 93 |
-
});
|
| 94 |
-
|
| 95 |
-
startY += rows.length;
|
| 96 |
-
});
|
| 97 |
-
};
|
| 98 |
-
|
| 99 |
-
function getCell(x, y) {
|
| 100 |
-
var row;
|
| 101 |
-
|
| 102 |
-
row = grid[y];
|
| 103 |
-
if (row)
|
| 104 |
-
return row[x];
|
| 105 |
-
};
|
| 106 |
-
|
| 107 |
-
function setSpanVal(td, name, val) {
|
| 108 |
-
if (td) {
|
| 109 |
-
val = parseInt(val);
|
| 110 |
-
|
| 111 |
-
if (val === 1)
|
| 112 |
-
td.removeAttribute(name, 1);
|
| 113 |
-
else
|
| 114 |
-
td.setAttribute(name, val, 1);
|
| 115 |
-
}
|
| 116 |
-
}
|
| 117 |
-
|
| 118 |
-
function isCellSelected(cell) {
|
| 119 |
-
return cell && (dom.hasClass(cell.elm, 'mceSelected') || cell == selectedCell);
|
| 120 |
-
};
|
| 121 |
-
|
| 122 |
-
function getSelectedRows() {
|
| 123 |
-
var rows = [];
|
| 124 |
-
|
| 125 |
-
each(table.rows, function(row) {
|
| 126 |
-
each(row.cells, function(cell) {
|
| 127 |
-
if (dom.hasClass(cell, 'mceSelected') || cell == selectedCell.elm) {
|
| 128 |
-
rows.push(row);
|
| 129 |
-
return false;
|
| 130 |
-
}
|
| 131 |
-
});
|
| 132 |
-
});
|
| 133 |
-
|
| 134 |
-
return rows;
|
| 135 |
-
};
|
| 136 |
-
|
| 137 |
-
function deleteTable() {
|
| 138 |
-
var rng = dom.createRng();
|
| 139 |
-
|
| 140 |
-
rng.setStartAfter(table);
|
| 141 |
-
rng.setEndAfter(table);
|
| 142 |
-
|
| 143 |
-
selection.setRng(rng);
|
| 144 |
-
|
| 145 |
-
dom.remove(table);
|
| 146 |
-
};
|
| 147 |
-
|
| 148 |
-
function cloneCell(cell) {
|
| 149 |
-
var formatNode;
|
| 150 |
-
|
| 151 |
-
// Clone formats
|
| 152 |
-
tinymce.walk(cell, function(node) {
|
| 153 |
-
var curNode;
|
| 154 |
-
|
| 155 |
-
if (node.nodeType == 3) {
|
| 156 |
-
each(dom.getParents(node.parentNode, null, cell).reverse(), function(node) {
|
| 157 |
-
node = cloneNode(node, false);
|
| 158 |
-
|
| 159 |
-
if (!formatNode)
|
| 160 |
-
formatNode = curNode = node;
|
| 161 |
-
else if (curNode)
|
| 162 |
-
curNode.appendChild(node);
|
| 163 |
-
|
| 164 |
-
curNode = node;
|
| 165 |
-
});
|
| 166 |
-
|
| 167 |
-
// Add something to the inner node
|
| 168 |
-
if (curNode)
|
| 169 |
-
curNode.innerHTML = tinymce.isIE ? ' ' : '<br data-mce-bogus="1" />';
|
| 170 |
-
|
| 171 |
-
return false;
|
| 172 |
-
}
|
| 173 |
-
}, 'childNodes');
|
| 174 |
-
|
| 175 |
-
cell = cloneNode(cell, false);
|
| 176 |
-
setSpanVal(cell, 'rowSpan', 1);
|
| 177 |
-
setSpanVal(cell, 'colSpan', 1);
|
| 178 |
-
|
| 179 |
-
if (formatNode) {
|
| 180 |
-
cell.appendChild(formatNode);
|
| 181 |
-
} else {
|
| 182 |
-
if (!tinymce.isIE)
|
| 183 |
-
cell.innerHTML = '<br data-mce-bogus="1" />';
|
| 184 |
-
}
|
| 185 |
-
|
| 186 |
-
return cell;
|
| 187 |
-
};
|
| 188 |
-
|
| 189 |
-
function cleanup() {
|
| 190 |
-
var rng = dom.createRng();
|
| 191 |
-
|
| 192 |
-
// Empty rows
|
| 193 |
-
each(dom.select('tr', table), function(tr) {
|
| 194 |
-
if (tr.cells.length == 0)
|
| 195 |
-
dom.remove(tr);
|
| 196 |
-
});
|
| 197 |
-
|
| 198 |
-
// Empty table
|
| 199 |
-
if (dom.select('tr', table).length == 0) {
|
| 200 |
-
rng.setStartAfter(table);
|
| 201 |
-
rng.setEndAfter(table);
|
| 202 |
-
selection.setRng(rng);
|
| 203 |
-
dom.remove(table);
|
| 204 |
-
return;
|
| 205 |
-
}
|
| 206 |
-
|
| 207 |
-
// Empty header/body/footer
|
| 208 |
-
each(dom.select('thead,tbody,tfoot', table), function(part) {
|
| 209 |
-
if (part.rows.length == 0)
|
| 210 |
-
dom.remove(part);
|
| 211 |
-
});
|
| 212 |
-
|
| 213 |
-
// Restore selection to start position if it still exists
|
| 214 |
-
buildGrid();
|
| 215 |
-
|
| 216 |
-
// Restore the selection to the closest table position
|
| 217 |
-
row = grid[Math.min(grid.length - 1, startPos.y)];
|
| 218 |
-
if (row) {
|
| 219 |
-
selection.select(row[Math.min(row.length - 1, startPos.x)].elm, true);
|
| 220 |
-
selection.collapse(true);
|
| 221 |
-
}
|
| 222 |
-
};
|
| 223 |
-
|
| 224 |
-
function fillLeftDown(x, y, rows, cols) {
|
| 225 |
-
var tr, x2, r, c, cell;
|
| 226 |
-
|
| 227 |
-
tr = grid[y][x].elm.parentNode;
|
| 228 |
-
for (r = 1; r <= rows; r++) {
|
| 229 |
-
tr = dom.getNext(tr, 'tr');
|
| 230 |
-
|
| 231 |
-
if (tr) {
|
| 232 |
-
// Loop left to find real cell
|
| 233 |
-
for (x2 = x; x2 >= 0; x2--) {
|
| 234 |
-
cell = grid[y + r][x2].elm;
|
| 235 |
-
|
| 236 |
-
if (cell.parentNode == tr) {
|
| 237 |
-
// Append clones after
|
| 238 |
-
for (c = 1; c <= cols; c++)
|
| 239 |
-
dom.insertAfter(cloneCell(cell), cell);
|
| 240 |
-
|
| 241 |
-
break;
|
| 242 |
-
}
|
| 243 |
-
}
|
| 244 |
-
|
| 245 |
-
if (x2 == -1) {
|
| 246 |
-
// Insert nodes before first cell
|
| 247 |
-
for (c = 1; c <= cols; c++)
|
| 248 |
-
tr.insertBefore(cloneCell(tr.cells[0]), tr.cells[0]);
|
| 249 |
-
}
|
| 250 |
-
}
|
| 251 |
-
}
|
| 252 |
-
};
|
| 253 |
-
|
| 254 |
-
function split() {
|
| 255 |
-
each(grid, function(row, y) {
|
| 256 |
-
each(row, function(cell, x) {
|
| 257 |
-
var colSpan, rowSpan, newCell, i;
|
| 258 |
-
|
| 259 |
-
if (isCellSelected(cell)) {
|
| 260 |
-
cell = cell.elm;
|
| 261 |
-
colSpan = getSpanVal(cell, 'colspan');
|
| 262 |
-
rowSpan = getSpanVal(cell, 'rowspan');
|
| 263 |
-
|
| 264 |
-
if (colSpan > 1 || rowSpan > 1) {
|
| 265 |
-
setSpanVal(cell, 'rowSpan', 1);
|
| 266 |
-
setSpanVal(cell, 'colSpan', 1);
|
| 267 |
-
|
| 268 |
-
// Insert cells right
|
| 269 |
-
for (i = 0; i < colSpan - 1; i++)
|
| 270 |
-
dom.insertAfter(cloneCell(cell), cell);
|
| 271 |
-
|
| 272 |
-
fillLeftDown(x, y, rowSpan - 1, colSpan);
|
| 273 |
-
}
|
| 274 |
-
}
|
| 275 |
-
});
|
| 276 |
-
});
|
| 277 |
-
};
|
| 278 |
-
|
| 279 |
-
function merge(cell, cols, rows) {
|
| 280 |
-
var startX, startY, endX, endY, x, y, startCell, endCell, cell, children, count;
|
| 281 |
-
|
| 282 |
-
// Use specified cell and cols/rows
|
| 283 |
-
if (cell) {
|
| 284 |
-
pos = getPos(cell);
|
| 285 |
-
startX = pos.x;
|
| 286 |
-
startY = pos.y;
|
| 287 |
-
endX = startX + (cols - 1);
|
| 288 |
-
endY = startY + (rows - 1);
|
| 289 |
-
} else {
|
| 290 |
-
startPos = endPos = null;
|
| 291 |
-
|
| 292 |
-
// Calculate start/end pos by checking for selected cells in grid works better with context menu
|
| 293 |
-
each(grid, function(row, y) {
|
| 294 |
-
each(row, function(cell, x) {
|
| 295 |
-
if (isCellSelected(cell)) {
|
| 296 |
-
if (!startPos) {
|
| 297 |
-
startPos = {x: x, y: y};
|
| 298 |
-
}
|
| 299 |
-
|
| 300 |
-
endPos = {x: x, y: y};
|
| 301 |
-
}
|
| 302 |
-
});
|
| 303 |
-
});
|
| 304 |
-
|
| 305 |
-
// Use selection
|
| 306 |
-
startX = startPos.x;
|
| 307 |
-
startY = startPos.y;
|
| 308 |
-
endX = endPos.x;
|
| 309 |
-
endY = endPos.y;
|
| 310 |
-
}
|
| 311 |
-
|
| 312 |
-
// Find start/end cells
|
| 313 |
-
startCell = getCell(startX, startY);
|
| 314 |
-
endCell = getCell(endX, endY);
|
| 315 |
-
|
| 316 |
-
// Check if the cells exists and if they are of the same part for example tbody = tbody
|
| 317 |
-
if (startCell && endCell && startCell.part == endCell.part) {
|
| 318 |
-
// Split and rebuild grid
|
| 319 |
-
split();
|
| 320 |
-
buildGrid();
|
| 321 |
-
|
| 322 |
-
// Set row/col span to start cell
|
| 323 |
-
startCell = getCell(startX, startY).elm;
|
| 324 |
-
setSpanVal(startCell, 'colSpan', (endX - startX) + 1);
|
| 325 |
-
setSpanVal(startCell, 'rowSpan', (endY - startY) + 1);
|
| 326 |
-
|
| 327 |
-
// Remove other cells and add it's contents to the start cell
|
| 328 |
-
for (y = startY; y <= endY; y++) {
|
| 329 |
-
for (x = startX; x <= endX; x++) {
|
| 330 |
-
if (!grid[y] || !grid[y][x])
|
| 331 |
-
continue;
|
| 332 |
-
|
| 333 |
-
cell = grid[y][x].elm;
|
| 334 |
-
|
| 335 |
-
if (cell != startCell) {
|
| 336 |
-
// Move children to startCell
|
| 337 |
-
children = tinymce.grep(cell.childNodes);
|
| 338 |
-
each(children, function(node) {
|
| 339 |
-
startCell.appendChild(node);
|
| 340 |
-
});
|
| 341 |
-
|
| 342 |
-
// Remove bogus nodes if there is children in the target cell
|
| 343 |
-
if (children.length) {
|
| 344 |
-
children = tinymce.grep(startCell.childNodes);
|
| 345 |
-
count = 0;
|
| 346 |
-
each(children, function(node) {
|
| 347 |
-
if (node.nodeName == 'BR' && dom.getAttrib(node, 'data-mce-bogus') && count++ < children.length - 1)
|
| 348 |
-
startCell.removeChild(node);
|
| 349 |
-
});
|
| 350 |
-
}
|
| 351 |
-
|
| 352 |
-
// Remove cell
|
| 353 |
-
dom.remove(cell);
|
| 354 |
-
}
|
| 355 |
-
}
|
| 356 |
-
}
|
| 357 |
-
|
| 358 |
-
// Remove empty rows etc and restore caret location
|
| 359 |
-
cleanup();
|
| 360 |
-
}
|
| 361 |
-
};
|
| 362 |
-
|
| 363 |
-
function insertRow(before) {
|
| 364 |
-
var posY, cell, lastCell, x, rowElm, newRow, newCell, otherCell, rowSpan;
|
| 365 |
-
|
| 366 |
-
// Find first/last row
|
| 367 |
-
each(grid, function(row, y) {
|
| 368 |
-
each(row, function(cell, x) {
|
| 369 |
-
if (isCellSelected(cell)) {
|
| 370 |
-
cell = cell.elm;
|
| 371 |
-
rowElm = cell.parentNode;
|
| 372 |
-
newRow = cloneNode(rowElm, false);
|
| 373 |
-
posY = y;
|
| 374 |
-
|
| 375 |
-
if (before)
|
| 376 |
-
return false;
|
| 377 |
-
}
|
| 378 |
-
});
|
| 379 |
-
|
| 380 |
-
if (before)
|
| 381 |
-
return !posY;
|
| 382 |
-
});
|
| 383 |
-
|
| 384 |
-
for (x = 0; x < grid[0].length; x++) {
|
| 385 |
-
// Cell not found could be because of an invalid table structure
|
| 386 |
-
if (!grid[posY][x])
|
| 387 |
-
continue;
|
| 388 |
-
|
| 389 |
-
cell = grid[posY][x].elm;
|
| 390 |
-
|
| 391 |
-
if (cell != lastCell) {
|
| 392 |
-
if (!before) {
|
| 393 |
-
rowSpan = getSpanVal(cell, 'rowspan');
|
| 394 |
-
if (rowSpan > 1) {
|
| 395 |
-
setSpanVal(cell, 'rowSpan', rowSpan + 1);
|
| 396 |
-
continue;
|
| 397 |
-
}
|
| 398 |
-
} else {
|
| 399 |
-
// Check if cell above can be expanded
|
| 400 |
-
if (posY > 0 && grid[posY - 1][x]) {
|
| 401 |
-
otherCell = grid[posY - 1][x].elm;
|
| 402 |
-
rowSpan = getSpanVal(otherCell, 'rowSpan');
|
| 403 |
-
if (rowSpan > 1) {
|
| 404 |
-
setSpanVal(otherCell, 'rowSpan', rowSpan + 1);
|
| 405 |
-
continue;
|
| 406 |
-
}
|
| 407 |
-
}
|
| 408 |
-
}
|
| 409 |
-
|
| 410 |
-
// Insert new cell into new row
|
| 411 |
-
newCell = cloneCell(cell);
|
| 412 |
-
setSpanVal(newCell, 'colSpan', cell.colSpan);
|
| 413 |
-
|
| 414 |
-
newRow.appendChild(newCell);
|
| 415 |
-
|
| 416 |
-
lastCell = cell;
|
| 417 |
-
}
|
| 418 |
-
}
|
| 419 |
-
|
| 420 |
-
if (newRow.hasChildNodes()) {
|
| 421 |
-
if (!before)
|
| 422 |
-
dom.insertAfter(newRow, rowElm);
|
| 423 |
-
else
|
| 424 |
-
rowElm.parentNode.insertBefore(newRow, rowElm);
|
| 425 |
-
}
|
| 426 |
-
};
|
| 427 |
-
|
| 428 |
-
function insertCol(before) {
|
| 429 |
-
var posX, lastCell;
|
| 430 |
-
|
| 431 |
-
// Find first/last column
|
| 432 |
-
each(grid, function(row, y) {
|
| 433 |
-
each(row, function(cell, x) {
|
| 434 |
-
if (isCellSelected(cell)) {
|
| 435 |
-
posX = x;
|
| 436 |
-
|
| 437 |
-
if (before)
|
| 438 |
-
return false;
|
| 439 |
-
}
|
| 440 |
-
});
|
| 441 |
-
|
| 442 |
-
if (before)
|
| 443 |
-
return !posX;
|
| 444 |
-
});
|
| 445 |
-
|
| 446 |
-
each(grid, function(row, y) {
|
| 447 |
-
var cell, rowSpan, colSpan;
|
| 448 |
-
|
| 449 |
-
if (!row[posX])
|
| 450 |
-
return;
|
| 451 |
-
|
| 452 |
-
cell = row[posX].elm;
|
| 453 |
-
if (cell != lastCell) {
|
| 454 |
-
colSpan = getSpanVal(cell, 'colspan');
|
| 455 |
-
rowSpan = getSpanVal(cell, 'rowspan');
|
| 456 |
-
|
| 457 |
-
if (colSpan == 1) {
|
| 458 |
-
if (!before) {
|
| 459 |
-
dom.insertAfter(cloneCell(cell), cell);
|
| 460 |
-
fillLeftDown(posX, y, rowSpan - 1, colSpan);
|
| 461 |
-
} else {
|
| 462 |
-
cell.parentNode.insertBefore(cloneCell(cell), cell);
|
| 463 |
-
fillLeftDown(posX, y, rowSpan - 1, colSpan);
|
| 464 |
-
}
|
| 465 |
-
} else
|
| 466 |
-
setSpanVal(cell, 'colSpan', cell.colSpan + 1);
|
| 467 |
-
|
| 468 |
-
lastCell = cell;
|
| 469 |
-
}
|
| 470 |
-
});
|
| 471 |
-
};
|
| 472 |
-
|
| 473 |
-
function deleteCols() {
|
| 474 |
-
var cols = [];
|
| 475 |
-
|
| 476 |
-
// Get selected column indexes
|
| 477 |
-
each(grid, function(row, y) {
|
| 478 |
-
each(row, function(cell, x) {
|
| 479 |
-
if (isCellSelected(cell) && tinymce.inArray(cols, x) === -1) {
|
| 480 |
-
each(grid, function(row) {
|
| 481 |
-
var cell = row[x].elm, colSpan;
|
| 482 |
-
|
| 483 |
-
colSpan = getSpanVal(cell, 'colSpan');
|
| 484 |
-
|
| 485 |
-
if (colSpan > 1)
|
| 486 |
-
setSpanVal(cell, 'colSpan', colSpan - 1);
|
| 487 |
-
else
|
| 488 |
-
dom.remove(cell);
|
| 489 |
-
});
|
| 490 |
-
|
| 491 |
-
cols.push(x);
|
| 492 |
-
}
|
| 493 |
-
});
|
| 494 |
-
});
|
| 495 |
-
|
| 496 |
-
cleanup();
|
| 497 |
-
};
|
| 498 |
-
|
| 499 |
-
function deleteRows() {
|
| 500 |
-
var rows;
|
| 501 |
-
|
| 502 |
-
function deleteRow(tr) {
|
| 503 |
-
var nextTr, pos, lastCell;
|
| 504 |
-
|
| 505 |
-
nextTr = dom.getNext(tr, 'tr');
|
| 506 |
-
|
| 507 |
-
// Move down row spanned cells
|
| 508 |
-
each(tr.cells, function(cell) {
|
| 509 |
-
var rowSpan = getSpanVal(cell, 'rowSpan');
|
| 510 |
-
|
| 511 |
-
if (rowSpan > 1) {
|
| 512 |
-
setSpanVal(cell, 'rowSpan', rowSpan - 1);
|
| 513 |
-
pos = getPos(cell);
|
| 514 |
-
fillLeftDown(pos.x, pos.y, 1, 1);
|
| 515 |
-
}
|
| 516 |
-
});
|
| 517 |
-
|
| 518 |
-
// Delete cells
|
| 519 |
-
pos = getPos(tr.cells[0]);
|
| 520 |
-
each(grid[pos.y], function(cell) {
|
| 521 |
-
var rowSpan;
|
| 522 |
-
|
| 523 |
-
cell = cell.elm;
|
| 524 |
-
|
| 525 |
-
if (cell != lastCell) {
|
| 526 |
-
rowSpan = getSpanVal(cell, 'rowSpan');
|
| 527 |
-
|
| 528 |
-
if (rowSpan <= 1)
|
| 529 |
-
dom.remove(cell);
|
| 530 |
-
else
|
| 531 |
-
setSpanVal(cell, 'rowSpan', rowSpan - 1);
|
| 532 |
-
|
| 533 |
-
lastCell = cell;
|
| 534 |
-
}
|
| 535 |
-
});
|
| 536 |
-
};
|
| 537 |
-
|
| 538 |
-
// Get selected rows and move selection out of scope
|
| 539 |
-
rows = getSelectedRows();
|
| 540 |
-
|
| 541 |
-
// Delete all selected rows
|
| 542 |
-
each(rows.reverse(), function(tr) {
|
| 543 |
-
deleteRow(tr);
|
| 544 |
-
});
|
| 545 |
-
|
| 546 |
-
cleanup();
|
| 547 |
-
};
|
| 548 |
-
|
| 549 |
-
function cutRows() {
|
| 550 |
-
var rows = getSelectedRows();
|
| 551 |
-
|
| 552 |
-
dom.remove(rows);
|
| 553 |
-
cleanup();
|
| 554 |
-
|
| 555 |
-
return rows;
|
| 556 |
-
};
|
| 557 |
-
|
| 558 |
-
function copyRows() {
|
| 559 |
-
var rows = getSelectedRows();
|
| 560 |
-
|
| 561 |
-
each(rows, function(row, i) {
|
| 562 |
-
rows[i] = cloneNode(row, true);
|
| 563 |
-
});
|
| 564 |
-
|
| 565 |
-
return rows;
|
| 566 |
-
};
|
| 567 |
-
|
| 568 |
-
function pasteRows(rows, before) {
|
| 569 |
-
var selectedRows = getSelectedRows(),
|
| 570 |
-
targetRow = selectedRows[before ? 0 : selectedRows.length - 1],
|
| 571 |
-
targetCellCount = targetRow.cells.length;
|
| 572 |
-
|
| 573 |
-
// Calc target cell count
|
| 574 |
-
each(grid, function(row) {
|
| 575 |
-
var match;
|
| 576 |
-
|
| 577 |
-
targetCellCount = 0;
|
| 578 |
-
each(row, function(cell, x) {
|
| 579 |
-
if (cell.real)
|
| 580 |
-
targetCellCount += cell.colspan;
|
| 581 |
-
|
| 582 |
-
if (cell.elm.parentNode == targetRow)
|
| 583 |
-
match = 1;
|
| 584 |
-
});
|
| 585 |
-
|
| 586 |
-
if (match)
|
| 587 |
-
return false;
|
| 588 |
-
});
|
| 589 |
-
|
| 590 |
-
if (!before)
|
| 591 |
-
rows.reverse();
|
| 592 |
-
|
| 593 |
-
each(rows, function(row) {
|
| 594 |
-
var cellCount = row.cells.length, cell;
|
| 595 |
-
|
| 596 |
-
// Remove col/rowspans
|
| 597 |
-
for (i = 0; i < cellCount; i++) {
|
| 598 |
-
cell = row.cells[i];
|
| 599 |
-
setSpanVal(cell, 'colSpan', 1);
|
| 600 |
-
setSpanVal(cell, 'rowSpan', 1);
|
| 601 |
-
}
|
| 602 |
-
|
| 603 |
-
// Needs more cells
|
| 604 |
-
for (i = cellCount; i < targetCellCount; i++)
|
| 605 |
-
row.appendChild(cloneCell(row.cells[cellCount - 1]));
|
| 606 |
-
|
| 607 |
-
// Needs less cells
|
| 608 |
-
for (i = targetCellCount; i < cellCount; i++)
|
| 609 |
-
dom.remove(row.cells[i]);
|
| 610 |
-
|
| 611 |
-
// Add before/after
|
| 612 |
-
if (before)
|
| 613 |
-
targetRow.parentNode.insertBefore(row, targetRow);
|
| 614 |
-
else
|
| 615 |
-
dom.insertAfter(row, targetRow);
|
| 616 |
-
});
|
| 617 |
-
|
| 618 |
-
// Remove current selection
|
| 619 |
-
dom.removeClass(dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
|
| 620 |
-
};
|
| 621 |
-
|
| 622 |
-
function getPos(target) {
|
| 623 |
-
var pos;
|
| 624 |
-
|
| 625 |
-
each(grid, function(row, y) {
|
| 626 |
-
each(row, function(cell, x) {
|
| 627 |
-
if (cell.elm == target) {
|
| 628 |
-
pos = {x : x, y : y};
|
| 629 |
-
return false;
|
| 630 |
-
}
|
| 631 |
-
});
|
| 632 |
-
|
| 633 |
-
return !pos;
|
| 634 |
-
});
|
| 635 |
-
|
| 636 |
-
return pos;
|
| 637 |
-
};
|
| 638 |
-
|
| 639 |
-
function setStartCell(cell) {
|
| 640 |
-
startPos = getPos(cell);
|
| 641 |
-
};
|
| 642 |
-
|
| 643 |
-
function findEndPos() {
|
| 644 |
-
var pos, maxX, maxY;
|
| 645 |
-
|
| 646 |
-
maxX = maxY = 0;
|
| 647 |
-
|
| 648 |
-
each(grid, function(row, y) {
|
| 649 |
-
each(row, function(cell, x) {
|
| 650 |
-
var colSpan, rowSpan;
|
| 651 |
-
|
| 652 |
-
if (isCellSelected(cell)) {
|
| 653 |
-
cell = grid[y][x];
|
| 654 |
-
|
| 655 |
-
if (x > maxX)
|
| 656 |
-
maxX = x;
|
| 657 |
-
|
| 658 |
-
if (y > maxY)
|
| 659 |
-
maxY = y;
|
| 660 |
-
|
| 661 |
-
if (cell.real) {
|
| 662 |
-
colSpan = cell.colspan - 1;
|
| 663 |
-
rowSpan = cell.rowspan - 1;
|
| 664 |
-
|
| 665 |
-
if (colSpan) {
|
| 666 |
-
if (x + colSpan > maxX)
|
| 667 |
-
maxX = x + colSpan;
|
| 668 |
-
}
|
| 669 |
-
|
| 670 |
-
if (rowSpan) {
|
| 671 |
-
if (y + rowSpan > maxY)
|
| 672 |
-
maxY = y + rowSpan;
|
| 673 |
-
}
|
| 674 |
-
}
|
| 675 |
-
}
|
| 676 |
-
});
|
| 677 |
-
});
|
| 678 |
-
|
| 679 |
-
return {x : maxX, y : maxY};
|
| 680 |
-
};
|
| 681 |
-
|
| 682 |
-
function setEndCell(cell) {
|
| 683 |
-
var startX, startY, endX, endY, maxX, maxY, colSpan, rowSpan;
|
| 684 |
-
|
| 685 |
-
endPos = getPos(cell);
|
| 686 |
-
|
| 687 |
-
if (startPos && endPos) {
|
| 688 |
-
// Get start/end positions
|
| 689 |
-
startX = Math.min(startPos.x, endPos.x);
|
| 690 |
-
startY = Math.min(startPos.y, endPos.y);
|
| 691 |
-
endX = Math.max(startPos.x, endPos.x);
|
| 692 |
-
endY = Math.max(startPos.y, endPos.y);
|
| 693 |
-
|
| 694 |
-
// Expand end positon to include spans
|
| 695 |
-
maxX = endX;
|
| 696 |
-
maxY = endY;
|
| 697 |
-
|
| 698 |
-
// Expand startX
|
| 699 |
-
for (y = startY; y <= maxY; y++) {
|
| 700 |
-
cell = grid[y][startX];
|
| 701 |
-
|
| 702 |
-
if (!cell.real) {
|
| 703 |
-
if (startX - (cell.colspan - 1) < startX)
|
| 704 |
-
startX -= cell.colspan - 1;
|
| 705 |
-
}
|
| 706 |
-
}
|
| 707 |
-
|
| 708 |
-
// Expand startY
|
| 709 |
-
for (x = startX; x <= maxX; x++) {
|
| 710 |
-
cell = grid[startY][x];
|
| 711 |
-
|
| 712 |
-
if (!cell.real) {
|
| 713 |
-
if (startY - (cell.rowspan - 1) < startY)
|
| 714 |
-
startY -= cell.rowspan - 1;
|
| 715 |
-
}
|
| 716 |
-
}
|
| 717 |
-
|
| 718 |
-
// Find max X, Y
|
| 719 |
-
for (y = startY; y <= endY; y++) {
|
| 720 |
-
for (x = startX; x <= endX; x++) {
|
| 721 |
-
cell = grid[y][x];
|
| 722 |
-
|
| 723 |
-
if (cell.real) {
|
| 724 |
-
colSpan = cell.colspan - 1;
|
| 725 |
-
rowSpan = cell.rowspan - 1;
|
| 726 |
-
|
| 727 |
-
if (colSpan) {
|
| 728 |
-
if (x + colSpan > maxX)
|
| 729 |
-
maxX = x + colSpan;
|
| 730 |
-
}
|
| 731 |
-
|
| 732 |
-
if (rowSpan) {
|
| 733 |
-
if (y + rowSpan > maxY)
|
| 734 |
-
maxY = y + rowSpan;
|
| 735 |
-
}
|
| 736 |
-
}
|
| 737 |
-
}
|
| 738 |
-
}
|
| 739 |
-
|
| 740 |
-
// Remove current selection
|
| 741 |
-
dom.removeClass(dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
|
| 742 |
-
|
| 743 |
-
// Add new selection
|
| 744 |
-
for (y = startY; y <= maxY; y++) {
|
| 745 |
-
for (x = startX; x <= maxX; x++) {
|
| 746 |
-
if (grid[y][x])
|
| 747 |
-
dom.addClass(grid[y][x].elm, 'mceSelected');
|
| 748 |
-
}
|
| 749 |
-
}
|
| 750 |
-
}
|
| 751 |
-
};
|
| 752 |
-
|
| 753 |
-
// Expose to public
|
| 754 |
-
tinymce.extend(this, {
|
| 755 |
-
deleteTable : deleteTable,
|
| 756 |
-
split : split,
|
| 757 |
-
merge : merge,
|
| 758 |
-
insertRow : insertRow,
|
| 759 |
-
insertCol : insertCol,
|
| 760 |
-
deleteCols : deleteCols,
|
| 761 |
-
deleteRows : deleteRows,
|
| 762 |
-
cutRows : cutRows,
|
| 763 |
-
copyRows : copyRows,
|
| 764 |
-
pasteRows : pasteRows,
|
| 765 |
-
getPos : getPos,
|
| 766 |
-
setStartCell : setStartCell,
|
| 767 |
-
setEndCell : setEndCell
|
| 768 |
-
});
|
| 769 |
-
};
|
| 770 |
-
|
| 771 |
-
tinymce.create('tinymce.plugins.TablePlugin', {
|
| 772 |
-
init : function(ed, url) {
|
| 773 |
-
var winMan, clipboardRows, hasCellSelection = true; // Might be selected cells on reload
|
| 774 |
-
|
| 775 |
-
function createTableGrid(node) {
|
| 776 |
-
var selection = ed.selection, tblElm = ed.dom.getParent(node || selection.getNode(), 'table');
|
| 777 |
-
|
| 778 |
-
if (tblElm)
|
| 779 |
-
return new TableGrid(tblElm, ed.dom, selection);
|
| 780 |
-
};
|
| 781 |
-
|
| 782 |
-
function cleanup() {
|
| 783 |
-
// Restore selection possibilities
|
| 784 |
-
ed.getBody().style.webkitUserSelect = '';
|
| 785 |
-
|
| 786 |
-
if (hasCellSelection) {
|
| 787 |
-
ed.dom.removeClass(ed.dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
|
| 788 |
-
hasCellSelection = false;
|
| 789 |
-
}
|
| 790 |
-
};
|
| 791 |
-
|
| 792 |
-
// Register buttons
|
| 793 |
-
each([
|
| 794 |
-
['table', 'table.desc', 'mceInsertTable', true],
|
| 795 |
-
['delete_table', 'table.del', 'mceTableDelete'],
|
| 796 |
-
['delete_col', 'table.delete_col_desc', 'mceTableDeleteCol'],
|
| 797 |
-
['delete_row', 'table.delete_row_desc', 'mceTableDeleteRow'],
|
| 798 |
-
['col_after', 'table.col_after_desc', 'mceTableInsertColAfter'],
|
| 799 |
-
['col_before', 'table.col_before_desc', 'mceTableInsertColBefore'],
|
| 800 |
-
['row_after', 'table.row_after_desc', 'mceTableInsertRowAfter'],
|
| 801 |
-
['row_before', 'table.row_before_desc', 'mceTableInsertRowBefore'],
|
| 802 |
-
['row_props', 'table.row_desc', 'mceTableRowProps', true],
|
| 803 |
-
['cell_props', 'table.cell_desc', 'mceTableCellProps', true],
|
| 804 |
-
['split_cells', 'table.split_cells_desc', 'mceTableSplitCells', true],
|
| 805 |
-
['merge_cells', 'table.merge_cells_desc', 'mceTableMergeCells', true]
|
| 806 |
-
], function(c) {
|
| 807 |
-
ed.addButton(c[0], {title : c[1], cmd : c[2], ui : c[3]});
|
| 808 |
-
});
|
| 809 |
-
|
| 810 |
-
// Select whole table is a table border is clicked
|
| 811 |
-
if (!tinymce.isIE) {
|
| 812 |
-
ed.onClick.add(function(ed, e) {
|
| 813 |
-
e = e.target;
|
| 814 |
-
|
| 815 |
-
if (e.nodeName === 'TABLE') {
|
| 816 |
-
ed.selection.select(e);
|
| 817 |
-
ed.nodeChanged();
|
| 818 |
-
}
|
| 819 |
-
});
|
| 820 |
-
}
|
| 821 |
-
|
| 822 |
-
ed.onPreProcess.add(function(ed, args) {
|
| 823 |
-
var nodes, i, node, dom = ed.dom, value;
|
| 824 |
-
|
| 825 |
-
nodes = dom.select('table', args.node);
|
| 826 |
-
i = nodes.length;
|
| 827 |
-
while (i--) {
|
| 828 |
-
node = nodes[i];
|
| 829 |
-
dom.setAttrib(node, 'data-mce-style', '');
|
| 830 |
-
|
| 831 |
-
if ((value = dom.getAttrib(node, 'width'))) {
|
| 832 |
-
dom.setStyle(node, 'width', value);
|
| 833 |
-
dom.setAttrib(node, 'width', '');
|
| 834 |
-
}
|
| 835 |
-
|
| 836 |
-
if ((value = dom.getAttrib(node, 'height'))) {
|
| 837 |
-
dom.setStyle(node, 'height', value);
|
| 838 |
-
dom.setAttrib(node, 'height', '');
|
| 839 |
-
}
|
| 840 |
-
}
|
| 841 |
-
});
|
| 842 |
-
|
| 843 |
-
// Handle node change updates
|
| 844 |
-
ed.onNodeChange.add(function(ed, cm, n) {
|
| 845 |
-
var p;
|
| 846 |
-
|
| 847 |
-
n = ed.selection.getStart();
|
| 848 |
-
p = ed.dom.getParent(n, 'td,th,caption');
|
| 849 |
-
cm.setActive('table', n.nodeName === 'TABLE' || !!p);
|
| 850 |
-
|
| 851 |
-
// Disable table tools if we are in caption
|
| 852 |
-
if (p && p.nodeName === 'CAPTION')
|
| 853 |
-
p = 0;
|
| 854 |
-
|
| 855 |
-
cm.setDisabled('delete_table', !p);
|
| 856 |
-
cm.setDisabled('delete_col', !p);
|
| 857 |
-
cm.setDisabled('delete_table', !p);
|
| 858 |
-
cm.setDisabled('delete_row', !p);
|
| 859 |
-
cm.setDisabled('col_after', !p);
|
| 860 |
-
cm.setDisabled('col_before', !p);
|
| 861 |
-
cm.setDisabled('row_after', !p);
|
| 862 |
-
cm.setDisabled('row_before', !p);
|
| 863 |
-
cm.setDisabled('row_props', !p);
|
| 864 |
-
cm.setDisabled('cell_props', !p);
|
| 865 |
-
cm.setDisabled('split_cells', !p);
|
| 866 |
-
cm.setDisabled('merge_cells', !p);
|
| 867 |
-
});
|
| 868 |
-
|
| 869 |
-
ed.onInit.add(function(ed) {
|
| 870 |
-
var startTable, startCell, dom = ed.dom, tableGrid;
|
| 871 |
-
|
| 872 |
-
winMan = ed.windowManager;
|
| 873 |
-
|
| 874 |
-
// Add cell selection logic
|
| 875 |
-
ed.onMouseDown.add(function(ed, e) {
|
| 876 |
-
if (e.button != 2) {
|
| 877 |
-
cleanup();
|
| 878 |
-
|
| 879 |
-
startCell = dom.getParent(e.target, 'td,th');
|
| 880 |
-
startTable = dom.getParent(startCell, 'table');
|
| 881 |
-
}
|
| 882 |
-
});
|
| 883 |
-
|
| 884 |
-
dom.bind(ed.getDoc(), 'mouseover', function(e) {
|
| 885 |
-
var sel, table, target = e.target;
|
| 886 |
-
|
| 887 |
-
if (startCell && (tableGrid || target != startCell) && (target.nodeName == 'TD' || target.nodeName == 'TH')) {
|
| 888 |
-
table = dom.getParent(target, 'table');
|
| 889 |
-
if (table == startTable) {
|
| 890 |
-
if (!tableGrid) {
|
| 891 |
-
tableGrid = createTableGrid(table);
|
| 892 |
-
tableGrid.setStartCell(startCell);
|
| 893 |
-
|
| 894 |
-
ed.getBody().style.webkitUserSelect = 'none';
|
| 895 |
-
}
|
| 896 |
-
|
| 897 |
-
tableGrid.setEndCell(target);
|
| 898 |
-
hasCellSelection = true;
|
| 899 |
-
}
|
| 900 |
-
|
| 901 |
-
// Remove current selection
|
| 902 |
-
sel = ed.selection.getSel();
|
| 903 |
-
|
| 904 |
-
try {
|
| 905 |
-
if (sel.removeAllRanges)
|
| 906 |
-
sel.removeAllRanges();
|
| 907 |
-
else
|
| 908 |
-
sel.empty();
|
| 909 |
-
} catch (ex) {
|
| 910 |
-
// IE9 might throw errors here
|
| 911 |
-
}
|
| 912 |
-
|
| 913 |
-
e.preventDefault();
|
| 914 |
-
}
|
| 915 |
-
});
|
| 916 |
-
|
| 917 |
-
ed.onMouseUp.add(function(ed, e) {
|
| 918 |
-
var rng, sel = ed.selection, selectedCells, nativeSel = sel.getSel(), walker, node, lastNode, endNode;
|
| 919 |
-
|
| 920 |
-
// Move selection to startCell
|
| 921 |
-
if (startCell) {
|
| 922 |
-
if (tableGrid)
|
| 923 |
-
ed.getBody().style.webkitUserSelect = '';
|
| 924 |
-
|
| 925 |
-
function setPoint(node, start) {
|
| 926 |
-
var walker = new tinymce.dom.TreeWalker(node, node);
|
| 927 |
-
|
| 928 |
-
do {
|
| 929 |
-
// Text node
|
| 930 |
-
if (node.nodeType == 3 && tinymce.trim(node.nodeValue).length != 0) {
|
| 931 |
-
if (start)
|
| 932 |
-
rng.setStart(node, 0);
|
| 933 |
-
else
|
| 934 |
-
rng.setEnd(node, node.nodeValue.length);
|
| 935 |
-
|
| 936 |
-
return;
|
| 937 |
-
}
|
| 938 |
-
|
| 939 |
-
// BR element
|
| 940 |
-
if (node.nodeName == 'BR') {
|
| 941 |
-
if (start)
|
| 942 |
-
rng.setStartBefore(node);
|
| 943 |
-
else
|
| 944 |
-
rng.setEndBefore(node);
|
| 945 |
-
|
| 946 |
-
return;
|
| 947 |
-
}
|
| 948 |
-
} while (node = (start ? walker.next() : walker.prev()));
|
| 949 |
-
}
|
| 950 |
-
|
| 951 |
-
// Try to expand text selection as much as we can only Gecko supports cell selection
|
| 952 |
-
selectedCells = dom.select('td.mceSelected,th.mceSelected');
|
| 953 |
-
if (selectedCells.length > 0) {
|
| 954 |
-
rng = dom.createRng();
|
| 955 |
-
node = selectedCells[0];
|
| 956 |
-
endNode = selectedCells[selectedCells.length - 1];
|
| 957 |
-
rng.setStartBefore(node);
|
| 958 |
-
rng.setEndAfter(node);
|
| 959 |
-
|
| 960 |
-
setPoint(node, 1);
|
| 961 |
-
walker = new tinymce.dom.TreeWalker(node, dom.getParent(selectedCells[0], 'table'));
|
| 962 |
-
|
| 963 |
-
do {
|
| 964 |
-
if (node.nodeName == 'TD' || node.nodeName == 'TH') {
|
| 965 |
-
if (!dom.hasClass(node, 'mceSelected'))
|
| 966 |
-
break;
|
| 967 |
-
|
| 968 |
-
lastNode = node;
|
| 969 |
-
}
|
| 970 |
-
} while (node = walker.next());
|
| 971 |
-
|
| 972 |
-
setPoint(lastNode);
|
| 973 |
-
|
| 974 |
-
sel.setRng(rng);
|
| 975 |
-
}
|
| 976 |
-
|
| 977 |
-
ed.nodeChanged();
|
| 978 |
-
startCell = tableGrid = startTable = null;
|
| 979 |
-
}
|
| 980 |
-
});
|
| 981 |
-
|
| 982 |
-
ed.onKeyUp.add(function(ed, e) {
|
| 983 |
-
cleanup();
|
| 984 |
-
});
|
| 985 |
-
|
| 986 |
-
ed.onKeyDown.add(function (ed, e) {
|
| 987 |
-
fixTableCellSelection(ed);
|
| 988 |
-
});
|
| 989 |
-
|
| 990 |
-
ed.onMouseDown.add(function (ed, e) {
|
| 991 |
-
if (e.button != 2) {
|
| 992 |
-
fixTableCellSelection(ed);
|
| 993 |
-
}
|
| 994 |
-
});
|
| 995 |
-
function tableCellSelected(ed, rng, n, currentCell) {
|
| 996 |
-
// The decision of when a table cell is selected is somewhat involved. The fact that this code is
|
| 997 |
-
// required is actually a pointer to the root cause of this bug. A cell is selected when the start
|
| 998 |
-
// and end offsets are 0, the start container is a text, and the selection node is either a TR (most cases)
|
| 999 |
-
// or the parent of the table (in the case of the selection containing the last cell of a table).
|
| 1000 |
-
var TEXT_NODE = 3, table = ed.dom.getParent(rng.startContainer, 'TABLE'),
|
| 1001 |
-
tableParent, allOfCellSelected, tableCellSelection;
|
| 1002 |
-
if (table)
|
| 1003 |
-
tableParent = table.parentNode;
|
| 1004 |
-
allOfCellSelected =rng.startContainer.nodeType == TEXT_NODE &&
|
| 1005 |
-
rng.startOffset == 0 &&
|
| 1006 |
-
rng.endOffset == 0 &&
|
| 1007 |
-
currentCell &&
|
| 1008 |
-
(n.nodeName=="TR" || n==tableParent);
|
| 1009 |
-
tableCellSelection = (n.nodeName=="TD"||n.nodeName=="TH")&& !currentCell;
|
| 1010 |
-
return allOfCellSelected || tableCellSelection;
|
| 1011 |
-
// return false;
|
| 1012 |
-
}
|
| 1013 |
-
|
| 1014 |
-
// this nasty hack is here to work around some WebKit selection bugs.
|
| 1015 |
-
function fixTableCellSelection(ed) {
|
| 1016 |
-
if (!tinymce.isWebKit)
|
| 1017 |
-
return;
|
| 1018 |
-
|
| 1019 |
-
var rng = ed.selection.getRng();
|
| 1020 |
-
var n = ed.selection.getNode();
|
| 1021 |
-
var currentCell = ed.dom.getParent(rng.startContainer, 'TD,TH');
|
| 1022 |
-
|
| 1023 |
-
if (!tableCellSelected(ed, rng, n, currentCell))
|
| 1024 |
-
return;
|
| 1025 |
-
if (!currentCell) {
|
| 1026 |
-
currentCell=n;
|
| 1027 |
-
}
|
| 1028 |
-
|
| 1029 |
-
// Get the very last node inside the table cell
|
| 1030 |
-
var end = currentCell.lastChild;
|
| 1031 |
-
while (end.lastChild)
|
| 1032 |
-
end = end.lastChild;
|
| 1033 |
-
|
| 1034 |
-
// Select the entire table cell. Nothing outside of the table cell should be selected.
|
| 1035 |
-
rng.setEnd(end, end.nodeValue.length);
|
| 1036 |
-
ed.selection.setRng(rng);
|
| 1037 |
-
}
|
| 1038 |
-
ed.plugins.table.fixTableCellSelection=fixTableCellSelection;
|
| 1039 |
-
|
| 1040 |
-
// Add context menu
|
| 1041 |
-
if (ed && ed.plugins.contextmenu) {
|
| 1042 |
-
ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) {
|
| 1043 |
-
var sm, se = ed.selection, el = se.getNode() || ed.getBody();
|
| 1044 |
-
|
| 1045 |
-
if (ed.dom.getParent(e, 'td') || ed.dom.getParent(e, 'th') || ed.dom.select('td.mceSelected,th.mceSelected').length) {
|
| 1046 |
-
m.removeAll();
|
| 1047 |
-
|
| 1048 |
-
if (el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) {
|
| 1049 |
-
m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true});
|
| 1050 |
-
m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'});
|
| 1051 |
-
m.addSeparator();
|
| 1052 |
-
}
|
| 1053 |
-
|
| 1054 |
-
if (el.nodeName == 'IMG' && el.className.indexOf('mceItem') == -1) {
|
| 1055 |
-
m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true});
|
| 1056 |
-
m.addSeparator();
|
| 1057 |
-
}
|
| 1058 |
-
|
| 1059 |
-
m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', value : {action : 'insert'}});
|
| 1060 |
-
m.add({title : 'table.props_desc', icon : 'table_props', cmd : 'mceInsertTable'});
|
| 1061 |
-
m.add({title : 'table.del', icon : 'delete_table', cmd : 'mceTableDelete'});
|
| 1062 |
-
m.addSeparator();
|
| 1063 |
-
|
| 1064 |
-
// Cell menu
|
| 1065 |
-
sm = m.addMenu({title : 'table.cell'});
|
| 1066 |
-
sm.add({title : 'table.cell_desc', icon : 'cell_props', cmd : 'mceTableCellProps'});
|
| 1067 |
-
sm.add({title : 'table.split_cells_desc', icon : 'split_cells', cmd : 'mceTableSplitCells'});
|
| 1068 |
-
sm.add({title : 'table.merge_cells_desc', icon : 'merge_cells', cmd : 'mceTableMergeCells'});
|
| 1069 |
-
|
| 1070 |
-
// Row menu
|
| 1071 |
-
sm = m.addMenu({title : 'table.row'});
|
| 1072 |
-
sm.add({title : 'table.row_desc', icon : 'row_props', cmd : 'mceTableRowProps'});
|
| 1073 |
-
sm.add({title : 'table.row_before_desc', icon : 'row_before', cmd : 'mceTableInsertRowBefore'});
|
| 1074 |
-
sm.add({title : 'table.row_after_desc', icon : 'row_after', cmd : 'mceTableInsertRowAfter'});
|
| 1075 |
-
sm.add({title : 'table.delete_row_desc', icon : 'delete_row', cmd : 'mceTableDeleteRow'});
|
| 1076 |
-
sm.addSeparator();
|
| 1077 |
-
sm.add({title : 'table.cut_row_desc', icon : 'cut', cmd : 'mceTableCutRow'});
|
| 1078 |
-
sm.add({title : 'table.copy_row_desc', icon : 'copy', cmd : 'mceTableCopyRow'});
|
| 1079 |
-
sm.add({title : 'table.paste_row_before_desc', icon : 'paste', cmd : 'mceTablePasteRowBefore'}).setDisabled(!clipboardRows);
|
| 1080 |
-
sm.add({title : 'table.paste_row_after_desc', icon : 'paste', cmd : 'mceTablePasteRowAfter'}).setDisabled(!clipboardRows);
|
| 1081 |
-
|
| 1082 |
-
// Column menu
|
| 1083 |
-
sm = m.addMenu({title : 'table.col'});
|
| 1084 |
-
sm.add({title : 'table.col_before_desc', icon : 'col_before', cmd : 'mceTableInsertColBefore'});
|
| 1085 |
-
sm.add({title : 'table.col_after_desc', icon : 'col_after', cmd : 'mceTableInsertColAfter'});
|
| 1086 |
-
sm.add({title : 'table.delete_col_desc', icon : 'delete_col', cmd : 'mceTableDeleteCol'});
|
| 1087 |
-
} else
|
| 1088 |
-
m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable'});
|
| 1089 |
-
});
|
| 1090 |
-
}
|
| 1091 |
-
|
| 1092 |
-
// Fix to allow navigating up and down in a table in WebKit browsers.
|
| 1093 |
-
if (tinymce.isWebKit) {
|
| 1094 |
-
function moveSelection(ed, e) {
|
| 1095 |
-
var VK = tinymce.VK;
|
| 1096 |
-
var key = e.keyCode;
|
| 1097 |
-
|
| 1098 |
-
function handle(upBool, sourceNode, event) {
|
| 1099 |
-
var siblingDirection = upBool ? 'previousSibling' : 'nextSibling';
|
| 1100 |
-
var currentRow = ed.dom.getParent(sourceNode, 'tr');
|
| 1101 |
-
var siblingRow = currentRow[siblingDirection];
|
| 1102 |
-
|
| 1103 |
-
if (siblingRow) {
|
| 1104 |
-
moveCursorToRow(ed, sourceNode, siblingRow, upBool);
|
| 1105 |
-
tinymce.dom.Event.cancel(event);
|
| 1106 |
-
return true;
|
| 1107 |
-
} else {
|
| 1108 |
-
var tableNode = ed.dom.getParent(currentRow, 'table');
|
| 1109 |
-
var middleNode = currentRow.parentNode;
|
| 1110 |
-
var parentNodeName = middleNode.nodeName.toLowerCase();
|
| 1111 |
-
if (parentNodeName === 'tbody' || parentNodeName === (upBool ? 'tfoot' : 'thead')) {
|
| 1112 |
-
var targetParent = getTargetParent(upBool, tableNode, middleNode, 'tbody');
|
| 1113 |
-
if (targetParent !== null) {
|
| 1114 |
-
return moveToRowInTarget(upBool, targetParent, sourceNode, event);
|
| 1115 |
-
}
|
| 1116 |
-
}
|
| 1117 |
-
return escapeTable(upBool, currentRow, siblingDirection, tableNode, event);
|
| 1118 |
-
}
|
| 1119 |
-
}
|
| 1120 |
-
|
| 1121 |
-
function getTargetParent(upBool, topNode, secondNode, nodeName) {
|
| 1122 |
-
var tbodies = ed.dom.select('>' + nodeName, topNode);
|
| 1123 |
-
var position = tbodies.indexOf(secondNode);
|
| 1124 |
-
if (upBool && position === 0 || !upBool && position === tbodies.length - 1) {
|
| 1125 |
-
return getFirstHeadOrFoot(upBool, topNode);
|
| 1126 |
-
} else if (position === -1) {
|
| 1127 |
-
var topOrBottom = secondNode.tagName.toLowerCase() === 'thead' ? 0 : tbodies.length - 1;
|
| 1128 |
-
return tbodies[topOrBottom];
|
| 1129 |
-
} else {
|
| 1130 |
-
return tbodies[position + (upBool ? -1 : 1)];
|
| 1131 |
-
}
|
| 1132 |
-
}
|
| 1133 |
-
|
| 1134 |
-
function getFirstHeadOrFoot(upBool, parent) {
|
| 1135 |
-
var tagName = upBool ? 'thead' : 'tfoot';
|
| 1136 |
-
var headOrFoot = ed.dom.select('>' + tagName, parent);
|
| 1137 |
-
return headOrFoot.length !== 0 ? headOrFoot[0] : null;
|
| 1138 |
-
}
|
| 1139 |
-
|
| 1140 |
-
function moveToRowInTarget(upBool, targetParent, sourceNode, event) {
|
| 1141 |
-
var targetRow = getChildForDirection(targetParent, upBool);
|
| 1142 |
-
targetRow && moveCursorToRow(ed, sourceNode, targetRow, upBool);
|
| 1143 |
-
tinymce.dom.Event.cancel(event);
|
| 1144 |
-
return true;
|
| 1145 |
-
}
|
| 1146 |
-
|
| 1147 |
-
function escapeTable(upBool, currentRow, siblingDirection, table, event) {
|
| 1148 |
-
var tableSibling = table[siblingDirection];
|
| 1149 |
-
if (tableSibling) {
|
| 1150 |
-
moveCursorToStartOfElement(tableSibling);
|
| 1151 |
-
return true;
|
| 1152 |
-
} else {
|
| 1153 |
-
var parentCell = ed.dom.getParent(table, 'td,th');
|
| 1154 |
-
if (parentCell) {
|
| 1155 |
-
return handle(upBool, parentCell, event);
|
| 1156 |
-
} else {
|
| 1157 |
-
var backUpSibling = getChildForDirection(currentRow, !upBool);
|
| 1158 |
-
moveCursorToStartOfElement(backUpSibling);
|
| 1159 |
-
return tinymce.dom.Event.cancel(event);
|
| 1160 |
-
}
|
| 1161 |
-
}
|
| 1162 |
-
}
|
| 1163 |
-
|
| 1164 |
-
function getChildForDirection(parent, up) {
|
| 1165 |
-
var child = parent && parent[up ? 'lastChild' : 'firstChild'];
|
| 1166 |
-
// BR is not a valid table child to return in this case we return the table cell
|
| 1167 |
-
return child && child.nodeName === 'BR' ? ed.dom.getParent(child, 'td,th') : child;
|
| 1168 |
-
}
|
| 1169 |
-
|
| 1170 |
-
function moveCursorToStartOfElement(n) {
|
| 1171 |
-
ed.selection.setCursorLocation(n, 0);
|
| 1172 |
-
}
|
| 1173 |
-
|
| 1174 |
-
function isVerticalMovement() {
|
| 1175 |
-
return key == VK.UP || key == VK.DOWN;
|
| 1176 |
-
}
|
| 1177 |
-
|
| 1178 |
-
function isInTable(ed) {
|
| 1179 |
-
var node = ed.selection.getNode();
|
| 1180 |
-
var currentRow = ed.dom.getParent(node, 'tr');
|
| 1181 |
-
return currentRow !== null;
|
| 1182 |
-
}
|
| 1183 |
-
|
| 1184 |
-
function columnIndex(column) {
|
| 1185 |
-
var colIndex = 0;
|
| 1186 |
-
var c = column;
|
| 1187 |
-
while (c.previousSibling) {
|
| 1188 |
-
c = c.previousSibling;
|
| 1189 |
-
colIndex = colIndex + getSpanVal(c, "colspan");
|
| 1190 |
-
}
|
| 1191 |
-
return colIndex;
|
| 1192 |
-
}
|
| 1193 |
-
|
| 1194 |
-
function findColumn(rowElement, columnIndex) {
|
| 1195 |
-
var c = 0;
|
| 1196 |
-
var r = 0;
|
| 1197 |
-
each(rowElement.children, function(cell, i) {
|
| 1198 |
-
c = c + getSpanVal(cell, "colspan");
|
| 1199 |
-
r = i;
|
| 1200 |
-
if (c > columnIndex)
|
| 1201 |
-
return false;
|
| 1202 |
-
});
|
| 1203 |
-
return r;
|
| 1204 |
-
}
|
| 1205 |
-
|
| 1206 |
-
function moveCursorToRow(ed, node, row, upBool) {
|
| 1207 |
-
var srcColumnIndex = columnIndex(ed.dom.getParent(node, 'td,th'));
|
| 1208 |
-
var tgtColumnIndex = findColumn(row, srcColumnIndex);
|
| 1209 |
-
var tgtNode = row.childNodes[tgtColumnIndex];
|
| 1210 |
-
var rowCellTarget = getChildForDirection(tgtNode, upBool);
|
| 1211 |
-
moveCursorToStartOfElement(rowCellTarget || tgtNode);
|
| 1212 |
-
}
|
| 1213 |
-
|
| 1214 |
-
function shouldFixCaret(preBrowserNode) {
|
| 1215 |
-
var newNode = ed.selection.getNode();
|
| 1216 |
-
var newParent = ed.dom.getParent(newNode, 'td,th');
|
| 1217 |
-
var oldParent = ed.dom.getParent(preBrowserNode, 'td,th');
|
| 1218 |
-
return newParent && newParent !== oldParent && checkSameParentTable(newParent, oldParent)
|
| 1219 |
-
}
|
| 1220 |
-
|
| 1221 |
-
function checkSameParentTable(nodeOne, NodeTwo) {
|
| 1222 |
-
return ed.dom.getParent(nodeOne, 'TABLE') === ed.dom.getParent(NodeTwo, 'TABLE');
|
| 1223 |
-
}
|
| 1224 |
-
|
| 1225 |
-
if (isVerticalMovement() && isInTable(ed)) {
|
| 1226 |
-
var preBrowserNode = ed.selection.getNode();
|
| 1227 |
-
setTimeout(function() {
|
| 1228 |
-
if (shouldFixCaret(preBrowserNode)) {
|
| 1229 |
-
handle(!e.shiftKey && key === VK.UP, preBrowserNode, e);
|
| 1230 |
-
}
|
| 1231 |
-
}, 0);
|
| 1232 |
-
}
|
| 1233 |
-
}
|
| 1234 |
-
|
| 1235 |
-
ed.onKeyDown.add(moveSelection);
|
| 1236 |
-
}
|
| 1237 |
-
|
| 1238 |
-
// Fixes an issue on Gecko where it's impossible to place the caret behind a table
|
| 1239 |
-
// This fix will force a paragraph element after the table but only when the forced_root_block setting is enabled
|
| 1240 |
-
function fixTableCaretPos() {
|
| 1241 |
-
var last;
|
| 1242 |
-
|
| 1243 |
-
// Skip empty text nodes form the end
|
| 1244 |
-
for (last = ed.getBody().lastChild; last && last.nodeType == 3 && !last.nodeValue.length; last = last.previousSibling) ;
|
| 1245 |
-
|
| 1246 |
-
if (last && last.nodeName == 'TABLE') {
|
| 1247 |
-
if (ed.settings.forced_root_block)
|
| 1248 |
-
ed.dom.add(ed.getBody(), ed.settings.forced_root_block, null, tinymce.isIE ? ' ' : '<br data-mce-bogus="1" />');
|
| 1249 |
-
else
|
| 1250 |
-
ed.dom.add(ed.getBody(), 'br', {'data-mce-bogus': '1'});
|
| 1251 |
-
}
|
| 1252 |
-
};
|
| 1253 |
-
|
| 1254 |
-
// Fixes an bug where it's impossible to place the caret before a table in Gecko
|
| 1255 |
-
// this fix solves it by detecting when the caret is at the beginning of such a table
|
| 1256 |
-
// and then manually moves the caret infront of the table
|
| 1257 |
-
if (tinymce.isGecko) {
|
| 1258 |
-
ed.onKeyDown.add(function(ed, e) {
|
| 1259 |
-
var rng, table, dom = ed.dom;
|
| 1260 |
-
|
| 1261 |
-
// On gecko it's not possible to place the caret before a table
|
| 1262 |
-
if (e.keyCode == 37 || e.keyCode == 38) {
|
| 1263 |
-
rng = ed.selection.getRng();
|
| 1264 |
-
table = dom.getParent(rng.startContainer, 'table');
|
| 1265 |
-
|
| 1266 |
-
if (table && ed.getBody().firstChild == table) {
|
| 1267 |
-
if (isAtStart(rng, table)) {
|
| 1268 |
-
rng = dom.createRng();
|
| 1269 |
-
|
| 1270 |
-
rng.setStartBefore(table);
|
| 1271 |
-
rng.setEndBefore(table);
|
| 1272 |
-
|
| 1273 |
-
ed.selection.setRng(rng);
|
| 1274 |
-
|
| 1275 |
-
e.preventDefault();
|
| 1276 |
-
}
|
| 1277 |
-
}
|
| 1278 |
-
}
|
| 1279 |
-
});
|
| 1280 |
-
}
|
| 1281 |
-
|
| 1282 |
-
ed.onKeyUp.add(fixTableCaretPos);
|
| 1283 |
-
ed.onSetContent.add(fixTableCaretPos);
|
| 1284 |
-
ed.onVisualAid.add(fixTableCaretPos);
|
| 1285 |
-
|
| 1286 |
-
ed.onPreProcess.add(function(ed, o) {
|
| 1287 |
-
var last = o.node.lastChild;
|
| 1288 |
-
|
| 1289 |
-
if (last && (last.nodeName == "BR" || (last.childNodes.length == 1 && (last.firstChild.nodeName == 'BR' || last.firstChild.nodeValue == '\u00a0'))) && last.previousSibling && last.previousSibling.nodeName == "TABLE") {
|
| 1290 |
-
ed.dom.remove(last);
|
| 1291 |
-
}
|
| 1292 |
-
});
|
| 1293 |
-
|
| 1294 |
-
|
| 1295 |
-
/**
|
| 1296 |
-
* Fixes bug in Gecko where shift-enter in table cell does not place caret on new line
|
| 1297 |
-
*
|
| 1298 |
-
* Removed: Since the new enter logic seems to fix this one.
|
| 1299 |
-
*/
|
| 1300 |
-
/*
|
| 1301 |
-
if (tinymce.isGecko) {
|
| 1302 |
-
ed.onKeyDown.add(function(ed, e) {
|
| 1303 |
-
if (e.keyCode === tinymce.VK.ENTER && e.shiftKey) {
|
| 1304 |
-
var node = ed.selection.getRng().startContainer;
|
| 1305 |
-
var tableCell = dom.getParent(node, 'td,th');
|
| 1306 |
-
if (tableCell) {
|
| 1307 |
-
var zeroSizedNbsp = ed.getDoc().createTextNode("\uFEFF");
|
| 1308 |
-
dom.insertAfter(zeroSizedNbsp, node);
|
| 1309 |
-
}
|
| 1310 |
-
}
|
| 1311 |
-
});
|
| 1312 |
-
}
|
| 1313 |
-
*/
|
| 1314 |
-
|
| 1315 |
-
fixTableCaretPos();
|
| 1316 |
-
ed.startContent = ed.getContent({format : 'raw'});
|
| 1317 |
-
});
|
| 1318 |
-
|
| 1319 |
-
// Register action commands
|
| 1320 |
-
each({
|
| 1321 |
-
mceTableSplitCells : function(grid) {
|
| 1322 |
-
grid.split();
|
| 1323 |
-
},
|
| 1324 |
-
|
| 1325 |
-
mceTableMergeCells : function(grid) {
|
| 1326 |
-
var rowSpan, colSpan, cell;
|
| 1327 |
-
|
| 1328 |
-
cell = ed.dom.getParent(ed.selection.getNode(), 'th,td');
|
| 1329 |
-
if (cell) {
|
| 1330 |
-
rowSpan = cell.rowSpan;
|
| 1331 |
-
colSpan = cell.colSpan;
|
| 1332 |
-
}
|
| 1333 |
-
|
| 1334 |
-
if (!ed.dom.select('td.mceSelected,th.mceSelected').length) {
|
| 1335 |
-
winMan.open({
|
| 1336 |
-
url : url + '/merge_cells.htm',
|
| 1337 |
-
width : 240 + parseInt(ed.getLang('table.merge_cells_delta_width', 0)),
|
| 1338 |
-
height : 110 + parseInt(ed.getLang('table.merge_cells_delta_height', 0)),
|
| 1339 |
-
inline : 1
|
| 1340 |
-
}, {
|
| 1341 |
-
rows : rowSpan,
|
| 1342 |
-
cols : colSpan,
|
| 1343 |
-
onaction : function(data) {
|
| 1344 |
-
grid.merge(cell, data.cols, data.rows);
|
| 1345 |
-
},
|
| 1346 |
-
plugin_url : url
|
| 1347 |
-
});
|
| 1348 |
-
} else
|
| 1349 |
-
grid.merge();
|
| 1350 |
-
},
|
| 1351 |
-
|
| 1352 |
-
mceTableInsertRowBefore : function(grid) {
|
| 1353 |
-
grid.insertRow(true);
|
| 1354 |
-
},
|
| 1355 |
-
|
| 1356 |
-
mceTableInsertRowAfter : function(grid) {
|
| 1357 |
-
grid.insertRow();
|
| 1358 |
-
},
|
| 1359 |
-
|
| 1360 |
-
mceTableInsertColBefore : function(grid) {
|
| 1361 |
-
grid.insertCol(true);
|
| 1362 |
-
},
|
| 1363 |
-
|
| 1364 |
-
mceTableInsertColAfter : function(grid) {
|
| 1365 |
-
grid.insertCol();
|
| 1366 |
-
},
|
| 1367 |
-
|
| 1368 |
-
mceTableDeleteCol : function(grid) {
|
| 1369 |
-
grid.deleteCols();
|
| 1370 |
-
},
|
| 1371 |
-
|
| 1372 |
-
mceTableDeleteRow : function(grid) {
|
| 1373 |
-
grid.deleteRows();
|
| 1374 |
-
},
|
| 1375 |
-
|
| 1376 |
-
mceTableCutRow : function(grid) {
|
| 1377 |
-
clipboardRows = grid.cutRows();
|
| 1378 |
-
},
|
| 1379 |
-
|
| 1380 |
-
mceTableCopyRow : function(grid) {
|
| 1381 |
-
clipboardRows = grid.copyRows();
|
| 1382 |
-
},
|
| 1383 |
-
|
| 1384 |
-
mceTablePasteRowBefore : function(grid) {
|
| 1385 |
-
grid.pasteRows(clipboardRows, true);
|
| 1386 |
-
},
|
| 1387 |
-
|
| 1388 |
-
mceTablePasteRowAfter : function(grid) {
|
| 1389 |
-
grid.pasteRows(clipboardRows);
|
| 1390 |
-
},
|
| 1391 |
-
|
| 1392 |
-
mceTableDelete : function(grid) {
|
| 1393 |
-
grid.deleteTable();
|
| 1394 |
-
}
|
| 1395 |
-
}, function(func, name) {
|
| 1396 |
-
ed.addCommand(name, function() {
|
| 1397 |
-
var grid = createTableGrid();
|
| 1398 |
-
|
| 1399 |
-
if (grid) {
|
| 1400 |
-
func(grid);
|
| 1401 |
-
ed.execCommand('mceRepaint');
|
| 1402 |
-
cleanup();
|
| 1403 |
-
}
|
| 1404 |
-
});
|
| 1405 |
-
});
|
| 1406 |
-
|
| 1407 |
-
// Register dialog commands
|
| 1408 |
-
each({
|
| 1409 |
-
mceInsertTable : function(val) {
|
| 1410 |
-
winMan.open({
|
| 1411 |
-
url : url + '/table.htm',
|
| 1412 |
-
width : 400 + parseInt(ed.getLang('table.table_delta_width', 0)),
|
| 1413 |
-
height : 320 + parseInt(ed.getLang('table.table_delta_height', 0)),
|
| 1414 |
-
inline : 1
|
| 1415 |
-
}, {
|
| 1416 |
-
plugin_url : url,
|
| 1417 |
-
action : val ? val.action : 0
|
| 1418 |
-
});
|
| 1419 |
-
},
|
| 1420 |
-
|
| 1421 |
-
mceTableRowProps : function() {
|
| 1422 |
-
winMan.open({
|
| 1423 |
-
url : url + '/row.htm',
|
| 1424 |
-
width : 400 + parseInt(ed.getLang('table.rowprops_delta_width', 0)),
|
| 1425 |
-
height : 295 + parseInt(ed.getLang('table.rowprops_delta_height', 0)),
|
| 1426 |
-
inline : 1
|
| 1427 |
-
}, {
|
| 1428 |
-
plugin_url : url
|
| 1429 |
-
});
|
| 1430 |
-
},
|
| 1431 |
-
|
| 1432 |
-
mceTableCellProps : function() {
|
| 1433 |
-
winMan.open({
|
| 1434 |
-
url : url + '/cell.htm',
|
| 1435 |
-
width : 400 + parseInt(ed.getLang('table.cellprops_delta_width', 0)),
|
| 1436 |
-
height : 295 + parseInt(ed.getLang('table.cellprops_delta_height', 0)),
|
| 1437 |
-
inline : 1
|
| 1438 |
-
}, {
|
| 1439 |
-
plugin_url : url
|
| 1440 |
-
});
|
| 1441 |
-
}
|
| 1442 |
-
}, function(func, name) {
|
| 1443 |
-
ed.addCommand(name, function(ui, val) {
|
| 1444 |
-
func(val);
|
| 1445 |
-
});
|
| 1446 |
-
});
|
| 1447 |
-
}
|
| 1448 |
-
});
|
| 1449 |
-
|
| 1450 |
-
// Register plugin
|
| 1451 |
-
tinymce.PluginManager.add('table', tinymce.plugins.TablePlugin);
|
| 1452 |
-
})(tinymce);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
tinymce3-table/js/cell.js
DELETED
|
@@ -1,319 +0,0 @@
|
|
| 1 |
-
tinyMCEPopup.requireLangPack();
|
| 2 |
-
|
| 3 |
-
var ed;
|
| 4 |
-
|
| 5 |
-
function init() {
|
| 6 |
-
ed = tinyMCEPopup.editor;
|
| 7 |
-
tinyMCEPopup.resizeToInnerSize();
|
| 8 |
-
|
| 9 |
-
document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table');
|
| 10 |
-
document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor');
|
| 11 |
-
document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor')
|
| 12 |
-
|
| 13 |
-
var inst = ed;
|
| 14 |
-
var tdElm = ed.dom.getParent(ed.selection.getStart(), "td,th");
|
| 15 |
-
var formObj = document.forms[0];
|
| 16 |
-
var st = ed.dom.parseStyle(ed.dom.getAttrib(tdElm, "style"));
|
| 17 |
-
|
| 18 |
-
// Get table cell data
|
| 19 |
-
var celltype = tdElm.nodeName.toLowerCase();
|
| 20 |
-
var align = ed.dom.getAttrib(tdElm, 'align');
|
| 21 |
-
var valign = ed.dom.getAttrib(tdElm, 'valign');
|
| 22 |
-
var width = trimSize(getStyle(tdElm, 'width', 'width'));
|
| 23 |
-
var height = trimSize(getStyle(tdElm, 'height', 'height'));
|
| 24 |
-
var bordercolor = convertRGBToHex(getStyle(tdElm, 'bordercolor', 'borderLeftColor'));
|
| 25 |
-
var bgcolor = convertRGBToHex(getStyle(tdElm, 'bgcolor', 'backgroundColor'));
|
| 26 |
-
var className = ed.dom.getAttrib(tdElm, 'class');
|
| 27 |
-
var backgroundimage = getStyle(tdElm, 'background', 'backgroundImage').replace(new RegExp("url\\(['\"]?([^'\"]*)['\"]?\\)", 'gi'), "$1");
|
| 28 |
-
var id = ed.dom.getAttrib(tdElm, 'id');
|
| 29 |
-
var lang = ed.dom.getAttrib(tdElm, 'lang');
|
| 30 |
-
var dir = ed.dom.getAttrib(tdElm, 'dir');
|
| 31 |
-
var scope = ed.dom.getAttrib(tdElm, 'scope');
|
| 32 |
-
|
| 33 |
-
// Setup form
|
| 34 |
-
addClassesToList('class', 'table_cell_styles');
|
| 35 |
-
TinyMCE_EditableSelects.init();
|
| 36 |
-
|
| 37 |
-
if (!ed.dom.hasClass(tdElm, 'mceSelected')) {
|
| 38 |
-
formObj.bordercolor.value = bordercolor;
|
| 39 |
-
formObj.bgcolor.value = bgcolor;
|
| 40 |
-
formObj.backgroundimage.value = backgroundimage;
|
| 41 |
-
formObj.width.value = width;
|
| 42 |
-
formObj.height.value = height;
|
| 43 |
-
formObj.id.value = id;
|
| 44 |
-
formObj.lang.value = lang;
|
| 45 |
-
formObj.style.value = ed.dom.serializeStyle(st);
|
| 46 |
-
selectByValue(formObj, 'align', align);
|
| 47 |
-
selectByValue(formObj, 'valign', valign);
|
| 48 |
-
selectByValue(formObj, 'class', className, true, true);
|
| 49 |
-
selectByValue(formObj, 'celltype', celltype);
|
| 50 |
-
selectByValue(formObj, 'dir', dir);
|
| 51 |
-
selectByValue(formObj, 'scope', scope);
|
| 52 |
-
|
| 53 |
-
// Resize some elements
|
| 54 |
-
if (isVisible('backgroundimagebrowser'))
|
| 55 |
-
document.getElementById('backgroundimage').style.width = '180px';
|
| 56 |
-
|
| 57 |
-
updateColor('bordercolor_pick', 'bordercolor');
|
| 58 |
-
updateColor('bgcolor_pick', 'bgcolor');
|
| 59 |
-
} else
|
| 60 |
-
tinyMCEPopup.dom.hide('action');
|
| 61 |
-
}
|
| 62 |
-
|
| 63 |
-
function updateAction() {
|
| 64 |
-
var el, inst = ed, tdElm, trElm, tableElm, formObj = document.forms[0];
|
| 65 |
-
|
| 66 |
-
if (!AutoValidator.validate(formObj)) {
|
| 67 |
-
tinyMCEPopup.alert(AutoValidator.getErrorMessages(formObj).join('. ') + '.');
|
| 68 |
-
return false;
|
| 69 |
-
}
|
| 70 |
-
|
| 71 |
-
tinyMCEPopup.restoreSelection();
|
| 72 |
-
el = ed.selection.getStart();
|
| 73 |
-
tdElm = ed.dom.getParent(el, "td,th");
|
| 74 |
-
trElm = ed.dom.getParent(el, "tr");
|
| 75 |
-
tableElm = ed.dom.getParent(el, "table");
|
| 76 |
-
|
| 77 |
-
// Cell is selected
|
| 78 |
-
if (ed.dom.hasClass(tdElm, 'mceSelected')) {
|
| 79 |
-
// Update all selected sells
|
| 80 |
-
tinymce.each(ed.dom.select('td.mceSelected,th.mceSelected'), function(td) {
|
| 81 |
-
updateCell(td);
|
| 82 |
-
});
|
| 83 |
-
|
| 84 |
-
ed.addVisual();
|
| 85 |
-
ed.nodeChanged();
|
| 86 |
-
inst.execCommand('mceEndUndoLevel');
|
| 87 |
-
tinyMCEPopup.close();
|
| 88 |
-
return;
|
| 89 |
-
}
|
| 90 |
-
|
| 91 |
-
switch (getSelectValue(formObj, 'action')) {
|
| 92 |
-
case "cell":
|
| 93 |
-
var celltype = getSelectValue(formObj, 'celltype');
|
| 94 |
-
var scope = getSelectValue(formObj, 'scope');
|
| 95 |
-
|
| 96 |
-
function doUpdate(s) {
|
| 97 |
-
if (s) {
|
| 98 |
-
updateCell(tdElm);
|
| 99 |
-
|
| 100 |
-
ed.addVisual();
|
| 101 |
-
ed.nodeChanged();
|
| 102 |
-
inst.execCommand('mceEndUndoLevel');
|
| 103 |
-
tinyMCEPopup.close();
|
| 104 |
-
}
|
| 105 |
-
};
|
| 106 |
-
|
| 107 |
-
if (ed.getParam("accessibility_warnings", 1)) {
|
| 108 |
-
if (celltype == "th" && scope == "")
|
| 109 |
-
tinyMCEPopup.confirm(ed.getLang('table_dlg.missing_scope', '', true), doUpdate);
|
| 110 |
-
else
|
| 111 |
-
doUpdate(1);
|
| 112 |
-
|
| 113 |
-
return;
|
| 114 |
-
}
|
| 115 |
-
|
| 116 |
-
updateCell(tdElm);
|
| 117 |
-
break;
|
| 118 |
-
|
| 119 |
-
case "row":
|
| 120 |
-
var cell = trElm.firstChild;
|
| 121 |
-
|
| 122 |
-
if (cell.nodeName != "TD" && cell.nodeName != "TH")
|
| 123 |
-
cell = nextCell(cell);
|
| 124 |
-
|
| 125 |
-
do {
|
| 126 |
-
cell = updateCell(cell, true);
|
| 127 |
-
} while ((cell = nextCell(cell)) != null);
|
| 128 |
-
|
| 129 |
-
break;
|
| 130 |
-
|
| 131 |
-
case "col":
|
| 132 |
-
var curr, col = 0, cell = trElm.firstChild, rows = tableElm.getElementsByTagName("tr");
|
| 133 |
-
|
| 134 |
-
if (cell.nodeName != "TD" && cell.nodeName != "TH")
|
| 135 |
-
cell = nextCell(cell);
|
| 136 |
-
|
| 137 |
-
do {
|
| 138 |
-
if (cell == tdElm)
|
| 139 |
-
break;
|
| 140 |
-
col += cell.getAttribute("colspan")?cell.getAttribute("colspan"):1;
|
| 141 |
-
} while ((cell = nextCell(cell)) != null);
|
| 142 |
-
|
| 143 |
-
for (var i=0; i<rows.length; i++) {
|
| 144 |
-
cell = rows[i].firstChild;
|
| 145 |
-
|
| 146 |
-
if (cell.nodeName != "TD" && cell.nodeName != "TH")
|
| 147 |
-
cell = nextCell(cell);
|
| 148 |
-
|
| 149 |
-
curr = 0;
|
| 150 |
-
do {
|
| 151 |
-
if (curr == col) {
|
| 152 |
-
cell = updateCell(cell, true);
|
| 153 |
-
break;
|
| 154 |
-
}
|
| 155 |
-
curr += cell.getAttribute("colspan")?cell.getAttribute("colspan"):1;
|
| 156 |
-
} while ((cell = nextCell(cell)) != null);
|
| 157 |
-
}
|
| 158 |
-
|
| 159 |
-
break;
|
| 160 |
-
|
| 161 |
-
case "all":
|
| 162 |
-
var rows = tableElm.getElementsByTagName("tr");
|
| 163 |
-
|
| 164 |
-
for (var i=0; i<rows.length; i++) {
|
| 165 |
-
var cell = rows[i].firstChild;
|
| 166 |
-
|
| 167 |
-
if (cell.nodeName != "TD" && cell.nodeName != "TH")
|
| 168 |
-
cell = nextCell(cell);
|
| 169 |
-
|
| 170 |
-
do {
|
| 171 |
-
cell = updateCell(cell, true);
|
| 172 |
-
} while ((cell = nextCell(cell)) != null);
|
| 173 |
-
}
|
| 174 |
-
|
| 175 |
-
break;
|
| 176 |
-
}
|
| 177 |
-
|
| 178 |
-
ed.addVisual();
|
| 179 |
-
ed.nodeChanged();
|
| 180 |
-
inst.execCommand('mceEndUndoLevel');
|
| 181 |
-
tinyMCEPopup.close();
|
| 182 |
-
}
|
| 183 |
-
|
| 184 |
-
function nextCell(elm) {
|
| 185 |
-
while ((elm = elm.nextSibling) != null) {
|
| 186 |
-
if (elm.nodeName == "TD" || elm.nodeName == "TH")
|
| 187 |
-
return elm;
|
| 188 |
-
}
|
| 189 |
-
|
| 190 |
-
return null;
|
| 191 |
-
}
|
| 192 |
-
|
| 193 |
-
function updateCell(td, skip_id) {
|
| 194 |
-
var inst = ed;
|
| 195 |
-
var formObj = document.forms[0];
|
| 196 |
-
var curCellType = td.nodeName.toLowerCase();
|
| 197 |
-
var celltype = getSelectValue(formObj, 'celltype');
|
| 198 |
-
var doc = inst.getDoc();
|
| 199 |
-
var dom = ed.dom;
|
| 200 |
-
|
| 201 |
-
if (!skip_id)
|
| 202 |
-
dom.setAttrib(td, 'id', formObj.id.value);
|
| 203 |
-
|
| 204 |
-
dom.setAttrib(td, 'align', formObj.align.value);
|
| 205 |
-
dom.setAttrib(td, 'vAlign', formObj.valign.value);
|
| 206 |
-
dom.setAttrib(td, 'lang', formObj.lang.value);
|
| 207 |
-
dom.setAttrib(td, 'dir', getSelectValue(formObj, 'dir'));
|
| 208 |
-
dom.setAttrib(td, 'style', ed.dom.serializeStyle(ed.dom.parseStyle(formObj.style.value)));
|
| 209 |
-
dom.setAttrib(td, 'scope', formObj.scope.value);
|
| 210 |
-
dom.setAttrib(td, 'class', getSelectValue(formObj, 'class'));
|
| 211 |
-
|
| 212 |
-
// Clear deprecated attributes
|
| 213 |
-
ed.dom.setAttrib(td, 'width', '');
|
| 214 |
-
ed.dom.setAttrib(td, 'height', '');
|
| 215 |
-
ed.dom.setAttrib(td, 'bgColor', '');
|
| 216 |
-
ed.dom.setAttrib(td, 'borderColor', '');
|
| 217 |
-
ed.dom.setAttrib(td, 'background', '');
|
| 218 |
-
|
| 219 |
-
// Set styles
|
| 220 |
-
td.style.width = getCSSSize(formObj.width.value);
|
| 221 |
-
td.style.height = getCSSSize(formObj.height.value);
|
| 222 |
-
if (formObj.bordercolor.value != "") {
|
| 223 |
-
td.style.borderColor = formObj.bordercolor.value;
|
| 224 |
-
td.style.borderStyle = td.style.borderStyle == "" ? "solid" : td.style.borderStyle;
|
| 225 |
-
td.style.borderWidth = td.style.borderWidth == "" ? "1px" : td.style.borderWidth;
|
| 226 |
-
} else
|
| 227 |
-
td.style.borderColor = '';
|
| 228 |
-
|
| 229 |
-
td.style.backgroundColor = formObj.bgcolor.value;
|
| 230 |
-
|
| 231 |
-
if (formObj.backgroundimage.value != "")
|
| 232 |
-
td.style.backgroundImage = "url('" + formObj.backgroundimage.value + "')";
|
| 233 |
-
else
|
| 234 |
-
td.style.backgroundImage = '';
|
| 235 |
-
|
| 236 |
-
if (curCellType != celltype) {
|
| 237 |
-
// changing to a different node type
|
| 238 |
-
var newCell = doc.createElement(celltype);
|
| 239 |
-
|
| 240 |
-
for (var c=0; c<td.childNodes.length; c++)
|
| 241 |
-
newCell.appendChild(td.childNodes[c].cloneNode(1));
|
| 242 |
-
|
| 243 |
-
for (var a=0; a<td.attributes.length; a++)
|
| 244 |
-
ed.dom.setAttrib(newCell, td.attributes[a].name, ed.dom.getAttrib(td, td.attributes[a].name));
|
| 245 |
-
|
| 246 |
-
td.parentNode.replaceChild(newCell, td);
|
| 247 |
-
td = newCell;
|
| 248 |
-
}
|
| 249 |
-
|
| 250 |
-
dom.setAttrib(td, 'style', dom.serializeStyle(dom.parseStyle(td.style.cssText)));
|
| 251 |
-
|
| 252 |
-
return td;
|
| 253 |
-
}
|
| 254 |
-
|
| 255 |
-
function changedBackgroundImage() {
|
| 256 |
-
var formObj = document.forms[0];
|
| 257 |
-
var st = ed.dom.parseStyle(formObj.style.value);
|
| 258 |
-
|
| 259 |
-
st['background-image'] = "url('" + formObj.backgroundimage.value + "')";
|
| 260 |
-
|
| 261 |
-
formObj.style.value = ed.dom.serializeStyle(st);
|
| 262 |
-
}
|
| 263 |
-
|
| 264 |
-
function changedSize() {
|
| 265 |
-
var formObj = document.forms[0];
|
| 266 |
-
var st = ed.dom.parseStyle(formObj.style.value);
|
| 267 |
-
|
| 268 |
-
var width = formObj.width.value;
|
| 269 |
-
if (width != "")
|
| 270 |
-
st['width'] = getCSSSize(width);
|
| 271 |
-
else
|
| 272 |
-
st['width'] = "";
|
| 273 |
-
|
| 274 |
-
var height = formObj.height.value;
|
| 275 |
-
if (height != "")
|
| 276 |
-
st['height'] = getCSSSize(height);
|
| 277 |
-
else
|
| 278 |
-
st['height'] = "";
|
| 279 |
-
|
| 280 |
-
formObj.style.value = ed.dom.serializeStyle(st);
|
| 281 |
-
}
|
| 282 |
-
|
| 283 |
-
function changedColor() {
|
| 284 |
-
var formObj = document.forms[0];
|
| 285 |
-
var st = ed.dom.parseStyle(formObj.style.value);
|
| 286 |
-
|
| 287 |
-
st['background-color'] = formObj.bgcolor.value;
|
| 288 |
-
st['border-color'] = formObj.bordercolor.value;
|
| 289 |
-
|
| 290 |
-
formObj.style.value = ed.dom.serializeStyle(st);
|
| 291 |
-
}
|
| 292 |
-
|
| 293 |
-
function changedStyle() {
|
| 294 |
-
var formObj = document.forms[0];
|
| 295 |
-
var st = ed.dom.parseStyle(formObj.style.value);
|
| 296 |
-
|
| 297 |
-
if (st['background-image'])
|
| 298 |
-
formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
|
| 299 |
-
else
|
| 300 |
-
formObj.backgroundimage.value = '';
|
| 301 |
-
|
| 302 |
-
if (st['width'])
|
| 303 |
-
formObj.width.value = trimSize(st['width']);
|
| 304 |
-
|
| 305 |
-
if (st['height'])
|
| 306 |
-
formObj.height.value = trimSize(st['height']);
|
| 307 |
-
|
| 308 |
-
if (st['background-color']) {
|
| 309 |
-
formObj.bgcolor.value = st['background-color'];
|
| 310 |
-
updateColor('bgcolor_pick','bgcolor');
|
| 311 |
-
}
|
| 312 |
-
|
| 313 |
-
if (st['border-color']) {
|
| 314 |
-
formObj.bordercolor.value = st['border-color'];
|
| 315 |
-
updateColor('bordercolor_pick','bordercolor');
|
| 316 |
-
}
|
| 317 |
-
}
|
| 318 |
-
|
| 319 |
-
tinyMCEPopup.onInit.add(init);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tinymce3-table/js/merge_cells.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
| 1 |
-
tinyMCEPopup.requireLangPack();
|
| 2 |
-
|
| 3 |
-
var MergeCellsDialog = {
|
| 4 |
-
init : function() {
|
| 5 |
-
var f = document.forms[0];
|
| 6 |
-
|
| 7 |
-
f.numcols.value = tinyMCEPopup.getWindowArg('cols', 1);
|
| 8 |
-
f.numrows.value = tinyMCEPopup.getWindowArg('rows', 1);
|
| 9 |
-
},
|
| 10 |
-
|
| 11 |
-
merge : function() {
|
| 12 |
-
var func, f = document.forms[0];
|
| 13 |
-
|
| 14 |
-
tinyMCEPopup.restoreSelection();
|
| 15 |
-
|
| 16 |
-
func = tinyMCEPopup.getWindowArg('onaction');
|
| 17 |
-
|
| 18 |
-
func({
|
| 19 |
-
cols : f.numcols.value,
|
| 20 |
-
rows : f.numrows.value
|
| 21 |
-
});
|
| 22 |
-
|
| 23 |
-
tinyMCEPopup.close();
|
| 24 |
-
}
|
| 25 |
-
};
|
| 26 |
-
|
| 27 |
-
tinyMCEPopup.onInit.add(MergeCellsDialog.init, MergeCellsDialog);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tinymce3-table/js/row.js
DELETED
|
@@ -1,237 +0,0 @@
|
|
| 1 |
-
tinyMCEPopup.requireLangPack();
|
| 2 |
-
|
| 3 |
-
function init() {
|
| 4 |
-
tinyMCEPopup.resizeToInnerSize();
|
| 5 |
-
|
| 6 |
-
document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table');
|
| 7 |
-
document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
|
| 8 |
-
|
| 9 |
-
var inst = tinyMCEPopup.editor;
|
| 10 |
-
var dom = inst.dom;
|
| 11 |
-
var trElm = dom.getParent(inst.selection.getStart(), "tr");
|
| 12 |
-
var formObj = document.forms[0];
|
| 13 |
-
var st = dom.parseStyle(dom.getAttrib(trElm, "style"));
|
| 14 |
-
|
| 15 |
-
// Get table row data
|
| 16 |
-
var rowtype = trElm.parentNode.nodeName.toLowerCase();
|
| 17 |
-
var align = dom.getAttrib(trElm, 'align');
|
| 18 |
-
var valign = dom.getAttrib(trElm, 'valign');
|
| 19 |
-
var height = trimSize(getStyle(trElm, 'height', 'height'));
|
| 20 |
-
var className = dom.getAttrib(trElm, 'class');
|
| 21 |
-
var bgcolor = convertRGBToHex(getStyle(trElm, 'bgcolor', 'backgroundColor'));
|
| 22 |
-
var backgroundimage = getStyle(trElm, 'background', 'backgroundImage').replace(new RegExp("url\\(['\"]?([^'\"]*)['\"]?\\)", 'gi'), "$1");
|
| 23 |
-
var id = dom.getAttrib(trElm, 'id');
|
| 24 |
-
var lang = dom.getAttrib(trElm, 'lang');
|
| 25 |
-
var dir = dom.getAttrib(trElm, 'dir');
|
| 26 |
-
|
| 27 |
-
selectByValue(formObj, 'rowtype', rowtype);
|
| 28 |
-
|
| 29 |
-
// Any cells selected
|
| 30 |
-
if (dom.select('td.mceSelected,th.mceSelected', trElm).length == 0) {
|
| 31 |
-
// Setup form
|
| 32 |
-
addClassesToList('class', 'table_row_styles');
|
| 33 |
-
TinyMCE_EditableSelects.init();
|
| 34 |
-
|
| 35 |
-
formObj.bgcolor.value = bgcolor;
|
| 36 |
-
formObj.backgroundimage.value = backgroundimage;
|
| 37 |
-
formObj.height.value = height;
|
| 38 |
-
formObj.id.value = id;
|
| 39 |
-
formObj.lang.value = lang;
|
| 40 |
-
formObj.style.value = dom.serializeStyle(st);
|
| 41 |
-
selectByValue(formObj, 'align', align);
|
| 42 |
-
selectByValue(formObj, 'valign', valign);
|
| 43 |
-
selectByValue(formObj, 'class', className, true, true);
|
| 44 |
-
selectByValue(formObj, 'dir', dir);
|
| 45 |
-
|
| 46 |
-
// Resize some elements
|
| 47 |
-
if (isVisible('backgroundimagebrowser'))
|
| 48 |
-
document.getElementById('backgroundimage').style.width = '180px';
|
| 49 |
-
|
| 50 |
-
updateColor('bgcolor_pick', 'bgcolor');
|
| 51 |
-
} else
|
| 52 |
-
tinyMCEPopup.dom.hide('action');
|
| 53 |
-
}
|
| 54 |
-
|
| 55 |
-
function updateAction() {
|
| 56 |
-
var inst = tinyMCEPopup.editor, dom = inst.dom, trElm, tableElm, formObj = document.forms[0];
|
| 57 |
-
var action = getSelectValue(formObj, 'action');
|
| 58 |
-
|
| 59 |
-
if (!AutoValidator.validate(formObj)) {
|
| 60 |
-
tinyMCEPopup.alert(AutoValidator.getErrorMessages(formObj).join('. ') + '.');
|
| 61 |
-
return false;
|
| 62 |
-
}
|
| 63 |
-
|
| 64 |
-
tinyMCEPopup.restoreSelection();
|
| 65 |
-
trElm = dom.getParent(inst.selection.getStart(), "tr");
|
| 66 |
-
tableElm = dom.getParent(inst.selection.getStart(), "table");
|
| 67 |
-
|
| 68 |
-
// Update all selected rows
|
| 69 |
-
if (dom.select('td.mceSelected,th.mceSelected', trElm).length > 0) {
|
| 70 |
-
tinymce.each(tableElm.rows, function(tr) {
|
| 71 |
-
var i;
|
| 72 |
-
|
| 73 |
-
for (i = 0; i < tr.cells.length; i++) {
|
| 74 |
-
if (dom.hasClass(tr.cells[i], 'mceSelected')) {
|
| 75 |
-
updateRow(tr, true);
|
| 76 |
-
return;
|
| 77 |
-
}
|
| 78 |
-
}
|
| 79 |
-
});
|
| 80 |
-
|
| 81 |
-
inst.addVisual();
|
| 82 |
-
inst.nodeChanged();
|
| 83 |
-
inst.execCommand('mceEndUndoLevel');
|
| 84 |
-
tinyMCEPopup.close();
|
| 85 |
-
return;
|
| 86 |
-
}
|
| 87 |
-
|
| 88 |
-
switch (action) {
|
| 89 |
-
case "row":
|
| 90 |
-
updateRow(trElm);
|
| 91 |
-
break;
|
| 92 |
-
|
| 93 |
-
case "all":
|
| 94 |
-
var rows = tableElm.getElementsByTagName("tr");
|
| 95 |
-
|
| 96 |
-
for (var i=0; i<rows.length; i++)
|
| 97 |
-
updateRow(rows[i], true);
|
| 98 |
-
|
| 99 |
-
break;
|
| 100 |
-
|
| 101 |
-
case "odd":
|
| 102 |
-
case "even":
|
| 103 |
-
var rows = tableElm.getElementsByTagName("tr");
|
| 104 |
-
|
| 105 |
-
for (var i=0; i<rows.length; i++) {
|
| 106 |
-
if ((i % 2 == 0 && action == "odd") || (i % 2 != 0 && action == "even"))
|
| 107 |
-
updateRow(rows[i], true, true);
|
| 108 |
-
}
|
| 109 |
-
|
| 110 |
-
break;
|
| 111 |
-
}
|
| 112 |
-
|
| 113 |
-
inst.addVisual();
|
| 114 |
-
inst.nodeChanged();
|
| 115 |
-
inst.execCommand('mceEndUndoLevel');
|
| 116 |
-
tinyMCEPopup.close();
|
| 117 |
-
}
|
| 118 |
-
|
| 119 |
-
function updateRow(tr_elm, skip_id, skip_parent) {
|
| 120 |
-
var inst = tinyMCEPopup.editor;
|
| 121 |
-
var formObj = document.forms[0];
|
| 122 |
-
var dom = inst.dom;
|
| 123 |
-
var curRowType = tr_elm.parentNode.nodeName.toLowerCase();
|
| 124 |
-
var rowtype = getSelectValue(formObj, 'rowtype');
|
| 125 |
-
var doc = inst.getDoc();
|
| 126 |
-
|
| 127 |
-
// Update row element
|
| 128 |
-
if (!skip_id)
|
| 129 |
-
dom.setAttrib(tr_elm, 'id', formObj.id.value);
|
| 130 |
-
|
| 131 |
-
dom.setAttrib(tr_elm, 'align', getSelectValue(formObj, 'align'));
|
| 132 |
-
dom.setAttrib(tr_elm, 'vAlign', getSelectValue(formObj, 'valign'));
|
| 133 |
-
dom.setAttrib(tr_elm, 'lang', formObj.lang.value);
|
| 134 |
-
dom.setAttrib(tr_elm, 'dir', getSelectValue(formObj, 'dir'));
|
| 135 |
-
dom.setAttrib(tr_elm, 'style', dom.serializeStyle(dom.parseStyle(formObj.style.value)));
|
| 136 |
-
dom.setAttrib(tr_elm, 'class', getSelectValue(formObj, 'class'));
|
| 137 |
-
|
| 138 |
-
// Clear deprecated attributes
|
| 139 |
-
dom.setAttrib(tr_elm, 'background', '');
|
| 140 |
-
dom.setAttrib(tr_elm, 'bgColor', '');
|
| 141 |
-
dom.setAttrib(tr_elm, 'height', '');
|
| 142 |
-
|
| 143 |
-
// Set styles
|
| 144 |
-
tr_elm.style.height = getCSSSize(formObj.height.value);
|
| 145 |
-
tr_elm.style.backgroundColor = formObj.bgcolor.value;
|
| 146 |
-
|
| 147 |
-
if (formObj.backgroundimage.value != "")
|
| 148 |
-
tr_elm.style.backgroundImage = "url('" + formObj.backgroundimage.value + "')";
|
| 149 |
-
else
|
| 150 |
-
tr_elm.style.backgroundImage = '';
|
| 151 |
-
|
| 152 |
-
// Setup new rowtype
|
| 153 |
-
if (curRowType != rowtype && !skip_parent) {
|
| 154 |
-
// first, clone the node we are working on
|
| 155 |
-
var newRow = tr_elm.cloneNode(1);
|
| 156 |
-
|
| 157 |
-
// next, find the parent of its new destination (creating it if necessary)
|
| 158 |
-
var theTable = dom.getParent(tr_elm, "table");
|
| 159 |
-
var dest = rowtype;
|
| 160 |
-
var newParent = null;
|
| 161 |
-
for (var i = 0; i < theTable.childNodes.length; i++) {
|
| 162 |
-
if (theTable.childNodes[i].nodeName.toLowerCase() == dest)
|
| 163 |
-
newParent = theTable.childNodes[i];
|
| 164 |
-
}
|
| 165 |
-
|
| 166 |
-
if (newParent == null) {
|
| 167 |
-
newParent = doc.createElement(dest);
|
| 168 |
-
|
| 169 |
-
if (theTable.firstChild.nodeName == 'CAPTION')
|
| 170 |
-
inst.dom.insertAfter(newParent, theTable.firstChild);
|
| 171 |
-
else
|
| 172 |
-
theTable.insertBefore(newParent, theTable.firstChild);
|
| 173 |
-
}
|
| 174 |
-
|
| 175 |
-
// append the row to the new parent
|
| 176 |
-
newParent.appendChild(newRow);
|
| 177 |
-
|
| 178 |
-
// remove the original
|
| 179 |
-
tr_elm.parentNode.removeChild(tr_elm);
|
| 180 |
-
|
| 181 |
-
// set tr_elm to the new node
|
| 182 |
-
tr_elm = newRow;
|
| 183 |
-
}
|
| 184 |
-
|
| 185 |
-
dom.setAttrib(tr_elm, 'style', dom.serializeStyle(dom.parseStyle(tr_elm.style.cssText)));
|
| 186 |
-
}
|
| 187 |
-
|
| 188 |
-
function changedBackgroundImage() {
|
| 189 |
-
var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;
|
| 190 |
-
var st = dom.parseStyle(formObj.style.value);
|
| 191 |
-
|
| 192 |
-
st['background-image'] = "url('" + formObj.backgroundimage.value + "')";
|
| 193 |
-
|
| 194 |
-
formObj.style.value = dom.serializeStyle(st);
|
| 195 |
-
}
|
| 196 |
-
|
| 197 |
-
function changedStyle() {
|
| 198 |
-
var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;
|
| 199 |
-
var st = dom.parseStyle(formObj.style.value);
|
| 200 |
-
|
| 201 |
-
if (st['background-image'])
|
| 202 |
-
formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
|
| 203 |
-
else
|
| 204 |
-
formObj.backgroundimage.value = '';
|
| 205 |
-
|
| 206 |
-
if (st['height'])
|
| 207 |
-
formObj.height.value = trimSize(st['height']);
|
| 208 |
-
|
| 209 |
-
if (st['background-color']) {
|
| 210 |
-
formObj.bgcolor.value = st['background-color'];
|
| 211 |
-
updateColor('bgcolor_pick','bgcolor');
|
| 212 |
-
}
|
| 213 |
-
}
|
| 214 |
-
|
| 215 |
-
function changedSize() {
|
| 216 |
-
var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;
|
| 217 |
-
var st = dom.parseStyle(formObj.style.value);
|
| 218 |
-
|
| 219 |
-
var height = formObj.height.value;
|
| 220 |
-
if (height != "")
|
| 221 |
-
st['height'] = getCSSSize(height);
|
| 222 |
-
else
|
| 223 |
-
st['height'] = "";
|
| 224 |
-
|
| 225 |
-
formObj.style.value = dom.serializeStyle(st);
|
| 226 |
-
}
|
| 227 |
-
|
| 228 |
-
function changedColor() {
|
| 229 |
-
var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;
|
| 230 |
-
var st = dom.parseStyle(formObj.style.value);
|
| 231 |
-
|
| 232 |
-
st['background-color'] = formObj.bgcolor.value;
|
| 233 |
-
|
| 234 |
-
formObj.style.value = dom.serializeStyle(st);
|
| 235 |
-
}
|
| 236 |
-
|
| 237 |
-
tinyMCEPopup.onInit.add(init);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tinymce3-table/js/table.js
DELETED
|
@@ -1,501 +0,0 @@
|
|
| 1 |
-
tinyMCEPopup.requireLangPack();
|
| 2 |
-
|
| 3 |
-
var action, orgTableWidth, orgTableHeight, dom = tinyMCEPopup.editor.dom;
|
| 4 |
-
|
| 5 |
-
function insertTable() {
|
| 6 |
-
var formObj = document.forms[0];
|
| 7 |
-
var inst = tinyMCEPopup.editor, dom = inst.dom;
|
| 8 |
-
var cols = 2, rows = 2, border = 0, cellpadding = -1, cellspacing = -1, align, width, height, className, caption, frame, rules;
|
| 9 |
-
var html = '', capEl, elm;
|
| 10 |
-
var cellLimit, rowLimit, colLimit;
|
| 11 |
-
|
| 12 |
-
tinyMCEPopup.restoreSelection();
|
| 13 |
-
|
| 14 |
-
if (!AutoValidator.validate(formObj)) {
|
| 15 |
-
tinyMCEPopup.alert(AutoValidator.getErrorMessages(formObj).join('. ') + '.');
|
| 16 |
-
return false;
|
| 17 |
-
}
|
| 18 |
-
|
| 19 |
-
elm = dom.getParent(inst.selection.getNode(), 'table');
|
| 20 |
-
|
| 21 |
-
// Get form data
|
| 22 |
-
cols = formObj.elements['cols'].value;
|
| 23 |
-
rows = formObj.elements['rows'].value;
|
| 24 |
-
border = formObj.elements['border'].value != "" ? formObj.elements['border'].value : 0;
|
| 25 |
-
cellpadding = formObj.elements['cellpadding'].value != "" ? formObj.elements['cellpadding'].value : "";
|
| 26 |
-
cellspacing = formObj.elements['cellspacing'].value != "" ? formObj.elements['cellspacing'].value : "";
|
| 27 |
-
align = getSelectValue(formObj, "align");
|
| 28 |
-
frame = getSelectValue(formObj, "tframe");
|
| 29 |
-
rules = getSelectValue(formObj, "rules");
|
| 30 |
-
width = formObj.elements['width'].value;
|
| 31 |
-
height = formObj.elements['height'].value;
|
| 32 |
-
bordercolor = formObj.elements['bordercolor'].value;
|
| 33 |
-
bgcolor = formObj.elements['bgcolor'].value;
|
| 34 |
-
className = getSelectValue(formObj, "class");
|
| 35 |
-
id = formObj.elements['id'].value;
|
| 36 |
-
summary = formObj.elements['summary'].value;
|
| 37 |
-
style = formObj.elements['style'].value;
|
| 38 |
-
dir = formObj.elements['dir'].value;
|
| 39 |
-
lang = formObj.elements['lang'].value;
|
| 40 |
-
background = formObj.elements['backgroundimage'].value;
|
| 41 |
-
caption = formObj.elements['caption'].checked;
|
| 42 |
-
|
| 43 |
-
cellLimit = tinyMCEPopup.getParam('table_cell_limit', false);
|
| 44 |
-
rowLimit = tinyMCEPopup.getParam('table_row_limit', false);
|
| 45 |
-
colLimit = tinyMCEPopup.getParam('table_col_limit', false);
|
| 46 |
-
|
| 47 |
-
// Validate table size
|
| 48 |
-
if (colLimit && cols > colLimit) {
|
| 49 |
-
tinyMCEPopup.alert(inst.getLang('table_dlg.col_limit').replace(/\{\$cols\}/g, colLimit));
|
| 50 |
-
return false;
|
| 51 |
-
} else if (rowLimit && rows > rowLimit) {
|
| 52 |
-
tinyMCEPopup.alert(inst.getLang('table_dlg.row_limit').replace(/\{\$rows\}/g, rowLimit));
|
| 53 |
-
return false;
|
| 54 |
-
} else if (cellLimit && cols * rows > cellLimit) {
|
| 55 |
-
tinyMCEPopup.alert(inst.getLang('table_dlg.cell_limit').replace(/\{\$cells\}/g, cellLimit));
|
| 56 |
-
return false;
|
| 57 |
-
}
|
| 58 |
-
|
| 59 |
-
// Update table
|
| 60 |
-
if (action == "update") {
|
| 61 |
-
dom.setAttrib(elm, 'cellPadding', cellpadding, true);
|
| 62 |
-
dom.setAttrib(elm, 'cellSpacing', cellspacing, true);
|
| 63 |
-
|
| 64 |
-
if (!isCssSize(border)) {
|
| 65 |
-
dom.setAttrib(elm, 'border', border);
|
| 66 |
-
} else {
|
| 67 |
-
dom.setAttrib(elm, 'border', '');
|
| 68 |
-
}
|
| 69 |
-
|
| 70 |
-
if (border == '') {
|
| 71 |
-
dom.setStyle(elm, 'border-width', '');
|
| 72 |
-
dom.setStyle(elm, 'border', '');
|
| 73 |
-
dom.setAttrib(elm, 'border', '');
|
| 74 |
-
}
|
| 75 |
-
|
| 76 |
-
dom.setAttrib(elm, 'align', align);
|
| 77 |
-
dom.setAttrib(elm, 'frame', frame);
|
| 78 |
-
dom.setAttrib(elm, 'rules', rules);
|
| 79 |
-
dom.setAttrib(elm, 'class', className);
|
| 80 |
-
dom.setAttrib(elm, 'style', style);
|
| 81 |
-
dom.setAttrib(elm, 'id', id);
|
| 82 |
-
dom.setAttrib(elm, 'summary', summary);
|
| 83 |
-
dom.setAttrib(elm, 'dir', dir);
|
| 84 |
-
dom.setAttrib(elm, 'lang', lang);
|
| 85 |
-
|
| 86 |
-
capEl = inst.dom.select('caption', elm)[0];
|
| 87 |
-
|
| 88 |
-
if (capEl && !caption)
|
| 89 |
-
capEl.parentNode.removeChild(capEl);
|
| 90 |
-
|
| 91 |
-
if (!capEl && caption) {
|
| 92 |
-
capEl = elm.ownerDocument.createElement('caption');
|
| 93 |
-
|
| 94 |
-
if (!tinymce.isIE)
|
| 95 |
-
capEl.innerHTML = '<br data-mce-bogus="1"/>';
|
| 96 |
-
|
| 97 |
-
elm.insertBefore(capEl, elm.firstChild);
|
| 98 |
-
}
|
| 99 |
-
|
| 100 |
-
if (width && inst.settings.inline_styles) {
|
| 101 |
-
dom.setStyle(elm, 'width', width);
|
| 102 |
-
dom.setAttrib(elm, 'width', '');
|
| 103 |
-
} else {
|
| 104 |
-
dom.setAttrib(elm, 'width', width, true);
|
| 105 |
-
dom.setStyle(elm, 'width', '');
|
| 106 |
-
}
|
| 107 |
-
|
| 108 |
-
// Remove these since they are not valid XHTML
|
| 109 |
-
dom.setAttrib(elm, 'borderColor', '');
|
| 110 |
-
dom.setAttrib(elm, 'bgColor', '');
|
| 111 |
-
dom.setAttrib(elm, 'background', '');
|
| 112 |
-
|
| 113 |
-
if (height && inst.settings.inline_styles) {
|
| 114 |
-
dom.setStyle(elm, 'height', height);
|
| 115 |
-
dom.setAttrib(elm, 'height', '');
|
| 116 |
-
} else {
|
| 117 |
-
dom.setAttrib(elm, 'height', height, true);
|
| 118 |
-
dom.setStyle(elm, 'height', '');
|
| 119 |
-
}
|
| 120 |
-
|
| 121 |
-
if (background != '')
|
| 122 |
-
elm.style.backgroundImage = "url('" + background + "')";
|
| 123 |
-
else
|
| 124 |
-
elm.style.backgroundImage = '';
|
| 125 |
-
|
| 126 |
-
/* if (tinyMCEPopup.getParam("inline_styles")) {
|
| 127 |
-
if (width != '')
|
| 128 |
-
elm.style.width = getCSSSize(width);
|
| 129 |
-
}*/
|
| 130 |
-
|
| 131 |
-
if (bordercolor != "") {
|
| 132 |
-
elm.style.borderColor = bordercolor;
|
| 133 |
-
elm.style.borderStyle = elm.style.borderStyle == "" ? "solid" : elm.style.borderStyle;
|
| 134 |
-
elm.style.borderWidth = cssSize(border);
|
| 135 |
-
} else
|
| 136 |
-
elm.style.borderColor = '';
|
| 137 |
-
|
| 138 |
-
elm.style.backgroundColor = bgcolor;
|
| 139 |
-
elm.style.height = getCSSSize(height);
|
| 140 |
-
|
| 141 |
-
inst.addVisual();
|
| 142 |
-
|
| 143 |
-
// Fix for stange MSIE align bug
|
| 144 |
-
//elm.outerHTML = elm.outerHTML;
|
| 145 |
-
|
| 146 |
-
inst.nodeChanged();
|
| 147 |
-
inst.execCommand('mceEndUndoLevel', false, {}, {skip_undo: true});
|
| 148 |
-
|
| 149 |
-
// Repaint if dimensions changed
|
| 150 |
-
if (formObj.width.value != orgTableWidth || formObj.height.value != orgTableHeight)
|
| 151 |
-
inst.execCommand('mceRepaint');
|
| 152 |
-
|
| 153 |
-
tinyMCEPopup.close();
|
| 154 |
-
return true;
|
| 155 |
-
}
|
| 156 |
-
|
| 157 |
-
// Create new table
|
| 158 |
-
html += '<table';
|
| 159 |
-
|
| 160 |
-
html += makeAttrib('id', id);
|
| 161 |
-
if (!isCssSize(border)) {
|
| 162 |
-
html += makeAttrib('border', border);
|
| 163 |
-
}
|
| 164 |
-
|
| 165 |
-
html += makeAttrib('cellpadding', cellpadding);
|
| 166 |
-
html += makeAttrib('cellspacing', cellspacing);
|
| 167 |
-
html += makeAttrib('data-mce-new', '1');
|
| 168 |
-
|
| 169 |
-
if (width && inst.settings.inline_styles) {
|
| 170 |
-
if (style)
|
| 171 |
-
style += '; ';
|
| 172 |
-
|
| 173 |
-
// Force px
|
| 174 |
-
if (/^[0-9\.]+$/.test(width))
|
| 175 |
-
width += 'px';
|
| 176 |
-
|
| 177 |
-
style += 'width: ' + width;
|
| 178 |
-
} else
|
| 179 |
-
html += makeAttrib('width', width);
|
| 180 |
-
|
| 181 |
-
/* if (height) {
|
| 182 |
-
if (style)
|
| 183 |
-
style += '; ';
|
| 184 |
-
|
| 185 |
-
style += 'height: ' + height;
|
| 186 |
-
}*/
|
| 187 |
-
|
| 188 |
-
//html += makeAttrib('height', height);
|
| 189 |
-
//html += makeAttrib('bordercolor', bordercolor);
|
| 190 |
-
//html += makeAttrib('bgcolor', bgcolor);
|
| 191 |
-
html += makeAttrib('align', align);
|
| 192 |
-
html += makeAttrib('frame', frame);
|
| 193 |
-
html += makeAttrib('rules', rules);
|
| 194 |
-
html += makeAttrib('class', className);
|
| 195 |
-
html += makeAttrib('style', style);
|
| 196 |
-
html += makeAttrib('summary', summary);
|
| 197 |
-
html += makeAttrib('dir', dir);
|
| 198 |
-
html += makeAttrib('lang', lang);
|
| 199 |
-
html += '>';
|
| 200 |
-
|
| 201 |
-
if (caption) {
|
| 202 |
-
if (!tinymce.isIE)
|
| 203 |
-
html += '<caption><br data-mce-bogus="1"/></caption>';
|
| 204 |
-
else
|
| 205 |
-
html += '<caption></caption>';
|
| 206 |
-
}
|
| 207 |
-
|
| 208 |
-
for (var y=0; y<rows; y++) {
|
| 209 |
-
html += "<tr>";
|
| 210 |
-
|
| 211 |
-
for (var x=0; x<cols; x++) {
|
| 212 |
-
if (!tinymce.isIE)
|
| 213 |
-
html += '<td><br data-mce-bogus="1"/></td>';
|
| 214 |
-
else
|
| 215 |
-
html += '<td></td>';
|
| 216 |
-
}
|
| 217 |
-
|
| 218 |
-
html += "</tr>";
|
| 219 |
-
}
|
| 220 |
-
|
| 221 |
-
html += "</table>";
|
| 222 |
-
|
| 223 |
-
// Move table
|
| 224 |
-
if (inst.settings.fix_table_elements) {
|
| 225 |
-
var patt = '';
|
| 226 |
-
|
| 227 |
-
inst.focus();
|
| 228 |
-
inst.selection.setContent('<br class="_mce_marker" />');
|
| 229 |
-
|
| 230 |
-
tinymce.each('h1,h2,h3,h4,h5,h6,p'.split(','), function(n) {
|
| 231 |
-
if (patt)
|
| 232 |
-
patt += ',';
|
| 233 |
-
|
| 234 |
-
patt += n + ' ._mce_marker';
|
| 235 |
-
});
|
| 236 |
-
|
| 237 |
-
tinymce.each(inst.dom.select(patt), function(n) {
|
| 238 |
-
inst.dom.split(inst.dom.getParent(n, 'h1,h2,h3,h4,h5,h6,p'), n);
|
| 239 |
-
});
|
| 240 |
-
|
| 241 |
-
dom.setOuterHTML(dom.select('br._mce_marker')[0], html);
|
| 242 |
-
} else
|
| 243 |
-
inst.execCommand('mceInsertContent', false, html);
|
| 244 |
-
|
| 245 |
-
tinymce.each(dom.select('table[data-mce-new]'), function(node) {
|
| 246 |
-
var tdorth = dom.select('td,th', node);
|
| 247 |
-
|
| 248 |
-
// Fixes a bug in IE where the caret cannot be placed after the table if the table is at the end of the document
|
| 249 |
-
if (tinymce.isIE && node.nextSibling == null) {
|
| 250 |
-
if (inst.settings.forced_root_block)
|
| 251 |
-
dom.insertAfter(dom.create(inst.settings.forced_root_block), node);
|
| 252 |
-
else
|
| 253 |
-
dom.insertAfter(dom.create('br', {'data-mce-bogus': '1'}), node);
|
| 254 |
-
}
|
| 255 |
-
|
| 256 |
-
try {
|
| 257 |
-
// IE9 might fail to do this selection
|
| 258 |
-
inst.selection.setCursorLocation(tdorth[0], 0);
|
| 259 |
-
} catch (ex) {
|
| 260 |
-
// Ignore
|
| 261 |
-
}
|
| 262 |
-
|
| 263 |
-
dom.setAttrib(node, 'data-mce-new', '');
|
| 264 |
-
});
|
| 265 |
-
|
| 266 |
-
inst.addVisual();
|
| 267 |
-
inst.execCommand('mceEndUndoLevel', false, {}, {skip_undo: true});
|
| 268 |
-
|
| 269 |
-
tinyMCEPopup.close();
|
| 270 |
-
}
|
| 271 |
-
|
| 272 |
-
function makeAttrib(attrib, value) {
|
| 273 |
-
var formObj = document.forms[0];
|
| 274 |
-
var valueElm = formObj.elements[attrib];
|
| 275 |
-
|
| 276 |
-
if (typeof(value) == "undefined" || value == null) {
|
| 277 |
-
value = "";
|
| 278 |
-
|
| 279 |
-
if (valueElm)
|
| 280 |
-
value = valueElm.value;
|
| 281 |
-
}
|
| 282 |
-
|
| 283 |
-
if (value == "")
|
| 284 |
-
return "";
|
| 285 |
-
|
| 286 |
-
// XML encode it
|
| 287 |
-
value = value.replace(/&/g, '&');
|
| 288 |
-
value = value.replace(/\"/g, '"');
|
| 289 |
-
value = value.replace(/</g, '<');
|
| 290 |
-
value = value.replace(/>/g, '>');
|
| 291 |
-
|
| 292 |
-
return ' ' + attrib + '="' + value + '"';
|
| 293 |
-
}
|
| 294 |
-
|
| 295 |
-
function init() {
|
| 296 |
-
tinyMCEPopup.resizeToInnerSize();
|
| 297 |
-
|
| 298 |
-
document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table');
|
| 299 |
-
document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table');
|
| 300 |
-
document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor');
|
| 301 |
-
document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
|
| 302 |
-
|
| 303 |
-
var cols = 2, rows = 2, border = tinyMCEPopup.getParam('table_default_border', '0'), cellpadding = tinyMCEPopup.getParam('table_default_cellpadding', ''), cellspacing = tinyMCEPopup.getParam('table_default_cellspacing', '');
|
| 304 |
-
var align = "", width = "", height = "", bordercolor = "", bgcolor = "", className = "";
|
| 305 |
-
var id = "", summary = "", style = "", dir = "", lang = "", background = "", bgcolor = "", bordercolor = "", rules = "", frame = "";
|
| 306 |
-
var inst = tinyMCEPopup.editor, dom = inst.dom;
|
| 307 |
-
var formObj = document.forms[0];
|
| 308 |
-
var elm = dom.getParent(inst.selection.getNode(), "table");
|
| 309 |
-
|
| 310 |
-
// Hide advanced fields that isn't available in the schema
|
| 311 |
-
tinymce.each("summary id rules dir style frame".split(" "), function(name) {
|
| 312 |
-
var tr = tinyMCEPopup.dom.getParent(name, "tr") || tinyMCEPopup.dom.getParent("t" + name, "tr");
|
| 313 |
-
|
| 314 |
-
if (tr && !tinyMCEPopup.editor.schema.isValid("table", name)) {
|
| 315 |
-
tr.style.display = 'none';
|
| 316 |
-
}
|
| 317 |
-
});
|
| 318 |
-
|
| 319 |
-
action = tinyMCEPopup.getWindowArg('action');
|
| 320 |
-
|
| 321 |
-
if (!action)
|
| 322 |
-
action = elm ? "update" : "insert";
|
| 323 |
-
|
| 324 |
-
if (elm && action != "insert") {
|
| 325 |
-
var rowsAr = elm.rows;
|
| 326 |
-
var cols = 0;
|
| 327 |
-
for (var i=0; i<rowsAr.length; i++)
|
| 328 |
-
if (rowsAr[i].cells.length > cols)
|
| 329 |
-
cols = rowsAr[i].cells.length;
|
| 330 |
-
|
| 331 |
-
cols = cols;
|
| 332 |
-
rows = rowsAr.length;
|
| 333 |
-
|
| 334 |
-
st = dom.parseStyle(dom.getAttrib(elm, "style"));
|
| 335 |
-
border = trimSize(getStyle(elm, 'border', 'borderWidth'));
|
| 336 |
-
cellpadding = dom.getAttrib(elm, 'cellpadding', "");
|
| 337 |
-
cellspacing = dom.getAttrib(elm, 'cellspacing', "");
|
| 338 |
-
width = trimSize(getStyle(elm, 'width', 'width'));
|
| 339 |
-
height = trimSize(getStyle(elm, 'height', 'height'));
|
| 340 |
-
bordercolor = convertRGBToHex(getStyle(elm, 'bordercolor', 'borderLeftColor'));
|
| 341 |
-
bgcolor = convertRGBToHex(getStyle(elm, 'bgcolor', 'backgroundColor'));
|
| 342 |
-
align = dom.getAttrib(elm, 'align', align);
|
| 343 |
-
frame = dom.getAttrib(elm, 'frame');
|
| 344 |
-
rules = dom.getAttrib(elm, 'rules');
|
| 345 |
-
className = tinymce.trim(dom.getAttrib(elm, 'class').replace(/mceItem.+/g, ''));
|
| 346 |
-
id = dom.getAttrib(elm, 'id');
|
| 347 |
-
summary = dom.getAttrib(elm, 'summary');
|
| 348 |
-
style = dom.serializeStyle(st);
|
| 349 |
-
dir = dom.getAttrib(elm, 'dir');
|
| 350 |
-
lang = dom.getAttrib(elm, 'lang');
|
| 351 |
-
background = getStyle(elm, 'background', 'backgroundImage').replace(new RegExp("url\\(['\"]?([^'\"]*)['\"]?\\)", 'gi'), "$1");
|
| 352 |
-
formObj.caption.checked = elm.getElementsByTagName('caption').length > 0;
|
| 353 |
-
|
| 354 |
-
orgTableWidth = width;
|
| 355 |
-
orgTableHeight = height;
|
| 356 |
-
|
| 357 |
-
action = "update";
|
| 358 |
-
formObj.insert.value = inst.getLang('update');
|
| 359 |
-
}
|
| 360 |
-
|
| 361 |
-
addClassesToList('class', "table_styles");
|
| 362 |
-
TinyMCE_EditableSelects.init();
|
| 363 |
-
|
| 364 |
-
// Update form
|
| 365 |
-
selectByValue(formObj, 'align', align);
|
| 366 |
-
selectByValue(formObj, 'tframe', frame);
|
| 367 |
-
selectByValue(formObj, 'rules', rules);
|
| 368 |
-
selectByValue(formObj, 'class', className, true, true);
|
| 369 |
-
formObj.cols.value = cols;
|
| 370 |
-
formObj.rows.value = rows;
|
| 371 |
-
formObj.border.value = border;
|
| 372 |
-
formObj.cellpadding.value = cellpadding;
|
| 373 |
-
formObj.cellspacing.value = cellspacing;
|
| 374 |
-
formObj.width.value = width;
|
| 375 |
-
formObj.height.value = height;
|
| 376 |
-
formObj.bordercolor.value = bordercolor;
|
| 377 |
-
formObj.bgcolor.value = bgcolor;
|
| 378 |
-
formObj.id.value = id;
|
| 379 |
-
formObj.summary.value = summary;
|
| 380 |
-
formObj.style.value = style;
|
| 381 |
-
formObj.dir.value = dir;
|
| 382 |
-
formObj.lang.value = lang;
|
| 383 |
-
formObj.backgroundimage.value = background;
|
| 384 |
-
|
| 385 |
-
updateColor('bordercolor_pick', 'bordercolor');
|
| 386 |
-
updateColor('bgcolor_pick', 'bgcolor');
|
| 387 |
-
|
| 388 |
-
// Resize some elements
|
| 389 |
-
if (isVisible('backgroundimagebrowser'))
|
| 390 |
-
document.getElementById('backgroundimage').style.width = '180px';
|
| 391 |
-
|
| 392 |
-
// Disable some fields in update mode
|
| 393 |
-
if (action == "update") {
|
| 394 |
-
formObj.cols.disabled = true;
|
| 395 |
-
formObj.rows.disabled = true;
|
| 396 |
-
}
|
| 397 |
-
}
|
| 398 |
-
|
| 399 |
-
function changedSize() {
|
| 400 |
-
var formObj = document.forms[0];
|
| 401 |
-
var st = dom.parseStyle(formObj.style.value);
|
| 402 |
-
|
| 403 |
-
/* var width = formObj.width.value;
|
| 404 |
-
if (width != "")
|
| 405 |
-
st['width'] = tinyMCEPopup.getParam("inline_styles") ? getCSSSize(width) : "";
|
| 406 |
-
else
|
| 407 |
-
st['width'] = "";*/
|
| 408 |
-
|
| 409 |
-
var height = formObj.height.value;
|
| 410 |
-
if (height != "")
|
| 411 |
-
st['height'] = getCSSSize(height);
|
| 412 |
-
else
|
| 413 |
-
st['height'] = "";
|
| 414 |
-
|
| 415 |
-
formObj.style.value = dom.serializeStyle(st);
|
| 416 |
-
}
|
| 417 |
-
|
| 418 |
-
function isCssSize(value) {
|
| 419 |
-
return /^[0-9.]+(%|in|cm|mm|em|ex|pt|pc|px)$/.test(value);
|
| 420 |
-
}
|
| 421 |
-
|
| 422 |
-
function cssSize(value, def) {
|
| 423 |
-
value = tinymce.trim(value || def);
|
| 424 |
-
|
| 425 |
-
if (!isCssSize(value)) {
|
| 426 |
-
return parseInt(value, 10) + 'px';
|
| 427 |
-
}
|
| 428 |
-
|
| 429 |
-
return value;
|
| 430 |
-
}
|
| 431 |
-
|
| 432 |
-
function changedBackgroundImage() {
|
| 433 |
-
var formObj = document.forms[0];
|
| 434 |
-
var st = dom.parseStyle(formObj.style.value);
|
| 435 |
-
|
| 436 |
-
st['background-image'] = "url('" + formObj.backgroundimage.value + "')";
|
| 437 |
-
|
| 438 |
-
formObj.style.value = dom.serializeStyle(st);
|
| 439 |
-
}
|
| 440 |
-
|
| 441 |
-
function changedBorder() {
|
| 442 |
-
var formObj = document.forms[0];
|
| 443 |
-
var st = dom.parseStyle(formObj.style.value);
|
| 444 |
-
|
| 445 |
-
// Update border width if the element has a color
|
| 446 |
-
if (formObj.border.value != "" && (isCssSize(formObj.border.value) || formObj.bordercolor.value != ""))
|
| 447 |
-
st['border-width'] = cssSize(formObj.border.value);
|
| 448 |
-
else {
|
| 449 |
-
if (!formObj.border.value) {
|
| 450 |
-
st['border'] = '';
|
| 451 |
-
st['border-width'] = '';
|
| 452 |
-
}
|
| 453 |
-
}
|
| 454 |
-
|
| 455 |
-
formObj.style.value = dom.serializeStyle(st);
|
| 456 |
-
}
|
| 457 |
-
|
| 458 |
-
function changedColor() {
|
| 459 |
-
var formObj = document.forms[0];
|
| 460 |
-
var st = dom.parseStyle(formObj.style.value);
|
| 461 |
-
|
| 462 |
-
st['background-color'] = formObj.bgcolor.value;
|
| 463 |
-
|
| 464 |
-
if (formObj.bordercolor.value != "") {
|
| 465 |
-
st['border-color'] = formObj.bordercolor.value;
|
| 466 |
-
|
| 467 |
-
// Add border-width if it's missing
|
| 468 |
-
if (!st['border-width'])
|
| 469 |
-
st['border-width'] = cssSize(formObj.border.value, 1);
|
| 470 |
-
}
|
| 471 |
-
|
| 472 |
-
formObj.style.value = dom.serializeStyle(st);
|
| 473 |
-
}
|
| 474 |
-
|
| 475 |
-
function changedStyle() {
|
| 476 |
-
var formObj = document.forms[0];
|
| 477 |
-
var st = dom.parseStyle(formObj.style.value);
|
| 478 |
-
|
| 479 |
-
if (st['background-image'])
|
| 480 |
-
formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\(['\"]?([^'\"]*)['\"]?\\)", 'gi'), "$1");
|
| 481 |
-
else
|
| 482 |
-
formObj.backgroundimage.value = '';
|
| 483 |
-
|
| 484 |
-
if (st['width'])
|
| 485 |
-
formObj.width.value = trimSize(st['width']);
|
| 486 |
-
|
| 487 |
-
if (st['height'])
|
| 488 |
-
formObj.height.value = trimSize(st['height']);
|
| 489 |
-
|
| 490 |
-
if (st['background-color']) {
|
| 491 |
-
formObj.bgcolor.value = st['background-color'];
|
| 492 |
-
updateColor('bgcolor_pick','bgcolor');
|
| 493 |
-
}
|
| 494 |
-
|
| 495 |
-
if (st['border-color']) {
|
| 496 |
-
formObj.bordercolor.value = st['border-color'];
|
| 497 |
-
updateColor('bordercolor_pick','bordercolor');
|
| 498 |
-
}
|
| 499 |
-
}
|
| 500 |
-
|
| 501 |
-
tinyMCEPopup.onInit.add(init);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tinymce3-table/langs/en_dlg.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
tinyMCE.addI18n('en.table_dlg',{"rules_border":"border","rules_box":"box","rules_vsides":"vsides","rules_rhs":"rhs","rules_lhs":"lhs","rules_hsides":"hsides","rules_below":"below","rules_above":"above","rules_void":"void",rules:"Rules","frame_all":"all","frame_cols":"cols","frame_rows":"rows","frame_groups":"groups","frame_none":"none",frame:"Frame",caption:"Table Caption","missing_scope":"Are you sure you want to continue without specifying a scope for this table header cell. Without it, it may be difficult for some users with disabilities to understand the content or data displayed of the table.","cell_limit":"You\'ve exceeded the maximum number of cells of {$cells}.","row_limit":"You\'ve exceeded the maximum number of rows of {$rows}.","col_limit":"You\'ve exceeded the maximum number of columns of {$cols}.",colgroup:"Col Group",rowgroup:"Row Group",scope:"Scope",tfoot:"Footer",tbody:"Body",thead:"Header","row_all":"Update All Rows in Table","row_even":"Update Even Rows in Table","row_odd":"Update Odd Rows in Table","row_row":"Update Current Row","cell_all":"Update All Cells in Table","cell_row":"Update All Cells in Row","cell_cell":"Update Current Cell",th:"Header",td:"Data",summary:"Summary",bgimage:"Background Image",rtl:"Right to Left",ltr:"Left to Right",mime:"Target MIME Type",langcode:"Language Code",langdir:"Language Direction",style:"Style",id:"ID","merge_cells_title":"Merge Table Cells",bgcolor:"Background Color",bordercolor:"Border Color","align_bottom":"Bottom","align_top":"Top",valign:"Vertical Alignment","cell_type":"Cell Type","cell_title":"Table Cell Properties","row_title":"Table Row Properties","align_middle":"Center","align_right":"Right","align_left":"Left","align_default":"Default",align:"Alignment",border:"Border",cellpadding:"Cell Padding",cellspacing:"Cell Spacing",rows:"Rows",cols:"Columns",height:"Height",width:"Width",title:"Insert/Edit Table",rowtype:"Row Type","advanced_props":"Advanced Properties","general_props":"General Properties","advanced_tab":"Advanced","general_tab":"General","cell_col":"Update all cells in column"});
|
|
|
tinymce3-table/merge_cells.htm
DELETED
|
@@ -1,32 +0,0 @@
|
|
| 1 |
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
| 2 |
-
<html xmlns="http://www.w3.org/1999/xhtml">
|
| 3 |
-
<head>
|
| 4 |
-
<title>{#table_dlg.merge_cells_title}</title>
|
| 5 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
| 6 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/mctabs.js"></script>
|
| 7 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/validate.js"></script>
|
| 8 |
-
<script type="text/javascript" src="js/merge_cells.js"></script>
|
| 9 |
-
</head>
|
| 10 |
-
<body style="margin: 8px" role="application">
|
| 11 |
-
<form onsubmit="MergeCellsDialog.merge();return false;" action="#">
|
| 12 |
-
<fieldset>
|
| 13 |
-
<legend>{#table_dlg.merge_cells_title}</legend>
|
| 14 |
-
<table role="presentation" border="0" cellpadding="0" cellspacing="3" width="100%">
|
| 15 |
-
<tr>
|
| 16 |
-
<td><label for="numcols">{#table_dlg.cols}</label>:</td>
|
| 17 |
-
<td align="right"><input type="text" id="numcols" name="numcols" value="" class="number min1 mceFocus" style="width: 30px" aria-required="true" /></td>
|
| 18 |
-
</tr>
|
| 19 |
-
<tr>
|
| 20 |
-
<td><label for="numrows">{#table_dlg.rows}</label>:</td>
|
| 21 |
-
<td align="right"><input type="text" id="numrows" name="numrows" value="" class="number min1" style="width: 30px" aria-required="true" /></td>
|
| 22 |
-
</tr>
|
| 23 |
-
</table>
|
| 24 |
-
</fieldset>
|
| 25 |
-
|
| 26 |
-
<div class="mceActionPanel">
|
| 27 |
-
<input type="submit" id="insert" name="insert" value="{#update}" />
|
| 28 |
-
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
| 29 |
-
</div>
|
| 30 |
-
</form>
|
| 31 |
-
</body>
|
| 32 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tinymce3-table/row.htm
DELETED
|
@@ -1,158 +0,0 @@
|
|
| 1 |
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
| 2 |
-
<html xmlns="http://www.w3.org/1999/xhtml">
|
| 3 |
-
<head>
|
| 4 |
-
<title>{#table_dlg.row_title}</title>
|
| 5 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
| 6 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/mctabs.js"></script>
|
| 7 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/form_utils.js"></script>
|
| 8 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/validate.js"></script>
|
| 9 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/editable_selects.js"></script>
|
| 10 |
-
<script type="text/javascript" src="js/row.js"></script>
|
| 11 |
-
<link href="css/row.css" rel="stylesheet" type="text/css" />
|
| 12 |
-
</head>
|
| 13 |
-
<body id="tablerow" style="display: none" role="application">
|
| 14 |
-
<form onsubmit="updateAction();return false;" action="#">
|
| 15 |
-
<div class="tabs">
|
| 16 |
-
<ul>
|
| 17 |
-
<li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li>
|
| 18 |
-
<li id="advanced_tab" aria-controls="advanced_panel"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>
|
| 19 |
-
</ul>
|
| 20 |
-
</div>
|
| 21 |
-
|
| 22 |
-
<div class="panel_wrapper">
|
| 23 |
-
<div id="general_panel" class="panel current">
|
| 24 |
-
<fieldset>
|
| 25 |
-
<legend>{#table_dlg.general_props}</legend>
|
| 26 |
-
|
| 27 |
-
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
|
| 28 |
-
<tr>
|
| 29 |
-
<td><label for="rowtype">{#table_dlg.rowtype}</label></td>
|
| 30 |
-
<td class="col2">
|
| 31 |
-
<select id="rowtype" name="rowtype" class="mceFocus">
|
| 32 |
-
<option value="thead">{#table_dlg.thead}</option>
|
| 33 |
-
<option value="tbody">{#table_dlg.tbody}</option>
|
| 34 |
-
<option value="tfoot">{#table_dlg.tfoot}</option>
|
| 35 |
-
</select>
|
| 36 |
-
</td>
|
| 37 |
-
</tr>
|
| 38 |
-
|
| 39 |
-
<tr>
|
| 40 |
-
<td><label for="align">{#table_dlg.align}</label></td>
|
| 41 |
-
<td class="col2">
|
| 42 |
-
<select id="align" name="align">
|
| 43 |
-
<option value="">{#not_set}</option>
|
| 44 |
-
<option value="center">{#table_dlg.align_middle}</option>
|
| 45 |
-
<option value="left">{#table_dlg.align_left}</option>
|
| 46 |
-
<option value="right">{#table_dlg.align_right}</option>
|
| 47 |
-
</select>
|
| 48 |
-
</td>
|
| 49 |
-
</tr>
|
| 50 |
-
|
| 51 |
-
<tr>
|
| 52 |
-
<td><label for="valign">{#table_dlg.valign}</label></td>
|
| 53 |
-
<td class="col2">
|
| 54 |
-
<select id="valign" name="valign">
|
| 55 |
-
<option value="">{#not_set}</option>
|
| 56 |
-
<option value="top">{#table_dlg.align_top}</option>
|
| 57 |
-
<option value="middle">{#table_dlg.align_middle}</option>
|
| 58 |
-
<option value="bottom">{#table_dlg.align_bottom}</option>
|
| 59 |
-
</select>
|
| 60 |
-
</td>
|
| 61 |
-
</tr>
|
| 62 |
-
|
| 63 |
-
<tr id="styleSelectRow">
|
| 64 |
-
<td><label for="class">{#class_name}</label></td>
|
| 65 |
-
<td class="col2">
|
| 66 |
-
<select id="class" name="class" class="mceEditableSelect">
|
| 67 |
-
<option value="" selected="selected">{#not_set}</option>
|
| 68 |
-
</select>
|
| 69 |
-
</td>
|
| 70 |
-
</tr>
|
| 71 |
-
|
| 72 |
-
<tr>
|
| 73 |
-
<td><label for="height">{#table_dlg.height}</label></td>
|
| 74 |
-
<td class="col2"><input name="height" type="text" id="height" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>
|
| 75 |
-
</tr>
|
| 76 |
-
</table>
|
| 77 |
-
</fieldset>
|
| 78 |
-
</div>
|
| 79 |
-
|
| 80 |
-
<div id="advanced_panel" class="panel">
|
| 81 |
-
<fieldset>
|
| 82 |
-
<legend>{#table_dlg.advanced_props}</legend>
|
| 83 |
-
|
| 84 |
-
<table role="presentation" border="0" cellpadding="0" cellspacing="4">
|
| 85 |
-
<tr>
|
| 86 |
-
<td class="column1"><label for="id">{#table_dlg.id}</label></td>
|
| 87 |
-
<td><input id="id" name="id" type="text" value="" style="width: 200px" /></td>
|
| 88 |
-
</tr>
|
| 89 |
-
|
| 90 |
-
<tr>
|
| 91 |
-
<td><label for="style">{#table_dlg.style}</label></td>
|
| 92 |
-
<td><input type="text" id="style" name="style" value="" style="width: 200px;" onchange="changedStyle();" /></td>
|
| 93 |
-
</tr>
|
| 94 |
-
|
| 95 |
-
<tr>
|
| 96 |
-
<td class="column1"><label for="dir">{#table_dlg.langdir}</label></td>
|
| 97 |
-
<td>
|
| 98 |
-
<select id="dir" name="dir" style="width: 200px">
|
| 99 |
-
<option value="">{#not_set}</option>
|
| 100 |
-
<option value="ltr">{#table_dlg.ltr}</option>
|
| 101 |
-
<option value="rtl">{#table_dlg.rtl}</option>
|
| 102 |
-
</select>
|
| 103 |
-
</td>
|
| 104 |
-
</tr>
|
| 105 |
-
|
| 106 |
-
<tr>
|
| 107 |
-
<td class="column1"><label for="lang">{#table_dlg.langcode}</label></td>
|
| 108 |
-
<td>
|
| 109 |
-
<input id="lang" name="lang" type="text" value="" style="width: 200px" />
|
| 110 |
-
</td>
|
| 111 |
-
</tr>
|
| 112 |
-
|
| 113 |
-
<tr>
|
| 114 |
-
<td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td>
|
| 115 |
-
<td>
|
| 116 |
-
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
| 117 |
-
<tr>
|
| 118 |
-
<td><input id="backgroundimage" name="backgroundimage" type="text" value="" style="width: 200px" onchange="changedBackgroundImage();" /></td>
|
| 119 |
-
<td id="backgroundimagebrowsercontainer"> </td>
|
| 120 |
-
</tr>
|
| 121 |
-
</table>
|
| 122 |
-
</td>
|
| 123 |
-
</tr>
|
| 124 |
-
|
| 125 |
-
<tr>
|
| 126 |
-
<td class="column1"><label for="bgcolor" id="bgcolor_label">{#table_dlg.bgcolor}</label></td>
|
| 127 |
-
<td>
|
| 128 |
-
<span role="group" aria-labelledby="bgcolor_label">
|
| 129 |
-
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
| 130 |
-
<tr>
|
| 131 |
-
<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>
|
| 132 |
-
<td id="bgcolor_pickcontainer"> </td>
|
| 133 |
-
</tr>
|
| 134 |
-
</table>
|
| 135 |
-
</span>
|
| 136 |
-
</td>
|
| 137 |
-
</tr>
|
| 138 |
-
</table>
|
| 139 |
-
</fieldset>
|
| 140 |
-
</div>
|
| 141 |
-
</div>
|
| 142 |
-
|
| 143 |
-
<div class="mceActionPanel">
|
| 144 |
-
<div>
|
| 145 |
-
<select id="action" name="action">
|
| 146 |
-
<option value="row">{#table_dlg.row_row}</option>
|
| 147 |
-
<option value="odd">{#table_dlg.row_odd}</option>
|
| 148 |
-
<option value="even">{#table_dlg.row_even}</option>
|
| 149 |
-
<option value="all">{#table_dlg.row_all}</option>
|
| 150 |
-
</select>
|
| 151 |
-
</div>
|
| 152 |
-
|
| 153 |
-
<input type="submit" id="insert" name="insert" value="{#update}" />
|
| 154 |
-
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
| 155 |
-
</div>
|
| 156 |
-
</form>
|
| 157 |
-
</body>
|
| 158 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tinymce3-table/table.htm
DELETED
|
@@ -1,188 +0,0 @@
|
|
| 1 |
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
| 2 |
-
<html xmlns="http://www.w3.org/1999/xhtml">
|
| 3 |
-
<head>
|
| 4 |
-
<title>{#table_dlg.title}</title>
|
| 5 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
| 6 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/mctabs.js"></script>
|
| 7 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/form_utils.js"></script>
|
| 8 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/validate.js"></script>
|
| 9 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/editable_selects.js"></script>
|
| 10 |
-
<script type="text/javascript" src="js/table.js"></script>
|
| 11 |
-
<link href="css/table.css" rel="stylesheet" type="text/css" />
|
| 12 |
-
</head>
|
| 13 |
-
<body id="table" style="display: none" role="application" aria-labelledby="app_title">
|
| 14 |
-
<span style="display:none;" id="app_title">{#table_dlg.title}</span>
|
| 15 |
-
<form onsubmit="insertTable();return false;" action="#">
|
| 16 |
-
<div class="tabs">
|
| 17 |
-
<ul>
|
| 18 |
-
<li id="general_tab" aria-controls="general_panel" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li>
|
| 19 |
-
<li id="advanced_tab" aria-controls="advanced_panel"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>
|
| 20 |
-
</ul>
|
| 21 |
-
</div>
|
| 22 |
-
|
| 23 |
-
<div class="panel_wrapper">
|
| 24 |
-
<div id="general_panel" class="panel current">
|
| 25 |
-
<fieldset>
|
| 26 |
-
<legend>{#table_dlg.general_props}</legend>
|
| 27 |
-
<table role="presentation" border="0" cellpadding="4" cellspacing="0" width="100%">
|
| 28 |
-
<tr>
|
| 29 |
-
<td><label id="colslabel" for="cols">{#table_dlg.cols}</label></td>
|
| 30 |
-
<td><input id="cols" name="cols" type="text" value="" size="3" maxlength="3" class="required number min1 mceFocus" aria-required="true" /></td>
|
| 31 |
-
<td><label id="rowslabel" for="rows">{#table_dlg.rows}</label></td>
|
| 32 |
-
<td><input id="rows" name="rows" type="text" value="" size="3" maxlength="3" class="required number min1" aria-required="true" /></td>
|
| 33 |
-
</tr>
|
| 34 |
-
<tr>
|
| 35 |
-
<td><label id="cellpaddinglabel" for="cellpadding">{#table_dlg.cellpadding}</label></td>
|
| 36 |
-
<td><input id="cellpadding" name="cellpadding" type="text" value="" size="3" maxlength="3" class="number" /></td>
|
| 37 |
-
<td><label id="cellspacinglabel" for="cellspacing">{#table_dlg.cellspacing}</label></td>
|
| 38 |
-
<td><input id="cellspacing" name="cellspacing" type="text" value="" size="3" maxlength="3" class="number" /></td>
|
| 39 |
-
</tr>
|
| 40 |
-
<tr>
|
| 41 |
-
<td><label id="alignlabel" for="align">{#table_dlg.align}</label></td>
|
| 42 |
-
<td><select id="align" name="align">
|
| 43 |
-
<option value="">{#not_set}</option>
|
| 44 |
-
<option value="center">{#table_dlg.align_middle}</option>
|
| 45 |
-
<option value="left">{#table_dlg.align_left}</option>
|
| 46 |
-
<option value="right">{#table_dlg.align_right}</option>
|
| 47 |
-
</select></td>
|
| 48 |
-
<td><label id="borderlabel" for="border">{#table_dlg.border}</label></td>
|
| 49 |
-
<td><input id="border" name="border" type="text" value="" size="3" maxlength="5" onchange="changedBorder();" class="size" /></td>
|
| 50 |
-
</tr>
|
| 51 |
-
<tr id="width_row">
|
| 52 |
-
<td><label id="widthlabel" for="width">{#table_dlg.width}</label></td>
|
| 53 |
-
<td><input name="width" type="text" id="width" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>
|
| 54 |
-
<td><label id="heightlabel" for="height">{#table_dlg.height}</label></td>
|
| 55 |
-
<td><input name="height" type="text" id="height" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>
|
| 56 |
-
</tr>
|
| 57 |
-
<tr id="styleSelectRow" >
|
| 58 |
-
<td><label id="classlabel" for="class">{#class_name}</label></td>
|
| 59 |
-
<td colspan="3" >
|
| 60 |
-
<select id="class" name="class" class="mceEditableSelect">
|
| 61 |
-
<option value="" selected="selected">{#not_set}</option>
|
| 62 |
-
</select></td>
|
| 63 |
-
</tr>
|
| 64 |
-
<tr>
|
| 65 |
-
<td class="column1" ><label for="caption">{#table_dlg.caption}</label></td>
|
| 66 |
-
<td><input id="caption" name="caption" type="checkbox" class="checkbox" value="true" /></td>
|
| 67 |
-
</tr>
|
| 68 |
-
</table>
|
| 69 |
-
</fieldset>
|
| 70 |
-
</div>
|
| 71 |
-
|
| 72 |
-
<div id="advanced_panel" class="panel">
|
| 73 |
-
<fieldset>
|
| 74 |
-
<legend>{#table_dlg.advanced_props}</legend>
|
| 75 |
-
|
| 76 |
-
<table role="presentation" border="0" cellpadding="0" cellspacing="4">
|
| 77 |
-
<tr>
|
| 78 |
-
<td class="column1"><label for="id">{#table_dlg.id}</label></td>
|
| 79 |
-
<td><input id="id" name="id" type="text" value="" class="advfield" /></td>
|
| 80 |
-
</tr>
|
| 81 |
-
|
| 82 |
-
<tr>
|
| 83 |
-
<td class="column1"><label for="summary">{#table_dlg.summary}</label></td>
|
| 84 |
-
<td><input id="summary" name="summary" type="text" value="" class="advfield" /></td>
|
| 85 |
-
</tr>
|
| 86 |
-
|
| 87 |
-
<tr>
|
| 88 |
-
<td><label for="style">{#table_dlg.style}</label></td>
|
| 89 |
-
<td><input type="text" id="style" name="style" value="" class="advfield" onchange="changedStyle();" /></td>
|
| 90 |
-
</tr>
|
| 91 |
-
|
| 92 |
-
<tr>
|
| 93 |
-
<td class="column1"><label id="langlabel" for="lang">{#table_dlg.langcode}</label></td>
|
| 94 |
-
<td>
|
| 95 |
-
<input id="lang" name="lang" type="text" value="" class="advfield" />
|
| 96 |
-
</td>
|
| 97 |
-
</tr>
|
| 98 |
-
|
| 99 |
-
<tr>
|
| 100 |
-
<td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td>
|
| 101 |
-
<td>
|
| 102 |
-
<table role="presentation" aria-labelledby="backgroundimage_label" border="0" cellpadding="0" cellspacing="0">
|
| 103 |
-
<tr>
|
| 104 |
-
<td><input id="backgroundimage" name="backgroundimage" type="text" value="" class="advfield" onchange="changedBackgroundImage();" /></td>
|
| 105 |
-
<td id="backgroundimagebrowsercontainer"> </td>
|
| 106 |
-
</tr>
|
| 107 |
-
</table>
|
| 108 |
-
</td>
|
| 109 |
-
</tr>
|
| 110 |
-
|
| 111 |
-
<tr>
|
| 112 |
-
<td class="column1"><label for="tframe">{#table_dlg.frame}</label></td>
|
| 113 |
-
<td>
|
| 114 |
-
<select id="tframe" name="tframe" class="advfield">
|
| 115 |
-
<option value="">{#not_set}</option>
|
| 116 |
-
<option value="void">{#table_dlg.rules_void}</option>
|
| 117 |
-
<option value="above">{#table_dlg.rules_above}</option>
|
| 118 |
-
<option value="below">{#table_dlg.rules_below}</option>
|
| 119 |
-
<option value="hsides">{#table_dlg.rules_hsides}</option>
|
| 120 |
-
<option value="lhs">{#table_dlg.rules_lhs}</option>
|
| 121 |
-
<option value="rhs">{#table_dlg.rules_rhs}</option>
|
| 122 |
-
<option value="vsides">{#table_dlg.rules_vsides}</option>
|
| 123 |
-
<option value="box">{#table_dlg.rules_box}</option>
|
| 124 |
-
<option value="border">{#table_dlg.rules_border}</option>
|
| 125 |
-
</select>
|
| 126 |
-
</td>
|
| 127 |
-
</tr>
|
| 128 |
-
|
| 129 |
-
<tr>
|
| 130 |
-
<td class="column1"><label for="rules">{#table_dlg.rules}</label></td>
|
| 131 |
-
<td>
|
| 132 |
-
<select id="rules" name="rules" class="advfield">
|
| 133 |
-
<option value="">{#not_set}</option>
|
| 134 |
-
<option value="none">{#table_dlg.frame_none}</option>
|
| 135 |
-
<option value="groups">{#table_dlg.frame_groups}</option>
|
| 136 |
-
<option value="rows">{#table_dlg.frame_rows}</option>
|
| 137 |
-
<option value="cols">{#table_dlg.frame_cols}</option>
|
| 138 |
-
<option value="all">{#table_dlg.frame_all}</option>
|
| 139 |
-
</select>
|
| 140 |
-
</td>
|
| 141 |
-
</tr>
|
| 142 |
-
|
| 143 |
-
<tr>
|
| 144 |
-
<td class="column1"><label for="dir">{#table_dlg.langdir}</label></td>
|
| 145 |
-
<td>
|
| 146 |
-
<select id="dir" name="dir" class="advfield">
|
| 147 |
-
<option value="">{#not_set}</option>
|
| 148 |
-
<option value="ltr">{#table_dlg.ltr}</option>
|
| 149 |
-
<option value="rtl">{#table_dlg.rtl}</option>
|
| 150 |
-
</select>
|
| 151 |
-
</td>
|
| 152 |
-
</tr>
|
| 153 |
-
|
| 154 |
-
<tr role="group" aria-labelledby="bordercolor_label">
|
| 155 |
-
<td class="column1"><label id="bordercolor_label" for="bordercolor">{#table_dlg.bordercolor}</label></td>
|
| 156 |
-
<td>
|
| 157 |
-
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
| 158 |
-
<tr>
|
| 159 |
-
<td><input id="bordercolor" name="bordercolor" type="text" value="" size="9" onchange="updateColor('bordercolor_pick','bordercolor');changedColor();" /></td>
|
| 160 |
-
<td id="bordercolor_pickcontainer"> </td>
|
| 161 |
-
</tr>
|
| 162 |
-
</table>
|
| 163 |
-
</td>
|
| 164 |
-
</tr>
|
| 165 |
-
|
| 166 |
-
<tr role="group" aria-labelledby="bgcolor_label">
|
| 167 |
-
<td class="column1"><label id="bgcolor_label" for="bgcolor">{#table_dlg.bgcolor}</label></td>
|
| 168 |
-
<td>
|
| 169 |
-
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
| 170 |
-
<tr>
|
| 171 |
-
<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>
|
| 172 |
-
<td id="bgcolor_pickcontainer"> </td>
|
| 173 |
-
</tr>
|
| 174 |
-
</table>
|
| 175 |
-
</td>
|
| 176 |
-
</tr>
|
| 177 |
-
</table>
|
| 178 |
-
</fieldset>
|
| 179 |
-
</div>
|
| 180 |
-
</div>
|
| 181 |
-
|
| 182 |
-
<div class="mceActionPanel">
|
| 183 |
-
<input type="submit" id="insert" name="insert" value="{#insert}" />
|
| 184 |
-
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
| 185 |
-
</div>
|
| 186 |
-
</form>
|
| 187 |
-
</body>
|
| 188 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tinymce4-table/plugin.js
DELETED
|
@@ -1,2293 +0,0 @@
|
|
| 1 |
-
/**
|
| 2 |
-
* Compiled inline version. (Library mode)
|
| 3 |
-
*/
|
| 4 |
-
|
| 5 |
-
/*jshint smarttabs:true, undef:true, latedef:true, curly:true, bitwise:true, camelcase:true */
|
| 6 |
-
/*globals $code */
|
| 7 |
-
|
| 8 |
-
(function(exports, undefined) {
|
| 9 |
-
"use strict";
|
| 10 |
-
|
| 11 |
-
var modules = {};
|
| 12 |
-
|
| 13 |
-
function require(ids, callback) {
|
| 14 |
-
var module, defs = [];
|
| 15 |
-
|
| 16 |
-
for (var i = 0; i < ids.length; ++i) {
|
| 17 |
-
module = modules[ids[i]] || resolve(ids[i]);
|
| 18 |
-
if (!module) {
|
| 19 |
-
throw 'module definition dependecy not found: ' + ids[i];
|
| 20 |
-
}
|
| 21 |
-
|
| 22 |
-
defs.push(module);
|
| 23 |
-
}
|
| 24 |
-
|
| 25 |
-
callback.apply(null, defs);
|
| 26 |
-
}
|
| 27 |
-
|
| 28 |
-
function define(id, dependencies, definition) {
|
| 29 |
-
if (typeof id !== 'string') {
|
| 30 |
-
throw 'invalid module definition, module id must be defined and be a string';
|
| 31 |
-
}
|
| 32 |
-
|
| 33 |
-
if (dependencies === undefined) {
|
| 34 |
-
throw 'invalid module definition, dependencies must be specified';
|
| 35 |
-
}
|
| 36 |
-
|
| 37 |
-
if (definition === undefined) {
|
| 38 |
-
throw 'invalid module definition, definition function must be specified';
|
| 39 |
-
}
|
| 40 |
-
|
| 41 |
-
require(dependencies, function() {
|
| 42 |
-
modules[id] = definition.apply(null, arguments);
|
| 43 |
-
});
|
| 44 |
-
}
|
| 45 |
-
|
| 46 |
-
function defined(id) {
|
| 47 |
-
return !!modules[id];
|
| 48 |
-
}
|
| 49 |
-
|
| 50 |
-
function resolve(id) {
|
| 51 |
-
var target = exports;
|
| 52 |
-
var fragments = id.split(/[.\/]/);
|
| 53 |
-
|
| 54 |
-
for (var fi = 0; fi < fragments.length; ++fi) {
|
| 55 |
-
if (!target[fragments[fi]]) {
|
| 56 |
-
return;
|
| 57 |
-
}
|
| 58 |
-
|
| 59 |
-
target = target[fragments[fi]];
|
| 60 |
-
}
|
| 61 |
-
|
| 62 |
-
return target;
|
| 63 |
-
}
|
| 64 |
-
|
| 65 |
-
function expose(ids) {
|
| 66 |
-
for (var i = 0; i < ids.length; i++) {
|
| 67 |
-
var target = exports;
|
| 68 |
-
var id = ids[i];
|
| 69 |
-
var fragments = id.split(/[.\/]/);
|
| 70 |
-
|
| 71 |
-
for (var fi = 0; fi < fragments.length - 1; ++fi) {
|
| 72 |
-
if (target[fragments[fi]] === undefined) {
|
| 73 |
-
target[fragments[fi]] = {};
|
| 74 |
-
}
|
| 75 |
-
|
| 76 |
-
target = target[fragments[fi]];
|
| 77 |
-
}
|
| 78 |
-
|
| 79 |
-
target[fragments[fragments.length - 1]] = modules[id];
|
| 80 |
-
}
|
| 81 |
-
}
|
| 82 |
-
|
| 83 |
-
// Included from: js/tinymce/plugins/table/classes/TableGrid.js
|
| 84 |
-
|
| 85 |
-
/**
|
| 86 |
-
* TableGrid.js
|
| 87 |
-
*
|
| 88 |
-
* Copyright, Moxiecode Systems AB
|
| 89 |
-
* Released under LGPL License.
|
| 90 |
-
*
|
| 91 |
-
* License: http://www.tinymce.com/license
|
| 92 |
-
* Contributing: http://www.tinymce.com/contributing
|
| 93 |
-
*/
|
| 94 |
-
|
| 95 |
-
/**
|
| 96 |
-
* This class creates a grid out of a table element. This
|
| 97 |
-
* makes it a whole lot easier to handle complex tables with
|
| 98 |
-
* col/row spans.
|
| 99 |
-
*
|
| 100 |
-
* @class tinymce.tableplugin.TableGrid
|
| 101 |
-
* @private
|
| 102 |
-
*/
|
| 103 |
-
define("tinymce/tableplugin/TableGrid", [
|
| 104 |
-
"tinymce/util/Tools",
|
| 105 |
-
"tinymce/Env"
|
| 106 |
-
], function(Tools, Env) {
|
| 107 |
-
var each = Tools.each;
|
| 108 |
-
|
| 109 |
-
function getSpanVal(td, name) {
|
| 110 |
-
return parseInt(td.getAttribute(name) || 1, 10);
|
| 111 |
-
}
|
| 112 |
-
|
| 113 |
-
return function(editor, table) {
|
| 114 |
-
var grid, startPos, endPos, selectedCell, selection = editor.selection, dom = selection.dom;
|
| 115 |
-
|
| 116 |
-
function buildGrid() {
|
| 117 |
-
var startY = 0;
|
| 118 |
-
|
| 119 |
-
grid = [];
|
| 120 |
-
|
| 121 |
-
each(['thead', 'tbody', 'tfoot'], function(part) {
|
| 122 |
-
var rows = dom.select('> ' + part + ' tr', table);
|
| 123 |
-
|
| 124 |
-
each(rows, function(tr, y) {
|
| 125 |
-
y += startY;
|
| 126 |
-
|
| 127 |
-
each(dom.select('> td, > th', tr), function(td, x) {
|
| 128 |
-
var x2, y2, rowspan, colspan;
|
| 129 |
-
|
| 130 |
-
// Skip over existing cells produced by rowspan
|
| 131 |
-
if (grid[y]) {
|
| 132 |
-
while (grid[y][x]) {
|
| 133 |
-
x++;
|
| 134 |
-
}
|
| 135 |
-
}
|
| 136 |
-
|
| 137 |
-
// Get col/rowspan from cell
|
| 138 |
-
rowspan = getSpanVal(td, 'rowspan');
|
| 139 |
-
colspan = getSpanVal(td, 'colspan');
|
| 140 |
-
|
| 141 |
-
// Fill out rowspan/colspan right and down
|
| 142 |
-
for (y2 = y; y2 < y + rowspan; y2++) {
|
| 143 |
-
if (!grid[y2]) {
|
| 144 |
-
grid[y2] = [];
|
| 145 |
-
}
|
| 146 |
-
|
| 147 |
-
for (x2 = x; x2 < x + colspan; x2++) {
|
| 148 |
-
grid[y2][x2] = {
|
| 149 |
-
part: part,
|
| 150 |
-
real: y2 == y && x2 == x,
|
| 151 |
-
elm: td,
|
| 152 |
-
rowspan: rowspan,
|
| 153 |
-
colspan: colspan
|
| 154 |
-
};
|
| 155 |
-
}
|
| 156 |
-
}
|
| 157 |
-
});
|
| 158 |
-
});
|
| 159 |
-
|
| 160 |
-
startY += rows.length;
|
| 161 |
-
});
|
| 162 |
-
}
|
| 163 |
-
|
| 164 |
-
function cloneNode(node, children) {
|
| 165 |
-
node = node.cloneNode(children);
|
| 166 |
-
node.removeAttribute('id');
|
| 167 |
-
|
| 168 |
-
return node;
|
| 169 |
-
}
|
| 170 |
-
|
| 171 |
-
function getCell(x, y) {
|
| 172 |
-
var row;
|
| 173 |
-
|
| 174 |
-
row = grid[y];
|
| 175 |
-
if (row) {
|
| 176 |
-
return row[x];
|
| 177 |
-
}
|
| 178 |
-
}
|
| 179 |
-
|
| 180 |
-
function setSpanVal(td, name, val) {
|
| 181 |
-
if (td) {
|
| 182 |
-
val = parseInt(val, 10);
|
| 183 |
-
|
| 184 |
-
if (val === 1) {
|
| 185 |
-
td.removeAttribute(name, 1);
|
| 186 |
-
} else {
|
| 187 |
-
td.setAttribute(name, val, 1);
|
| 188 |
-
}
|
| 189 |
-
}
|
| 190 |
-
}
|
| 191 |
-
|
| 192 |
-
function isCellSelected(cell) {
|
| 193 |
-
return cell && (dom.hasClass(cell.elm, 'mce-item-selected') || cell == selectedCell);
|
| 194 |
-
}
|
| 195 |
-
|
| 196 |
-
function getSelectedRows() {
|
| 197 |
-
var rows = [];
|
| 198 |
-
|
| 199 |
-
each(table.rows, function(row) {
|
| 200 |
-
each(row.cells, function(cell) {
|
| 201 |
-
if (dom.hasClass(cell, 'mce-item-selected') || (selectedCell && cell == selectedCell.elm)) {
|
| 202 |
-
rows.push(row);
|
| 203 |
-
return false;
|
| 204 |
-
}
|
| 205 |
-
});
|
| 206 |
-
});
|
| 207 |
-
|
| 208 |
-
return rows;
|
| 209 |
-
}
|
| 210 |
-
|
| 211 |
-
function deleteTable() {
|
| 212 |
-
var rng = dom.createRng();
|
| 213 |
-
|
| 214 |
-
rng.setStartAfter(table);
|
| 215 |
-
rng.setEndAfter(table);
|
| 216 |
-
|
| 217 |
-
selection.setRng(rng);
|
| 218 |
-
|
| 219 |
-
dom.remove(table);
|
| 220 |
-
}
|
| 221 |
-
|
| 222 |
-
function cloneCell(cell) {
|
| 223 |
-
var formatNode, cloneFormats = {};
|
| 224 |
-
|
| 225 |
-
if (editor.settings.table_clone_elements !== false) {
|
| 226 |
-
cloneFormats = Tools.makeMap(
|
| 227 |
-
(editor.settings.table_clone_elements || 'strong em b i span font h1 h2 h3 h4 h5 h6 p div').toUpperCase(),
|
| 228 |
-
/[ ,]/
|
| 229 |
-
);
|
| 230 |
-
}
|
| 231 |
-
|
| 232 |
-
// Clone formats
|
| 233 |
-
Tools.walk(cell, function(node) {
|
| 234 |
-
var curNode;
|
| 235 |
-
|
| 236 |
-
if (node.nodeType == 3) {
|
| 237 |
-
each(dom.getParents(node.parentNode, null, cell).reverse(), function(node) {
|
| 238 |
-
if (!cloneFormats[node.nodeName]) {
|
| 239 |
-
return;
|
| 240 |
-
}
|
| 241 |
-
|
| 242 |
-
node = cloneNode(node, false);
|
| 243 |
-
|
| 244 |
-
if (!formatNode) {
|
| 245 |
-
formatNode = curNode = node;
|
| 246 |
-
} else if (curNode) {
|
| 247 |
-
curNode.appendChild(node);
|
| 248 |
-
}
|
| 249 |
-
|
| 250 |
-
curNode = node;
|
| 251 |
-
});
|
| 252 |
-
|
| 253 |
-
// Add something to the inner node
|
| 254 |
-
if (curNode) {
|
| 255 |
-
curNode.innerHTML = Env.ie ? ' ' : '<br data-mce-bogus="1" />';
|
| 256 |
-
}
|
| 257 |
-
|
| 258 |
-
return false;
|
| 259 |
-
}
|
| 260 |
-
}, 'childNodes');
|
| 261 |
-
|
| 262 |
-
cell = cloneNode(cell, false);
|
| 263 |
-
setSpanVal(cell, 'rowSpan', 1);
|
| 264 |
-
setSpanVal(cell, 'colSpan', 1);
|
| 265 |
-
|
| 266 |
-
if (formatNode) {
|
| 267 |
-
cell.appendChild(formatNode);
|
| 268 |
-
} else {
|
| 269 |
-
if (!Env.ie) {
|
| 270 |
-
cell.innerHTML = '<br data-mce-bogus="1" />';
|
| 271 |
-
}
|
| 272 |
-
}
|
| 273 |
-
|
| 274 |
-
return cell;
|
| 275 |
-
}
|
| 276 |
-
|
| 277 |
-
function cleanup() {
|
| 278 |
-
var rng = dom.createRng(), row;
|
| 279 |
-
|
| 280 |
-
// Empty rows
|
| 281 |
-
each(dom.select('tr', table), function(tr) {
|
| 282 |
-
if (tr.cells.length === 0) {
|
| 283 |
-
dom.remove(tr);
|
| 284 |
-
}
|
| 285 |
-
});
|
| 286 |
-
|
| 287 |
-
// Empty table
|
| 288 |
-
if (dom.select('tr', table).length === 0) {
|
| 289 |
-
rng.setStartBefore(table);
|
| 290 |
-
rng.setEndBefore(table);
|
| 291 |
-
selection.setRng(rng);
|
| 292 |
-
dom.remove(table);
|
| 293 |
-
return;
|
| 294 |
-
}
|
| 295 |
-
|
| 296 |
-
// Empty header/body/footer
|
| 297 |
-
each(dom.select('thead,tbody,tfoot', table), function(part) {
|
| 298 |
-
if (part.rows.length === 0) {
|
| 299 |
-
dom.remove(part);
|
| 300 |
-
}
|
| 301 |
-
});
|
| 302 |
-
|
| 303 |
-
// Restore selection to start position if it still exists
|
| 304 |
-
buildGrid();
|
| 305 |
-
|
| 306 |
-
// If we have a valid startPos object
|
| 307 |
-
if (startPos) {
|
| 308 |
-
// Restore the selection to the closest table position
|
| 309 |
-
row = grid[Math.min(grid.length - 1, startPos.y)];
|
| 310 |
-
if (row) {
|
| 311 |
-
selection.select(row[Math.min(row.length - 1, startPos.x)].elm, true);
|
| 312 |
-
selection.collapse(true);
|
| 313 |
-
}
|
| 314 |
-
}
|
| 315 |
-
}
|
| 316 |
-
|
| 317 |
-
function fillLeftDown(x, y, rows, cols) {
|
| 318 |
-
var tr, x2, r, c, cell;
|
| 319 |
-
|
| 320 |
-
tr = grid[y][x].elm.parentNode;
|
| 321 |
-
for (r = 1; r <= rows; r++) {
|
| 322 |
-
tr = dom.getNext(tr, 'tr');
|
| 323 |
-
|
| 324 |
-
if (tr) {
|
| 325 |
-
// Loop left to find real cell
|
| 326 |
-
for (x2 = x; x2 >= 0; x2--) {
|
| 327 |
-
cell = grid[y + r][x2].elm;
|
| 328 |
-
|
| 329 |
-
if (cell.parentNode == tr) {
|
| 330 |
-
// Append clones after
|
| 331 |
-
for (c = 1; c <= cols; c++) {
|
| 332 |
-
dom.insertAfter(cloneCell(cell), cell);
|
| 333 |
-
}
|
| 334 |
-
|
| 335 |
-
break;
|
| 336 |
-
}
|
| 337 |
-
}
|
| 338 |
-
|
| 339 |
-
if (x2 == -1) {
|
| 340 |
-
// Insert nodes before first cell
|
| 341 |
-
for (c = 1; c <= cols; c++) {
|
| 342 |
-
tr.insertBefore(cloneCell(tr.cells[0]), tr.cells[0]);
|
| 343 |
-
}
|
| 344 |
-
}
|
| 345 |
-
}
|
| 346 |
-
}
|
| 347 |
-
}
|
| 348 |
-
|
| 349 |
-
function split() {
|
| 350 |
-
each(grid, function(row, y) {
|
| 351 |
-
each(row, function(cell, x) {
|
| 352 |
-
var colSpan, rowSpan, i;
|
| 353 |
-
|
| 354 |
-
if (isCellSelected(cell)) {
|
| 355 |
-
cell = cell.elm;
|
| 356 |
-
colSpan = getSpanVal(cell, 'colspan');
|
| 357 |
-
rowSpan = getSpanVal(cell, 'rowspan');
|
| 358 |
-
|
| 359 |
-
if (colSpan > 1 || rowSpan > 1) {
|
| 360 |
-
setSpanVal(cell, 'rowSpan', 1);
|
| 361 |
-
setSpanVal(cell, 'colSpan', 1);
|
| 362 |
-
|
| 363 |
-
// Insert cells right
|
| 364 |
-
for (i = 0; i < colSpan - 1; i++) {
|
| 365 |
-
dom.insertAfter(cloneCell(cell), cell);
|
| 366 |
-
}
|
| 367 |
-
|
| 368 |
-
fillLeftDown(x, y, rowSpan - 1, colSpan);
|
| 369 |
-
}
|
| 370 |
-
}
|
| 371 |
-
});
|
| 372 |
-
});
|
| 373 |
-
}
|
| 374 |
-
|
| 375 |
-
function merge(cell, cols, rows) {
|
| 376 |
-
var pos, startX, startY, endX, endY, x, y, startCell, endCell, children, count;
|
| 377 |
-
|
| 378 |
-
// Use specified cell and cols/rows
|
| 379 |
-
if (cell) {
|
| 380 |
-
pos = getPos(cell);
|
| 381 |
-
startX = pos.x;
|
| 382 |
-
startY = pos.y;
|
| 383 |
-
endX = startX + (cols - 1);
|
| 384 |
-
endY = startY + (rows - 1);
|
| 385 |
-
} else {
|
| 386 |
-
startPos = endPos = null;
|
| 387 |
-
|
| 388 |
-
// Calculate start/end pos by checking for selected cells in grid works better with context menu
|
| 389 |
-
each(grid, function(row, y) {
|
| 390 |
-
each(row, function(cell, x) {
|
| 391 |
-
if (isCellSelected(cell)) {
|
| 392 |
-
if (!startPos) {
|
| 393 |
-
startPos = {x: x, y: y};
|
| 394 |
-
}
|
| 395 |
-
|
| 396 |
-
endPos = {x: x, y: y};
|
| 397 |
-
}
|
| 398 |
-
});
|
| 399 |
-
});
|
| 400 |
-
|
| 401 |
-
// Use selection, but make sure startPos is valid before accessing
|
| 402 |
-
if (startPos) {
|
| 403 |
-
startX = startPos.x;
|
| 404 |
-
startY = startPos.y;
|
| 405 |
-
endX = endPos.x;
|
| 406 |
-
endY = endPos.y;
|
| 407 |
-
}
|
| 408 |
-
}
|
| 409 |
-
|
| 410 |
-
// Find start/end cells
|
| 411 |
-
startCell = getCell(startX, startY);
|
| 412 |
-
endCell = getCell(endX, endY);
|
| 413 |
-
|
| 414 |
-
// Check if the cells exists and if they are of the same part for example tbody = tbody
|
| 415 |
-
if (startCell && endCell && startCell.part == endCell.part) {
|
| 416 |
-
// Split and rebuild grid
|
| 417 |
-
split();
|
| 418 |
-
buildGrid();
|
| 419 |
-
|
| 420 |
-
// Set row/col span to start cell
|
| 421 |
-
startCell = getCell(startX, startY).elm;
|
| 422 |
-
setSpanVal(startCell, 'colSpan', (endX - startX) + 1);
|
| 423 |
-
setSpanVal(startCell, 'rowSpan', (endY - startY) + 1);
|
| 424 |
-
|
| 425 |
-
// Remove other cells and add it's contents to the start cell
|
| 426 |
-
for (y = startY; y <= endY; y++) {
|
| 427 |
-
for (x = startX; x <= endX; x++) {
|
| 428 |
-
if (!grid[y] || !grid[y][x]) {
|
| 429 |
-
continue;
|
| 430 |
-
}
|
| 431 |
-
|
| 432 |
-
cell = grid[y][x].elm;
|
| 433 |
-
|
| 434 |
-
/*jshint loopfunc:true */
|
| 435 |
-
/*eslint loop-func:0 */
|
| 436 |
-
if (cell != startCell) {
|
| 437 |
-
// Move children to startCell
|
| 438 |
-
children = Tools.grep(cell.childNodes);
|
| 439 |
-
each(children, function(node) {
|
| 440 |
-
startCell.appendChild(node);
|
| 441 |
-
});
|
| 442 |
-
|
| 443 |
-
// Remove bogus nodes if there is children in the target cell
|
| 444 |
-
if (children.length) {
|
| 445 |
-
children = Tools.grep(startCell.childNodes);
|
| 446 |
-
count = 0;
|
| 447 |
-
each(children, function(node) {
|
| 448 |
-
if (node.nodeName == 'BR' && dom.getAttrib(node, 'data-mce-bogus') && count++ < children.length - 1) {
|
| 449 |
-
startCell.removeChild(node);
|
| 450 |
-
}
|
| 451 |
-
});
|
| 452 |
-
}
|
| 453 |
-
|
| 454 |
-
dom.remove(cell);
|
| 455 |
-
}
|
| 456 |
-
}
|
| 457 |
-
}
|
| 458 |
-
|
| 459 |
-
// Remove empty rows etc and restore caret location
|
| 460 |
-
cleanup();
|
| 461 |
-
}
|
| 462 |
-
}
|
| 463 |
-
|
| 464 |
-
function insertRow(before) {
|
| 465 |
-
var posY, cell, lastCell, x, rowElm, newRow, newCell, otherCell, rowSpan;
|
| 466 |
-
|
| 467 |
-
// Find first/last row
|
| 468 |
-
each(grid, function(row, y) {
|
| 469 |
-
each(row, function(cell) {
|
| 470 |
-
if (isCellSelected(cell)) {
|
| 471 |
-
cell = cell.elm;
|
| 472 |
-
rowElm = cell.parentNode;
|
| 473 |
-
newRow = cloneNode(rowElm, false);
|
| 474 |
-
posY = y;
|
| 475 |
-
|
| 476 |
-
if (before) {
|
| 477 |
-
return false;
|
| 478 |
-
}
|
| 479 |
-
}
|
| 480 |
-
});
|
| 481 |
-
|
| 482 |
-
if (before) {
|
| 483 |
-
return !posY;
|
| 484 |
-
}
|
| 485 |
-
});
|
| 486 |
-
|
| 487 |
-
// If posY is undefined there is nothing for us to do here...just return to avoid crashing below
|
| 488 |
-
if (posY === undefined) {
|
| 489 |
-
return;
|
| 490 |
-
}
|
| 491 |
-
|
| 492 |
-
for (x = 0; x < grid[0].length; x++) {
|
| 493 |
-
// Cell not found could be because of an invalid table structure
|
| 494 |
-
if (!grid[posY][x]) {
|
| 495 |
-
continue;
|
| 496 |
-
}
|
| 497 |
-
|
| 498 |
-
cell = grid[posY][x].elm;
|
| 499 |
-
|
| 500 |
-
if (cell != lastCell) {
|
| 501 |
-
if (!before) {
|
| 502 |
-
rowSpan = getSpanVal(cell, 'rowspan');
|
| 503 |
-
if (rowSpan > 1) {
|
| 504 |
-
setSpanVal(cell, 'rowSpan', rowSpan + 1);
|
| 505 |
-
continue;
|
| 506 |
-
}
|
| 507 |
-
} else {
|
| 508 |
-
// Check if cell above can be expanded
|
| 509 |
-
if (posY > 0 && grid[posY - 1][x]) {
|
| 510 |
-
otherCell = grid[posY - 1][x].elm;
|
| 511 |
-
rowSpan = getSpanVal(otherCell, 'rowSpan');
|
| 512 |
-
if (rowSpan > 1) {
|
| 513 |
-
setSpanVal(otherCell, 'rowSpan', rowSpan + 1);
|
| 514 |
-
continue;
|
| 515 |
-
}
|
| 516 |
-
}
|
| 517 |
-
}
|
| 518 |
-
|
| 519 |
-
// Insert new cell into new row
|
| 520 |
-
newCell = cloneCell(cell);
|
| 521 |
-
setSpanVal(newCell, 'colSpan', cell.colSpan);
|
| 522 |
-
|
| 523 |
-
newRow.appendChild(newCell);
|
| 524 |
-
|
| 525 |
-
lastCell = cell;
|
| 526 |
-
}
|
| 527 |
-
}
|
| 528 |
-
|
| 529 |
-
if (newRow.hasChildNodes()) {
|
| 530 |
-
if (!before) {
|
| 531 |
-
dom.insertAfter(newRow, rowElm);
|
| 532 |
-
} else {
|
| 533 |
-
rowElm.parentNode.insertBefore(newRow, rowElm);
|
| 534 |
-
}
|
| 535 |
-
}
|
| 536 |
-
}
|
| 537 |
-
|
| 538 |
-
function insertCol(before) {
|
| 539 |
-
var posX, lastCell;
|
| 540 |
-
|
| 541 |
-
// Find first/last column
|
| 542 |
-
each(grid, function(row) {
|
| 543 |
-
each(row, function(cell, x) {
|
| 544 |
-
if (isCellSelected(cell)) {
|
| 545 |
-
posX = x;
|
| 546 |
-
|
| 547 |
-
if (before) {
|
| 548 |
-
return false;
|
| 549 |
-
}
|
| 550 |
-
}
|
| 551 |
-
});
|
| 552 |
-
|
| 553 |
-
if (before) {
|
| 554 |
-
return !posX;
|
| 555 |
-
}
|
| 556 |
-
});
|
| 557 |
-
|
| 558 |
-
each(grid, function(row, y) {
|
| 559 |
-
var cell, rowSpan, colSpan;
|
| 560 |
-
|
| 561 |
-
if (!row[posX]) {
|
| 562 |
-
return;
|
| 563 |
-
}
|
| 564 |
-
|
| 565 |
-
cell = row[posX].elm;
|
| 566 |
-
if (cell != lastCell) {
|
| 567 |
-
colSpan = getSpanVal(cell, 'colspan');
|
| 568 |
-
rowSpan = getSpanVal(cell, 'rowspan');
|
| 569 |
-
|
| 570 |
-
if (colSpan == 1) {
|
| 571 |
-
if (!before) {
|
| 572 |
-
dom.insertAfter(cloneCell(cell), cell);
|
| 573 |
-
fillLeftDown(posX, y, rowSpan - 1, colSpan);
|
| 574 |
-
} else {
|
| 575 |
-
cell.parentNode.insertBefore(cloneCell(cell), cell);
|
| 576 |
-
fillLeftDown(posX, y, rowSpan - 1, colSpan);
|
| 577 |
-
}
|
| 578 |
-
} else {
|
| 579 |
-
setSpanVal(cell, 'colSpan', cell.colSpan + 1);
|
| 580 |
-
}
|
| 581 |
-
|
| 582 |
-
lastCell = cell;
|
| 583 |
-
}
|
| 584 |
-
});
|
| 585 |
-
}
|
| 586 |
-
|
| 587 |
-
function deleteCols() {
|
| 588 |
-
var cols = [];
|
| 589 |
-
|
| 590 |
-
// Get selected column indexes
|
| 591 |
-
each(grid, function(row) {
|
| 592 |
-
each(row, function(cell, x) {
|
| 593 |
-
if (isCellSelected(cell) && Tools.inArray(cols, x) === -1) {
|
| 594 |
-
each(grid, function(row) {
|
| 595 |
-
var cell = row[x].elm, colSpan;
|
| 596 |
-
|
| 597 |
-
colSpan = getSpanVal(cell, 'colSpan');
|
| 598 |
-
|
| 599 |
-
if (colSpan > 1) {
|
| 600 |
-
setSpanVal(cell, 'colSpan', colSpan - 1);
|
| 601 |
-
} else {
|
| 602 |
-
dom.remove(cell);
|
| 603 |
-
}
|
| 604 |
-
});
|
| 605 |
-
|
| 606 |
-
cols.push(x);
|
| 607 |
-
}
|
| 608 |
-
});
|
| 609 |
-
});
|
| 610 |
-
|
| 611 |
-
cleanup();
|
| 612 |
-
}
|
| 613 |
-
|
| 614 |
-
function deleteRows() {
|
| 615 |
-
var rows;
|
| 616 |
-
|
| 617 |
-
function deleteRow(tr) {
|
| 618 |
-
var nextTr, pos, lastCell;
|
| 619 |
-
|
| 620 |
-
nextTr = dom.getNext(tr, 'tr');
|
| 621 |
-
|
| 622 |
-
// Move down row spanned cells
|
| 623 |
-
each(tr.cells, function(cell) {
|
| 624 |
-
var rowSpan = getSpanVal(cell, 'rowSpan');
|
| 625 |
-
|
| 626 |
-
if (rowSpan > 1) {
|
| 627 |
-
setSpanVal(cell, 'rowSpan', rowSpan - 1);
|
| 628 |
-
pos = getPos(cell);
|
| 629 |
-
fillLeftDown(pos.x, pos.y, 1, 1);
|
| 630 |
-
}
|
| 631 |
-
});
|
| 632 |
-
|
| 633 |
-
// Delete cells
|
| 634 |
-
pos = getPos(tr.cells[0]);
|
| 635 |
-
each(grid[pos.y], function(cell) {
|
| 636 |
-
var rowSpan;
|
| 637 |
-
|
| 638 |
-
cell = cell.elm;
|
| 639 |
-
|
| 640 |
-
if (cell != lastCell) {
|
| 641 |
-
rowSpan = getSpanVal(cell, 'rowSpan');
|
| 642 |
-
|
| 643 |
-
if (rowSpan <= 1) {
|
| 644 |
-
dom.remove(cell);
|
| 645 |
-
} else {
|
| 646 |
-
setSpanVal(cell, 'rowSpan', rowSpan - 1);
|
| 647 |
-
}
|
| 648 |
-
|
| 649 |
-
lastCell = cell;
|
| 650 |
-
}
|
| 651 |
-
});
|
| 652 |
-
}
|
| 653 |
-
|
| 654 |
-
// Get selected rows and move selection out of scope
|
| 655 |
-
rows = getSelectedRows();
|
| 656 |
-
|
| 657 |
-
// Delete all selected rows
|
| 658 |
-
each(rows.reverse(), function(tr) {
|
| 659 |
-
deleteRow(tr);
|
| 660 |
-
});
|
| 661 |
-
|
| 662 |
-
cleanup();
|
| 663 |
-
}
|
| 664 |
-
|
| 665 |
-
function cutRows() {
|
| 666 |
-
var rows = getSelectedRows();
|
| 667 |
-
|
| 668 |
-
dom.remove(rows);
|
| 669 |
-
cleanup();
|
| 670 |
-
|
| 671 |
-
return rows;
|
| 672 |
-
}
|
| 673 |
-
|
| 674 |
-
function copyRows() {
|
| 675 |
-
var rows = getSelectedRows();
|
| 676 |
-
|
| 677 |
-
each(rows, function(row, i) {
|
| 678 |
-
rows[i] = cloneNode(row, true);
|
| 679 |
-
});
|
| 680 |
-
|
| 681 |
-
return rows;
|
| 682 |
-
}
|
| 683 |
-
|
| 684 |
-
function pasteRows(rows, before) {
|
| 685 |
-
var selectedRows = getSelectedRows(),
|
| 686 |
-
targetRow = selectedRows[before ? 0 : selectedRows.length - 1],
|
| 687 |
-
targetCellCount = targetRow.cells.length;
|
| 688 |
-
|
| 689 |
-
// Nothing to paste
|
| 690 |
-
if (!rows) {
|
| 691 |
-
return;
|
| 692 |
-
}
|
| 693 |
-
|
| 694 |
-
// Calc target cell count
|
| 695 |
-
each(grid, function(row) {
|
| 696 |
-
var match;
|
| 697 |
-
|
| 698 |
-
targetCellCount = 0;
|
| 699 |
-
each(row, function(cell) {
|
| 700 |
-
if (cell.real) {
|
| 701 |
-
targetCellCount += cell.colspan;
|
| 702 |
-
}
|
| 703 |
-
|
| 704 |
-
if (cell.elm.parentNode == targetRow) {
|
| 705 |
-
match = 1;
|
| 706 |
-
}
|
| 707 |
-
});
|
| 708 |
-
|
| 709 |
-
if (match) {
|
| 710 |
-
return false;
|
| 711 |
-
}
|
| 712 |
-
});
|
| 713 |
-
|
| 714 |
-
if (!before) {
|
| 715 |
-
rows.reverse();
|
| 716 |
-
}
|
| 717 |
-
|
| 718 |
-
each(rows, function(row) {
|
| 719 |
-
var i, cellCount = row.cells.length, cell;
|
| 720 |
-
|
| 721 |
-
// Remove col/rowspans
|
| 722 |
-
for (i = 0; i < cellCount; i++) {
|
| 723 |
-
cell = row.cells[i];
|
| 724 |
-
setSpanVal(cell, 'colSpan', 1);
|
| 725 |
-
setSpanVal(cell, 'rowSpan', 1);
|
| 726 |
-
}
|
| 727 |
-
|
| 728 |
-
// Needs more cells
|
| 729 |
-
for (i = cellCount; i < targetCellCount; i++) {
|
| 730 |
-
row.appendChild(cloneCell(row.cells[cellCount - 1]));
|
| 731 |
-
}
|
| 732 |
-
|
| 733 |
-
// Needs less cells
|
| 734 |
-
for (i = targetCellCount; i < cellCount; i++) {
|
| 735 |
-
dom.remove(row.cells[i]);
|
| 736 |
-
}
|
| 737 |
-
|
| 738 |
-
// Add before/after
|
| 739 |
-
if (before) {
|
| 740 |
-
targetRow.parentNode.insertBefore(row, targetRow);
|
| 741 |
-
} else {
|
| 742 |
-
dom.insertAfter(row, targetRow);
|
| 743 |
-
}
|
| 744 |
-
});
|
| 745 |
-
|
| 746 |
-
// Remove current selection
|
| 747 |
-
dom.removeClass(dom.select('td.mce-item-selected,th.mce-item-selected'), 'mce-item-selected');
|
| 748 |
-
}
|
| 749 |
-
|
| 750 |
-
function getPos(target) {
|
| 751 |
-
var pos;
|
| 752 |
-
|
| 753 |
-
each(grid, function(row, y) {
|
| 754 |
-
each(row, function(cell, x) {
|
| 755 |
-
if (cell.elm == target) {
|
| 756 |
-
pos = {x : x, y : y};
|
| 757 |
-
return false;
|
| 758 |
-
}
|
| 759 |
-
});
|
| 760 |
-
|
| 761 |
-
return !pos;
|
| 762 |
-
});
|
| 763 |
-
|
| 764 |
-
return pos;
|
| 765 |
-
}
|
| 766 |
-
|
| 767 |
-
function setStartCell(cell) {
|
| 768 |
-
startPos = getPos(cell);
|
| 769 |
-
}
|
| 770 |
-
|
| 771 |
-
function findEndPos() {
|
| 772 |
-
var maxX, maxY;
|
| 773 |
-
|
| 774 |
-
maxX = maxY = 0;
|
| 775 |
-
|
| 776 |
-
each(grid, function(row, y) {
|
| 777 |
-
each(row, function(cell, x) {
|
| 778 |
-
var colSpan, rowSpan;
|
| 779 |
-
|
| 780 |
-
if (isCellSelected(cell)) {
|
| 781 |
-
cell = grid[y][x];
|
| 782 |
-
|
| 783 |
-
if (x > maxX) {
|
| 784 |
-
maxX = x;
|
| 785 |
-
}
|
| 786 |
-
|
| 787 |
-
if (y > maxY) {
|
| 788 |
-
maxY = y;
|
| 789 |
-
}
|
| 790 |
-
|
| 791 |
-
if (cell.real) {
|
| 792 |
-
colSpan = cell.colspan - 1;
|
| 793 |
-
rowSpan = cell.rowspan - 1;
|
| 794 |
-
|
| 795 |
-
if (colSpan) {
|
| 796 |
-
if (x + colSpan > maxX) {
|
| 797 |
-
maxX = x + colSpan;
|
| 798 |
-
}
|
| 799 |
-
}
|
| 800 |
-
|
| 801 |
-
if (rowSpan) {
|
| 802 |
-
if (y + rowSpan > maxY) {
|
| 803 |
-
maxY = y + rowSpan;
|
| 804 |
-
}
|
| 805 |
-
}
|
| 806 |
-
}
|
| 807 |
-
}
|
| 808 |
-
});
|
| 809 |
-
});
|
| 810 |
-
|
| 811 |
-
return {x : maxX, y : maxY};
|
| 812 |
-
}
|
| 813 |
-
|
| 814 |
-
function setEndCell(cell) {
|
| 815 |
-
var startX, startY, endX, endY, maxX, maxY, colSpan, rowSpan, x, y;
|
| 816 |
-
|
| 817 |
-
endPos = getPos(cell);
|
| 818 |
-
|
| 819 |
-
if (startPos && endPos) {
|
| 820 |
-
// Get start/end positions
|
| 821 |
-
startX = Math.min(startPos.x, endPos.x);
|
| 822 |
-
startY = Math.min(startPos.y, endPos.y);
|
| 823 |
-
endX = Math.max(startPos.x, endPos.x);
|
| 824 |
-
endY = Math.max(startPos.y, endPos.y);
|
| 825 |
-
|
| 826 |
-
// Expand end positon to include spans
|
| 827 |
-
maxX = endX;
|
| 828 |
-
maxY = endY;
|
| 829 |
-
|
| 830 |
-
// Expand startX
|
| 831 |
-
for (y = startY; y <= maxY; y++) {
|
| 832 |
-
cell = grid[y][startX];
|
| 833 |
-
|
| 834 |
-
if (!cell.real) {
|
| 835 |
-
if (startX - (cell.colspan - 1) < startX) {
|
| 836 |
-
startX -= cell.colspan - 1;
|
| 837 |
-
}
|
| 838 |
-
}
|
| 839 |
-
}
|
| 840 |
-
|
| 841 |
-
// Expand startY
|
| 842 |
-
for (x = startX; x <= maxX; x++) {
|
| 843 |
-
cell = grid[startY][x];
|
| 844 |
-
|
| 845 |
-
if (!cell.real) {
|
| 846 |
-
if (startY - (cell.rowspan - 1) < startY) {
|
| 847 |
-
startY -= cell.rowspan - 1;
|
| 848 |
-
}
|
| 849 |
-
}
|
| 850 |
-
}
|
| 851 |
-
|
| 852 |
-
// Find max X, Y
|
| 853 |
-
for (y = startY; y <= endY; y++) {
|
| 854 |
-
for (x = startX; x <= endX; x++) {
|
| 855 |
-
cell = grid[y][x];
|
| 856 |
-
|
| 857 |
-
if (cell.real) {
|
| 858 |
-
colSpan = cell.colspan - 1;
|
| 859 |
-
rowSpan = cell.rowspan - 1;
|
| 860 |
-
|
| 861 |
-
if (colSpan) {
|
| 862 |
-
if (x + colSpan > maxX) {
|
| 863 |
-
maxX = x + colSpan;
|
| 864 |
-
}
|
| 865 |
-
}
|
| 866 |
-
|
| 867 |
-
if (rowSpan) {
|
| 868 |
-
if (y + rowSpan > maxY) {
|
| 869 |
-
maxY = y + rowSpan;
|
| 870 |
-
}
|
| 871 |
-
}
|
| 872 |
-
}
|
| 873 |
-
}
|
| 874 |
-
}
|
| 875 |
-
|
| 876 |
-
// Remove current selection
|
| 877 |
-
dom.removeClass(dom.select('td.mce-item-selected,th.mce-item-selected'), 'mce-item-selected');
|
| 878 |
-
|
| 879 |
-
// Add new selection
|
| 880 |
-
for (y = startY; y <= maxY; y++) {
|
| 881 |
-
for (x = startX; x <= maxX; x++) {
|
| 882 |
-
if (grid[y][x]) {
|
| 883 |
-
dom.addClass(grid[y][x].elm, 'mce-item-selected');
|
| 884 |
-
}
|
| 885 |
-
}
|
| 886 |
-
}
|
| 887 |
-
}
|
| 888 |
-
}
|
| 889 |
-
|
| 890 |
-
table = table || dom.getParent(selection.getStart(), 'table');
|
| 891 |
-
|
| 892 |
-
buildGrid();
|
| 893 |
-
|
| 894 |
-
selectedCell = dom.getParent(selection.getStart(), 'th,td');
|
| 895 |
-
if (selectedCell) {
|
| 896 |
-
startPos = getPos(selectedCell);
|
| 897 |
-
endPos = findEndPos();
|
| 898 |
-
selectedCell = getCell(startPos.x, startPos.y);
|
| 899 |
-
}
|
| 900 |
-
|
| 901 |
-
Tools.extend(this, {
|
| 902 |
-
deleteTable: deleteTable,
|
| 903 |
-
split: split,
|
| 904 |
-
merge: merge,
|
| 905 |
-
insertRow: insertRow,
|
| 906 |
-
insertCol: insertCol,
|
| 907 |
-
deleteCols: deleteCols,
|
| 908 |
-
deleteRows: deleteRows,
|
| 909 |
-
cutRows: cutRows,
|
| 910 |
-
copyRows: copyRows,
|
| 911 |
-
pasteRows: pasteRows,
|
| 912 |
-
getPos: getPos,
|
| 913 |
-
setStartCell: setStartCell,
|
| 914 |
-
setEndCell: setEndCell
|
| 915 |
-
});
|
| 916 |
-
};
|
| 917 |
-
});
|
| 918 |
-
|
| 919 |
-
// Included from: js/tinymce/plugins/table/classes/Quirks.js
|
| 920 |
-
|
| 921 |
-
/**
|
| 922 |
-
* Quirks.js
|
| 923 |
-
*
|
| 924 |
-
* Copyright, Moxiecode Systems AB
|
| 925 |
-
* Released under LGPL License.
|
| 926 |
-
*
|
| 927 |
-
* License: http://www.tinymce.com/license
|
| 928 |
-
* Contributing: http://www.tinymce.com/contributing
|
| 929 |
-
*/
|
| 930 |
-
|
| 931 |
-
/**
|
| 932 |
-
* This class includes fixes for various browser quirks.
|
| 933 |
-
*
|
| 934 |
-
* @class tinymce.tableplugin.Quirks
|
| 935 |
-
* @private
|
| 936 |
-
*/
|
| 937 |
-
define("tinymce/tableplugin/Quirks", [
|
| 938 |
-
"tinymce/util/VK",
|
| 939 |
-
"tinymce/Env",
|
| 940 |
-
"tinymce/util/Tools"
|
| 941 |
-
], function(VK, Env, Tools) {
|
| 942 |
-
var each = Tools.each;
|
| 943 |
-
|
| 944 |
-
function getSpanVal(td, name) {
|
| 945 |
-
return parseInt(td.getAttribute(name) || 1, 10);
|
| 946 |
-
}
|
| 947 |
-
|
| 948 |
-
return function(editor) {
|
| 949 |
-
/**
|
| 950 |
-
* Fixed caret movement around tables on WebKit.
|
| 951 |
-
*/
|
| 952 |
-
function moveWebKitSelection() {
|
| 953 |
-
function eventHandler(e) {
|
| 954 |
-
var key = e.keyCode;
|
| 955 |
-
|
| 956 |
-
function handle(upBool, sourceNode) {
|
| 957 |
-
var siblingDirection = upBool ? 'previousSibling' : 'nextSibling';
|
| 958 |
-
var currentRow = editor.dom.getParent(sourceNode, 'tr');
|
| 959 |
-
var siblingRow = currentRow[siblingDirection];
|
| 960 |
-
|
| 961 |
-
if (siblingRow) {
|
| 962 |
-
moveCursorToRow(editor, sourceNode, siblingRow, upBool);
|
| 963 |
-
e.preventDefault();
|
| 964 |
-
return true;
|
| 965 |
-
} else {
|
| 966 |
-
var tableNode = editor.dom.getParent(currentRow, 'table');
|
| 967 |
-
var middleNode = currentRow.parentNode;
|
| 968 |
-
var parentNodeName = middleNode.nodeName.toLowerCase();
|
| 969 |
-
if (parentNodeName === 'tbody' || parentNodeName === (upBool ? 'tfoot' : 'thead')) {
|
| 970 |
-
var targetParent = getTargetParent(upBool, tableNode, middleNode, 'tbody');
|
| 971 |
-
if (targetParent !== null) {
|
| 972 |
-
return moveToRowInTarget(upBool, targetParent, sourceNode);
|
| 973 |
-
}
|
| 974 |
-
}
|
| 975 |
-
return escapeTable(upBool, currentRow, siblingDirection, tableNode);
|
| 976 |
-
}
|
| 977 |
-
}
|
| 978 |
-
|
| 979 |
-
function getTargetParent(upBool, topNode, secondNode, nodeName) {
|
| 980 |
-
var tbodies = editor.dom.select('>' + nodeName, topNode);
|
| 981 |
-
var position = tbodies.indexOf(secondNode);
|
| 982 |
-
if (upBool && position === 0 || !upBool && position === tbodies.length - 1) {
|
| 983 |
-
return getFirstHeadOrFoot(upBool, topNode);
|
| 984 |
-
} else if (position === -1) {
|
| 985 |
-
var topOrBottom = secondNode.tagName.toLowerCase() === 'thead' ? 0 : tbodies.length - 1;
|
| 986 |
-
return tbodies[topOrBottom];
|
| 987 |
-
} else {
|
| 988 |
-
return tbodies[position + (upBool ? -1 : 1)];
|
| 989 |
-
}
|
| 990 |
-
}
|
| 991 |
-
|
| 992 |
-
function getFirstHeadOrFoot(upBool, parent) {
|
| 993 |
-
var tagName = upBool ? 'thead' : 'tfoot';
|
| 994 |
-
var headOrFoot = editor.dom.select('>' + tagName, parent);
|
| 995 |
-
return headOrFoot.length !== 0 ? headOrFoot[0] : null;
|
| 996 |
-
}
|
| 997 |
-
|
| 998 |
-
function moveToRowInTarget(upBool, targetParent, sourceNode) {
|
| 999 |
-
var targetRow = getChildForDirection(targetParent, upBool);
|
| 1000 |
-
|
| 1001 |
-
if (targetRow) {
|
| 1002 |
-
moveCursorToRow(editor, sourceNode, targetRow, upBool);
|
| 1003 |
-
}
|
| 1004 |
-
|
| 1005 |
-
e.preventDefault();
|
| 1006 |
-
return true;
|
| 1007 |
-
}
|
| 1008 |
-
|
| 1009 |
-
function escapeTable(upBool, currentRow, siblingDirection, table) {
|
| 1010 |
-
var tableSibling = table[siblingDirection];
|
| 1011 |
-
|
| 1012 |
-
if (tableSibling) {
|
| 1013 |
-
moveCursorToStartOfElement(tableSibling);
|
| 1014 |
-
return true;
|
| 1015 |
-
} else {
|
| 1016 |
-
var parentCell = editor.dom.getParent(table, 'td,th');
|
| 1017 |
-
if (parentCell) {
|
| 1018 |
-
return handle(upBool, parentCell, e);
|
| 1019 |
-
} else {
|
| 1020 |
-
var backUpSibling = getChildForDirection(currentRow, !upBool);
|
| 1021 |
-
moveCursorToStartOfElement(backUpSibling);
|
| 1022 |
-
e.preventDefault();
|
| 1023 |
-
return false;
|
| 1024 |
-
}
|
| 1025 |
-
}
|
| 1026 |
-
}
|
| 1027 |
-
|
| 1028 |
-
function getChildForDirection(parent, up) {
|
| 1029 |
-
var child = parent && parent[up ? 'lastChild' : 'firstChild'];
|
| 1030 |
-
// BR is not a valid table child to return in this case we return the table cell
|
| 1031 |
-
return child && child.nodeName === 'BR' ? editor.dom.getParent(child, 'td,th') : child;
|
| 1032 |
-
}
|
| 1033 |
-
|
| 1034 |
-
function moveCursorToStartOfElement(n) {
|
| 1035 |
-
editor.selection.setCursorLocation(n, 0);
|
| 1036 |
-
}
|
| 1037 |
-
|
| 1038 |
-
function isVerticalMovement() {
|
| 1039 |
-
return key == VK.UP || key == VK.DOWN;
|
| 1040 |
-
}
|
| 1041 |
-
|
| 1042 |
-
function isInTable(editor) {
|
| 1043 |
-
var node = editor.selection.getNode();
|
| 1044 |
-
var currentRow = editor.dom.getParent(node, 'tr');
|
| 1045 |
-
return currentRow !== null;
|
| 1046 |
-
}
|
| 1047 |
-
|
| 1048 |
-
function columnIndex(column) {
|
| 1049 |
-
var colIndex = 0;
|
| 1050 |
-
var c = column;
|
| 1051 |
-
while (c.previousSibling) {
|
| 1052 |
-
c = c.previousSibling;
|
| 1053 |
-
colIndex = colIndex + getSpanVal(c, "colspan");
|
| 1054 |
-
}
|
| 1055 |
-
return colIndex;
|
| 1056 |
-
}
|
| 1057 |
-
|
| 1058 |
-
function findColumn(rowElement, columnIndex) {
|
| 1059 |
-
var c = 0, r = 0;
|
| 1060 |
-
|
| 1061 |
-
each(rowElement.children, function(cell, i) {
|
| 1062 |
-
c = c + getSpanVal(cell, "colspan");
|
| 1063 |
-
r = i;
|
| 1064 |
-
if (c > columnIndex) {
|
| 1065 |
-
return false;
|
| 1066 |
-
}
|
| 1067 |
-
});
|
| 1068 |
-
return r;
|
| 1069 |
-
}
|
| 1070 |
-
|
| 1071 |
-
function moveCursorToRow(ed, node, row, upBool) {
|
| 1072 |
-
var srcColumnIndex = columnIndex(editor.dom.getParent(node, 'td,th'));
|
| 1073 |
-
var tgtColumnIndex = findColumn(row, srcColumnIndex);
|
| 1074 |
-
var tgtNode = row.childNodes[tgtColumnIndex];
|
| 1075 |
-
var rowCellTarget = getChildForDirection(tgtNode, upBool);
|
| 1076 |
-
moveCursorToStartOfElement(rowCellTarget || tgtNode);
|
| 1077 |
-
}
|
| 1078 |
-
|
| 1079 |
-
function shouldFixCaret(preBrowserNode) {
|
| 1080 |
-
var newNode = editor.selection.getNode();
|
| 1081 |
-
var newParent = editor.dom.getParent(newNode, 'td,th');
|
| 1082 |
-
var oldParent = editor.dom.getParent(preBrowserNode, 'td,th');
|
| 1083 |
-
|
| 1084 |
-
return newParent && newParent !== oldParent && checkSameParentTable(newParent, oldParent);
|
| 1085 |
-
}
|
| 1086 |
-
|
| 1087 |
-
function checkSameParentTable(nodeOne, NodeTwo) {
|
| 1088 |
-
return editor.dom.getParent(nodeOne, 'TABLE') === editor.dom.getParent(NodeTwo, 'TABLE');
|
| 1089 |
-
}
|
| 1090 |
-
|
| 1091 |
-
if (isVerticalMovement() && isInTable(editor)) {
|
| 1092 |
-
var preBrowserNode = editor.selection.getNode();
|
| 1093 |
-
setTimeout(function() {
|
| 1094 |
-
if (shouldFixCaret(preBrowserNode)) {
|
| 1095 |
-
handle(!e.shiftKey && key === VK.UP, preBrowserNode, e);
|
| 1096 |
-
}
|
| 1097 |
-
}, 0);
|
| 1098 |
-
}
|
| 1099 |
-
}
|
| 1100 |
-
|
| 1101 |
-
editor.on('KeyDown', function(e) {
|
| 1102 |
-
eventHandler(e);
|
| 1103 |
-
});
|
| 1104 |
-
}
|
| 1105 |
-
|
| 1106 |
-
function fixBeforeTableCaretBug() {
|
| 1107 |
-
// Checks if the selection/caret is at the start of the specified block element
|
| 1108 |
-
function isAtStart(rng, par) {
|
| 1109 |
-
var doc = par.ownerDocument, rng2 = doc.createRange(), elm;
|
| 1110 |
-
|
| 1111 |
-
rng2.setStartBefore(par);
|
| 1112 |
-
rng2.setEnd(rng.endContainer, rng.endOffset);
|
| 1113 |
-
|
| 1114 |
-
elm = doc.createElement('body');
|
| 1115 |
-
elm.appendChild(rng2.cloneContents());
|
| 1116 |
-
|
| 1117 |
-
// Check for text characters of other elements that should be treated as content
|
| 1118 |
-
return elm.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi, '-').replace(/<[^>]+>/g, '').length === 0;
|
| 1119 |
-
}
|
| 1120 |
-
|
| 1121 |
-
// Fixes an bug where it's impossible to place the caret before a table in Gecko
|
| 1122 |
-
// this fix solves it by detecting when the caret is at the beginning of such a table
|
| 1123 |
-
// and then manually moves the caret infront of the table
|
| 1124 |
-
editor.on('KeyDown', function(e) {
|
| 1125 |
-
var rng, table, dom = editor.dom;
|
| 1126 |
-
|
| 1127 |
-
// On gecko it's not possible to place the caret before a table
|
| 1128 |
-
if (e.keyCode == 37 || e.keyCode == 38) {
|
| 1129 |
-
rng = editor.selection.getRng();
|
| 1130 |
-
table = dom.getParent(rng.startContainer, 'table');
|
| 1131 |
-
|
| 1132 |
-
if (table && editor.getBody().firstChild == table) {
|
| 1133 |
-
if (isAtStart(rng, table)) {
|
| 1134 |
-
rng = dom.createRng();
|
| 1135 |
-
|
| 1136 |
-
rng.setStartBefore(table);
|
| 1137 |
-
rng.setEndBefore(table);
|
| 1138 |
-
|
| 1139 |
-
editor.selection.setRng(rng);
|
| 1140 |
-
|
| 1141 |
-
e.preventDefault();
|
| 1142 |
-
}
|
| 1143 |
-
}
|
| 1144 |
-
}
|
| 1145 |
-
});
|
| 1146 |
-
}
|
| 1147 |
-
|
| 1148 |
-
// Fixes an issue on Gecko where it's impossible to place the caret behind a table
|
| 1149 |
-
// This fix will force a paragraph element after the table but only when the forced_root_block setting is enabled
|
| 1150 |
-
function fixTableCaretPos() {
|
| 1151 |
-
editor.on('KeyDown SetContent VisualAid', function() {
|
| 1152 |
-
var last;
|
| 1153 |
-
|
| 1154 |
-
// Skip empty text nodes from the end
|
| 1155 |
-
for (last = editor.getBody().lastChild; last; last = last.previousSibling) {
|
| 1156 |
-
if (last.nodeType == 3) {
|
| 1157 |
-
if (last.nodeValue.length > 0) {
|
| 1158 |
-
break;
|
| 1159 |
-
}
|
| 1160 |
-
} else if (last.nodeType == 1 && !last.getAttribute('data-mce-bogus')) {
|
| 1161 |
-
break;
|
| 1162 |
-
}
|
| 1163 |
-
}
|
| 1164 |
-
|
| 1165 |
-
if (last && last.nodeName == 'TABLE') {
|
| 1166 |
-
if (editor.settings.forced_root_block) {
|
| 1167 |
-
editor.dom.add(
|
| 1168 |
-
editor.getBody(),
|
| 1169 |
-
editor.settings.forced_root_block,
|
| 1170 |
-
editor.settings.forced_root_block_attrs,
|
| 1171 |
-
Env.ie && Env.ie < 11 ? ' ' : '<br data-mce-bogus="1" />'
|
| 1172 |
-
);
|
| 1173 |
-
} else {
|
| 1174 |
-
editor.dom.add(editor.getBody(), 'br', {'data-mce-bogus': '1'});
|
| 1175 |
-
}
|
| 1176 |
-
}
|
| 1177 |
-
});
|
| 1178 |
-
|
| 1179 |
-
editor.on('PreProcess', function(o) {
|
| 1180 |
-
var last = o.node.lastChild;
|
| 1181 |
-
|
| 1182 |
-
if (last && (last.nodeName == "BR" || (last.childNodes.length == 1 &&
|
| 1183 |
-
(last.firstChild.nodeName == 'BR' || last.firstChild.nodeValue == '\u00a0'))) &&
|
| 1184 |
-
last.previousSibling && last.previousSibling.nodeName == "TABLE") {
|
| 1185 |
-
editor.dom.remove(last);
|
| 1186 |
-
}
|
| 1187 |
-
});
|
| 1188 |
-
}
|
| 1189 |
-
|
| 1190 |
-
// this nasty hack is here to work around some WebKit selection bugs.
|
| 1191 |
-
function fixTableCellSelection() {
|
| 1192 |
-
function tableCellSelected(ed, rng, n, currentCell) {
|
| 1193 |
-
// The decision of when a table cell is selected is somewhat involved. The fact that this code is
|
| 1194 |
-
// required is actually a pointer to the root cause of this bug. A cell is selected when the start
|
| 1195 |
-
// and end offsets are 0, the start container is a text, and the selection node is either a TR (most cases)
|
| 1196 |
-
// or the parent of the table (in the case of the selection containing the last cell of a table).
|
| 1197 |
-
var TEXT_NODE = 3, table = ed.dom.getParent(rng.startContainer, 'TABLE');
|
| 1198 |
-
var tableParent, allOfCellSelected, tableCellSelection;
|
| 1199 |
-
|
| 1200 |
-
if (table) {
|
| 1201 |
-
tableParent = table.parentNode;
|
| 1202 |
-
}
|
| 1203 |
-
|
| 1204 |
-
allOfCellSelected = rng.startContainer.nodeType == TEXT_NODE &&
|
| 1205 |
-
rng.startOffset === 0 &&
|
| 1206 |
-
rng.endOffset === 0 &&
|
| 1207 |
-
currentCell &&
|
| 1208 |
-
(n.nodeName == "TR" || n == tableParent);
|
| 1209 |
-
|
| 1210 |
-
tableCellSelection = (n.nodeName == "TD" || n.nodeName == "TH") && !currentCell;
|
| 1211 |
-
|
| 1212 |
-
return allOfCellSelected || tableCellSelection;
|
| 1213 |
-
}
|
| 1214 |
-
|
| 1215 |
-
function fixSelection() {
|
| 1216 |
-
var rng = editor.selection.getRng();
|
| 1217 |
-
var n = editor.selection.getNode();
|
| 1218 |
-
var currentCell = editor.dom.getParent(rng.startContainer, 'TD,TH');
|
| 1219 |
-
|
| 1220 |
-
if (!tableCellSelected(editor, rng, n, currentCell)) {
|
| 1221 |
-
return;
|
| 1222 |
-
}
|
| 1223 |
-
|
| 1224 |
-
if (!currentCell) {
|
| 1225 |
-
currentCell = n;
|
| 1226 |
-
}
|
| 1227 |
-
|
| 1228 |
-
// Get the very last node inside the table cell
|
| 1229 |
-
var end = currentCell.lastChild;
|
| 1230 |
-
while (end.lastChild) {
|
| 1231 |
-
end = end.lastChild;
|
| 1232 |
-
}
|
| 1233 |
-
|
| 1234 |
-
// Select the entire table cell. Nothing outside of the table cell should be selected.
|
| 1235 |
-
rng.setEnd(end, end.nodeValue.length);
|
| 1236 |
-
editor.selection.setRng(rng);
|
| 1237 |
-
}
|
| 1238 |
-
|
| 1239 |
-
editor.on('KeyDown', function() {
|
| 1240 |
-
fixSelection();
|
| 1241 |
-
});
|
| 1242 |
-
|
| 1243 |
-
editor.on('MouseDown', function(e) {
|
| 1244 |
-
if (e.button != 2) {
|
| 1245 |
-
fixSelection();
|
| 1246 |
-
}
|
| 1247 |
-
});
|
| 1248 |
-
}
|
| 1249 |
-
|
| 1250 |
-
/**
|
| 1251 |
-
* Delete table if all cells are selected.
|
| 1252 |
-
*/
|
| 1253 |
-
function deleteTable() {
|
| 1254 |
-
editor.on('keydown', function(e) {
|
| 1255 |
-
if ((e.keyCode == VK.DELETE || e.keyCode == VK.BACKSPACE) && !e.isDefaultPrevented()) {
|
| 1256 |
-
var table = editor.dom.getParent(editor.selection.getStart(), 'table');
|
| 1257 |
-
|
| 1258 |
-
if (table) {
|
| 1259 |
-
var cells = editor.dom.select('td,th', table), i = cells.length;
|
| 1260 |
-
while (i--) {
|
| 1261 |
-
if (!editor.dom.hasClass(cells[i], 'mce-item-selected')) {
|
| 1262 |
-
return;
|
| 1263 |
-
}
|
| 1264 |
-
}
|
| 1265 |
-
|
| 1266 |
-
e.preventDefault();
|
| 1267 |
-
editor.execCommand('mceTableDelete');
|
| 1268 |
-
}
|
| 1269 |
-
}
|
| 1270 |
-
});
|
| 1271 |
-
}
|
| 1272 |
-
|
| 1273 |
-
deleteTable();
|
| 1274 |
-
|
| 1275 |
-
if (Env.webkit) {
|
| 1276 |
-
moveWebKitSelection();
|
| 1277 |
-
fixTableCellSelection();
|
| 1278 |
-
}
|
| 1279 |
-
|
| 1280 |
-
if (Env.gecko) {
|
| 1281 |
-
fixBeforeTableCaretBug();
|
| 1282 |
-
fixTableCaretPos();
|
| 1283 |
-
}
|
| 1284 |
-
|
| 1285 |
-
if (Env.ie > 10) {
|
| 1286 |
-
fixBeforeTableCaretBug();
|
| 1287 |
-
fixTableCaretPos();
|
| 1288 |
-
}
|
| 1289 |
-
};
|
| 1290 |
-
});
|
| 1291 |
-
|
| 1292 |
-
// Included from: js/tinymce/plugins/table/classes/CellSelection.js
|
| 1293 |
-
|
| 1294 |
-
/**
|
| 1295 |
-
* CellSelection.js
|
| 1296 |
-
*
|
| 1297 |
-
* Copyright, Moxiecode Systems AB
|
| 1298 |
-
* Released under LGPL License.
|
| 1299 |
-
*
|
| 1300 |
-
* License: http://www.tinymce.com/license
|
| 1301 |
-
* Contributing: http://www.tinymce.com/contributing
|
| 1302 |
-
*/
|
| 1303 |
-
|
| 1304 |
-
/**
|
| 1305 |
-
* This class handles table cell selection by faking it using a css class that gets applied
|
| 1306 |
-
* to cells when dragging the mouse from one cell to another.
|
| 1307 |
-
*
|
| 1308 |
-
* @class tinymce.tableplugin.CellSelection
|
| 1309 |
-
* @private
|
| 1310 |
-
*/
|
| 1311 |
-
define("tinymce/tableplugin/CellSelection", [
|
| 1312 |
-
"tinymce/tableplugin/TableGrid",
|
| 1313 |
-
"tinymce/dom/TreeWalker",
|
| 1314 |
-
"tinymce/util/Tools"
|
| 1315 |
-
], function(TableGrid, TreeWalker, Tools) {
|
| 1316 |
-
return function(editor) {
|
| 1317 |
-
var dom = editor.dom, tableGrid, startCell, startTable, hasCellSelection = true;
|
| 1318 |
-
|
| 1319 |
-
function clear() {
|
| 1320 |
-
// Restore selection possibilities
|
| 1321 |
-
editor.getBody().style.webkitUserSelect = '';
|
| 1322 |
-
|
| 1323 |
-
if (hasCellSelection) {
|
| 1324 |
-
editor.dom.removeClass(
|
| 1325 |
-
editor.dom.select('td.mce-item-selected,th.mce-item-selected'),
|
| 1326 |
-
'mce-item-selected'
|
| 1327 |
-
);
|
| 1328 |
-
|
| 1329 |
-
hasCellSelection = false;
|
| 1330 |
-
}
|
| 1331 |
-
}
|
| 1332 |
-
|
| 1333 |
-
function cellSelectionHandler(e) {
|
| 1334 |
-
var sel, table, target = e.target;
|
| 1335 |
-
|
| 1336 |
-
if (startCell && (tableGrid || target != startCell) && (target.nodeName == 'TD' || target.nodeName == 'TH')) {
|
| 1337 |
-
table = dom.getParent(target, 'table');
|
| 1338 |
-
if (table == startTable) {
|
| 1339 |
-
if (!tableGrid) {
|
| 1340 |
-
tableGrid = new TableGrid(editor, table);
|
| 1341 |
-
tableGrid.setStartCell(startCell);
|
| 1342 |
-
|
| 1343 |
-
editor.getBody().style.webkitUserSelect = 'none';
|
| 1344 |
-
}
|
| 1345 |
-
|
| 1346 |
-
tableGrid.setEndCell(target);
|
| 1347 |
-
hasCellSelection = true;
|
| 1348 |
-
}
|
| 1349 |
-
|
| 1350 |
-
// Remove current selection
|
| 1351 |
-
sel = editor.selection.getSel();
|
| 1352 |
-
|
| 1353 |
-
try {
|
| 1354 |
-
if (sel.removeAllRanges) {
|
| 1355 |
-
sel.removeAllRanges();
|
| 1356 |
-
} else {
|
| 1357 |
-
sel.empty();
|
| 1358 |
-
}
|
| 1359 |
-
} catch (ex) {
|
| 1360 |
-
// IE9 might throw errors here
|
| 1361 |
-
}
|
| 1362 |
-
|
| 1363 |
-
e.preventDefault();
|
| 1364 |
-
}
|
| 1365 |
-
}
|
| 1366 |
-
|
| 1367 |
-
// Add cell selection logic
|
| 1368 |
-
editor.on('MouseDown', function(e) {
|
| 1369 |
-
if (e.button != 2) {
|
| 1370 |
-
clear();
|
| 1371 |
-
|
| 1372 |
-
startCell = dom.getParent(e.target, 'td,th');
|
| 1373 |
-
startTable = dom.getParent(startCell, 'table');
|
| 1374 |
-
}
|
| 1375 |
-
});
|
| 1376 |
-
|
| 1377 |
-
editor.on('mouseover', cellSelectionHandler);
|
| 1378 |
-
|
| 1379 |
-
editor.on('remove', function() {
|
| 1380 |
-
dom.unbind(editor.getDoc(), 'mouseover', cellSelectionHandler);
|
| 1381 |
-
});
|
| 1382 |
-
|
| 1383 |
-
editor.on('MouseUp', function() {
|
| 1384 |
-
var rng, sel = editor.selection, selectedCells, walker, node, lastNode, endNode;
|
| 1385 |
-
|
| 1386 |
-
function setPoint(node, start) {
|
| 1387 |
-
var walker = new TreeWalker(node, node);
|
| 1388 |
-
|
| 1389 |
-
do {
|
| 1390 |
-
// Text node
|
| 1391 |
-
if (node.nodeType == 3 && Tools.trim(node.nodeValue).length !== 0) {
|
| 1392 |
-
if (start) {
|
| 1393 |
-
rng.setStart(node, 0);
|
| 1394 |
-
} else {
|
| 1395 |
-
rng.setEnd(node, node.nodeValue.length);
|
| 1396 |
-
}
|
| 1397 |
-
|
| 1398 |
-
return;
|
| 1399 |
-
}
|
| 1400 |
-
|
| 1401 |
-
// BR element
|
| 1402 |
-
if (node.nodeName == 'BR') {
|
| 1403 |
-
if (start) {
|
| 1404 |
-
rng.setStartBefore(node);
|
| 1405 |
-
} else {
|
| 1406 |
-
rng.setEndBefore(node);
|
| 1407 |
-
}
|
| 1408 |
-
|
| 1409 |
-
return;
|
| 1410 |
-
}
|
| 1411 |
-
} while ((node = (start ? walker.next() : walker.prev())));
|
| 1412 |
-
}
|
| 1413 |
-
|
| 1414 |
-
// Move selection to startCell
|
| 1415 |
-
if (startCell) {
|
| 1416 |
-
if (tableGrid) {
|
| 1417 |
-
editor.getBody().style.webkitUserSelect = '';
|
| 1418 |
-
}
|
| 1419 |
-
|
| 1420 |
-
// Try to expand text selection as much as we can only Gecko supports cell selection
|
| 1421 |
-
selectedCells = dom.select('td.mce-item-selected,th.mce-item-selected');
|
| 1422 |
-
if (selectedCells.length > 0) {
|
| 1423 |
-
rng = dom.createRng();
|
| 1424 |
-
node = selectedCells[0];
|
| 1425 |
-
endNode = selectedCells[selectedCells.length - 1];
|
| 1426 |
-
rng.setStartBefore(node);
|
| 1427 |
-
rng.setEndAfter(node);
|
| 1428 |
-
|
| 1429 |
-
setPoint(node, 1);
|
| 1430 |
-
walker = new TreeWalker(node, dom.getParent(selectedCells[0], 'table'));
|
| 1431 |
-
|
| 1432 |
-
do {
|
| 1433 |
-
if (node.nodeName == 'TD' || node.nodeName == 'TH') {
|
| 1434 |
-
if (!dom.hasClass(node, 'mce-item-selected')) {
|
| 1435 |
-
break;
|
| 1436 |
-
}
|
| 1437 |
-
|
| 1438 |
-
lastNode = node;
|
| 1439 |
-
}
|
| 1440 |
-
} while ((node = walker.next()));
|
| 1441 |
-
|
| 1442 |
-
setPoint(lastNode);
|
| 1443 |
-
|
| 1444 |
-
sel.setRng(rng);
|
| 1445 |
-
}
|
| 1446 |
-
|
| 1447 |
-
editor.nodeChanged();
|
| 1448 |
-
startCell = tableGrid = startTable = null;
|
| 1449 |
-
}
|
| 1450 |
-
});
|
| 1451 |
-
|
| 1452 |
-
editor.on('KeyUp', function() {
|
| 1453 |
-
clear();
|
| 1454 |
-
});
|
| 1455 |
-
|
| 1456 |
-
return {
|
| 1457 |
-
clear: clear
|
| 1458 |
-
};
|
| 1459 |
-
};
|
| 1460 |
-
});
|
| 1461 |
-
|
| 1462 |
-
// Included from: js/tinymce/plugins/table/classes/Plugin.js
|
| 1463 |
-
|
| 1464 |
-
/**
|
| 1465 |
-
* Plugin.js
|
| 1466 |
-
*
|
| 1467 |
-
* Copyright, Moxiecode Systems AB
|
| 1468 |
-
* Released under LGPL License.
|
| 1469 |
-
*
|
| 1470 |
-
* License: http://www.tinymce.com/license
|
| 1471 |
-
* Contributing: http://www.tinymce.com/contributing
|
| 1472 |
-
*/
|
| 1473 |
-
|
| 1474 |
-
/**
|
| 1475 |
-
* This class contains all core logic for the table plugin.
|
| 1476 |
-
*
|
| 1477 |
-
* @class tinymce.tableplugin.Plugin
|
| 1478 |
-
* @private
|
| 1479 |
-
*/
|
| 1480 |
-
define("tinymce/tableplugin/Plugin", [
|
| 1481 |
-
"tinymce/tableplugin/TableGrid",
|
| 1482 |
-
"tinymce/tableplugin/Quirks",
|
| 1483 |
-
"tinymce/tableplugin/CellSelection",
|
| 1484 |
-
"tinymce/util/Tools",
|
| 1485 |
-
"tinymce/dom/TreeWalker",
|
| 1486 |
-
"tinymce/Env",
|
| 1487 |
-
"tinymce/PluginManager"
|
| 1488 |
-
], function(TableGrid, Quirks, CellSelection, Tools, TreeWalker, Env, PluginManager) {
|
| 1489 |
-
var each = Tools.each;
|
| 1490 |
-
|
| 1491 |
-
function Plugin(editor) {
|
| 1492 |
-
var winMan, clipboardRows, self = this; // Might be selected cells on reload
|
| 1493 |
-
|
| 1494 |
-
function removePxSuffix(size) {
|
| 1495 |
-
return size ? size.replace(/px$/, '') : "";
|
| 1496 |
-
}
|
| 1497 |
-
|
| 1498 |
-
function addSizeSuffix(size) {
|
| 1499 |
-
if (/^[0-9]+$/.test(size)) {
|
| 1500 |
-
size += "px";
|
| 1501 |
-
}
|
| 1502 |
-
|
| 1503 |
-
return size;
|
| 1504 |
-
}
|
| 1505 |
-
|
| 1506 |
-
function unApplyAlign(elm) {
|
| 1507 |
-
each('left center right'.split(' '), function(name) {
|
| 1508 |
-
editor.formatter.remove('align' + name, {}, elm);
|
| 1509 |
-
});
|
| 1510 |
-
}
|
| 1511 |
-
|
| 1512 |
-
function tableDialog() {
|
| 1513 |
-
var dom = editor.dom, tableElm, colsCtrl, rowsCtrl, data;
|
| 1514 |
-
|
| 1515 |
-
tableElm = dom.getParent(editor.selection.getStart(), 'table');
|
| 1516 |
-
|
| 1517 |
-
data = {
|
| 1518 |
-
width: removePxSuffix(dom.getStyle(tableElm, 'width') || dom.getAttrib(tableElm, 'width')),
|
| 1519 |
-
height: removePxSuffix(dom.getStyle(tableElm, 'height') || dom.getAttrib(tableElm, 'height')),
|
| 1520 |
-
cellspacing: tableElm ? dom.getAttrib(tableElm, 'cellspacing') : '',
|
| 1521 |
-
cellpadding: tableElm ? dom.getAttrib(tableElm, 'cellpadding') : '',
|
| 1522 |
-
border: tableElm ? dom.getAttrib(tableElm, 'border') : '',
|
| 1523 |
-
caption: !!dom.select('caption', tableElm)[0]
|
| 1524 |
-
};
|
| 1525 |
-
|
| 1526 |
-
each('left center right'.split(' '), function(name) {
|
| 1527 |
-
if (editor.formatter.matchNode(tableElm, 'align' + name)) {
|
| 1528 |
-
data.align = name;
|
| 1529 |
-
}
|
| 1530 |
-
});
|
| 1531 |
-
|
| 1532 |
-
if (!tableElm) {
|
| 1533 |
-
colsCtrl = {label: 'Cols', name: 'cols'};
|
| 1534 |
-
rowsCtrl = {label: 'Rows', name: 'rows'};
|
| 1535 |
-
}
|
| 1536 |
-
|
| 1537 |
-
editor.windowManager.open({
|
| 1538 |
-
title: "Table properties",
|
| 1539 |
-
items: {
|
| 1540 |
-
type: 'form',
|
| 1541 |
-
layout: 'grid',
|
| 1542 |
-
columns: 2,
|
| 1543 |
-
data: data,
|
| 1544 |
-
defaults: {
|
| 1545 |
-
type: 'textbox',
|
| 1546 |
-
maxWidth: 50
|
| 1547 |
-
},
|
| 1548 |
-
items: [
|
| 1549 |
-
colsCtrl,
|
| 1550 |
-
rowsCtrl,
|
| 1551 |
-
{label: 'Width', name: 'width'},
|
| 1552 |
-
{label: 'Height', name: 'height'},
|
| 1553 |
-
{label: 'Cell spacing', name: 'cellspacing'},
|
| 1554 |
-
{label: 'Cell padding', name: 'cellpadding'},
|
| 1555 |
-
{label: 'Border', name: 'border'},
|
| 1556 |
-
{label: 'Caption', name: 'caption', type: 'checkbox'},
|
| 1557 |
-
{
|
| 1558 |
-
label: 'Alignment',
|
| 1559 |
-
minWidth: 90,
|
| 1560 |
-
name: 'align',
|
| 1561 |
-
type: 'listbox',
|
| 1562 |
-
text: 'None',
|
| 1563 |
-
maxWidth: null,
|
| 1564 |
-
values: [
|
| 1565 |
-
{text: 'None', value: ''},
|
| 1566 |
-
{text: 'Left', value: 'left'},
|
| 1567 |
-
{text: 'Center', value: 'center'},
|
| 1568 |
-
{text: 'Right', value: 'right'}
|
| 1569 |
-
]
|
| 1570 |
-
}
|
| 1571 |
-
]
|
| 1572 |
-
},
|
| 1573 |
-
|
| 1574 |
-
onsubmit: function() {
|
| 1575 |
-
var data = this.toJSON(), captionElm;
|
| 1576 |
-
|
| 1577 |
-
editor.undoManager.transact(function() {
|
| 1578 |
-
if (!tableElm) {
|
| 1579 |
-
tableElm = insertTable(data.cols || 1, data.rows || 1);
|
| 1580 |
-
}
|
| 1581 |
-
|
| 1582 |
-
editor.dom.setAttribs(tableElm, {
|
| 1583 |
-
cellspacing: data.cellspacing,
|
| 1584 |
-
cellpadding: data.cellpadding,
|
| 1585 |
-
border: data.border
|
| 1586 |
-
});
|
| 1587 |
-
|
| 1588 |
-
editor.dom.setStyles(tableElm, {
|
| 1589 |
-
width: addSizeSuffix(data.width),
|
| 1590 |
-
height: addSizeSuffix(data.height)
|
| 1591 |
-
});
|
| 1592 |
-
|
| 1593 |
-
// Toggle caption on/off
|
| 1594 |
-
captionElm = dom.select('caption', tableElm)[0];
|
| 1595 |
-
|
| 1596 |
-
if (captionElm && !data.caption) {
|
| 1597 |
-
dom.remove(captionElm);
|
| 1598 |
-
}
|
| 1599 |
-
|
| 1600 |
-
if (!captionElm && data.caption) {
|
| 1601 |
-
captionElm = dom.create('caption');
|
| 1602 |
-
captionElm.innerHTML = !Env.ie ? '<br data-mce-bogus="1"/>' : '\u00a0';
|
| 1603 |
-
tableElm.insertBefore(captionElm, tableElm.firstChild);
|
| 1604 |
-
}
|
| 1605 |
-
|
| 1606 |
-
unApplyAlign(tableElm);
|
| 1607 |
-
if (data.align) {
|
| 1608 |
-
editor.formatter.apply('align' + data.align, {}, tableElm);
|
| 1609 |
-
}
|
| 1610 |
-
|
| 1611 |
-
editor.focus();
|
| 1612 |
-
editor.addVisual();
|
| 1613 |
-
});
|
| 1614 |
-
}
|
| 1615 |
-
});
|
| 1616 |
-
}
|
| 1617 |
-
|
| 1618 |
-
function mergeDialog(grid, cell) {
|
| 1619 |
-
editor.windowManager.open({
|
| 1620 |
-
title: "Merge cells",
|
| 1621 |
-
body: [
|
| 1622 |
-
{label: 'Cols', name: 'cols', type: 'textbox', size: 10},
|
| 1623 |
-
{label: 'Rows', name: 'rows', type: 'textbox', size: 10}
|
| 1624 |
-
],
|
| 1625 |
-
onsubmit: function() {
|
| 1626 |
-
var data = this.toJSON();
|
| 1627 |
-
|
| 1628 |
-
editor.undoManager.transact(function() {
|
| 1629 |
-
grid.merge(cell, data.cols, data.rows);
|
| 1630 |
-
});
|
| 1631 |
-
}
|
| 1632 |
-
});
|
| 1633 |
-
}
|
| 1634 |
-
|
| 1635 |
-
function cellDialog() {
|
| 1636 |
-
var dom = editor.dom, cellElm, data, cells = [];
|
| 1637 |
-
|
| 1638 |
-
// Get selected cells or the current cell
|
| 1639 |
-
cells = editor.dom.select('td.mce-item-selected,th.mce-item-selected');
|
| 1640 |
-
cellElm = editor.dom.getParent(editor.selection.getStart(), 'td,th');
|
| 1641 |
-
if (!cells.length && cellElm) {
|
| 1642 |
-
cells.push(cellElm);
|
| 1643 |
-
}
|
| 1644 |
-
|
| 1645 |
-
cellElm = cellElm || cells[0];
|
| 1646 |
-
|
| 1647 |
-
if (!cellElm) {
|
| 1648 |
-
// If this element is null, return now to avoid crashing.
|
| 1649 |
-
return;
|
| 1650 |
-
}
|
| 1651 |
-
|
| 1652 |
-
data = {
|
| 1653 |
-
width: removePxSuffix(dom.getStyle(cellElm, 'width') || dom.getAttrib(cellElm, 'width')),
|
| 1654 |
-
height: removePxSuffix(dom.getStyle(cellElm, 'height') || dom.getAttrib(cellElm, 'height')),
|
| 1655 |
-
scope: dom.getAttrib(cellElm, 'scope')
|
| 1656 |
-
};
|
| 1657 |
-
|
| 1658 |
-
data.type = cellElm.nodeName.toLowerCase();
|
| 1659 |
-
|
| 1660 |
-
each('left center right'.split(' '), function(name) {
|
| 1661 |
-
if (editor.formatter.matchNode(cellElm, 'align' + name)) {
|
| 1662 |
-
data.align = name;
|
| 1663 |
-
}
|
| 1664 |
-
});
|
| 1665 |
-
|
| 1666 |
-
editor.windowManager.open({
|
| 1667 |
-
title: "Cell properties",
|
| 1668 |
-
items: {
|
| 1669 |
-
type: 'form',
|
| 1670 |
-
data: data,
|
| 1671 |
-
layout: 'grid',
|
| 1672 |
-
columns: 2,
|
| 1673 |
-
defaults: {
|
| 1674 |
-
type: 'textbox',
|
| 1675 |
-
maxWidth: 50
|
| 1676 |
-
},
|
| 1677 |
-
items: [
|
| 1678 |
-
{label: 'Width', name: 'width'},
|
| 1679 |
-
{label: 'Height', name: 'height'},
|
| 1680 |
-
{
|
| 1681 |
-
label: 'Cell type',
|
| 1682 |
-
name: 'type',
|
| 1683 |
-
type: 'listbox',
|
| 1684 |
-
text: 'None',
|
| 1685 |
-
minWidth: 90,
|
| 1686 |
-
maxWidth: null,
|
| 1687 |
-
values: [
|
| 1688 |
-
{text: 'Cell', value: 'td'},
|
| 1689 |
-
{text: 'Header cell', value: 'th'}
|
| 1690 |
-
]
|
| 1691 |
-
},
|
| 1692 |
-
{
|
| 1693 |
-
label: 'Scope',
|
| 1694 |
-
name: 'scope',
|
| 1695 |
-
type: 'listbox',
|
| 1696 |
-
text: 'None',
|
| 1697 |
-
minWidth: 90,
|
| 1698 |
-
maxWidth: null,
|
| 1699 |
-
values: [
|
| 1700 |
-
{text: 'None', value: ''},
|
| 1701 |
-
{text: 'Row', value: 'row'},
|
| 1702 |
-
{text: 'Column', value: 'col'},
|
| 1703 |
-
{text: 'Row group', value: 'rowgroup'},
|
| 1704 |
-
{text: 'Column group', value: 'colgroup'}
|
| 1705 |
-
]
|
| 1706 |
-
},
|
| 1707 |
-
{
|
| 1708 |
-
label: 'Alignment',
|
| 1709 |
-
name: 'align',
|
| 1710 |
-
type: 'listbox',
|
| 1711 |
-
text: 'None',
|
| 1712 |
-
minWidth: 90,
|
| 1713 |
-
maxWidth: null,
|
| 1714 |
-
values: [
|
| 1715 |
-
{text: 'None', value: ''},
|
| 1716 |
-
{text: 'Left', value: 'left'},
|
| 1717 |
-
{text: 'Center', value: 'center'},
|
| 1718 |
-
{text: 'Right', value: 'right'}
|
| 1719 |
-
]
|
| 1720 |
-
}
|
| 1721 |
-
]
|
| 1722 |
-
},
|
| 1723 |
-
|
| 1724 |
-
onsubmit: function() {
|
| 1725 |
-
var data = this.toJSON();
|
| 1726 |
-
|
| 1727 |
-
editor.undoManager.transact(function() {
|
| 1728 |
-
each(cells, function(cellElm) {
|
| 1729 |
-
editor.dom.setAttrib(cellElm, 'scope', data.scope);
|
| 1730 |
-
|
| 1731 |
-
editor.dom.setStyles(cellElm, {
|
| 1732 |
-
width: addSizeSuffix(data.width),
|
| 1733 |
-
height: addSizeSuffix(data.height)
|
| 1734 |
-
});
|
| 1735 |
-
|
| 1736 |
-
// Switch cell type
|
| 1737 |
-
if (data.type && cellElm.nodeName.toLowerCase() != data.type) {
|
| 1738 |
-
cellElm = dom.rename(cellElm, data.type);
|
| 1739 |
-
}
|
| 1740 |
-
|
| 1741 |
-
// Apply/remove alignment
|
| 1742 |
-
unApplyAlign(cellElm);
|
| 1743 |
-
if (data.align) {
|
| 1744 |
-
editor.formatter.apply('align' + data.align, {}, cellElm);
|
| 1745 |
-
}
|
| 1746 |
-
});
|
| 1747 |
-
|
| 1748 |
-
editor.focus();
|
| 1749 |
-
});
|
| 1750 |
-
}
|
| 1751 |
-
});
|
| 1752 |
-
}
|
| 1753 |
-
|
| 1754 |
-
function rowDialog() {
|
| 1755 |
-
var dom = editor.dom, tableElm, cellElm, rowElm, data, rows = [];
|
| 1756 |
-
|
| 1757 |
-
tableElm = editor.dom.getParent(editor.selection.getStart(), 'table');
|
| 1758 |
-
cellElm = editor.dom.getParent(editor.selection.getStart(), 'td,th');
|
| 1759 |
-
|
| 1760 |
-
each(tableElm.rows, function(row) {
|
| 1761 |
-
each(row.cells, function(cell) {
|
| 1762 |
-
if (dom.hasClass(cell, 'mce-item-selected') || cell == cellElm) {
|
| 1763 |
-
rows.push(row);
|
| 1764 |
-
return false;
|
| 1765 |
-
}
|
| 1766 |
-
});
|
| 1767 |
-
});
|
| 1768 |
-
|
| 1769 |
-
rowElm = rows[0];
|
| 1770 |
-
if (!rowElm) {
|
| 1771 |
-
// If this element is null, return now to avoid crashing.
|
| 1772 |
-
return;
|
| 1773 |
-
}
|
| 1774 |
-
|
| 1775 |
-
data = {
|
| 1776 |
-
height: removePxSuffix(dom.getStyle(rowElm, 'height') || dom.getAttrib(rowElm, 'height')),
|
| 1777 |
-
scope: dom.getAttrib(rowElm, 'scope')
|
| 1778 |
-
};
|
| 1779 |
-
|
| 1780 |
-
data.type = rowElm.parentNode.nodeName.toLowerCase();
|
| 1781 |
-
|
| 1782 |
-
each('left center right'.split(' '), function(name) {
|
| 1783 |
-
if (editor.formatter.matchNode(rowElm, 'align' + name)) {
|
| 1784 |
-
data.align = name;
|
| 1785 |
-
}
|
| 1786 |
-
});
|
| 1787 |
-
|
| 1788 |
-
editor.windowManager.open({
|
| 1789 |
-
title: "Row properties",
|
| 1790 |
-
items: {
|
| 1791 |
-
type: 'form',
|
| 1792 |
-
data: data,
|
| 1793 |
-
columns: 2,
|
| 1794 |
-
defaults: {
|
| 1795 |
-
type: 'textbox'
|
| 1796 |
-
},
|
| 1797 |
-
items: [
|
| 1798 |
-
{
|
| 1799 |
-
type: 'listbox',
|
| 1800 |
-
name: 'type',
|
| 1801 |
-
label: 'Row type',
|
| 1802 |
-
text: 'None',
|
| 1803 |
-
maxWidth: null,
|
| 1804 |
-
values: [
|
| 1805 |
-
{text: 'Header', value: 'thead'},
|
| 1806 |
-
{text: 'Body', value: 'tbody'},
|
| 1807 |
-
{text: 'Footer', value: 'tfoot'}
|
| 1808 |
-
]
|
| 1809 |
-
},
|
| 1810 |
-
{
|
| 1811 |
-
type: 'listbox',
|
| 1812 |
-
name: 'align',
|
| 1813 |
-
label: 'Alignment',
|
| 1814 |
-
text: 'None',
|
| 1815 |
-
maxWidth: null,
|
| 1816 |
-
values: [
|
| 1817 |
-
{text: 'None', value: ''},
|
| 1818 |
-
{text: 'Left', value: 'left'},
|
| 1819 |
-
{text: 'Center', value: 'center'},
|
| 1820 |
-
{text: 'Right', value: 'right'}
|
| 1821 |
-
]
|
| 1822 |
-
},
|
| 1823 |
-
{label: 'Height', name: 'height'}
|
| 1824 |
-
]
|
| 1825 |
-
},
|
| 1826 |
-
|
| 1827 |
-
onsubmit: function() {
|
| 1828 |
-
var data = this.toJSON(), tableElm, oldParentElm, parentElm;
|
| 1829 |
-
|
| 1830 |
-
editor.undoManager.transact(function() {
|
| 1831 |
-
var toType = data.type;
|
| 1832 |
-
|
| 1833 |
-
each(rows, function(rowElm) {
|
| 1834 |
-
editor.dom.setAttrib(rowElm, 'scope', data.scope);
|
| 1835 |
-
|
| 1836 |
-
editor.dom.setStyles(rowElm, {
|
| 1837 |
-
height: addSizeSuffix(data.height)
|
| 1838 |
-
});
|
| 1839 |
-
|
| 1840 |
-
if (toType != rowElm.parentNode.nodeName.toLowerCase()) {
|
| 1841 |
-
tableElm = dom.getParent(rowElm, 'table');
|
| 1842 |
-
|
| 1843 |
-
oldParentElm = rowElm.parentNode;
|
| 1844 |
-
parentElm = dom.select(toType, tableElm)[0];
|
| 1845 |
-
if (!parentElm) {
|
| 1846 |
-
parentElm = dom.create(toType);
|
| 1847 |
-
if (tableElm.firstChild) {
|
| 1848 |
-
tableElm.insertBefore(parentElm, tableElm.firstChild);
|
| 1849 |
-
} else {
|
| 1850 |
-
tableElm.appendChild(parentElm);
|
| 1851 |
-
}
|
| 1852 |
-
}
|
| 1853 |
-
|
| 1854 |
-
parentElm.appendChild(rowElm);
|
| 1855 |
-
|
| 1856 |
-
if (!oldParentElm.hasChildNodes()) {
|
| 1857 |
-
dom.remove(oldParentElm);
|
| 1858 |
-
}
|
| 1859 |
-
}
|
| 1860 |
-
|
| 1861 |
-
// Apply/remove alignment
|
| 1862 |
-
unApplyAlign(rowElm);
|
| 1863 |
-
if (data.align) {
|
| 1864 |
-
editor.formatter.apply('align' + data.align, {}, rowElm);
|
| 1865 |
-
}
|
| 1866 |
-
});
|
| 1867 |
-
|
| 1868 |
-
editor.focus();
|
| 1869 |
-
});
|
| 1870 |
-
}
|
| 1871 |
-
});
|
| 1872 |
-
}
|
| 1873 |
-
|
| 1874 |
-
function cmd(command) {
|
| 1875 |
-
return function() {
|
| 1876 |
-
editor.execCommand(command);
|
| 1877 |
-
};
|
| 1878 |
-
}
|
| 1879 |
-
|
| 1880 |
-
function insertTable(cols, rows) {
|
| 1881 |
-
var y, x, html;
|
| 1882 |
-
|
| 1883 |
-
html = '<table id="__mce"><tbody>';
|
| 1884 |
-
|
| 1885 |
-
for (y = 0; y < rows; y++) {
|
| 1886 |
-
html += '<tr>';
|
| 1887 |
-
|
| 1888 |
-
for (x = 0; x < cols; x++) {
|
| 1889 |
-
html += '<td>' + (Env.ie ? " " : '<br>') + '</td>';
|
| 1890 |
-
}
|
| 1891 |
-
|
| 1892 |
-
html += '</tr>';
|
| 1893 |
-
}
|
| 1894 |
-
|
| 1895 |
-
html += '</tbody></table>';
|
| 1896 |
-
|
| 1897 |
-
editor.insertContent(html);
|
| 1898 |
-
|
| 1899 |
-
var tableElm = editor.dom.get('__mce');
|
| 1900 |
-
editor.dom.setAttrib(tableElm, 'id', null);
|
| 1901 |
-
|
| 1902 |
-
return tableElm;
|
| 1903 |
-
}
|
| 1904 |
-
|
| 1905 |
-
function handleDisabledState(ctrl, selector) {
|
| 1906 |
-
function bindStateListener() {
|
| 1907 |
-
ctrl.disabled(!editor.dom.getParent(editor.selection.getStart(), selector));
|
| 1908 |
-
|
| 1909 |
-
editor.selection.selectorChanged(selector, function(state) {
|
| 1910 |
-
ctrl.disabled(!state);
|
| 1911 |
-
});
|
| 1912 |
-
}
|
| 1913 |
-
|
| 1914 |
-
if (editor.initialized) {
|
| 1915 |
-
bindStateListener();
|
| 1916 |
-
} else {
|
| 1917 |
-
editor.on('init', bindStateListener);
|
| 1918 |
-
}
|
| 1919 |
-
}
|
| 1920 |
-
|
| 1921 |
-
function postRender() {
|
| 1922 |
-
/*jshint validthis:true*/
|
| 1923 |
-
handleDisabledState(this, 'table');
|
| 1924 |
-
}
|
| 1925 |
-
|
| 1926 |
-
function postRenderCell() {
|
| 1927 |
-
/*jshint validthis:true*/
|
| 1928 |
-
handleDisabledState(this, 'td,th');
|
| 1929 |
-
}
|
| 1930 |
-
|
| 1931 |
-
function generateTableGrid() {
|
| 1932 |
-
var html = '';
|
| 1933 |
-
|
| 1934 |
-
html = '<table role="grid" class="mce-grid mce-grid-border" aria-readonly="true">';
|
| 1935 |
-
|
| 1936 |
-
for (var y = 0; y < 10; y++) {
|
| 1937 |
-
html += '<tr>';
|
| 1938 |
-
|
| 1939 |
-
for (var x = 0; x < 10; x++) {
|
| 1940 |
-
html += '<td role="gridcell" tabindex="-1"><a id="mcegrid' + (y * 10 + x) + '" href="#" ' +
|
| 1941 |
-
'data-mce-x="' + x + '" data-mce-y="' + y + '" ' +
|
| 1942 |
-
'' + (x + y === 0 ? ' class="mce-active"' : '') + '></a></td>';
|
| 1943 |
-
}
|
| 1944 |
-
|
| 1945 |
-
html += '</tr>';
|
| 1946 |
-
}
|
| 1947 |
-
|
| 1948 |
-
html += '</table>';
|
| 1949 |
-
|
| 1950 |
-
html += '<div class="mce-text-center" role="presentation">1 x 1</div>';
|
| 1951 |
-
|
| 1952 |
-
return html;
|
| 1953 |
-
}
|
| 1954 |
-
|
| 1955 |
-
function selectGrid(tx, ty, control) {
|
| 1956 |
-
var table = control.getEl().getElementsByTagName('table')[0];
|
| 1957 |
-
var rel = control.parent().rel, x, y, focusCell, cell;
|
| 1958 |
-
|
| 1959 |
-
if (control.isRtl() || rel == 'tl-tr') {
|
| 1960 |
-
for (y = 9; y >= 0; y--) {
|
| 1961 |
-
for (x = 0; x < 10; x++) {
|
| 1962 |
-
cell = table.rows[y].childNodes[x].firstChild;
|
| 1963 |
-
|
| 1964 |
-
editor.dom.toggleClass(
|
| 1965 |
-
cell,
|
| 1966 |
-
'mce-active',
|
| 1967 |
-
x >= tx && y <= ty
|
| 1968 |
-
);
|
| 1969 |
-
|
| 1970 |
-
if (x >= tx && y <= ty) {
|
| 1971 |
-
focusCell = cell;
|
| 1972 |
-
}
|
| 1973 |
-
}
|
| 1974 |
-
}
|
| 1975 |
-
|
| 1976 |
-
tx = 9 - tx;
|
| 1977 |
-
table.nextSibling.innerHTML = tx + ' x ' + (ty + 1);
|
| 1978 |
-
} else {
|
| 1979 |
-
for (y = 0; y < 10; y++) {
|
| 1980 |
-
for (x = 0; x < 10; x++) {
|
| 1981 |
-
cell = table.rows[y].childNodes[x].firstChild;
|
| 1982 |
-
|
| 1983 |
-
editor.dom.toggleClass(
|
| 1984 |
-
cell,
|
| 1985 |
-
'mce-active',
|
| 1986 |
-
x <= tx && y <= ty
|
| 1987 |
-
);
|
| 1988 |
-
|
| 1989 |
-
if (x <= tx && y <= ty) {
|
| 1990 |
-
focusCell = cell;
|
| 1991 |
-
}
|
| 1992 |
-
}
|
| 1993 |
-
}
|
| 1994 |
-
|
| 1995 |
-
table.nextSibling.innerHTML = (tx + 1) + ' x ' + (ty + 1);
|
| 1996 |
-
}
|
| 1997 |
-
|
| 1998 |
-
return focusCell.parentNode;
|
| 1999 |
-
}
|
| 2000 |
-
|
| 2001 |
-
if (editor.settings.table_grid === false) {
|
| 2002 |
-
editor.addMenuItem('inserttable', {
|
| 2003 |
-
text: 'Insert table',
|
| 2004 |
-
icon: 'table',
|
| 2005 |
-
context: 'table',
|
| 2006 |
-
onclick: tableDialog
|
| 2007 |
-
});
|
| 2008 |
-
} else {
|
| 2009 |
-
editor.addMenuItem('inserttable', {
|
| 2010 |
-
text: 'Insert table',
|
| 2011 |
-
icon: 'table',
|
| 2012 |
-
context: 'table',
|
| 2013 |
-
ariaHideMenu: true,
|
| 2014 |
-
onclick: function(e) {
|
| 2015 |
-
if (e.aria) {
|
| 2016 |
-
this.parent().hideAll();
|
| 2017 |
-
e.stopImmediatePropagation();
|
| 2018 |
-
tableDialog();
|
| 2019 |
-
}
|
| 2020 |
-
},
|
| 2021 |
-
onhide: function() {
|
| 2022 |
-
var elements = this.menu.items()[0].getEl().getElementsByTagName('a');
|
| 2023 |
-
editor.dom.removeClass(elements, 'mce-active');
|
| 2024 |
-
editor.dom.addClass(elements[0], 'mce-active');
|
| 2025 |
-
},
|
| 2026 |
-
menu: [
|
| 2027 |
-
{
|
| 2028 |
-
type: 'container',
|
| 2029 |
-
html: generateTableGrid(),
|
| 2030 |
-
|
| 2031 |
-
onPostRender: function() {
|
| 2032 |
-
this.lastX = this.lastY = 0;
|
| 2033 |
-
},
|
| 2034 |
-
|
| 2035 |
-
onmousemove: function(e) {
|
| 2036 |
-
var target = e.target, x, y;
|
| 2037 |
-
|
| 2038 |
-
if (target.tagName.toUpperCase() == 'A') {
|
| 2039 |
-
x = parseInt(target.getAttribute('data-mce-x'), 10);
|
| 2040 |
-
y = parseInt(target.getAttribute('data-mce-y'), 10);
|
| 2041 |
-
|
| 2042 |
-
if (x !== this.lastX || y !== this.lastY) {
|
| 2043 |
-
selectGrid(x, y, e.control);
|
| 2044 |
-
|
| 2045 |
-
this.lastX = x;
|
| 2046 |
-
this.lastY = y;
|
| 2047 |
-
}
|
| 2048 |
-
}
|
| 2049 |
-
},
|
| 2050 |
-
|
| 2051 |
-
onkeydown: function(e) {
|
| 2052 |
-
var x = this.lastX, y = this.lastY, isHandled;
|
| 2053 |
-
|
| 2054 |
-
switch (e.keyCode) {
|
| 2055 |
-
case 37: // DOM_VK_LEFT
|
| 2056 |
-
if (x > 0) {
|
| 2057 |
-
x--;
|
| 2058 |
-
isHandled = true;
|
| 2059 |
-
}
|
| 2060 |
-
break;
|
| 2061 |
-
|
| 2062 |
-
case 39: // DOM_VK_RIGHT
|
| 2063 |
-
isHandled = true;
|
| 2064 |
-
|
| 2065 |
-
if (x < 9) {
|
| 2066 |
-
x++;
|
| 2067 |
-
}
|
| 2068 |
-
break;
|
| 2069 |
-
|
| 2070 |
-
case 38: // DOM_VK_UP
|
| 2071 |
-
isHandled = true;
|
| 2072 |
-
|
| 2073 |
-
if (y > 0) {
|
| 2074 |
-
y--;
|
| 2075 |
-
}
|
| 2076 |
-
break;
|
| 2077 |
-
|
| 2078 |
-
case 40: // DOM_VK_DOWN
|
| 2079 |
-
isHandled = true;
|
| 2080 |
-
|
| 2081 |
-
if (y < 9) {
|
| 2082 |
-
y++;
|
| 2083 |
-
}
|
| 2084 |
-
break;
|
| 2085 |
-
}
|
| 2086 |
-
|
| 2087 |
-
if (isHandled) {
|
| 2088 |
-
e.preventDefault();
|
| 2089 |
-
e.stopPropagation();
|
| 2090 |
-
|
| 2091 |
-
selectGrid(x, y, e.control).focus();
|
| 2092 |
-
|
| 2093 |
-
this.lastX = x;
|
| 2094 |
-
this.lastY = y;
|
| 2095 |
-
}
|
| 2096 |
-
},
|
| 2097 |
-
|
| 2098 |
-
onclick: function(e) {
|
| 2099 |
-
if (e.target.tagName.toUpperCase() == 'A') {
|
| 2100 |
-
e.preventDefault();
|
| 2101 |
-
e.stopPropagation();
|
| 2102 |
-
this.parent().cancel();
|
| 2103 |
-
|
| 2104 |
-
insertTable(this.lastX + 1, this.lastY + 1);
|
| 2105 |
-
}
|
| 2106 |
-
}
|
| 2107 |
-
}
|
| 2108 |
-
]
|
| 2109 |
-
});
|
| 2110 |
-
}
|
| 2111 |
-
|
| 2112 |
-
editor.addMenuItem('tableprops', {
|
| 2113 |
-
text: 'Table properties',
|
| 2114 |
-
context: 'table',
|
| 2115 |
-
onPostRender: postRender,
|
| 2116 |
-
onclick: tableDialog
|
| 2117 |
-
});
|
| 2118 |
-
|
| 2119 |
-
editor.addMenuItem('deletetable', {
|
| 2120 |
-
text: 'Delete table',
|
| 2121 |
-
context: 'table',
|
| 2122 |
-
onPostRender: postRender,
|
| 2123 |
-
cmd: 'mceTableDelete'
|
| 2124 |
-
});
|
| 2125 |
-
|
| 2126 |
-
editor.addMenuItem('cell', {
|
| 2127 |
-
separator: 'before',
|
| 2128 |
-
text: 'Cell',
|
| 2129 |
-
context: 'table',
|
| 2130 |
-
menu: [
|
| 2131 |
-
{text: 'Cell properties', onclick: cmd('mceTableCellProps'), onPostRender: postRenderCell},
|
| 2132 |
-
{text: 'Merge cells', onclick: cmd('mceTableMergeCells'), onPostRender: postRenderCell},
|
| 2133 |
-
{text: 'Split cell', onclick: cmd('mceTableSplitCells'), onPostRender: postRenderCell}
|
| 2134 |
-
]
|
| 2135 |
-
});
|
| 2136 |
-
|
| 2137 |
-
editor.addMenuItem('row', {
|
| 2138 |
-
text: 'Row',
|
| 2139 |
-
context: 'table',
|
| 2140 |
-
menu: [
|
| 2141 |
-
{text: 'Insert row before', onclick: cmd('mceTableInsertRowBefore'), onPostRender: postRenderCell},
|
| 2142 |
-
{text: 'Insert row after', onclick: cmd('mceTableInsertRowAfter'), onPostRender: postRenderCell},
|
| 2143 |
-
{text: 'Delete row', onclick: cmd('mceTableDeleteRow'), onPostRender: postRenderCell},
|
| 2144 |
-
{text: 'Row properties', onclick: cmd('mceTableRowProps'), onPostRender: postRenderCell},
|
| 2145 |
-
{text: '-'},
|
| 2146 |
-
{text: 'Cut row', onclick: cmd('mceTableCutRow'), onPostRender: postRenderCell},
|
| 2147 |
-
{text: 'Copy row', onclick: cmd('mceTableCopyRow'), onPostRender: postRenderCell},
|
| 2148 |
-
{text: 'Paste row before', onclick: cmd('mceTablePasteRowBefore'), onPostRender: postRenderCell},
|
| 2149 |
-
{text: 'Paste row after', onclick: cmd('mceTablePasteRowAfter'), onPostRender: postRenderCell}
|
| 2150 |
-
]
|
| 2151 |
-
});
|
| 2152 |
-
|
| 2153 |
-
editor.addMenuItem('column', {
|
| 2154 |
-
text: 'Column',
|
| 2155 |
-
context: 'table',
|
| 2156 |
-
menu: [
|
| 2157 |
-
{text: 'Insert column before', onclick: cmd('mceTableInsertColBefore'), onPostRender: postRenderCell},
|
| 2158 |
-
{text: 'Insert column after', onclick: cmd('mceTableInsertColAfter'), onPostRender: postRenderCell},
|
| 2159 |
-
{text: 'Delete column', onclick: cmd('mceTableDeleteCol'), onPostRender: postRenderCell}
|
| 2160 |
-
]
|
| 2161 |
-
});
|
| 2162 |
-
|
| 2163 |
-
var menuItems = [];
|
| 2164 |
-
each("inserttable tableprops deletetable | cell row column".split(' '), function(name) {
|
| 2165 |
-
if (name == '|') {
|
| 2166 |
-
menuItems.push({text: '-'});
|
| 2167 |
-
} else {
|
| 2168 |
-
menuItems.push(editor.menuItems[name]);
|
| 2169 |
-
}
|
| 2170 |
-
});
|
| 2171 |
-
|
| 2172 |
-
editor.addButton("table", {
|
| 2173 |
-
type: "menubutton",
|
| 2174 |
-
title: "Table",
|
| 2175 |
-
menu: menuItems
|
| 2176 |
-
});
|
| 2177 |
-
|
| 2178 |
-
// Select whole table is a table border is clicked
|
| 2179 |
-
if (!Env.isIE) {
|
| 2180 |
-
editor.on('click', function(e) {
|
| 2181 |
-
e = e.target;
|
| 2182 |
-
|
| 2183 |
-
if (e.nodeName === 'TABLE') {
|
| 2184 |
-
editor.selection.select(e);
|
| 2185 |
-
editor.nodeChanged();
|
| 2186 |
-
}
|
| 2187 |
-
});
|
| 2188 |
-
}
|
| 2189 |
-
|
| 2190 |
-
self.quirks = new Quirks(editor);
|
| 2191 |
-
|
| 2192 |
-
editor.on('Init', function() {
|
| 2193 |
-
winMan = editor.windowManager;
|
| 2194 |
-
self.cellSelection = new CellSelection(editor);
|
| 2195 |
-
});
|
| 2196 |
-
|
| 2197 |
-
// Register action commands
|
| 2198 |
-
each({
|
| 2199 |
-
mceTableSplitCells: function(grid) {
|
| 2200 |
-
grid.split();
|
| 2201 |
-
},
|
| 2202 |
-
|
| 2203 |
-
mceTableMergeCells: function(grid) {
|
| 2204 |
-
var rowSpan, colSpan, cell;
|
| 2205 |
-
|
| 2206 |
-
cell = editor.dom.getParent(editor.selection.getStart(), 'th,td');
|
| 2207 |
-
if (cell) {
|
| 2208 |
-
rowSpan = cell.rowSpan;
|
| 2209 |
-
colSpan = cell.colSpan;
|
| 2210 |
-
}
|
| 2211 |
-
|
| 2212 |
-
if (!editor.dom.select('td.mce-item-selected,th.mce-item-selected').length) {
|
| 2213 |
-
mergeDialog(grid, cell);
|
| 2214 |
-
} else {
|
| 2215 |
-
grid.merge();
|
| 2216 |
-
}
|
| 2217 |
-
},
|
| 2218 |
-
|
| 2219 |
-
mceTableInsertRowBefore: function(grid) {
|
| 2220 |
-
grid.insertRow(true);
|
| 2221 |
-
},
|
| 2222 |
-
|
| 2223 |
-
mceTableInsertRowAfter: function(grid) {
|
| 2224 |
-
grid.insertRow();
|
| 2225 |
-
},
|
| 2226 |
-
|
| 2227 |
-
mceTableInsertColBefore: function(grid) {
|
| 2228 |
-
grid.insertCol(true);
|
| 2229 |
-
},
|
| 2230 |
-
|
| 2231 |
-
mceTableInsertColAfter: function(grid) {
|
| 2232 |
-
grid.insertCol();
|
| 2233 |
-
},
|
| 2234 |
-
|
| 2235 |
-
mceTableDeleteCol: function(grid) {
|
| 2236 |
-
grid.deleteCols();
|
| 2237 |
-
},
|
| 2238 |
-
|
| 2239 |
-
mceTableDeleteRow: function(grid) {
|
| 2240 |
-
grid.deleteRows();
|
| 2241 |
-
},
|
| 2242 |
-
|
| 2243 |
-
mceTableCutRow: function(grid) {
|
| 2244 |
-
clipboardRows = grid.cutRows();
|
| 2245 |
-
},
|
| 2246 |
-
|
| 2247 |
-
mceTableCopyRow: function(grid) {
|
| 2248 |
-
clipboardRows = grid.copyRows();
|
| 2249 |
-
},
|
| 2250 |
-
|
| 2251 |
-
mceTablePasteRowBefore: function(grid) {
|
| 2252 |
-
grid.pasteRows(clipboardRows, true);
|
| 2253 |
-
},
|
| 2254 |
-
|
| 2255 |
-
mceTablePasteRowAfter: function(grid) {
|
| 2256 |
-
grid.pasteRows(clipboardRows);
|
| 2257 |
-
},
|
| 2258 |
-
|
| 2259 |
-
mceTableDelete: function(grid) {
|
| 2260 |
-
grid.deleteTable();
|
| 2261 |
-
}
|
| 2262 |
-
}, function(func, name) {
|
| 2263 |
-
editor.addCommand(name, function() {
|
| 2264 |
-
var grid = new TableGrid(editor);
|
| 2265 |
-
|
| 2266 |
-
if (grid) {
|
| 2267 |
-
func(grid);
|
| 2268 |
-
editor.execCommand('mceRepaint');
|
| 2269 |
-
self.cellSelection.clear();
|
| 2270 |
-
}
|
| 2271 |
-
});
|
| 2272 |
-
});
|
| 2273 |
-
|
| 2274 |
-
// Register dialog commands
|
| 2275 |
-
each({
|
| 2276 |
-
mceInsertTable: function() {
|
| 2277 |
-
tableDialog();
|
| 2278 |
-
},
|
| 2279 |
-
|
| 2280 |
-
mceTableRowProps: rowDialog,
|
| 2281 |
-
mceTableCellProps: cellDialog
|
| 2282 |
-
}, function(func, name) {
|
| 2283 |
-
editor.addCommand(name, function(ui, val) {
|
| 2284 |
-
func(val);
|
| 2285 |
-
});
|
| 2286 |
-
});
|
| 2287 |
-
}
|
| 2288 |
-
|
| 2289 |
-
PluginManager.add('table', Plugin);
|
| 2290 |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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tinymce4-table/plugin.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
!function(e,t){"use strict";function n(e,t){for(var n,o=[],i=0;i<e.length;++i){if(n=l[e[i]]||r(e[i]),!n)throw"module definition dependecy not found: "+e[i];o.push(n)}t.apply(null,o)}function o(e,o,i){if("string"!=typeof e)throw"invalid module definition, module id must be defined and be a string";if(o===t)throw"invalid module definition, dependencies must be specified";if(i===t)throw"invalid module definition, definition function must be specified";n(o,function(){l[e]=i.apply(null,arguments)})}function i(e){return!!l[e]}function r(t){for(var n=e,o=t.split(/[.\/]/),i=0;i<o.length;++i){if(!n[o[i]])return;n=n[o[i]]}return n}function a(n){for(var o=0;o<n.length;o++){for(var i=e,r=n[o],a=r.split(/[.\/]/),s=0;s<a.length-1;++s)i[a[s]]===t&&(i[a[s]]={}),i=i[a[s]];i[a[a.length-1]]=l[r]}}var l={},s="tinymce/tableplugin/TableGrid",c="tinymce/util/Tools",d="tinymce/Env",u="tinymce/tableplugin/Quirks",f="tinymce/util/VK",m="tinymce/tableplugin/CellSelection",p="tinymce/dom/TreeWalker",g="tinymce/tableplugin/Plugin",h="tinymce/PluginManager";o(s,[c,d],function(e,n){function o(e,t){return parseInt(e.getAttribute(t)||1,10)}var i=e.each;return function(r,a){function l(){var e=0;A=[],i(["thead","tbody","tfoot"],function(t){var n=I.select("> "+t+" tr",a);i(n,function(n,r){r+=e,i(I.select("> td, > th",n),function(e,n){var i,a,l,s;if(A[r])for(;A[r][n];)n++;for(l=o(e,"rowspan"),s=o(e,"colspan"),a=r;r+l>a;a++)for(A[a]||(A[a]=[]),i=n;n+s>i;i++)A[a][i]={part:t,real:a==r&&i==n,elm:e,rowspan:l,colspan:s}})}),e+=n.length})}function s(e,t){return e=e.cloneNode(t),e.removeAttribute("id"),e}function c(e,t){var n;return n=A[t],n?n[e]:void 0}function d(e,t,n){e&&(n=parseInt(n,10),1===n?e.removeAttribute(t,1):e.setAttribute(t,n,1))}function u(e){return e&&(I.hasClass(e.elm,"mce-item-selected")||e==M)}function f(){var e=[];return i(a.rows,function(t){i(t.cells,function(n){return I.hasClass(n,"mce-item-selected")||M&&n==M.elm?(e.push(t),!1):void 0})}),e}function m(){var e=I.createRng();e.setStartAfter(a),e.setEndAfter(a),E.setRng(e),I.remove(a)}function p(t){var o,a={};return r.settings.table_clone_elements!==!1&&(a=e.makeMap((r.settings.table_clone_elements||"strong em b i span font h1 h2 h3 h4 h5 h6 p div").toUpperCase(),/[ ,]/)),e.walk(t,function(e){var r;return 3==e.nodeType?(i(I.getParents(e.parentNode,null,t).reverse(),function(e){a[e.nodeName]&&(e=s(e,!1),o?r&&r.appendChild(e):o=r=e,r=e)}),r&&(r.innerHTML=n.ie?" ":'<br data-mce-bogus="1" />'),!1):void 0},"childNodes"),t=s(t,!1),d(t,"rowSpan",1),d(t,"colSpan",1),o?t.appendChild(o):n.ie||(t.innerHTML='<br data-mce-bogus="1" />'),t}function g(){var e=I.createRng(),t;return i(I.select("tr",a),function(e){0===e.cells.length&&I.remove(e)}),0===I.select("tr",a).length?(e.setStartBefore(a),e.setEndBefore(a),E.setRng(e),void I.remove(a)):(i(I.select("thead,tbody,tfoot",a),function(e){0===e.rows.length&&I.remove(e)}),l(),void(B&&(t=A[Math.min(A.length-1,B.y)],t&&(E.select(t[Math.min(t.length-1,B.x)].elm,!0),E.collapse(!0)))))}function h(e,t,n,o){var i,r,a,l,s;for(i=A[t][e].elm.parentNode,a=1;n>=a;a++)if(i=I.getNext(i,"tr")){for(r=e;r>=0;r--)if(s=A[t+a][r].elm,s.parentNode==i){for(l=1;o>=l;l++)I.insertAfter(p(s),s);break}if(-1==r)for(l=1;o>=l;l++)i.insertBefore(p(i.cells[0]),i.cells[0])}}function b(){i(A,function(e,t){i(e,function(e,n){var i,r,a;if(u(e)&&(e=e.elm,i=o(e,"colspan"),r=o(e,"rowspan"),i>1||r>1)){for(d(e,"rowSpan",1),d(e,"colSpan",1),a=0;i-1>a;a++)I.insertAfter(p(e),e);h(n,t,r-1,i)}})})}function v(t,n,o){var r,a,s,f,m,p,h,v,y,w,x;if(t?(r=T(t),a=r.x,s=r.y,f=a+(n-1),m=s+(o-1)):(B=D=null,i(A,function(e,t){i(e,function(e,n){u(e)&&(B||(B={x:n,y:t}),D={x:n,y:t})})}),B&&(a=B.x,s=B.y,f=D.x,m=D.y)),v=c(a,s),y=c(f,m),v&&y&&v.part==y.part){for(b(),l(),v=c(a,s).elm,d(v,"colSpan",f-a+1),d(v,"rowSpan",m-s+1),h=s;m>=h;h++)for(p=a;f>=p;p++)A[h]&&A[h][p]&&(t=A[h][p].elm,t!=v&&(w=e.grep(t.childNodes),i(w,function(e){v.appendChild(e)}),w.length&&(w=e.grep(v.childNodes),x=0,i(w,function(e){"BR"==e.nodeName&&I.getAttrib(e,"data-mce-bogus")&&x++<w.length-1&&v.removeChild(e)})),I.remove(t)));g()}}function y(e){var n,r,a,l,c,f,m,g,h;if(i(A,function(t,o){return i(t,function(t){return u(t)&&(t=t.elm,c=t.parentNode,f=s(c,!1),n=o,e)?!1:void 0}),e?!n:void 0}),n!==t){for(l=0;l<A[0].length;l++)if(A[n][l]&&(r=A[n][l].elm,r!=a)){if(e){if(n>0&&A[n-1][l]&&(g=A[n-1][l].elm,h=o(g,"rowSpan"),h>1)){d(g,"rowSpan",h+1);continue}}else if(h=o(r,"rowspan"),h>1){d(r,"rowSpan",h+1);continue}m=p(r),d(m,"colSpan",r.colSpan),f.appendChild(m),a=r}f.hasChildNodes()&&(e?c.parentNode.insertBefore(f,c):I.insertAfter(f,c))}}function w(e){var t,n;i(A,function(n){return i(n,function(n,o){return u(n)&&(t=o,e)?!1:void 0}),e?!t:void 0}),i(A,function(i,r){var a,l,s;i[t]&&(a=i[t].elm,a!=n&&(s=o(a,"colspan"),l=o(a,"rowspan"),1==s?e?(a.parentNode.insertBefore(p(a),a),h(t,r,l-1,s)):(I.insertAfter(p(a),a),h(t,r,l-1,s)):d(a,"colSpan",a.colSpan+1),n=a))})}function x(){var t=[];i(A,function(n){i(n,function(n,r){u(n)&&-1===e.inArray(t,r)&&(i(A,function(e){var t=e[r].elm,n;n=o(t,"colSpan"),n>1?d(t,"colSpan",n-1):I.remove(t)}),t.push(r))})}),g()}function C(){function e(e){var t,n,r;t=I.getNext(e,"tr"),i(e.cells,function(e){var t=o(e,"rowSpan");t>1&&(d(e,"rowSpan",t-1),n=T(e),h(n.x,n.y,1,1))}),n=T(e.cells[0]),i(A[n.y],function(e){var t;e=e.elm,e!=r&&(t=o(e,"rowSpan"),1>=t?I.remove(e):d(e,"rowSpan",t-1),r=e)})}var t;t=f(),i(t.reverse(),function(t){e(t)}),g()}function P(){var e=f();return I.remove(e),g(),e}function R(){var e=f();return i(e,function(t,n){e[n]=s(t,!0)}),e}function S(e,t){var n=f(),o=n[t?0:n.length-1],r=o.cells.length;e&&(i(A,function(e){var t;return r=0,i(e,function(e){e.real&&(r+=e.colspan),e.elm.parentNode==o&&(t=1)}),t?!1:void 0}),t||e.reverse(),i(e,function(e){var n,i=e.cells.length,a;for(n=0;i>n;n++)a=e.cells[n],d(a,"colSpan",1),d(a,"rowSpan",1);for(n=i;r>n;n++)e.appendChild(p(e.cells[i-1]));for(n=r;i>n;n++)I.remove(e.cells[n]);t?o.parentNode.insertBefore(e,o):I.insertAfter(e,o)}),I.removeClass(I.select("td.mce-item-selected,th.mce-item-selected"),"mce-item-selected"))}function T(e){var t;return i(A,function(n,o){return i(n,function(n,i){return n.elm==e?(t={x:i,y:o},!1):void 0}),!t}),t}function k(e){B=T(e)}function N(){var e,t;return e=t=0,i(A,function(n,o){i(n,function(n,i){var r,a;u(n)&&(n=A[o][i],i>e&&(e=i),o>t&&(t=o),n.real&&(r=n.colspan-1,a=n.rowspan-1,r&&i+r>e&&(e=i+r),a&&o+a>t&&(t=o+a)))})}),{x:e,y:t}}function _(e){var t,n,o,i,r,a,l,s,c,d;if(D=T(e),B&&D){for(t=Math.min(B.x,D.x),n=Math.min(B.y,D.y),o=Math.max(B.x,D.x),i=Math.max(B.y,D.y),r=o,a=i,d=n;a>=d;d++)e=A[d][t],e.real||t-(e.colspan-1)<t&&(t-=e.colspan-1);for(c=t;r>=c;c++)e=A[n][c],e.real||n-(e.rowspan-1)<n&&(n-=e.rowspan-1);for(d=n;i>=d;d++)for(c=t;o>=c;c++)e=A[d][c],e.real&&(l=e.colspan-1,s=e.rowspan-1,l&&c+l>r&&(r=c+l),s&&d+s>a&&(a=d+s));for(I.removeClass(I.select("td.mce-item-selected,th.mce-item-selected"),"mce-item-selected"),d=n;a>=d;d++)for(c=t;r>=c;c++)A[d][c]&&I.addClass(A[d][c].elm,"mce-item-selected")}}var A,B,D,M,E=r.selection,I=E.dom;a=a||I.getParent(E.getStart(),"table"),l(),M=I.getParent(E.getStart(),"th,td"),M&&(B=T(M),D=N(),M=c(B.x,B.y)),e.extend(this,{deleteTable:m,split:b,merge:v,insertRow:y,insertCol:w,deleteCols:x,deleteRows:C,cutRows:P,copyRows:R,pasteRows:S,getPos:T,setStartCell:k,setEndCell:_})}}),o(u,[f,d,c],function(e,t,n){function o(e,t){return parseInt(e.getAttribute(t)||1,10)}var i=n.each;return function(n){function r(){function t(t){function r(e,o){var i=e?"previousSibling":"nextSibling",r=n.dom.getParent(o,"tr"),l=r[i];if(l)return h(n,o,l,e),t.preventDefault(),!0;var d=n.dom.getParent(r,"table"),u=r.parentNode,f=u.nodeName.toLowerCase();if("tbody"===f||f===(e?"tfoot":"thead")){var m=a(e,d,u,"tbody");if(null!==m)return s(e,m,o)}return c(e,r,i,d)}function a(e,t,o,i){var r=n.dom.select(">"+i,t),a=r.indexOf(o);if(e&&0===a||!e&&a===r.length-1)return l(e,t);if(-1===a){var s="thead"===o.tagName.toLowerCase()?0:r.length-1;return r[s]}return r[a+(e?-1:1)]}function l(e,t){var o=e?"thead":"tfoot",i=n.dom.select(">"+o,t);return 0!==i.length?i[0]:null}function s(e,o,i){var r=d(o,e);return r&&h(n,i,r,e),t.preventDefault(),!0}function c(e,o,i,a){var l=a[i];if(l)return u(l),!0;var s=n.dom.getParent(a,"td,th");if(s)return r(e,s,t);var c=d(o,!e);return u(c),t.preventDefault(),!1}function d(e,t){var o=e&&e[t?"lastChild":"firstChild"];return o&&"BR"===o.nodeName?n.dom.getParent(o,"td,th"):o}function u(e){n.selection.setCursorLocation(e,0)}function f(){return y==e.UP||y==e.DOWN}function m(e){var t=e.selection.getNode(),n=e.dom.getParent(t,"tr");return null!==n}function p(e){for(var t=0,n=e;n.previousSibling;)n=n.previousSibling,t+=o(n,"colspan");return t}function g(e,t){var n=0,r=0;return i(e.children,function(e,i){return n+=o(e,"colspan"),r=i,n>t?!1:void 0}),r}function h(e,t,o,i){var r=p(n.dom.getParent(t,"td,th")),a=g(o,r),l=o.childNodes[a],s=d(l,i);u(s||l)}function b(e){var t=n.selection.getNode(),o=n.dom.getParent(t,"td,th"),i=n.dom.getParent(e,"td,th");return o&&o!==i&&v(o,i)}function v(e,t){return n.dom.getParent(e,"TABLE")===n.dom.getParent(t,"TABLE")}var y=t.keyCode;if(f()&&m(n)){var w=n.selection.getNode();setTimeout(function(){b(w)&&r(!t.shiftKey&&y===e.UP,w,t)},0)}}n.on("KeyDown",function(e){t(e)})}function a(){function e(e,t){var n=t.ownerDocument,o=n.createRange(),i;return o.setStartBefore(t),o.setEnd(e.endContainer,e.endOffset),i=n.createElement("body"),i.appendChild(o.cloneContents()),0===i.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi,"-").replace(/<[^>]+>/g,"").length}n.on("KeyDown",function(t){var o,i,r=n.dom;(37==t.keyCode||38==t.keyCode)&&(o=n.selection.getRng(),i=r.getParent(o.startContainer,"table"),i&&n.getBody().firstChild==i&&e(o,i)&&(o=r.createRng(),o.setStartBefore(i),o.setEndBefore(i),n.selection.setRng(o),t.preventDefault()))})}function l(){n.on("KeyDown SetContent VisualAid",function(){var e;for(e=n.getBody().lastChild;e;e=e.previousSibling)if(3==e.nodeType){if(e.nodeValue.length>0)break}else if(1==e.nodeType&&!e.getAttribute("data-mce-bogus"))break;e&&"TABLE"==e.nodeName&&(n.settings.forced_root_block?n.dom.add(n.getBody(),n.settings.forced_root_block,n.settings.forced_root_block_attrs,t.ie&&t.ie<11?" ":'<br data-mce-bogus="1" />'):n.dom.add(n.getBody(),"br",{"data-mce-bogus":"1"}))}),n.on("PreProcess",function(e){var t=e.node.lastChild;t&&("BR"==t.nodeName||1==t.childNodes.length&&("BR"==t.firstChild.nodeName||"\xa0"==t.firstChild.nodeValue))&&t.previousSibling&&"TABLE"==t.previousSibling.nodeName&&n.dom.remove(t)})}function s(){function e(e,t,n,o){var i=3,r=e.dom.getParent(t.startContainer,"TABLE"),a,l,s;return r&&(a=r.parentNode),l=t.startContainer.nodeType==i&&0===t.startOffset&&0===t.endOffset&&o&&("TR"==n.nodeName||n==a),s=("TD"==n.nodeName||"TH"==n.nodeName)&&!o,l||s}function t(){var t=n.selection.getRng(),o=n.selection.getNode(),i=n.dom.getParent(t.startContainer,"TD,TH");if(e(n,t,o,i)){i||(i=o);for(var r=i.lastChild;r.lastChild;)r=r.lastChild;t.setEnd(r,r.nodeValue.length),n.selection.setRng(t)}}n.on("KeyDown",function(){t()}),n.on("MouseDown",function(e){2!=e.button&&t()})}function c(){n.on("keydown",function(t){if((t.keyCode==e.DELETE||t.keyCode==e.BACKSPACE)&&!t.isDefaultPrevented()){var o=n.dom.getParent(n.selection.getStart(),"table");if(o){for(var i=n.dom.select("td,th",o),r=i.length;r--;)if(!n.dom.hasClass(i[r],"mce-item-selected"))return;t.preventDefault(),n.execCommand("mceTableDelete")}}})}c(),t.webkit&&(r(),s()),t.gecko&&(a(),l()),t.ie>10&&(a(),l())}}),o(m,[s,p,c],function(e,t,n){return function(o){function i(){o.getBody().style.webkitUserSelect="",d&&(o.dom.removeClass(o.dom.select("td.mce-item-selected,th.mce-item-selected"),"mce-item-selected"),d=!1)}function r(t){var n,i,r=t.target;if(s&&(l||r!=s)&&("TD"==r.nodeName||"TH"==r.nodeName)){i=a.getParent(r,"table"),i==c&&(l||(l=new e(o,i),l.setStartCell(s),o.getBody().style.webkitUserSelect="none"),l.setEndCell(r),d=!0),n=o.selection.getSel();try{n.removeAllRanges?n.removeAllRanges():n.empty()}catch(u){}t.preventDefault()}}var a=o.dom,l,s,c,d=!0;return o.on("MouseDown",function(e){2!=e.button&&(i(),s=a.getParent(e.target,"td,th"),c=a.getParent(s,"table"))}),o.on("mouseover",r),o.on("remove",function(){a.unbind(o.getDoc(),"mouseover",r)}),o.on("MouseUp",function(){function e(e,o){var r=new t(e,e);do{if(3==e.nodeType&&0!==n.trim(e.nodeValue).length)return void(o?i.setStart(e,0):i.setEnd(e,e.nodeValue.length));if("BR"==e.nodeName)return void(o?i.setStartBefore(e):i.setEndBefore(e))}while(e=o?r.next():r.prev())}var i,r=o.selection,d,u,f,m,p;if(s){if(l&&(o.getBody().style.webkitUserSelect=""),d=a.select("td.mce-item-selected,th.mce-item-selected"),d.length>0){i=a.createRng(),f=d[0],p=d[d.length-1],i.setStartBefore(f),i.setEndAfter(f),e(f,1),u=new t(f,a.getParent(d[0],"table"));do if("TD"==f.nodeName||"TH"==f.nodeName){if(!a.hasClass(f,"mce-item-selected"))break;m=f}while(f=u.next());e(m),r.setRng(i)}o.nodeChanged(),s=l=c=null}}),o.on("KeyUp",function(){i()}),{clear:i}}}),o(g,[s,u,m,c,p,d,h],function(e,t,n,o,i,r,a){function l(o){function i(e){return e?e.replace(/px$/,""):""}function a(e){return/^[0-9]+$/.test(e)&&(e+="px"),e}function l(e){s("left center right".split(" "),function(t){o.formatter.remove("align"+t,{},e)})}function c(){var e=o.dom,t,n,c,d;t=e.getParent(o.selection.getStart(),"table"),d={width:i(e.getStyle(t,"width")||e.getAttrib(t,"width")),height:i(e.getStyle(t,"height")||e.getAttrib(t,"height")),cellspacing:t?e.getAttrib(t,"cellspacing"):"",cellpadding:t?e.getAttrib(t,"cellpadding"):"",border:t?e.getAttrib(t,"border"):"",caption:!!e.select("caption",t)[0]},s("left center right".split(" "),function(e){o.formatter.matchNode(t,"align"+e)&&(d.align=e)}),t||(n={label:"Cols",name:"cols"},c={label:"Rows",name:"rows"}),o.windowManager.open({title:"Table properties",items:{type:"form",layout:"grid",columns:2,data:d,defaults:{type:"textbox",maxWidth:50},items:[n,c,{label:"Width",name:"width"},{label:"Height",name:"height"},{label:"Cell spacing",name:"cellspacing"},{label:"Cell padding",name:"cellpadding"},{label:"Border",name:"border"},{label:"Caption",name:"caption",type:"checkbox"},{label:"Alignment",minWidth:90,name:"align",type:"listbox",text:"None",maxWidth:null,values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]}]},onsubmit:function(){var n=this.toJSON(),i;o.undoManager.transact(function(){t||(t=p(n.cols||1,n.rows||1)),o.dom.setAttribs(t,{cellspacing:n.cellspacing,cellpadding:n.cellpadding,border:n.border}),o.dom.setStyles(t,{width:a(n.width),height:a(n.height)}),i=e.select("caption",t)[0],i&&!n.caption&&e.remove(i),!i&&n.caption&&(i=e.create("caption"),i.innerHTML=r.ie?"\xa0":'<br data-mce-bogus="1"/>',t.insertBefore(i,t.firstChild)),l(t),n.align&&o.formatter.apply("align"+n.align,{},t),o.focus(),o.addVisual()})}})}function d(e,t){o.windowManager.open({title:"Merge cells",body:[{label:"Cols",name:"cols",type:"textbox",size:10},{label:"Rows",name:"rows",type:"textbox",size:10}],onsubmit:function(){var n=this.toJSON();o.undoManager.transact(function(){e.merge(t,n.cols,n.rows)})}})}function u(){var e=o.dom,t,n,r=[];r=o.dom.select("td.mce-item-selected,th.mce-item-selected"),t=o.dom.getParent(o.selection.getStart(),"td,th"),!r.length&&t&&r.push(t),t=t||r[0],t&&(n={width:i(e.getStyle(t,"width")||e.getAttrib(t,"width")),height:i(e.getStyle(t,"height")||e.getAttrib(t,"height")),scope:e.getAttrib(t,"scope")},n.type=t.nodeName.toLowerCase(),s("left center right".split(" "),function(e){o.formatter.matchNode(t,"align"+e)&&(n.align=e)}),o.windowManager.open({title:"Cell properties",items:{type:"form",data:n,layout:"grid",columns:2,defaults:{type:"textbox",maxWidth:50},items:[{label:"Width",name:"width"},{label:"Height",name:"height"},{label:"Cell type",name:"type",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"Cell",value:"td"},{text:"Header cell",value:"th"}]},{label:"Scope",name:"scope",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Row",value:"row"},{text:"Column",value:"col"},{text:"Row group",value:"rowgroup"},{text:"Column group",value:"colgroup"}]},{label:"Alignment",name:"align",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]}]},onsubmit:function(){var t=this.toJSON();o.undoManager.transact(function(){s(r,function(n){o.dom.setAttrib(n,"scope",t.scope),o.dom.setStyles(n,{width:a(t.width),height:a(t.height)}),t.type&&n.nodeName.toLowerCase()!=t.type&&(n=e.rename(n,t.type)),l(n),t.align&&o.formatter.apply("align"+t.align,{},n)}),o.focus()})}}))}function f(){var e=o.dom,t,n,r,c,d=[];t=o.dom.getParent(o.selection.getStart(),"table"),n=o.dom.getParent(o.selection.getStart(),"td,th"),s(t.rows,function(t){s(t.cells,function(o){return e.hasClass(o,"mce-item-selected")||o==n?(d.push(t),!1):void 0})}),r=d[0],r&&(c={height:i(e.getStyle(r,"height")||e.getAttrib(r,"height")),scope:e.getAttrib(r,"scope")},c.type=r.parentNode.nodeName.toLowerCase(),s("left center right".split(" "),function(e){o.formatter.matchNode(r,"align"+e)&&(c.align=e)}),o.windowManager.open({title:"Row properties",items:{type:"form",data:c,columns:2,defaults:{type:"textbox"},items:[{type:"listbox",name:"type",label:"Row type",text:"None",maxWidth:null,values:[{text:"Header",value:"thead"},{text:"Body",value:"tbody"},{text:"Footer",value:"tfoot"}]},{type:"listbox",name:"align",label:"Alignment",text:"None",maxWidth:null,values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"Height",name:"height"}]},onsubmit:function(){var t=this.toJSON(),n,i,r;o.undoManager.transact(function(){var c=t.type;s(d,function(s){o.dom.setAttrib(s,"scope",t.scope),o.dom.setStyles(s,{height:a(t.height)}),c!=s.parentNode.nodeName.toLowerCase()&&(n=e.getParent(s,"table"),i=s.parentNode,r=e.select(c,n)[0],r||(r=e.create(c),n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r)),r.appendChild(s),i.hasChildNodes()||e.remove(i)),l(s),t.align&&o.formatter.apply("align"+t.align,{},s)}),o.focus()})}}))}function m(e){return function(){o.execCommand(e)}}function p(e,t){var n,i,a;for(a='<table id="__mce"><tbody>',n=0;t>n;n++){for(a+="<tr>",i=0;e>i;i++)a+="<td>"+(r.ie?" ":"<br>")+"</td>";a+="</tr>"}a+="</tbody></table>",o.insertContent(a);var l=o.dom.get("__mce");return o.dom.setAttrib(l,"id",null),l}function g(e,t){function n(){e.disabled(!o.dom.getParent(o.selection.getStart(),t)),o.selection.selectorChanged(t,function(t){e.disabled(!t)})}o.initialized?n():o.on("init",n)}function h(){g(this,"table")}function b(){g(this,"td,th")}function v(){var e="";e='<table role="grid" class="mce-grid mce-grid-border" aria-readonly="true">';for(var t=0;10>t;t++){e+="<tr>";for(var n=0;10>n;n++)e+='<td role="gridcell" tabindex="-1"><a id="mcegrid'+(10*t+n)+'" href="#" data-mce-x="'+n+'" data-mce-y="'+t+'" '+(n+t===0?' class="mce-active"':"")+"></a></td>";e+="</tr>"}return e+="</table>",e+='<div class="mce-text-center" role="presentation">1 x 1</div>'}function y(e,t,n){var i=n.getEl().getElementsByTagName("table")[0],r=n.parent().rel,a,l,s,c;if(n.isRtl()||"tl-tr"==r){for(l=9;l>=0;l--)for(a=0;10>a;a++)c=i.rows[l].childNodes[a].firstChild,o.dom.toggleClass(c,"mce-active",a>=e&&t>=l),a>=e&&t>=l&&(s=c);e=9-e,i.nextSibling.innerHTML=e+" x "+(t+1)}else{for(l=0;10>l;l++)for(a=0;10>a;a++)c=i.rows[l].childNodes[a].firstChild,o.dom.toggleClass(c,"mce-active",e>=a&&t>=l),e>=a&&t>=l&&(s=c);i.nextSibling.innerHTML=e+1+" x "+(t+1)}return s.parentNode}var w,x,C=this;o.settings.table_grid===!1?o.addMenuItem("inserttable",{text:"Insert table",icon:"table",context:"table",onclick:c}):o.addMenuItem("inserttable",{text:"Insert table",icon:"table",context:"table",ariaHideMenu:!0,onclick:function(e){e.aria&&(this.parent().hideAll(),e.stopImmediatePropagation(),c())},onhide:function(){var e=this.menu.items()[0].getEl().getElementsByTagName("a");o.dom.removeClass(e,"mce-active"),o.dom.addClass(e[0],"mce-active")},menu:[{type:"container",html:v(),onPostRender:function(){this.lastX=this.lastY=0},onmousemove:function(e){var t=e.target,n,o;"A"==t.tagName.toUpperCase()&&(n=parseInt(t.getAttribute("data-mce-x"),10),o=parseInt(t.getAttribute("data-mce-y"),10),(n!==this.lastX||o!==this.lastY)&&(y(n,o,e.control),this.lastX=n,this.lastY=o))},onkeydown:function(e){var t=this.lastX,n=this.lastY,o;switch(e.keyCode){case 37:t>0&&(t--,o=!0);break;case 39:o=!0,9>t&&t++;break;case 38:o=!0,n>0&&n--;break;case 40:o=!0,9>n&&n++}o&&(e.preventDefault(),e.stopPropagation(),y(t,n,e.control).focus(),this.lastX=t,this.lastY=n)},onclick:function(e){"A"==e.target.tagName.toUpperCase()&&(e.preventDefault(),e.stopPropagation(),this.parent().cancel(),p(this.lastX+1,this.lastY+1))}}]}),o.addMenuItem("tableprops",{text:"Table properties",context:"table",onPostRender:h,onclick:c}),o.addMenuItem("deletetable",{text:"Delete table",context:"table",onPostRender:h,cmd:"mceTableDelete"}),o.addMenuItem("cell",{separator:"before",text:"Cell",context:"table",menu:[{text:"Cell properties",onclick:m("mceTableCellProps"),onPostRender:b},{text:"Merge cells",onclick:m("mceTableMergeCells"),onPostRender:b},{text:"Split cell",onclick:m("mceTableSplitCells"),onPostRender:b}]}),o.addMenuItem("row",{text:"Row",context:"table",menu:[{text:"Insert row before",onclick:m("mceTableInsertRowBefore"),onPostRender:b},{text:"Insert row after",onclick:m("mceTableInsertRowAfter"),onPostRender:b},{text:"Delete row",onclick:m("mceTableDeleteRow"),onPostRender:b},{text:"Row properties",onclick:m("mceTableRowProps"),onPostRender:b},{text:"-"},{text:"Cut row",onclick:m("mceTableCutRow"),onPostRender:b},{text:"Copy row",onclick:m("mceTableCopyRow"),onPostRender:b},{text:"Paste row before",onclick:m("mceTablePasteRowBefore"),onPostRender:b},{text:"Paste row after",onclick:m("mceTablePasteRowAfter"),onPostRender:b}]}),o.addMenuItem("column",{text:"Column",context:"table",menu:[{text:"Insert column before",onclick:m("mceTableInsertColBefore"),onPostRender:b},{text:"Insert column after",onclick:m("mceTableInsertColAfter"),onPostRender:b},{text:"Delete column",onclick:m("mceTableDeleteCol"),onPostRender:b}]});var P=[];s("inserttable tableprops deletetable | cell row column".split(" "),function(e){P.push("|"==e?{text:"-"}:o.menuItems[e])}),o.addButton("table",{type:"menubutton",title:"Table",menu:P}),r.isIE||o.on("click",function(e){e=e.target,"TABLE"===e.nodeName&&(o.selection.select(e),o.nodeChanged())}),C.quirks=new t(o),o.on("Init",function(){w=o.windowManager,C.cellSelection=new n(o)}),s({mceTableSplitCells:function(e){e.split()},mceTableMergeCells:function(e){var t,n,i;i=o.dom.getParent(o.selection.getStart(),"th,td"),i&&(t=i.rowSpan,n=i.colSpan),o.dom.select("td.mce-item-selected,th.mce-item-selected").length?e.merge():d(e,i)},mceTableInsertRowBefore:function(e){e.insertRow(!0)},mceTableInsertRowAfter:function(e){e.insertRow()},mceTableInsertColBefore:function(e){e.insertCol(!0)},mceTableInsertColAfter:function(e){e.insertCol()},mceTableDeleteCol:function(e){e.deleteCols()},mceTableDeleteRow:function(e){e.deleteRows()},mceTableCutRow:function(e){x=e.cutRows()},mceTableCopyRow:function(e){x=e.copyRows()},mceTablePasteRowBefore:function(e){e.pasteRows(x,!0)},mceTablePasteRowAfter:function(e){e.pasteRows(x)},mceTableDelete:function(e){e.deleteTable()}},function(t,n){o.addCommand(n,function(){var n=new e(o);n&&(t(n),o.execCommand("mceRepaint"),C.cellSelection.clear())})}),s({mceInsertTable:function(){c()},mceTableRowProps:f,mceTableCellProps:u},function(e,t){o.addCommand(t,function(t,n){e(n)})})}var s=o.each;a.add("table",l)}),a([s,u,m,g])}(this);
|
|
|
tinymce47-table/plugin.js
ADDED
|
@@ -0,0 +1,10450 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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1 |
+
(function () {
|
| 2 |
+
var table = (function () {
|
| 3 |
+
'use strict';
|
| 4 |
+
|
| 5 |
+
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
| 6 |
+
|
| 7 |
+
var noop = function () {
|
| 8 |
+
var x = [];
|
| 9 |
+
for (var _i = 0; _i < arguments.length; _i++) {
|
| 10 |
+
x[_i] = arguments[_i];
|
| 11 |
+
}
|
| 12 |
+
};
|
| 13 |
+
var noarg = function (f) {
|
| 14 |
+
return function () {
|
| 15 |
+
var x = [];
|
| 16 |
+
for (var _i = 0; _i < arguments.length; _i++) {
|
| 17 |
+
x[_i] = arguments[_i];
|
| 18 |
+
}
|
| 19 |
+
return f();
|
| 20 |
+
};
|
| 21 |
+
};
|
| 22 |
+
var compose = function (fa, fb) {
|
| 23 |
+
return function () {
|
| 24 |
+
var x = [];
|
| 25 |
+
for (var _i = 0; _i < arguments.length; _i++) {
|
| 26 |
+
x[_i] = arguments[_i];
|
| 27 |
+
}
|
| 28 |
+
return fa(fb.apply(null, arguments));
|
| 29 |
+
};
|
| 30 |
+
};
|
| 31 |
+
var constant = function (value) {
|
| 32 |
+
return function () {
|
| 33 |
+
return value;
|
| 34 |
+
};
|
| 35 |
+
};
|
| 36 |
+
var identity = function (x) {
|
| 37 |
+
return x;
|
| 38 |
+
};
|
| 39 |
+
var tripleEquals = function (a, b) {
|
| 40 |
+
return a === b;
|
| 41 |
+
};
|
| 42 |
+
var curry = function (f) {
|
| 43 |
+
var x = [];
|
| 44 |
+
for (var _i = 1; _i < arguments.length; _i++) {
|
| 45 |
+
x[_i - 1] = arguments[_i];
|
| 46 |
+
}
|
| 47 |
+
var args = new Array(arguments.length - 1);
|
| 48 |
+
for (var i = 1; i < arguments.length; i++)
|
| 49 |
+
args[i - 1] = arguments[i];
|
| 50 |
+
return function () {
|
| 51 |
+
var x = [];
|
| 52 |
+
for (var _i = 0; _i < arguments.length; _i++) {
|
| 53 |
+
x[_i] = arguments[_i];
|
| 54 |
+
}
|
| 55 |
+
var newArgs = new Array(arguments.length);
|
| 56 |
+
for (var j = 0; j < newArgs.length; j++)
|
| 57 |
+
newArgs[j] = arguments[j];
|
| 58 |
+
var all = args.concat(newArgs);
|
| 59 |
+
return f.apply(null, all);
|
| 60 |
+
};
|
| 61 |
+
};
|
| 62 |
+
var not = function (f) {
|
| 63 |
+
return function () {
|
| 64 |
+
var x = [];
|
| 65 |
+
for (var _i = 0; _i < arguments.length; _i++) {
|
| 66 |
+
x[_i] = arguments[_i];
|
| 67 |
+
}
|
| 68 |
+
return !f.apply(null, arguments);
|
| 69 |
+
};
|
| 70 |
+
};
|
| 71 |
+
var die = function (msg) {
|
| 72 |
+
return function () {
|
| 73 |
+
throw new Error(msg);
|
| 74 |
+
};
|
| 75 |
+
};
|
| 76 |
+
var apply = function (f) {
|
| 77 |
+
return f();
|
| 78 |
+
};
|
| 79 |
+
var call = function (f) {
|
| 80 |
+
f();
|
| 81 |
+
};
|
| 82 |
+
var never = constant(false);
|
| 83 |
+
var always = constant(true);
|
| 84 |
+
var $_20nfr6k7jfuw8q4g = {
|
| 85 |
+
noop: noop,
|
| 86 |
+
noarg: noarg,
|
| 87 |
+
compose: compose,
|
| 88 |
+
constant: constant,
|
| 89 |
+
identity: identity,
|
| 90 |
+
tripleEquals: tripleEquals,
|
| 91 |
+
curry: curry,
|
| 92 |
+
not: not,
|
| 93 |
+
die: die,
|
| 94 |
+
apply: apply,
|
| 95 |
+
call: call,
|
| 96 |
+
never: never,
|
| 97 |
+
always: always
|
| 98 |
+
};
|
| 99 |
+
|
| 100 |
+
var never$1 = $_20nfr6k7jfuw8q4g.never;
|
| 101 |
+
var always$1 = $_20nfr6k7jfuw8q4g.always;
|
| 102 |
+
var none = function () {
|
| 103 |
+
return NONE;
|
| 104 |
+
};
|
| 105 |
+
var NONE = function () {
|
| 106 |
+
var eq = function (o) {
|
| 107 |
+
return o.isNone();
|
| 108 |
+
};
|
| 109 |
+
var call = function (thunk) {
|
| 110 |
+
return thunk();
|
| 111 |
+
};
|
| 112 |
+
var id = function (n) {
|
| 113 |
+
return n;
|
| 114 |
+
};
|
| 115 |
+
var noop = function () {
|
| 116 |
+
};
|
| 117 |
+
var me = {
|
| 118 |
+
fold: function (n, s) {
|
| 119 |
+
return n();
|
| 120 |
+
},
|
| 121 |
+
is: never$1,
|
| 122 |
+
isSome: never$1,
|
| 123 |
+
isNone: always$1,
|
| 124 |
+
getOr: id,
|
| 125 |
+
getOrThunk: call,
|
| 126 |
+
getOrDie: function (msg) {
|
| 127 |
+
throw new Error(msg || 'error: getOrDie called on none.');
|
| 128 |
+
},
|
| 129 |
+
or: id,
|
| 130 |
+
orThunk: call,
|
| 131 |
+
map: none,
|
| 132 |
+
ap: none,
|
| 133 |
+
each: noop,
|
| 134 |
+
bind: none,
|
| 135 |
+
flatten: none,
|
| 136 |
+
exists: never$1,
|
| 137 |
+
forall: always$1,
|
| 138 |
+
filter: none,
|
| 139 |
+
equals: eq,
|
| 140 |
+
equals_: eq,
|
| 141 |
+
toArray: function () {
|
| 142 |
+
return [];
|
| 143 |
+
},
|
| 144 |
+
toString: $_20nfr6k7jfuw8q4g.constant('none()')
|
| 145 |
+
};
|
| 146 |
+
if (Object.freeze)
|
| 147 |
+
Object.freeze(me);
|
| 148 |
+
return me;
|
| 149 |
+
}();
|
| 150 |
+
var some = function (a) {
|
| 151 |
+
var constant_a = function () {
|
| 152 |
+
return a;
|
| 153 |
+
};
|
| 154 |
+
var self = function () {
|
| 155 |
+
return me;
|
| 156 |
+
};
|
| 157 |
+
var map = function (f) {
|
| 158 |
+
return some(f(a));
|
| 159 |
+
};
|
| 160 |
+
var bind = function (f) {
|
| 161 |
+
return f(a);
|
| 162 |
+
};
|
| 163 |
+
var me = {
|
| 164 |
+
fold: function (n, s) {
|
| 165 |
+
return s(a);
|
| 166 |
+
},
|
| 167 |
+
is: function (v) {
|
| 168 |
+
return a === v;
|
| 169 |
+
},
|
| 170 |
+
isSome: always$1,
|
| 171 |
+
isNone: never$1,
|
| 172 |
+
getOr: constant_a,
|
| 173 |
+
getOrThunk: constant_a,
|
| 174 |
+
getOrDie: constant_a,
|
| 175 |
+
or: self,
|
| 176 |
+
orThunk: self,
|
| 177 |
+
map: map,
|
| 178 |
+
ap: function (optfab) {
|
| 179 |
+
return optfab.fold(none, function (fab) {
|
| 180 |
+
return some(fab(a));
|
| 181 |
+
});
|
| 182 |
+
},
|
| 183 |
+
each: function (f) {
|
| 184 |
+
f(a);
|
| 185 |
+
},
|
| 186 |
+
bind: bind,
|
| 187 |
+
flatten: constant_a,
|
| 188 |
+
exists: bind,
|
| 189 |
+
forall: bind,
|
| 190 |
+
filter: function (f) {
|
| 191 |
+
return f(a) ? me : NONE;
|
| 192 |
+
},
|
| 193 |
+
equals: function (o) {
|
| 194 |
+
return o.is(a);
|
| 195 |
+
},
|
| 196 |
+
equals_: function (o, elementEq) {
|
| 197 |
+
return o.fold(never$1, function (b) {
|
| 198 |
+
return elementEq(a, b);
|
| 199 |
+
});
|
| 200 |
+
},
|
| 201 |
+
toArray: function () {
|
| 202 |
+
return [a];
|
| 203 |
+
},
|
| 204 |
+
toString: function () {
|
| 205 |
+
return 'some(' + a + ')';
|
| 206 |
+
}
|
| 207 |
+
};
|
| 208 |
+
return me;
|
| 209 |
+
};
|
| 210 |
+
var from = function (value) {
|
| 211 |
+
return value === null || value === undefined ? NONE : some(value);
|
| 212 |
+
};
|
| 213 |
+
var Option = {
|
| 214 |
+
some: some,
|
| 215 |
+
none: none,
|
| 216 |
+
from: from
|
| 217 |
+
};
|
| 218 |
+
|
| 219 |
+
var typeOf = function (x) {
|
| 220 |
+
if (x === null)
|
| 221 |
+
return 'null';
|
| 222 |
+
var t = typeof x;
|
| 223 |
+
if (t === 'object' && Array.prototype.isPrototypeOf(x))
|
| 224 |
+
return 'array';
|
| 225 |
+
if (t === 'object' && String.prototype.isPrototypeOf(x))
|
| 226 |
+
return 'string';
|
| 227 |
+
return t;
|
| 228 |
+
};
|
| 229 |
+
var isType = function (type) {
|
| 230 |
+
return function (value) {
|
| 231 |
+
return typeOf(value) === type;
|
| 232 |
+
};
|
| 233 |
+
};
|
| 234 |
+
var $_g6mvnrk8jfuw8q4k = {
|
| 235 |
+
isString: isType('string'),
|
| 236 |
+
isObject: isType('object'),
|
| 237 |
+
isArray: isType('array'),
|
| 238 |
+
isNull: isType('null'),
|
| 239 |
+
isBoolean: isType('boolean'),
|
| 240 |
+
isUndefined: isType('undefined'),
|
| 241 |
+
isFunction: isType('function'),
|
| 242 |
+
isNumber: isType('number')
|
| 243 |
+
};
|
| 244 |
+
|
| 245 |
+
var rawIndexOf = function () {
|
| 246 |
+
var pIndexOf = Array.prototype.indexOf;
|
| 247 |
+
var fastIndex = function (xs, x) {
|
| 248 |
+
return pIndexOf.call(xs, x);
|
| 249 |
+
};
|
| 250 |
+
var slowIndex = function (xs, x) {
|
| 251 |
+
return slowIndexOf(xs, x);
|
| 252 |
+
};
|
| 253 |
+
return pIndexOf === undefined ? slowIndex : fastIndex;
|
| 254 |
+
}();
|
| 255 |
+
var indexOf = function (xs, x) {
|
| 256 |
+
var r = rawIndexOf(xs, x);
|
| 257 |
+
return r === -1 ? Option.none() : Option.some(r);
|
| 258 |
+
};
|
| 259 |
+
var contains = function (xs, x) {
|
| 260 |
+
return rawIndexOf(xs, x) > -1;
|
| 261 |
+
};
|
| 262 |
+
var exists = function (xs, pred) {
|
| 263 |
+
return findIndex(xs, pred).isSome();
|
| 264 |
+
};
|
| 265 |
+
var range = function (num, f) {
|
| 266 |
+
var r = [];
|
| 267 |
+
for (var i = 0; i < num; i++) {
|
| 268 |
+
r.push(f(i));
|
| 269 |
+
}
|
| 270 |
+
return r;
|
| 271 |
+
};
|
| 272 |
+
var chunk = function (array, size) {
|
| 273 |
+
var r = [];
|
| 274 |
+
for (var i = 0; i < array.length; i += size) {
|
| 275 |
+
var s = array.slice(i, i + size);
|
| 276 |
+
r.push(s);
|
| 277 |
+
}
|
| 278 |
+
return r;
|
| 279 |
+
};
|
| 280 |
+
var map = function (xs, f) {
|
| 281 |
+
var len = xs.length;
|
| 282 |
+
var r = new Array(len);
|
| 283 |
+
for (var i = 0; i < len; i++) {
|
| 284 |
+
var x = xs[i];
|
| 285 |
+
r[i] = f(x, i, xs);
|
| 286 |
+
}
|
| 287 |
+
return r;
|
| 288 |
+
};
|
| 289 |
+
var each = function (xs, f) {
|
| 290 |
+
for (var i = 0, len = xs.length; i < len; i++) {
|
| 291 |
+
var x = xs[i];
|
| 292 |
+
f(x, i, xs);
|
| 293 |
+
}
|
| 294 |
+
};
|
| 295 |
+
var eachr = function (xs, f) {
|
| 296 |
+
for (var i = xs.length - 1; i >= 0; i--) {
|
| 297 |
+
var x = xs[i];
|
| 298 |
+
f(x, i, xs);
|
| 299 |
+
}
|
| 300 |
+
};
|
| 301 |
+
var partition = function (xs, pred) {
|
| 302 |
+
var pass = [];
|
| 303 |
+
var fail = [];
|
| 304 |
+
for (var i = 0, len = xs.length; i < len; i++) {
|
| 305 |
+
var x = xs[i];
|
| 306 |
+
var arr = pred(x, i, xs) ? pass : fail;
|
| 307 |
+
arr.push(x);
|
| 308 |
+
}
|
| 309 |
+
return {
|
| 310 |
+
pass: pass,
|
| 311 |
+
fail: fail
|
| 312 |
+
};
|
| 313 |
+
};
|
| 314 |
+
var filter = function (xs, pred) {
|
| 315 |
+
var r = [];
|
| 316 |
+
for (var i = 0, len = xs.length; i < len; i++) {
|
| 317 |
+
var x = xs[i];
|
| 318 |
+
if (pred(x, i, xs)) {
|
| 319 |
+
r.push(x);
|
| 320 |
+
}
|
| 321 |
+
}
|
| 322 |
+
return r;
|
| 323 |
+
};
|
| 324 |
+
var groupBy = function (xs, f) {
|
| 325 |
+
if (xs.length === 0) {
|
| 326 |
+
return [];
|
| 327 |
+
} else {
|
| 328 |
+
var wasType = f(xs[0]);
|
| 329 |
+
var r = [];
|
| 330 |
+
var group = [];
|
| 331 |
+
for (var i = 0, len = xs.length; i < len; i++) {
|
| 332 |
+
var x = xs[i];
|
| 333 |
+
var type = f(x);
|
| 334 |
+
if (type !== wasType) {
|
| 335 |
+
r.push(group);
|
| 336 |
+
group = [];
|
| 337 |
+
}
|
| 338 |
+
wasType = type;
|
| 339 |
+
group.push(x);
|
| 340 |
+
}
|
| 341 |
+
if (group.length !== 0) {
|
| 342 |
+
r.push(group);
|
| 343 |
+
}
|
| 344 |
+
return r;
|
| 345 |
+
}
|
| 346 |
+
};
|
| 347 |
+
var foldr = function (xs, f, acc) {
|
| 348 |
+
eachr(xs, function (x) {
|
| 349 |
+
acc = f(acc, x);
|
| 350 |
+
});
|
| 351 |
+
return acc;
|
| 352 |
+
};
|
| 353 |
+
var foldl = function (xs, f, acc) {
|
| 354 |
+
each(xs, function (x) {
|
| 355 |
+
acc = f(acc, x);
|
| 356 |
+
});
|
| 357 |
+
return acc;
|
| 358 |
+
};
|
| 359 |
+
var find = function (xs, pred) {
|
| 360 |
+
for (var i = 0, len = xs.length; i < len; i++) {
|
| 361 |
+
var x = xs[i];
|
| 362 |
+
if (pred(x, i, xs)) {
|
| 363 |
+
return Option.some(x);
|
| 364 |
+
}
|
| 365 |
+
}
|
| 366 |
+
return Option.none();
|
| 367 |
+
};
|
| 368 |
+
var findIndex = function (xs, pred) {
|
| 369 |
+
for (var i = 0, len = xs.length; i < len; i++) {
|
| 370 |
+
var x = xs[i];
|
| 371 |
+
if (pred(x, i, xs)) {
|
| 372 |
+
return Option.some(i);
|
| 373 |
+
}
|
| 374 |
+
}
|
| 375 |
+
return Option.none();
|
| 376 |
+
};
|
| 377 |
+
var slowIndexOf = function (xs, x) {
|
| 378 |
+
for (var i = 0, len = xs.length; i < len; ++i) {
|
| 379 |
+
if (xs[i] === x) {
|
| 380 |
+
return i;
|
| 381 |
+
}
|
| 382 |
+
}
|
| 383 |
+
return -1;
|
| 384 |
+
};
|
| 385 |
+
var push = Array.prototype.push;
|
| 386 |
+
var flatten = function (xs) {
|
| 387 |
+
var r = [];
|
| 388 |
+
for (var i = 0, len = xs.length; i < len; ++i) {
|
| 389 |
+
if (!Array.prototype.isPrototypeOf(xs[i]))
|
| 390 |
+
throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
|
| 391 |
+
push.apply(r, xs[i]);
|
| 392 |
+
}
|
| 393 |
+
return r;
|
| 394 |
+
};
|
| 395 |
+
var bind = function (xs, f) {
|
| 396 |
+
var output = map(xs, f);
|
| 397 |
+
return flatten(output);
|
| 398 |
+
};
|
| 399 |
+
var forall = function (xs, pred) {
|
| 400 |
+
for (var i = 0, len = xs.length; i < len; ++i) {
|
| 401 |
+
var x = xs[i];
|
| 402 |
+
if (pred(x, i, xs) !== true) {
|
| 403 |
+
return false;
|
| 404 |
+
}
|
| 405 |
+
}
|
| 406 |
+
return true;
|
| 407 |
+
};
|
| 408 |
+
var equal = function (a1, a2) {
|
| 409 |
+
return a1.length === a2.length && forall(a1, function (x, i) {
|
| 410 |
+
return x === a2[i];
|
| 411 |
+
});
|
| 412 |
+
};
|
| 413 |
+
var slice = Array.prototype.slice;
|
| 414 |
+
var reverse = function (xs) {
|
| 415 |
+
var r = slice.call(xs, 0);
|
| 416 |
+
r.reverse();
|
| 417 |
+
return r;
|
| 418 |
+
};
|
| 419 |
+
var difference = function (a1, a2) {
|
| 420 |
+
return filter(a1, function (x) {
|
| 421 |
+
return !contains(a2, x);
|
| 422 |
+
});
|
| 423 |
+
};
|
| 424 |
+
var mapToObject = function (xs, f) {
|
| 425 |
+
var r = {};
|
| 426 |
+
for (var i = 0, len = xs.length; i < len; i++) {
|
| 427 |
+
var x = xs[i];
|
| 428 |
+
r[String(x)] = f(x, i);
|
| 429 |
+
}
|
| 430 |
+
return r;
|
| 431 |
+
};
|
| 432 |
+
var pure = function (x) {
|
| 433 |
+
return [x];
|
| 434 |
+
};
|
| 435 |
+
var sort = function (xs, comparator) {
|
| 436 |
+
var copy = slice.call(xs, 0);
|
| 437 |
+
copy.sort(comparator);
|
| 438 |
+
return copy;
|
| 439 |
+
};
|
| 440 |
+
var head = function (xs) {
|
| 441 |
+
return xs.length === 0 ? Option.none() : Option.some(xs[0]);
|
| 442 |
+
};
|
| 443 |
+
var last = function (xs) {
|
| 444 |
+
return xs.length === 0 ? Option.none() : Option.some(xs[xs.length - 1]);
|
| 445 |
+
};
|
| 446 |
+
var from$1 = $_g6mvnrk8jfuw8q4k.isFunction(Array.from) ? Array.from : function (x) {
|
| 447 |
+
return slice.call(x);
|
| 448 |
+
};
|
| 449 |
+
var $_tyr3yk5jfuw8q47 = {
|
| 450 |
+
map: map,
|
| 451 |
+
each: each,
|
| 452 |
+
eachr: eachr,
|
| 453 |
+
partition: partition,
|
| 454 |
+
filter: filter,
|
| 455 |
+
groupBy: groupBy,
|
| 456 |
+
indexOf: indexOf,
|
| 457 |
+
foldr: foldr,
|
| 458 |
+
foldl: foldl,
|
| 459 |
+
find: find,
|
| 460 |
+
findIndex: findIndex,
|
| 461 |
+
flatten: flatten,
|
| 462 |
+
bind: bind,
|
| 463 |
+
forall: forall,
|
| 464 |
+
exists: exists,
|
| 465 |
+
contains: contains,
|
| 466 |
+
equal: equal,
|
| 467 |
+
reverse: reverse,
|
| 468 |
+
chunk: chunk,
|
| 469 |
+
difference: difference,
|
| 470 |
+
mapToObject: mapToObject,
|
| 471 |
+
pure: pure,
|
| 472 |
+
sort: sort,
|
| 473 |
+
range: range,
|
| 474 |
+
head: head,
|
| 475 |
+
last: last,
|
| 476 |
+
from: from$1
|
| 477 |
+
};
|
| 478 |
+
|
| 479 |
+
var keys = function () {
|
| 480 |
+
var fastKeys = Object.keys;
|
| 481 |
+
var slowKeys = function (o) {
|
| 482 |
+
var r = [];
|
| 483 |
+
for (var i in o) {
|
| 484 |
+
if (o.hasOwnProperty(i)) {
|
| 485 |
+
r.push(i);
|
| 486 |
+
}
|
| 487 |
+
}
|
| 488 |
+
return r;
|
| 489 |
+
};
|
| 490 |
+
return fastKeys === undefined ? slowKeys : fastKeys;
|
| 491 |
+
}();
|
| 492 |
+
var each$1 = function (obj, f) {
|
| 493 |
+
var props = keys(obj);
|
| 494 |
+
for (var k = 0, len = props.length; k < len; k++) {
|
| 495 |
+
var i = props[k];
|
| 496 |
+
var x = obj[i];
|
| 497 |
+
f(x, i, obj);
|
| 498 |
+
}
|
| 499 |
+
};
|
| 500 |
+
var objectMap = function (obj, f) {
|
| 501 |
+
return tupleMap(obj, function (x, i, obj) {
|
| 502 |
+
return {
|
| 503 |
+
k: i,
|
| 504 |
+
v: f(x, i, obj)
|
| 505 |
+
};
|
| 506 |
+
});
|
| 507 |
+
};
|
| 508 |
+
var tupleMap = function (obj, f) {
|
| 509 |
+
var r = {};
|
| 510 |
+
each$1(obj, function (x, i) {
|
| 511 |
+
var tuple = f(x, i, obj);
|
| 512 |
+
r[tuple.k] = tuple.v;
|
| 513 |
+
});
|
| 514 |
+
return r;
|
| 515 |
+
};
|
| 516 |
+
var bifilter = function (obj, pred) {
|
| 517 |
+
var t = {};
|
| 518 |
+
var f = {};
|
| 519 |
+
each$1(obj, function (x, i) {
|
| 520 |
+
var branch = pred(x, i) ? t : f;
|
| 521 |
+
branch[i] = x;
|
| 522 |
+
});
|
| 523 |
+
return {
|
| 524 |
+
t: t,
|
| 525 |
+
f: f
|
| 526 |
+
};
|
| 527 |
+
};
|
| 528 |
+
var mapToArray = function (obj, f) {
|
| 529 |
+
var r = [];
|
| 530 |
+
each$1(obj, function (value, name) {
|
| 531 |
+
r.push(f(value, name));
|
| 532 |
+
});
|
| 533 |
+
return r;
|
| 534 |
+
};
|
| 535 |
+
var find$1 = function (obj, pred) {
|
| 536 |
+
var props = keys(obj);
|
| 537 |
+
for (var k = 0, len = props.length; k < len; k++) {
|
| 538 |
+
var i = props[k];
|
| 539 |
+
var x = obj[i];
|
| 540 |
+
if (pred(x, i, obj)) {
|
| 541 |
+
return Option.some(x);
|
| 542 |
+
}
|
| 543 |
+
}
|
| 544 |
+
return Option.none();
|
| 545 |
+
};
|
| 546 |
+
var values = function (obj) {
|
| 547 |
+
return mapToArray(obj, function (v) {
|
| 548 |
+
return v;
|
| 549 |
+
});
|
| 550 |
+
};
|
| 551 |
+
var size = function (obj) {
|
| 552 |
+
return values(obj).length;
|
| 553 |
+
};
|
| 554 |
+
var $_11yiupkajfuw8q5c = {
|
| 555 |
+
bifilter: bifilter,
|
| 556 |
+
each: each$1,
|
| 557 |
+
map: objectMap,
|
| 558 |
+
mapToArray: mapToArray,
|
| 559 |
+
tupleMap: tupleMap,
|
| 560 |
+
find: find$1,
|
| 561 |
+
keys: keys,
|
| 562 |
+
values: values,
|
| 563 |
+
size: size
|
| 564 |
+
};
|
| 565 |
+
|
| 566 |
+
function Immutable () {
|
| 567 |
+
var fields = [];
|
| 568 |
+
for (var _i = 0; _i < arguments.length; _i++) {
|
| 569 |
+
fields[_i] = arguments[_i];
|
| 570 |
+
}
|
| 571 |
+
return function () {
|
| 572 |
+
var values = [];
|
| 573 |
+
for (var _i = 0; _i < arguments.length; _i++) {
|
| 574 |
+
values[_i] = arguments[_i];
|
| 575 |
+
}
|
| 576 |
+
if (fields.length !== values.length) {
|
| 577 |
+
throw new Error('Wrong number of arguments to struct. Expected "[' + fields.length + ']", got ' + values.length + ' arguments');
|
| 578 |
+
}
|
| 579 |
+
var struct = {};
|
| 580 |
+
$_tyr3yk5jfuw8q47.each(fields, function (name, i) {
|
| 581 |
+
struct[name] = $_20nfr6k7jfuw8q4g.constant(values[i]);
|
| 582 |
+
});
|
| 583 |
+
return struct;
|
| 584 |
+
};
|
| 585 |
+
}
|
| 586 |
+
|
| 587 |
+
var sort$1 = function (arr) {
|
| 588 |
+
return arr.slice(0).sort();
|
| 589 |
+
};
|
| 590 |
+
var reqMessage = function (required, keys) {
|
| 591 |
+
throw new Error('All required keys (' + sort$1(required).join(', ') + ') were not specified. Specified keys were: ' + sort$1(keys).join(', ') + '.');
|
| 592 |
+
};
|
| 593 |
+
var unsuppMessage = function (unsupported) {
|
| 594 |
+
throw new Error('Unsupported keys for object: ' + sort$1(unsupported).join(', '));
|
| 595 |
+
};
|
| 596 |
+
var validateStrArr = function (label, array) {
|
| 597 |
+
if (!$_g6mvnrk8jfuw8q4k.isArray(array))
|
| 598 |
+
throw new Error('The ' + label + ' fields must be an array. Was: ' + array + '.');
|
| 599 |
+
$_tyr3yk5jfuw8q47.each(array, function (a) {
|
| 600 |
+
if (!$_g6mvnrk8jfuw8q4k.isString(a))
|
| 601 |
+
throw new Error('The value ' + a + ' in the ' + label + ' fields was not a string.');
|
| 602 |
+
});
|
| 603 |
+
};
|
| 604 |
+
var invalidTypeMessage = function (incorrect, type) {
|
| 605 |
+
throw new Error('All values need to be of type: ' + type + '. Keys (' + sort$1(incorrect).join(', ') + ') were not.');
|
| 606 |
+
};
|
| 607 |
+
var checkDupes = function (everything) {
|
| 608 |
+
var sorted = sort$1(everything);
|
| 609 |
+
var dupe = $_tyr3yk5jfuw8q47.find(sorted, function (s, i) {
|
| 610 |
+
return i < sorted.length - 1 && s === sorted[i + 1];
|
| 611 |
+
});
|
| 612 |
+
dupe.each(function (d) {
|
| 613 |
+
throw new Error('The field: ' + d + ' occurs more than once in the combined fields: [' + sorted.join(', ') + '].');
|
| 614 |
+
});
|
| 615 |
+
};
|
| 616 |
+
var $_2j2nzkkejfuw8q5j = {
|
| 617 |
+
sort: sort$1,
|
| 618 |
+
reqMessage: reqMessage,
|
| 619 |
+
unsuppMessage: unsuppMessage,
|
| 620 |
+
validateStrArr: validateStrArr,
|
| 621 |
+
invalidTypeMessage: invalidTypeMessage,
|
| 622 |
+
checkDupes: checkDupes
|
| 623 |
+
};
|
| 624 |
+
|
| 625 |
+
function MixedBag (required, optional) {
|
| 626 |
+
var everything = required.concat(optional);
|
| 627 |
+
if (everything.length === 0)
|
| 628 |
+
throw new Error('You must specify at least one required or optional field.');
|
| 629 |
+
$_2j2nzkkejfuw8q5j.validateStrArr('required', required);
|
| 630 |
+
$_2j2nzkkejfuw8q5j.validateStrArr('optional', optional);
|
| 631 |
+
$_2j2nzkkejfuw8q5j.checkDupes(everything);
|
| 632 |
+
return function (obj) {
|
| 633 |
+
var keys = $_11yiupkajfuw8q5c.keys(obj);
|
| 634 |
+
var allReqd = $_tyr3yk5jfuw8q47.forall(required, function (req) {
|
| 635 |
+
return $_tyr3yk5jfuw8q47.contains(keys, req);
|
| 636 |
+
});
|
| 637 |
+
if (!allReqd)
|
| 638 |
+
$_2j2nzkkejfuw8q5j.reqMessage(required, keys);
|
| 639 |
+
var unsupported = $_tyr3yk5jfuw8q47.filter(keys, function (key) {
|
| 640 |
+
return !$_tyr3yk5jfuw8q47.contains(everything, key);
|
| 641 |
+
});
|
| 642 |
+
if (unsupported.length > 0)
|
| 643 |
+
$_2j2nzkkejfuw8q5j.unsuppMessage(unsupported);
|
| 644 |
+
var r = {};
|
| 645 |
+
$_tyr3yk5jfuw8q47.each(required, function (req) {
|
| 646 |
+
r[req] = $_20nfr6k7jfuw8q4g.constant(obj[req]);
|
| 647 |
+
});
|
| 648 |
+
$_tyr3yk5jfuw8q47.each(optional, function (opt) {
|
| 649 |
+
r[opt] = $_20nfr6k7jfuw8q4g.constant(Object.prototype.hasOwnProperty.call(obj, opt) ? Option.some(obj[opt]) : Option.none());
|
| 650 |
+
});
|
| 651 |
+
return r;
|
| 652 |
+
};
|
| 653 |
+
}
|
| 654 |
+
|
| 655 |
+
var $_5now9kbjfuw8q5e = {
|
| 656 |
+
immutable: Immutable,
|
| 657 |
+
immutableBag: MixedBag
|
| 658 |
+
};
|
| 659 |
+
|
| 660 |
+
var dimensions = $_5now9kbjfuw8q5e.immutable('width', 'height');
|
| 661 |
+
var grid = $_5now9kbjfuw8q5e.immutable('rows', 'columns');
|
| 662 |
+
var address = $_5now9kbjfuw8q5e.immutable('row', 'column');
|
| 663 |
+
var coords = $_5now9kbjfuw8q5e.immutable('x', 'y');
|
| 664 |
+
var detail = $_5now9kbjfuw8q5e.immutable('element', 'rowspan', 'colspan');
|
| 665 |
+
var detailnew = $_5now9kbjfuw8q5e.immutable('element', 'rowspan', 'colspan', 'isNew');
|
| 666 |
+
var extended = $_5now9kbjfuw8q5e.immutable('element', 'rowspan', 'colspan', 'row', 'column');
|
| 667 |
+
var rowdata = $_5now9kbjfuw8q5e.immutable('element', 'cells', 'section');
|
| 668 |
+
var elementnew = $_5now9kbjfuw8q5e.immutable('element', 'isNew');
|
| 669 |
+
var rowdatanew = $_5now9kbjfuw8q5e.immutable('element', 'cells', 'section', 'isNew');
|
| 670 |
+
var rowcells = $_5now9kbjfuw8q5e.immutable('cells', 'section');
|
| 671 |
+
var rowdetails = $_5now9kbjfuw8q5e.immutable('details', 'section');
|
| 672 |
+
var bounds = $_5now9kbjfuw8q5e.immutable('startRow', 'startCol', 'finishRow', 'finishCol');
|
| 673 |
+
var $_ce5pyrkgjfuw8q5v = {
|
| 674 |
+
dimensions: dimensions,
|
| 675 |
+
grid: grid,
|
| 676 |
+
address: address,
|
| 677 |
+
coords: coords,
|
| 678 |
+
extended: extended,
|
| 679 |
+
detail: detail,
|
| 680 |
+
detailnew: detailnew,
|
| 681 |
+
rowdata: rowdata,
|
| 682 |
+
elementnew: elementnew,
|
| 683 |
+
rowdatanew: rowdatanew,
|
| 684 |
+
rowcells: rowcells,
|
| 685 |
+
rowdetails: rowdetails,
|
| 686 |
+
bounds: bounds
|
| 687 |
+
};
|
| 688 |
+
|
| 689 |
+
var fromHtml = function (html, scope) {
|
| 690 |
+
var doc = scope || document;
|
| 691 |
+
var div = doc.createElement('div');
|
| 692 |
+
div.innerHTML = html;
|
| 693 |
+
if (!div.hasChildNodes() || div.childNodes.length > 1) {
|
| 694 |
+
console.error('HTML does not have a single root node', html);
|
| 695 |
+
throw 'HTML must have a single root node';
|
| 696 |
+
}
|
| 697 |
+
return fromDom(div.childNodes[0]);
|
| 698 |
+
};
|
| 699 |
+
var fromTag = function (tag, scope) {
|
| 700 |
+
var doc = scope || document;
|
| 701 |
+
var node = doc.createElement(tag);
|
| 702 |
+
return fromDom(node);
|
| 703 |
+
};
|
| 704 |
+
var fromText = function (text, scope) {
|
| 705 |
+
var doc = scope || document;
|
| 706 |
+
var node = doc.createTextNode(text);
|
| 707 |
+
return fromDom(node);
|
| 708 |
+
};
|
| 709 |
+
var fromDom = function (node) {
|
| 710 |
+
if (node === null || node === undefined)
|
| 711 |
+
throw new Error('Node cannot be null or undefined');
|
| 712 |
+
return { dom: $_20nfr6k7jfuw8q4g.constant(node) };
|
| 713 |
+
};
|
| 714 |
+
var fromPoint = function (doc, x, y) {
|
| 715 |
+
return Option.from(doc.dom().elementFromPoint(x, y)).map(fromDom);
|
| 716 |
+
};
|
| 717 |
+
var $_xbeoqkkjfuw8q73 = {
|
| 718 |
+
fromHtml: fromHtml,
|
| 719 |
+
fromTag: fromTag,
|
| 720 |
+
fromText: fromText,
|
| 721 |
+
fromDom: fromDom,
|
| 722 |
+
fromPoint: fromPoint
|
| 723 |
+
};
|
| 724 |
+
|
| 725 |
+
var $_x3hpikljfuw8q78 = {
|
| 726 |
+
ATTRIBUTE: 2,
|
| 727 |
+
CDATA_SECTION: 4,
|
| 728 |
+
COMMENT: 8,
|
| 729 |
+
DOCUMENT: 9,
|
| 730 |
+
DOCUMENT_TYPE: 10,
|
| 731 |
+
DOCUMENT_FRAGMENT: 11,
|
| 732 |
+
ELEMENT: 1,
|
| 733 |
+
TEXT: 3,
|
| 734 |
+
PROCESSING_INSTRUCTION: 7,
|
| 735 |
+
ENTITY_REFERENCE: 5,
|
| 736 |
+
ENTITY: 6,
|
| 737 |
+
NOTATION: 12
|
| 738 |
+
};
|
| 739 |
+
|
| 740 |
+
var ELEMENT = $_x3hpikljfuw8q78.ELEMENT;
|
| 741 |
+
var DOCUMENT = $_x3hpikljfuw8q78.DOCUMENT;
|
| 742 |
+
var is = function (element, selector) {
|
| 743 |
+
var elem = element.dom();
|
| 744 |
+
if (elem.nodeType !== ELEMENT)
|
| 745 |
+
return false;
|
| 746 |
+
else if (elem.matches !== undefined)
|
| 747 |
+
return elem.matches(selector);
|
| 748 |
+
else if (elem.msMatchesSelector !== undefined)
|
| 749 |
+
return elem.msMatchesSelector(selector);
|
| 750 |
+
else if (elem.webkitMatchesSelector !== undefined)
|
| 751 |
+
return elem.webkitMatchesSelector(selector);
|
| 752 |
+
else if (elem.mozMatchesSelector !== undefined)
|
| 753 |
+
return elem.mozMatchesSelector(selector);
|
| 754 |
+
else
|
| 755 |
+
throw new Error('Browser lacks native selectors');
|
| 756 |
+
};
|
| 757 |
+
var bypassSelector = function (dom) {
|
| 758 |
+
return dom.nodeType !== ELEMENT && dom.nodeType !== DOCUMENT || dom.childElementCount === 0;
|
| 759 |
+
};
|
| 760 |
+
var all = function (selector, scope) {
|
| 761 |
+
var base = scope === undefined ? document : scope.dom();
|
| 762 |
+
return bypassSelector(base) ? [] : $_tyr3yk5jfuw8q47.map(base.querySelectorAll(selector), $_xbeoqkkjfuw8q73.fromDom);
|
| 763 |
+
};
|
| 764 |
+
var one = function (selector, scope) {
|
| 765 |
+
var base = scope === undefined ? document : scope.dom();
|
| 766 |
+
return bypassSelector(base) ? Option.none() : Option.from(base.querySelector(selector)).map($_xbeoqkkjfuw8q73.fromDom);
|
| 767 |
+
};
|
| 768 |
+
var $_enn9uikjjfuw8q6w = {
|
| 769 |
+
all: all,
|
| 770 |
+
is: is,
|
| 771 |
+
one: one
|
| 772 |
+
};
|
| 773 |
+
|
| 774 |
+
var toArray = function (target, f) {
|
| 775 |
+
var r = [];
|
| 776 |
+
var recurse = function (e) {
|
| 777 |
+
r.push(e);
|
| 778 |
+
return f(e);
|
| 779 |
+
};
|
| 780 |
+
var cur = f(target);
|
| 781 |
+
do {
|
| 782 |
+
cur = cur.bind(recurse);
|
| 783 |
+
} while (cur.isSome());
|
| 784 |
+
return r;
|
| 785 |
+
};
|
| 786 |
+
var $_myhefknjfuw8q7m = { toArray: toArray };
|
| 787 |
+
|
| 788 |
+
var global$1 = typeof window !== 'undefined' ? window : Function('return this;')();
|
| 789 |
+
|
| 790 |
+
var path = function (parts, scope) {
|
| 791 |
+
var o = scope !== undefined && scope !== null ? scope : global$1;
|
| 792 |
+
for (var i = 0; i < parts.length && o !== undefined && o !== null; ++i)
|
| 793 |
+
o = o[parts[i]];
|
| 794 |
+
return o;
|
| 795 |
+
};
|
| 796 |
+
var resolve = function (p, scope) {
|
| 797 |
+
var parts = p.split('.');
|
| 798 |
+
return path(parts, scope);
|
| 799 |
+
};
|
| 800 |
+
var step = function (o, part) {
|
| 801 |
+
if (o[part] === undefined || o[part] === null)
|
| 802 |
+
o[part] = {};
|
| 803 |
+
return o[part];
|
| 804 |
+
};
|
| 805 |
+
var forge = function (parts, target) {
|
| 806 |
+
var o = target !== undefined ? target : global$1;
|
| 807 |
+
for (var i = 0; i < parts.length; ++i)
|
| 808 |
+
o = step(o, parts[i]);
|
| 809 |
+
return o;
|
| 810 |
+
};
|
| 811 |
+
var namespace = function (name, target) {
|
| 812 |
+
var parts = name.split('.');
|
| 813 |
+
return forge(parts, target);
|
| 814 |
+
};
|
| 815 |
+
var $_1but6zkrjfuw8q81 = {
|
| 816 |
+
path: path,
|
| 817 |
+
resolve: resolve,
|
| 818 |
+
forge: forge,
|
| 819 |
+
namespace: namespace
|
| 820 |
+
};
|
| 821 |
+
|
| 822 |
+
var unsafe = function (name, scope) {
|
| 823 |
+
return $_1but6zkrjfuw8q81.resolve(name, scope);
|
| 824 |
+
};
|
| 825 |
+
var getOrDie = function (name, scope) {
|
| 826 |
+
var actual = unsafe(name, scope);
|
| 827 |
+
if (actual === undefined || actual === null)
|
| 828 |
+
throw name + ' not available on this browser';
|
| 829 |
+
return actual;
|
| 830 |
+
};
|
| 831 |
+
var $_3og7cjkqjfuw8q7y = { getOrDie: getOrDie };
|
| 832 |
+
|
| 833 |
+
var node = function () {
|
| 834 |
+
var f = $_3og7cjkqjfuw8q7y.getOrDie('Node');
|
| 835 |
+
return f;
|
| 836 |
+
};
|
| 837 |
+
var compareDocumentPosition = function (a, b, match) {
|
| 838 |
+
return (a.compareDocumentPosition(b) & match) !== 0;
|
| 839 |
+
};
|
| 840 |
+
var documentPositionPreceding = function (a, b) {
|
| 841 |
+
return compareDocumentPosition(a, b, node().DOCUMENT_POSITION_PRECEDING);
|
| 842 |
+
};
|
| 843 |
+
var documentPositionContainedBy = function (a, b) {
|
| 844 |
+
return compareDocumentPosition(a, b, node().DOCUMENT_POSITION_CONTAINED_BY);
|
| 845 |
+
};
|
| 846 |
+
var $_3crkomkpjfuw8q7x = {
|
| 847 |
+
documentPositionPreceding: documentPositionPreceding,
|
| 848 |
+
documentPositionContainedBy: documentPositionContainedBy
|
| 849 |
+
};
|
| 850 |
+
|
| 851 |
+
var cached = function (f) {
|
| 852 |
+
var called = false;
|
| 853 |
+
var r;
|
| 854 |
+
return function () {
|
| 855 |
+
if (!called) {
|
| 856 |
+
called = true;
|
| 857 |
+
r = f.apply(null, arguments);
|
| 858 |
+
}
|
| 859 |
+
return r;
|
| 860 |
+
};
|
| 861 |
+
};
|
| 862 |
+
var $_cfqymdkujfuw8q85 = { cached: cached };
|
| 863 |
+
|
| 864 |
+
var firstMatch = function (regexes, s) {
|
| 865 |
+
for (var i = 0; i < regexes.length; i++) {
|
| 866 |
+
var x = regexes[i];
|
| 867 |
+
if (x.test(s))
|
| 868 |
+
return x;
|
| 869 |
+
}
|
| 870 |
+
return undefined;
|
| 871 |
+
};
|
| 872 |
+
var find$2 = function (regexes, agent) {
|
| 873 |
+
var r = firstMatch(regexes, agent);
|
| 874 |
+
if (!r)
|
| 875 |
+
return {
|
| 876 |
+
major: 0,
|
| 877 |
+
minor: 0
|
| 878 |
+
};
|
| 879 |
+
var group = function (i) {
|
| 880 |
+
return Number(agent.replace(r, '$' + i));
|
| 881 |
+
};
|
| 882 |
+
return nu(group(1), group(2));
|
| 883 |
+
};
|
| 884 |
+
var detect = function (versionRegexes, agent) {
|
| 885 |
+
var cleanedAgent = String(agent).toLowerCase();
|
| 886 |
+
if (versionRegexes.length === 0)
|
| 887 |
+
return unknown();
|
| 888 |
+
return find$2(versionRegexes, cleanedAgent);
|
| 889 |
+
};
|
| 890 |
+
var unknown = function () {
|
| 891 |
+
return nu(0, 0);
|
| 892 |
+
};
|
| 893 |
+
var nu = function (major, minor) {
|
| 894 |
+
return {
|
| 895 |
+
major: major,
|
| 896 |
+
minor: minor
|
| 897 |
+
};
|
| 898 |
+
};
|
| 899 |
+
var $_yulx6kxjfuw8q8c = {
|
| 900 |
+
nu: nu,
|
| 901 |
+
detect: detect,
|
| 902 |
+
unknown: unknown
|
| 903 |
+
};
|
| 904 |
+
|
| 905 |
+
var edge = 'Edge';
|
| 906 |
+
var chrome = 'Chrome';
|
| 907 |
+
var ie = 'IE';
|
| 908 |
+
var opera = 'Opera';
|
| 909 |
+
var firefox = 'Firefox';
|
| 910 |
+
var safari = 'Safari';
|
| 911 |
+
var isBrowser = function (name, current) {
|
| 912 |
+
return function () {
|
| 913 |
+
return current === name;
|
| 914 |
+
};
|
| 915 |
+
};
|
| 916 |
+
var unknown$1 = function () {
|
| 917 |
+
return nu$1({
|
| 918 |
+
current: undefined,
|
| 919 |
+
version: $_yulx6kxjfuw8q8c.unknown()
|
| 920 |
+
});
|
| 921 |
+
};
|
| 922 |
+
var nu$1 = function (info) {
|
| 923 |
+
var current = info.current;
|
| 924 |
+
var version = info.version;
|
| 925 |
+
return {
|
| 926 |
+
current: current,
|
| 927 |
+
version: version,
|
| 928 |
+
isEdge: isBrowser(edge, current),
|
| 929 |
+
isChrome: isBrowser(chrome, current),
|
| 930 |
+
isIE: isBrowser(ie, current),
|
| 931 |
+
isOpera: isBrowser(opera, current),
|
| 932 |
+
isFirefox: isBrowser(firefox, current),
|
| 933 |
+
isSafari: isBrowser(safari, current)
|
| 934 |
+
};
|
| 935 |
+
};
|
| 936 |
+
var $_1x5z0nkwjfuw8q88 = {
|
| 937 |
+
unknown: unknown$1,
|
| 938 |
+
nu: nu$1,
|
| 939 |
+
edge: $_20nfr6k7jfuw8q4g.constant(edge),
|
| 940 |
+
chrome: $_20nfr6k7jfuw8q4g.constant(chrome),
|
| 941 |
+
ie: $_20nfr6k7jfuw8q4g.constant(ie),
|
| 942 |
+
opera: $_20nfr6k7jfuw8q4g.constant(opera),
|
| 943 |
+
firefox: $_20nfr6k7jfuw8q4g.constant(firefox),
|
| 944 |
+
safari: $_20nfr6k7jfuw8q4g.constant(safari)
|
| 945 |
+
};
|
| 946 |
+
|
| 947 |
+
var windows = 'Windows';
|
| 948 |
+
var ios = 'iOS';
|
| 949 |
+
var android = 'Android';
|
| 950 |
+
var linux = 'Linux';
|
| 951 |
+
var osx = 'OSX';
|
| 952 |
+
var solaris = 'Solaris';
|
| 953 |
+
var freebsd = 'FreeBSD';
|
| 954 |
+
var isOS = function (name, current) {
|
| 955 |
+
return function () {
|
| 956 |
+
return current === name;
|
| 957 |
+
};
|
| 958 |
+
};
|
| 959 |
+
var unknown$2 = function () {
|
| 960 |
+
return nu$2({
|
| 961 |
+
current: undefined,
|
| 962 |
+
version: $_yulx6kxjfuw8q8c.unknown()
|
| 963 |
+
});
|
| 964 |
+
};
|
| 965 |
+
var nu$2 = function (info) {
|
| 966 |
+
var current = info.current;
|
| 967 |
+
var version = info.version;
|
| 968 |
+
return {
|
| 969 |
+
current: current,
|
| 970 |
+
version: version,
|
| 971 |
+
isWindows: isOS(windows, current),
|
| 972 |
+
isiOS: isOS(ios, current),
|
| 973 |
+
isAndroid: isOS(android, current),
|
| 974 |
+
isOSX: isOS(osx, current),
|
| 975 |
+
isLinux: isOS(linux, current),
|
| 976 |
+
isSolaris: isOS(solaris, current),
|
| 977 |
+
isFreeBSD: isOS(freebsd, current)
|
| 978 |
+
};
|
| 979 |
+
};
|
| 980 |
+
var $_87zg95kyjfuw8q8d = {
|
| 981 |
+
unknown: unknown$2,
|
| 982 |
+
nu: nu$2,
|
| 983 |
+
windows: $_20nfr6k7jfuw8q4g.constant(windows),
|
| 984 |
+
ios: $_20nfr6k7jfuw8q4g.constant(ios),
|
| 985 |
+
android: $_20nfr6k7jfuw8q4g.constant(android),
|
| 986 |
+
linux: $_20nfr6k7jfuw8q4g.constant(linux),
|
| 987 |
+
osx: $_20nfr6k7jfuw8q4g.constant(osx),
|
| 988 |
+
solaris: $_20nfr6k7jfuw8q4g.constant(solaris),
|
| 989 |
+
freebsd: $_20nfr6k7jfuw8q4g.constant(freebsd)
|
| 990 |
+
};
|
| 991 |
+
|
| 992 |
+
function DeviceType (os, browser, userAgent) {
|
| 993 |
+
var isiPad = os.isiOS() && /ipad/i.test(userAgent) === true;
|
| 994 |
+
var isiPhone = os.isiOS() && !isiPad;
|
| 995 |
+
var isAndroid3 = os.isAndroid() && os.version.major === 3;
|
| 996 |
+
var isAndroid4 = os.isAndroid() && os.version.major === 4;
|
| 997 |
+
var isTablet = isiPad || isAndroid3 || isAndroid4 && /mobile/i.test(userAgent) === true;
|
| 998 |
+
var isTouch = os.isiOS() || os.isAndroid();
|
| 999 |
+
var isPhone = isTouch && !isTablet;
|
| 1000 |
+
var iOSwebview = browser.isSafari() && os.isiOS() && /safari/i.test(userAgent) === false;
|
| 1001 |
+
return {
|
| 1002 |
+
isiPad: $_20nfr6k7jfuw8q4g.constant(isiPad),
|
| 1003 |
+
isiPhone: $_20nfr6k7jfuw8q4g.constant(isiPhone),
|
| 1004 |
+
isTablet: $_20nfr6k7jfuw8q4g.constant(isTablet),
|
| 1005 |
+
isPhone: $_20nfr6k7jfuw8q4g.constant(isPhone),
|
| 1006 |
+
isTouch: $_20nfr6k7jfuw8q4g.constant(isTouch),
|
| 1007 |
+
isAndroid: os.isAndroid,
|
| 1008 |
+
isiOS: os.isiOS,
|
| 1009 |
+
isWebView: $_20nfr6k7jfuw8q4g.constant(iOSwebview)
|
| 1010 |
+
};
|
| 1011 |
+
}
|
| 1012 |
+
|
| 1013 |
+
var detect$1 = function (candidates, userAgent) {
|
| 1014 |
+
var agent = String(userAgent).toLowerCase();
|
| 1015 |
+
return $_tyr3yk5jfuw8q47.find(candidates, function (candidate) {
|
| 1016 |
+
return candidate.search(agent);
|
| 1017 |
+
});
|
| 1018 |
+
};
|
| 1019 |
+
var detectBrowser = function (browsers, userAgent) {
|
| 1020 |
+
return detect$1(browsers, userAgent).map(function (browser) {
|
| 1021 |
+
var version = $_yulx6kxjfuw8q8c.detect(browser.versionRegexes, userAgent);
|
| 1022 |
+
return {
|
| 1023 |
+
current: browser.name,
|
| 1024 |
+
version: version
|
| 1025 |
+
};
|
| 1026 |
+
});
|
| 1027 |
+
};
|
| 1028 |
+
var detectOs = function (oses, userAgent) {
|
| 1029 |
+
return detect$1(oses, userAgent).map(function (os) {
|
| 1030 |
+
var version = $_yulx6kxjfuw8q8c.detect(os.versionRegexes, userAgent);
|
| 1031 |
+
return {
|
| 1032 |
+
current: os.name,
|
| 1033 |
+
version: version
|
| 1034 |
+
};
|
| 1035 |
+
});
|
| 1036 |
+
};
|
| 1037 |
+
var $_62ehlbl0jfuw8q8o = {
|
| 1038 |
+
detectBrowser: detectBrowser,
|
| 1039 |
+
detectOs: detectOs
|
| 1040 |
+
};
|
| 1041 |
+
|
| 1042 |
+
var addToStart = function (str, prefix) {
|
| 1043 |
+
return prefix + str;
|
| 1044 |
+
};
|
| 1045 |
+
var addToEnd = function (str, suffix) {
|
| 1046 |
+
return str + suffix;
|
| 1047 |
+
};
|
| 1048 |
+
var removeFromStart = function (str, numChars) {
|
| 1049 |
+
return str.substring(numChars);
|
| 1050 |
+
};
|
| 1051 |
+
var removeFromEnd = function (str, numChars) {
|
| 1052 |
+
return str.substring(0, str.length - numChars);
|
| 1053 |
+
};
|
| 1054 |
+
var $_1u5wzbl3jfuw8q90 = {
|
| 1055 |
+
addToStart: addToStart,
|
| 1056 |
+
addToEnd: addToEnd,
|
| 1057 |
+
removeFromStart: removeFromStart,
|
| 1058 |
+
removeFromEnd: removeFromEnd
|
| 1059 |
+
};
|
| 1060 |
+
|
| 1061 |
+
var first = function (str, count) {
|
| 1062 |
+
return str.substr(0, count);
|
| 1063 |
+
};
|
| 1064 |
+
var last$1 = function (str, count) {
|
| 1065 |
+
return str.substr(str.length - count, str.length);
|
| 1066 |
+
};
|
| 1067 |
+
var head$1 = function (str) {
|
| 1068 |
+
return str === '' ? Option.none() : Option.some(str.substr(0, 1));
|
| 1069 |
+
};
|
| 1070 |
+
var tail = function (str) {
|
| 1071 |
+
return str === '' ? Option.none() : Option.some(str.substring(1));
|
| 1072 |
+
};
|
| 1073 |
+
var $_6v04e7l4jfuw8q91 = {
|
| 1074 |
+
first: first,
|
| 1075 |
+
last: last$1,
|
| 1076 |
+
head: head$1,
|
| 1077 |
+
tail: tail
|
| 1078 |
+
};
|
| 1079 |
+
|
| 1080 |
+
var checkRange = function (str, substr, start) {
|
| 1081 |
+
if (substr === '')
|
| 1082 |
+
return true;
|
| 1083 |
+
if (str.length < substr.length)
|
| 1084 |
+
return false;
|
| 1085 |
+
var x = str.substr(start, start + substr.length);
|
| 1086 |
+
return x === substr;
|
| 1087 |
+
};
|
| 1088 |
+
var supplant = function (str, obj) {
|
| 1089 |
+
var isStringOrNumber = function (a) {
|
| 1090 |
+
var t = typeof a;
|
| 1091 |
+
return t === 'string' || t === 'number';
|
| 1092 |
+
};
|
| 1093 |
+
return str.replace(/\${([^{}]*)}/g, function (a, b) {
|
| 1094 |
+
var value = obj[b];
|
| 1095 |
+
return isStringOrNumber(value) ? value : a;
|
| 1096 |
+
});
|
| 1097 |
+
};
|
| 1098 |
+
var removeLeading = function (str, prefix) {
|
| 1099 |
+
return startsWith(str, prefix) ? $_1u5wzbl3jfuw8q90.removeFromStart(str, prefix.length) : str;
|
| 1100 |
+
};
|
| 1101 |
+
var removeTrailing = function (str, prefix) {
|
| 1102 |
+
return endsWith(str, prefix) ? $_1u5wzbl3jfuw8q90.removeFromEnd(str, prefix.length) : str;
|
| 1103 |
+
};
|
| 1104 |
+
var ensureLeading = function (str, prefix) {
|
| 1105 |
+
return startsWith(str, prefix) ? str : $_1u5wzbl3jfuw8q90.addToStart(str, prefix);
|
| 1106 |
+
};
|
| 1107 |
+
var ensureTrailing = function (str, prefix) {
|
| 1108 |
+
return endsWith(str, prefix) ? str : $_1u5wzbl3jfuw8q90.addToEnd(str, prefix);
|
| 1109 |
+
};
|
| 1110 |
+
var contains$1 = function (str, substr) {
|
| 1111 |
+
return str.indexOf(substr) !== -1;
|
| 1112 |
+
};
|
| 1113 |
+
var capitalize = function (str) {
|
| 1114 |
+
return $_6v04e7l4jfuw8q91.head(str).bind(function (head) {
|
| 1115 |
+
return $_6v04e7l4jfuw8q91.tail(str).map(function (tail) {
|
| 1116 |
+
return head.toUpperCase() + tail;
|
| 1117 |
+
});
|
| 1118 |
+
}).getOr(str);
|
| 1119 |
+
};
|
| 1120 |
+
var startsWith = function (str, prefix) {
|
| 1121 |
+
return checkRange(str, prefix, 0);
|
| 1122 |
+
};
|
| 1123 |
+
var endsWith = function (str, suffix) {
|
| 1124 |
+
return checkRange(str, suffix, str.length - suffix.length);
|
| 1125 |
+
};
|
| 1126 |
+
var trim = function (str) {
|
| 1127 |
+
return str.replace(/^\s+|\s+$/g, '');
|
| 1128 |
+
};
|
| 1129 |
+
var lTrim = function (str) {
|
| 1130 |
+
return str.replace(/^\s+/g, '');
|
| 1131 |
+
};
|
| 1132 |
+
var rTrim = function (str) {
|
| 1133 |
+
return str.replace(/\s+$/g, '');
|
| 1134 |
+
};
|
| 1135 |
+
var $_ey09l9l2jfuw8q8y = {
|
| 1136 |
+
supplant: supplant,
|
| 1137 |
+
startsWith: startsWith,
|
| 1138 |
+
removeLeading: removeLeading,
|
| 1139 |
+
removeTrailing: removeTrailing,
|
| 1140 |
+
ensureLeading: ensureLeading,
|
| 1141 |
+
ensureTrailing: ensureTrailing,
|
| 1142 |
+
endsWith: endsWith,
|
| 1143 |
+
contains: contains$1,
|
| 1144 |
+
trim: trim,
|
| 1145 |
+
lTrim: lTrim,
|
| 1146 |
+
rTrim: rTrim,
|
| 1147 |
+
capitalize: capitalize
|
| 1148 |
+
};
|
| 1149 |
+
|
| 1150 |
+
var normalVersionRegex = /.*?version\/\ ?([0-9]+)\.([0-9]+).*/;
|
| 1151 |
+
var checkContains = function (target) {
|
| 1152 |
+
return function (uastring) {
|
| 1153 |
+
return $_ey09l9l2jfuw8q8y.contains(uastring, target);
|
| 1154 |
+
};
|
| 1155 |
+
};
|
| 1156 |
+
var browsers = [
|
| 1157 |
+
{
|
| 1158 |
+
name: 'Edge',
|
| 1159 |
+
versionRegexes: [/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],
|
| 1160 |
+
search: function (uastring) {
|
| 1161 |
+
var monstrosity = $_ey09l9l2jfuw8q8y.contains(uastring, 'edge/') && $_ey09l9l2jfuw8q8y.contains(uastring, 'chrome') && $_ey09l9l2jfuw8q8y.contains(uastring, 'safari') && $_ey09l9l2jfuw8q8y.contains(uastring, 'applewebkit');
|
| 1162 |
+
return monstrosity;
|
| 1163 |
+
}
|
| 1164 |
+
},
|
| 1165 |
+
{
|
| 1166 |
+
name: 'Chrome',
|
| 1167 |
+
versionRegexes: [
|
| 1168 |
+
/.*?chrome\/([0-9]+)\.([0-9]+).*/,
|
| 1169 |
+
normalVersionRegex
|
| 1170 |
+
],
|
| 1171 |
+
search: function (uastring) {
|
| 1172 |
+
return $_ey09l9l2jfuw8q8y.contains(uastring, 'chrome') && !$_ey09l9l2jfuw8q8y.contains(uastring, 'chromeframe');
|
| 1173 |
+
}
|
| 1174 |
+
},
|
| 1175 |
+
{
|
| 1176 |
+
name: 'IE',
|
| 1177 |
+
versionRegexes: [
|
| 1178 |
+
/.*?msie\ ?([0-9]+)\.([0-9]+).*/,
|
| 1179 |
+
/.*?rv:([0-9]+)\.([0-9]+).*/
|
| 1180 |
+
],
|
| 1181 |
+
search: function (uastring) {
|
| 1182 |
+
return $_ey09l9l2jfuw8q8y.contains(uastring, 'msie') || $_ey09l9l2jfuw8q8y.contains(uastring, 'trident');
|
| 1183 |
+
}
|
| 1184 |
+
},
|
| 1185 |
+
{
|
| 1186 |
+
name: 'Opera',
|
| 1187 |
+
versionRegexes: [
|
| 1188 |
+
normalVersionRegex,
|
| 1189 |
+
/.*?opera\/([0-9]+)\.([0-9]+).*/
|
| 1190 |
+
],
|
| 1191 |
+
search: checkContains('opera')
|
| 1192 |
+
},
|
| 1193 |
+
{
|
| 1194 |
+
name: 'Firefox',
|
| 1195 |
+
versionRegexes: [/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],
|
| 1196 |
+
search: checkContains('firefox')
|
| 1197 |
+
},
|
| 1198 |
+
{
|
| 1199 |
+
name: 'Safari',
|
| 1200 |
+
versionRegexes: [
|
| 1201 |
+
normalVersionRegex,
|
| 1202 |
+
/.*?cpu os ([0-9]+)_([0-9]+).*/
|
| 1203 |
+
],
|
| 1204 |
+
search: function (uastring) {
|
| 1205 |
+
return ($_ey09l9l2jfuw8q8y.contains(uastring, 'safari') || $_ey09l9l2jfuw8q8y.contains(uastring, 'mobile/')) && $_ey09l9l2jfuw8q8y.contains(uastring, 'applewebkit');
|
| 1206 |
+
}
|
| 1207 |
+
}
|
| 1208 |
+
];
|
| 1209 |
+
var oses = [
|
| 1210 |
+
{
|
| 1211 |
+
name: 'Windows',
|
| 1212 |
+
search: checkContains('win'),
|
| 1213 |
+
versionRegexes: [/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]
|
| 1214 |
+
},
|
| 1215 |
+
{
|
| 1216 |
+
name: 'iOS',
|
| 1217 |
+
search: function (uastring) {
|
| 1218 |
+
return $_ey09l9l2jfuw8q8y.contains(uastring, 'iphone') || $_ey09l9l2jfuw8q8y.contains(uastring, 'ipad');
|
| 1219 |
+
},
|
| 1220 |
+
versionRegexes: [
|
| 1221 |
+
/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,
|
| 1222 |
+
/.*cpu os ([0-9]+)_([0-9]+).*/,
|
| 1223 |
+
/.*cpu iphone os ([0-9]+)_([0-9]+).*/
|
| 1224 |
+
]
|
| 1225 |
+
},
|
| 1226 |
+
{
|
| 1227 |
+
name: 'Android',
|
| 1228 |
+
search: checkContains('android'),
|
| 1229 |
+
versionRegexes: [/.*?android\ ?([0-9]+)\.([0-9]+).*/]
|
| 1230 |
+
},
|
| 1231 |
+
{
|
| 1232 |
+
name: 'OSX',
|
| 1233 |
+
search: checkContains('os x'),
|
| 1234 |
+
versionRegexes: [/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]
|
| 1235 |
+
},
|
| 1236 |
+
{
|
| 1237 |
+
name: 'Linux',
|
| 1238 |
+
search: checkContains('linux'),
|
| 1239 |
+
versionRegexes: []
|
| 1240 |
+
},
|
| 1241 |
+
{
|
| 1242 |
+
name: 'Solaris',
|
| 1243 |
+
search: checkContains('sunos'),
|
| 1244 |
+
versionRegexes: []
|
| 1245 |
+
},
|
| 1246 |
+
{
|
| 1247 |
+
name: 'FreeBSD',
|
| 1248 |
+
search: checkContains('freebsd'),
|
| 1249 |
+
versionRegexes: []
|
| 1250 |
+
}
|
| 1251 |
+
];
|
| 1252 |
+
var $_6xdjg7l1jfuw8q8s = {
|
| 1253 |
+
browsers: $_20nfr6k7jfuw8q4g.constant(browsers),
|
| 1254 |
+
oses: $_20nfr6k7jfuw8q4g.constant(oses)
|
| 1255 |
+
};
|
| 1256 |
+
|
| 1257 |
+
var detect$2 = function (userAgent) {
|
| 1258 |
+
var browsers = $_6xdjg7l1jfuw8q8s.browsers();
|
| 1259 |
+
var oses = $_6xdjg7l1jfuw8q8s.oses();
|
| 1260 |
+
var browser = $_62ehlbl0jfuw8q8o.detectBrowser(browsers, userAgent).fold($_1x5z0nkwjfuw8q88.unknown, $_1x5z0nkwjfuw8q88.nu);
|
| 1261 |
+
var os = $_62ehlbl0jfuw8q8o.detectOs(oses, userAgent).fold($_87zg95kyjfuw8q8d.unknown, $_87zg95kyjfuw8q8d.nu);
|
| 1262 |
+
var deviceType = DeviceType(os, browser, userAgent);
|
| 1263 |
+
return {
|
| 1264 |
+
browser: browser,
|
| 1265 |
+
os: os,
|
| 1266 |
+
deviceType: deviceType
|
| 1267 |
+
};
|
| 1268 |
+
};
|
| 1269 |
+
var $_5kufzskvjfuw8q87 = { detect: detect$2 };
|
| 1270 |
+
|
| 1271 |
+
var detect$3 = $_cfqymdkujfuw8q85.cached(function () {
|
| 1272 |
+
var userAgent = navigator.userAgent;
|
| 1273 |
+
return $_5kufzskvjfuw8q87.detect(userAgent);
|
| 1274 |
+
});
|
| 1275 |
+
var $_fqgee0ktjfuw8q83 = { detect: detect$3 };
|
| 1276 |
+
|
| 1277 |
+
var eq = function (e1, e2) {
|
| 1278 |
+
return e1.dom() === e2.dom();
|
| 1279 |
+
};
|
| 1280 |
+
var isEqualNode = function (e1, e2) {
|
| 1281 |
+
return e1.dom().isEqualNode(e2.dom());
|
| 1282 |
+
};
|
| 1283 |
+
var member = function (element, elements) {
|
| 1284 |
+
return $_tyr3yk5jfuw8q47.exists(elements, $_20nfr6k7jfuw8q4g.curry(eq, element));
|
| 1285 |
+
};
|
| 1286 |
+
var regularContains = function (e1, e2) {
|
| 1287 |
+
var d1 = e1.dom(), d2 = e2.dom();
|
| 1288 |
+
return d1 === d2 ? false : d1.contains(d2);
|
| 1289 |
+
};
|
| 1290 |
+
var ieContains = function (e1, e2) {
|
| 1291 |
+
return $_3crkomkpjfuw8q7x.documentPositionContainedBy(e1.dom(), e2.dom());
|
| 1292 |
+
};
|
| 1293 |
+
var browser = $_fqgee0ktjfuw8q83.detect().browser;
|
| 1294 |
+
var contains$2 = browser.isIE() ? ieContains : regularContains;
|
| 1295 |
+
var $_e8rn66kojfuw8q7n = {
|
| 1296 |
+
eq: eq,
|
| 1297 |
+
isEqualNode: isEqualNode,
|
| 1298 |
+
member: member,
|
| 1299 |
+
contains: contains$2,
|
| 1300 |
+
is: $_enn9uikjjfuw8q6w.is
|
| 1301 |
+
};
|
| 1302 |
+
|
| 1303 |
+
var owner = function (element) {
|
| 1304 |
+
return $_xbeoqkkjfuw8q73.fromDom(element.dom().ownerDocument);
|
| 1305 |
+
};
|
| 1306 |
+
var documentElement = function (element) {
|
| 1307 |
+
var doc = owner(element);
|
| 1308 |
+
return $_xbeoqkkjfuw8q73.fromDom(doc.dom().documentElement);
|
| 1309 |
+
};
|
| 1310 |
+
var defaultView = function (element) {
|
| 1311 |
+
var el = element.dom();
|
| 1312 |
+
var defaultView = el.ownerDocument.defaultView;
|
| 1313 |
+
return $_xbeoqkkjfuw8q73.fromDom(defaultView);
|
| 1314 |
+
};
|
| 1315 |
+
var parent = function (element) {
|
| 1316 |
+
var dom = element.dom();
|
| 1317 |
+
return Option.from(dom.parentNode).map($_xbeoqkkjfuw8q73.fromDom);
|
| 1318 |
+
};
|
| 1319 |
+
var findIndex$1 = function (element) {
|
| 1320 |
+
return parent(element).bind(function (p) {
|
| 1321 |
+
var kin = children(p);
|
| 1322 |
+
return $_tyr3yk5jfuw8q47.findIndex(kin, function (elem) {
|
| 1323 |
+
return $_e8rn66kojfuw8q7n.eq(element, elem);
|
| 1324 |
+
});
|
| 1325 |
+
});
|
| 1326 |
+
};
|
| 1327 |
+
var parents = function (element, isRoot) {
|
| 1328 |
+
var stop = $_g6mvnrk8jfuw8q4k.isFunction(isRoot) ? isRoot : $_20nfr6k7jfuw8q4g.constant(false);
|
| 1329 |
+
var dom = element.dom();
|
| 1330 |
+
var ret = [];
|
| 1331 |
+
while (dom.parentNode !== null && dom.parentNode !== undefined) {
|
| 1332 |
+
var rawParent = dom.parentNode;
|
| 1333 |
+
var parent = $_xbeoqkkjfuw8q73.fromDom(rawParent);
|
| 1334 |
+
ret.push(parent);
|
| 1335 |
+
if (stop(parent) === true)
|
| 1336 |
+
break;
|
| 1337 |
+
else
|
| 1338 |
+
dom = rawParent;
|
| 1339 |
+
}
|
| 1340 |
+
return ret;
|
| 1341 |
+
};
|
| 1342 |
+
var siblings = function (element) {
|
| 1343 |
+
var filterSelf = function (elements) {
|
| 1344 |
+
return $_tyr3yk5jfuw8q47.filter(elements, function (x) {
|
| 1345 |
+
return !$_e8rn66kojfuw8q7n.eq(element, x);
|
| 1346 |
+
});
|
| 1347 |
+
};
|
| 1348 |
+
return parent(element).map(children).map(filterSelf).getOr([]);
|
| 1349 |
+
};
|
| 1350 |
+
var offsetParent = function (element) {
|
| 1351 |
+
var dom = element.dom();
|
| 1352 |
+
return Option.from(dom.offsetParent).map($_xbeoqkkjfuw8q73.fromDom);
|
| 1353 |
+
};
|
| 1354 |
+
var prevSibling = function (element) {
|
| 1355 |
+
var dom = element.dom();
|
| 1356 |
+
return Option.from(dom.previousSibling).map($_xbeoqkkjfuw8q73.fromDom);
|
| 1357 |
+
};
|
| 1358 |
+
var nextSibling = function (element) {
|
| 1359 |
+
var dom = element.dom();
|
| 1360 |
+
return Option.from(dom.nextSibling).map($_xbeoqkkjfuw8q73.fromDom);
|
| 1361 |
+
};
|
| 1362 |
+
var prevSiblings = function (element) {
|
| 1363 |
+
return $_tyr3yk5jfuw8q47.reverse($_myhefknjfuw8q7m.toArray(element, prevSibling));
|
| 1364 |
+
};
|
| 1365 |
+
var nextSiblings = function (element) {
|
| 1366 |
+
return $_myhefknjfuw8q7m.toArray(element, nextSibling);
|
| 1367 |
+
};
|
| 1368 |
+
var children = function (element) {
|
| 1369 |
+
var dom = element.dom();
|
| 1370 |
+
return $_tyr3yk5jfuw8q47.map(dom.childNodes, $_xbeoqkkjfuw8q73.fromDom);
|
| 1371 |
+
};
|
| 1372 |
+
var child = function (element, index) {
|
| 1373 |
+
var children = element.dom().childNodes;
|
| 1374 |
+
return Option.from(children[index]).map($_xbeoqkkjfuw8q73.fromDom);
|
| 1375 |
+
};
|
| 1376 |
+
var firstChild = function (element) {
|
| 1377 |
+
return child(element, 0);
|
| 1378 |
+
};
|
| 1379 |
+
var lastChild = function (element) {
|
| 1380 |
+
return child(element, element.dom().childNodes.length - 1);
|
| 1381 |
+
};
|
| 1382 |
+
var childNodesCount = function (element) {
|
| 1383 |
+
return element.dom().childNodes.length;
|
| 1384 |
+
};
|
| 1385 |
+
var hasChildNodes = function (element) {
|
| 1386 |
+
return element.dom().hasChildNodes();
|
| 1387 |
+
};
|
| 1388 |
+
var spot = $_5now9kbjfuw8q5e.immutable('element', 'offset');
|
| 1389 |
+
var leaf = function (element, offset) {
|
| 1390 |
+
var cs = children(element);
|
| 1391 |
+
return cs.length > 0 && offset < cs.length ? spot(cs[offset], 0) : spot(element, offset);
|
| 1392 |
+
};
|
| 1393 |
+
var $_s8scrkmjfuw8q7a = {
|
| 1394 |
+
owner: owner,
|
| 1395 |
+
defaultView: defaultView,
|
| 1396 |
+
documentElement: documentElement,
|
| 1397 |
+
parent: parent,
|
| 1398 |
+
findIndex: findIndex$1,
|
| 1399 |
+
parents: parents,
|
| 1400 |
+
siblings: siblings,
|
| 1401 |
+
prevSibling: prevSibling,
|
| 1402 |
+
offsetParent: offsetParent,
|
| 1403 |
+
prevSiblings: prevSiblings,
|
| 1404 |
+
nextSibling: nextSibling,
|
| 1405 |
+
nextSiblings: nextSiblings,
|
| 1406 |
+
children: children,
|
| 1407 |
+
child: child,
|
| 1408 |
+
firstChild: firstChild,
|
| 1409 |
+
lastChild: lastChild,
|
| 1410 |
+
childNodesCount: childNodesCount,
|
| 1411 |
+
hasChildNodes: hasChildNodes,
|
| 1412 |
+
leaf: leaf
|
| 1413 |
+
};
|
| 1414 |
+
|
| 1415 |
+
var firstLayer = function (scope, selector) {
|
| 1416 |
+
return filterFirstLayer(scope, selector, $_20nfr6k7jfuw8q4g.constant(true));
|
| 1417 |
+
};
|
| 1418 |
+
var filterFirstLayer = function (scope, selector, predicate) {
|
| 1419 |
+
return $_tyr3yk5jfuw8q47.bind($_s8scrkmjfuw8q7a.children(scope), function (x) {
|
| 1420 |
+
return $_enn9uikjjfuw8q6w.is(x, selector) ? predicate(x) ? [x] : [] : filterFirstLayer(x, selector, predicate);
|
| 1421 |
+
});
|
| 1422 |
+
};
|
| 1423 |
+
var $_2g609akijfuw8q6n = {
|
| 1424 |
+
firstLayer: firstLayer,
|
| 1425 |
+
filterFirstLayer: filterFirstLayer
|
| 1426 |
+
};
|
| 1427 |
+
|
| 1428 |
+
var name = function (element) {
|
| 1429 |
+
var r = element.dom().nodeName;
|
| 1430 |
+
return r.toLowerCase();
|
| 1431 |
+
};
|
| 1432 |
+
var type = function (element) {
|
| 1433 |
+
return element.dom().nodeType;
|
| 1434 |
+
};
|
| 1435 |
+
var value = function (element) {
|
| 1436 |
+
return element.dom().nodeValue;
|
| 1437 |
+
};
|
| 1438 |
+
var isType$1 = function (t) {
|
| 1439 |
+
return function (element) {
|
| 1440 |
+
return type(element) === t;
|
| 1441 |
+
};
|
| 1442 |
+
};
|
| 1443 |
+
var isComment = function (element) {
|
| 1444 |
+
return type(element) === $_x3hpikljfuw8q78.COMMENT || name(element) === '#comment';
|
| 1445 |
+
};
|
| 1446 |
+
var isElement = isType$1($_x3hpikljfuw8q78.ELEMENT);
|
| 1447 |
+
var isText = isType$1($_x3hpikljfuw8q78.TEXT);
|
| 1448 |
+
var isDocument = isType$1($_x3hpikljfuw8q78.DOCUMENT);
|
| 1449 |
+
var $_a8gk30l6jfuw8q9c = {
|
| 1450 |
+
name: name,
|
| 1451 |
+
type: type,
|
| 1452 |
+
value: value,
|
| 1453 |
+
isElement: isElement,
|
| 1454 |
+
isText: isText,
|
| 1455 |
+
isDocument: isDocument,
|
| 1456 |
+
isComment: isComment
|
| 1457 |
+
};
|
| 1458 |
+
|
| 1459 |
+
var rawSet = function (dom, key, value) {
|
| 1460 |
+
if ($_g6mvnrk8jfuw8q4k.isString(value) || $_g6mvnrk8jfuw8q4k.isBoolean(value) || $_g6mvnrk8jfuw8q4k.isNumber(value)) {
|
| 1461 |
+
dom.setAttribute(key, value + '');
|
| 1462 |
+
} else {
|
| 1463 |
+
console.error('Invalid call to Attr.set. Key ', key, ':: Value ', value, ':: Element ', dom);
|
| 1464 |
+
throw new Error('Attribute value was not simple');
|
| 1465 |
+
}
|
| 1466 |
+
};
|
| 1467 |
+
var set = function (element, key, value) {
|
| 1468 |
+
rawSet(element.dom(), key, value);
|
| 1469 |
+
};
|
| 1470 |
+
var setAll = function (element, attrs) {
|
| 1471 |
+
var dom = element.dom();
|
| 1472 |
+
$_11yiupkajfuw8q5c.each(attrs, function (v, k) {
|
| 1473 |
+
rawSet(dom, k, v);
|
| 1474 |
+
});
|
| 1475 |
+
};
|
| 1476 |
+
var get = function (element, key) {
|
| 1477 |
+
var v = element.dom().getAttribute(key);
|
| 1478 |
+
return v === null ? undefined : v;
|
| 1479 |
+
};
|
| 1480 |
+
var has = function (element, key) {
|
| 1481 |
+
var dom = element.dom();
|
| 1482 |
+
return dom && dom.hasAttribute ? dom.hasAttribute(key) : false;
|
| 1483 |
+
};
|
| 1484 |
+
var remove = function (element, key) {
|
| 1485 |
+
element.dom().removeAttribute(key);
|
| 1486 |
+
};
|
| 1487 |
+
var hasNone = function (element) {
|
| 1488 |
+
var attrs = element.dom().attributes;
|
| 1489 |
+
return attrs === undefined || attrs === null || attrs.length === 0;
|
| 1490 |
+
};
|
| 1491 |
+
var clone = function (element) {
|
| 1492 |
+
return $_tyr3yk5jfuw8q47.foldl(element.dom().attributes, function (acc, attr) {
|
| 1493 |
+
acc[attr.name] = attr.value;
|
| 1494 |
+
return acc;
|
| 1495 |
+
}, {});
|
| 1496 |
+
};
|
| 1497 |
+
var transferOne = function (source, destination, attr) {
|
| 1498 |
+
if (has(source, attr) && !has(destination, attr))
|
| 1499 |
+
set(destination, attr, get(source, attr));
|
| 1500 |
+
};
|
| 1501 |
+
var transfer = function (source, destination, attrs) {
|
| 1502 |
+
if (!$_a8gk30l6jfuw8q9c.isElement(source) || !$_a8gk30l6jfuw8q9c.isElement(destination))
|
| 1503 |
+
return;
|
| 1504 |
+
$_tyr3yk5jfuw8q47.each(attrs, function (attr) {
|
| 1505 |
+
transferOne(source, destination, attr);
|
| 1506 |
+
});
|
| 1507 |
+
};
|
| 1508 |
+
var $_3q82t2l5jfuw8q93 = {
|
| 1509 |
+
clone: clone,
|
| 1510 |
+
set: set,
|
| 1511 |
+
setAll: setAll,
|
| 1512 |
+
get: get,
|
| 1513 |
+
has: has,
|
| 1514 |
+
remove: remove,
|
| 1515 |
+
hasNone: hasNone,
|
| 1516 |
+
transfer: transfer
|
| 1517 |
+
};
|
| 1518 |
+
|
| 1519 |
+
var inBody = function (element) {
|
| 1520 |
+
var dom = $_a8gk30l6jfuw8q9c.isText(element) ? element.dom().parentNode : element.dom();
|
| 1521 |
+
return dom !== undefined && dom !== null && dom.ownerDocument.body.contains(dom);
|
| 1522 |
+
};
|
| 1523 |
+
var body = $_cfqymdkujfuw8q85.cached(function () {
|
| 1524 |
+
return getBody($_xbeoqkkjfuw8q73.fromDom(document));
|
| 1525 |
+
});
|
| 1526 |
+
var getBody = function (doc) {
|
| 1527 |
+
var body = doc.dom().body;
|
| 1528 |
+
if (body === null || body === undefined)
|
| 1529 |
+
throw 'Body is not available yet';
|
| 1530 |
+
return $_xbeoqkkjfuw8q73.fromDom(body);
|
| 1531 |
+
};
|
| 1532 |
+
var $_atd1tul9jfuw8q9i = {
|
| 1533 |
+
body: body,
|
| 1534 |
+
getBody: getBody,
|
| 1535 |
+
inBody: inBody
|
| 1536 |
+
};
|
| 1537 |
+
|
| 1538 |
+
var all$1 = function (predicate) {
|
| 1539 |
+
return descendants($_atd1tul9jfuw8q9i.body(), predicate);
|
| 1540 |
+
};
|
| 1541 |
+
var ancestors = function (scope, predicate, isRoot) {
|
| 1542 |
+
return $_tyr3yk5jfuw8q47.filter($_s8scrkmjfuw8q7a.parents(scope, isRoot), predicate);
|
| 1543 |
+
};
|
| 1544 |
+
var siblings$1 = function (scope, predicate) {
|
| 1545 |
+
return $_tyr3yk5jfuw8q47.filter($_s8scrkmjfuw8q7a.siblings(scope), predicate);
|
| 1546 |
+
};
|
| 1547 |
+
var children$1 = function (scope, predicate) {
|
| 1548 |
+
return $_tyr3yk5jfuw8q47.filter($_s8scrkmjfuw8q7a.children(scope), predicate);
|
| 1549 |
+
};
|
| 1550 |
+
var descendants = function (scope, predicate) {
|
| 1551 |
+
var result = [];
|
| 1552 |
+
$_tyr3yk5jfuw8q47.each($_s8scrkmjfuw8q7a.children(scope), function (x) {
|
| 1553 |
+
if (predicate(x)) {
|
| 1554 |
+
result = result.concat([x]);
|
| 1555 |
+
}
|
| 1556 |
+
result = result.concat(descendants(x, predicate));
|
| 1557 |
+
});
|
| 1558 |
+
return result;
|
| 1559 |
+
};
|
| 1560 |
+
var $_4d3nfbl8jfuw8q9f = {
|
| 1561 |
+
all: all$1,
|
| 1562 |
+
ancestors: ancestors,
|
| 1563 |
+
siblings: siblings$1,
|
| 1564 |
+
children: children$1,
|
| 1565 |
+
descendants: descendants
|
| 1566 |
+
};
|
| 1567 |
+
|
| 1568 |
+
var all$2 = function (selector) {
|
| 1569 |
+
return $_enn9uikjjfuw8q6w.all(selector);
|
| 1570 |
+
};
|
| 1571 |
+
var ancestors$1 = function (scope, selector, isRoot) {
|
| 1572 |
+
return $_4d3nfbl8jfuw8q9f.ancestors(scope, function (e) {
|
| 1573 |
+
return $_enn9uikjjfuw8q6w.is(e, selector);
|
| 1574 |
+
}, isRoot);
|
| 1575 |
+
};
|
| 1576 |
+
var siblings$2 = function (scope, selector) {
|
| 1577 |
+
return $_4d3nfbl8jfuw8q9f.siblings(scope, function (e) {
|
| 1578 |
+
return $_enn9uikjjfuw8q6w.is(e, selector);
|
| 1579 |
+
});
|
| 1580 |
+
};
|
| 1581 |
+
var children$2 = function (scope, selector) {
|
| 1582 |
+
return $_4d3nfbl8jfuw8q9f.children(scope, function (e) {
|
| 1583 |
+
return $_enn9uikjjfuw8q6w.is(e, selector);
|
| 1584 |
+
});
|
| 1585 |
+
};
|
| 1586 |
+
var descendants$1 = function (scope, selector) {
|
| 1587 |
+
return $_enn9uikjjfuw8q6w.all(selector, scope);
|
| 1588 |
+
};
|
| 1589 |
+
var $_6c9d0hl7jfuw8q9d = {
|
| 1590 |
+
all: all$2,
|
| 1591 |
+
ancestors: ancestors$1,
|
| 1592 |
+
siblings: siblings$2,
|
| 1593 |
+
children: children$2,
|
| 1594 |
+
descendants: descendants$1
|
| 1595 |
+
};
|
| 1596 |
+
|
| 1597 |
+
function ClosestOrAncestor (is, ancestor, scope, a, isRoot) {
|
| 1598 |
+
return is(scope, a) ? Option.some(scope) : $_g6mvnrk8jfuw8q4k.isFunction(isRoot) && isRoot(scope) ? Option.none() : ancestor(scope, a, isRoot);
|
| 1599 |
+
}
|
| 1600 |
+
|
| 1601 |
+
var first$1 = function (predicate) {
|
| 1602 |
+
return descendant($_atd1tul9jfuw8q9i.body(), predicate);
|
| 1603 |
+
};
|
| 1604 |
+
var ancestor = function (scope, predicate, isRoot) {
|
| 1605 |
+
var element = scope.dom();
|
| 1606 |
+
var stop = $_g6mvnrk8jfuw8q4k.isFunction(isRoot) ? isRoot : $_20nfr6k7jfuw8q4g.constant(false);
|
| 1607 |
+
while (element.parentNode) {
|
| 1608 |
+
element = element.parentNode;
|
| 1609 |
+
var el = $_xbeoqkkjfuw8q73.fromDom(element);
|
| 1610 |
+
if (predicate(el))
|
| 1611 |
+
return Option.some(el);
|
| 1612 |
+
else if (stop(el))
|
| 1613 |
+
break;
|
| 1614 |
+
}
|
| 1615 |
+
return Option.none();
|
| 1616 |
+
};
|
| 1617 |
+
var closest = function (scope, predicate, isRoot) {
|
| 1618 |
+
var is = function (scope) {
|
| 1619 |
+
return predicate(scope);
|
| 1620 |
+
};
|
| 1621 |
+
return ClosestOrAncestor(is, ancestor, scope, predicate, isRoot);
|
| 1622 |
+
};
|
| 1623 |
+
var sibling = function (scope, predicate) {
|
| 1624 |
+
var element = scope.dom();
|
| 1625 |
+
if (!element.parentNode)
|
| 1626 |
+
return Option.none();
|
| 1627 |
+
return child$1($_xbeoqkkjfuw8q73.fromDom(element.parentNode), function (x) {
|
| 1628 |
+
return !$_e8rn66kojfuw8q7n.eq(scope, x) && predicate(x);
|
| 1629 |
+
});
|
| 1630 |
+
};
|
| 1631 |
+
var child$1 = function (scope, predicate) {
|
| 1632 |
+
var result = $_tyr3yk5jfuw8q47.find(scope.dom().childNodes, $_20nfr6k7jfuw8q4g.compose(predicate, $_xbeoqkkjfuw8q73.fromDom));
|
| 1633 |
+
return result.map($_xbeoqkkjfuw8q73.fromDom);
|
| 1634 |
+
};
|
| 1635 |
+
var descendant = function (scope, predicate) {
|
| 1636 |
+
var descend = function (element) {
|
| 1637 |
+
for (var i = 0; i < element.childNodes.length; i++) {
|
| 1638 |
+
if (predicate($_xbeoqkkjfuw8q73.fromDom(element.childNodes[i])))
|
| 1639 |
+
return Option.some($_xbeoqkkjfuw8q73.fromDom(element.childNodes[i]));
|
| 1640 |
+
var res = descend(element.childNodes[i]);
|
| 1641 |
+
if (res.isSome())
|
| 1642 |
+
return res;
|
| 1643 |
+
}
|
| 1644 |
+
return Option.none();
|
| 1645 |
+
};
|
| 1646 |
+
return descend(scope.dom());
|
| 1647 |
+
};
|
| 1648 |
+
var $_11ympzlbjfuw8q9n = {
|
| 1649 |
+
first: first$1,
|
| 1650 |
+
ancestor: ancestor,
|
| 1651 |
+
closest: closest,
|
| 1652 |
+
sibling: sibling,
|
| 1653 |
+
child: child$1,
|
| 1654 |
+
descendant: descendant
|
| 1655 |
+
};
|
| 1656 |
+
|
| 1657 |
+
var first$2 = function (selector) {
|
| 1658 |
+
return $_enn9uikjjfuw8q6w.one(selector);
|
| 1659 |
+
};
|
| 1660 |
+
var ancestor$1 = function (scope, selector, isRoot) {
|
| 1661 |
+
return $_11ympzlbjfuw8q9n.ancestor(scope, function (e) {
|
| 1662 |
+
return $_enn9uikjjfuw8q6w.is(e, selector);
|
| 1663 |
+
}, isRoot);
|
| 1664 |
+
};
|
| 1665 |
+
var sibling$1 = function (scope, selector) {
|
| 1666 |
+
return $_11ympzlbjfuw8q9n.sibling(scope, function (e) {
|
| 1667 |
+
return $_enn9uikjjfuw8q6w.is(e, selector);
|
| 1668 |
+
});
|
| 1669 |
+
};
|
| 1670 |
+
var child$2 = function (scope, selector) {
|
| 1671 |
+
return $_11ympzlbjfuw8q9n.child(scope, function (e) {
|
| 1672 |
+
return $_enn9uikjjfuw8q6w.is(e, selector);
|
| 1673 |
+
});
|
| 1674 |
+
};
|
| 1675 |
+
var descendant$1 = function (scope, selector) {
|
| 1676 |
+
return $_enn9uikjjfuw8q6w.one(selector, scope);
|
| 1677 |
+
};
|
| 1678 |
+
var closest$1 = function (scope, selector, isRoot) {
|
| 1679 |
+
return ClosestOrAncestor($_enn9uikjjfuw8q6w.is, ancestor$1, scope, selector, isRoot);
|
| 1680 |
+
};
|
| 1681 |
+
var $_8wdrbmlajfuw8q9m = {
|
| 1682 |
+
first: first$2,
|
| 1683 |
+
ancestor: ancestor$1,
|
| 1684 |
+
sibling: sibling$1,
|
| 1685 |
+
child: child$2,
|
| 1686 |
+
descendant: descendant$1,
|
| 1687 |
+
closest: closest$1
|
| 1688 |
+
};
|
| 1689 |
+
|
| 1690 |
+
var lookup = function (tags, element, _isRoot) {
|
| 1691 |
+
var isRoot = _isRoot !== undefined ? _isRoot : $_20nfr6k7jfuw8q4g.constant(false);
|
| 1692 |
+
if (isRoot(element))
|
| 1693 |
+
return Option.none();
|
| 1694 |
+
if ($_tyr3yk5jfuw8q47.contains(tags, $_a8gk30l6jfuw8q9c.name(element)))
|
| 1695 |
+
return Option.some(element);
|
| 1696 |
+
var isRootOrUpperTable = function (element) {
|
| 1697 |
+
return $_enn9uikjjfuw8q6w.is(element, 'table') || isRoot(element);
|
| 1698 |
+
};
|
| 1699 |
+
return $_8wdrbmlajfuw8q9m.ancestor(element, tags.join(','), isRootOrUpperTable);
|
| 1700 |
+
};
|
| 1701 |
+
var cell = function (element, isRoot) {
|
| 1702 |
+
return lookup([
|
| 1703 |
+
'td',
|
| 1704 |
+
'th'
|
| 1705 |
+
], element, isRoot);
|
| 1706 |
+
};
|
| 1707 |
+
var cells = function (ancestor) {
|
| 1708 |
+
return $_2g609akijfuw8q6n.firstLayer(ancestor, 'th,td');
|
| 1709 |
+
};
|
| 1710 |
+
var notCell = function (element, isRoot) {
|
| 1711 |
+
return lookup([
|
| 1712 |
+
'caption',
|
| 1713 |
+
'tr',
|
| 1714 |
+
'tbody',
|
| 1715 |
+
'tfoot',
|
| 1716 |
+
'thead'
|
| 1717 |
+
], element, isRoot);
|
| 1718 |
+
};
|
| 1719 |
+
var neighbours = function (selector, element) {
|
| 1720 |
+
return $_s8scrkmjfuw8q7a.parent(element).map(function (parent) {
|
| 1721 |
+
return $_6c9d0hl7jfuw8q9d.children(parent, selector);
|
| 1722 |
+
});
|
| 1723 |
+
};
|
| 1724 |
+
var neighbourCells = $_20nfr6k7jfuw8q4g.curry(neighbours, 'th,td');
|
| 1725 |
+
var neighbourRows = $_20nfr6k7jfuw8q4g.curry(neighbours, 'tr');
|
| 1726 |
+
var firstCell = function (ancestor) {
|
| 1727 |
+
return $_8wdrbmlajfuw8q9m.descendant(ancestor, 'th,td');
|
| 1728 |
+
};
|
| 1729 |
+
var table = function (element, isRoot) {
|
| 1730 |
+
return $_8wdrbmlajfuw8q9m.closest(element, 'table', isRoot);
|
| 1731 |
+
};
|
| 1732 |
+
var row = function (element, isRoot) {
|
| 1733 |
+
return lookup(['tr'], element, isRoot);
|
| 1734 |
+
};
|
| 1735 |
+
var rows = function (ancestor) {
|
| 1736 |
+
return $_2g609akijfuw8q6n.firstLayer(ancestor, 'tr');
|
| 1737 |
+
};
|
| 1738 |
+
var attr = function (element, property) {
|
| 1739 |
+
return parseInt($_3q82t2l5jfuw8q93.get(element, property), 10);
|
| 1740 |
+
};
|
| 1741 |
+
var grid$1 = function (element, rowProp, colProp) {
|
| 1742 |
+
var rows = attr(element, rowProp);
|
| 1743 |
+
var cols = attr(element, colProp);
|
| 1744 |
+
return $_ce5pyrkgjfuw8q5v.grid(rows, cols);
|
| 1745 |
+
};
|
| 1746 |
+
var $_aqhz9okhjfuw8q5y = {
|
| 1747 |
+
cell: cell,
|
| 1748 |
+
firstCell: firstCell,
|
| 1749 |
+
cells: cells,
|
| 1750 |
+
neighbourCells: neighbourCells,
|
| 1751 |
+
table: table,
|
| 1752 |
+
row: row,
|
| 1753 |
+
rows: rows,
|
| 1754 |
+
notCell: notCell,
|
| 1755 |
+
neighbourRows: neighbourRows,
|
| 1756 |
+
attr: attr,
|
| 1757 |
+
grid: grid$1
|
| 1758 |
+
};
|
| 1759 |
+
|
| 1760 |
+
var fromTable = function (table) {
|
| 1761 |
+
var rows = $_aqhz9okhjfuw8q5y.rows(table);
|
| 1762 |
+
return $_tyr3yk5jfuw8q47.map(rows, function (row) {
|
| 1763 |
+
var element = row;
|
| 1764 |
+
var parent = $_s8scrkmjfuw8q7a.parent(element);
|
| 1765 |
+
var parentSection = parent.bind(function (parent) {
|
| 1766 |
+
var parentName = $_a8gk30l6jfuw8q9c.name(parent);
|
| 1767 |
+
return parentName === 'tfoot' || parentName === 'thead' || parentName === 'tbody' ? parentName : 'tbody';
|
| 1768 |
+
});
|
| 1769 |
+
var cells = $_tyr3yk5jfuw8q47.map($_aqhz9okhjfuw8q5y.cells(row), function (cell) {
|
| 1770 |
+
var rowspan = $_3q82t2l5jfuw8q93.has(cell, 'rowspan') ? parseInt($_3q82t2l5jfuw8q93.get(cell, 'rowspan'), 10) : 1;
|
| 1771 |
+
var colspan = $_3q82t2l5jfuw8q93.has(cell, 'colspan') ? parseInt($_3q82t2l5jfuw8q93.get(cell, 'colspan'), 10) : 1;
|
| 1772 |
+
return $_ce5pyrkgjfuw8q5v.detail(cell, rowspan, colspan);
|
| 1773 |
+
});
|
| 1774 |
+
return $_ce5pyrkgjfuw8q5v.rowdata(element, cells, parentSection);
|
| 1775 |
+
});
|
| 1776 |
+
};
|
| 1777 |
+
var fromPastedRows = function (rows, example) {
|
| 1778 |
+
return $_tyr3yk5jfuw8q47.map(rows, function (row) {
|
| 1779 |
+
var cells = $_tyr3yk5jfuw8q47.map($_aqhz9okhjfuw8q5y.cells(row), function (cell) {
|
| 1780 |
+
var rowspan = $_3q82t2l5jfuw8q93.has(cell, 'rowspan') ? parseInt($_3q82t2l5jfuw8q93.get(cell, 'rowspan'), 10) : 1;
|
| 1781 |
+
var colspan = $_3q82t2l5jfuw8q93.has(cell, 'colspan') ? parseInt($_3q82t2l5jfuw8q93.get(cell, 'colspan'), 10) : 1;
|
| 1782 |
+
return $_ce5pyrkgjfuw8q5v.detail(cell, rowspan, colspan);
|
| 1783 |
+
});
|
| 1784 |
+
return $_ce5pyrkgjfuw8q5v.rowdata(row, cells, example.section());
|
| 1785 |
+
});
|
| 1786 |
+
};
|
| 1787 |
+
var $_dy3x0nkfjfuw8q5l = {
|
| 1788 |
+
fromTable: fromTable,
|
| 1789 |
+
fromPastedRows: fromPastedRows
|
| 1790 |
+
};
|
| 1791 |
+
|
| 1792 |
+
var key = function (row, column) {
|
| 1793 |
+
return row + ',' + column;
|
| 1794 |
+
};
|
| 1795 |
+
var getAt = function (warehouse, row, column) {
|
| 1796 |
+
var raw = warehouse.access()[key(row, column)];
|
| 1797 |
+
return raw !== undefined ? Option.some(raw) : Option.none();
|
| 1798 |
+
};
|
| 1799 |
+
var findItem = function (warehouse, item, comparator) {
|
| 1800 |
+
var filtered = filterItems(warehouse, function (detail) {
|
| 1801 |
+
return comparator(item, detail.element());
|
| 1802 |
+
});
|
| 1803 |
+
return filtered.length > 0 ? Option.some(filtered[0]) : Option.none();
|
| 1804 |
+
};
|
| 1805 |
+
var filterItems = function (warehouse, predicate) {
|
| 1806 |
+
var all = $_tyr3yk5jfuw8q47.bind(warehouse.all(), function (r) {
|
| 1807 |
+
return r.cells();
|
| 1808 |
+
});
|
| 1809 |
+
return $_tyr3yk5jfuw8q47.filter(all, predicate);
|
| 1810 |
+
};
|
| 1811 |
+
var generate = function (list) {
|
| 1812 |
+
var access = {};
|
| 1813 |
+
var cells = [];
|
| 1814 |
+
var maxRows = list.length;
|
| 1815 |
+
var maxColumns = 0;
|
| 1816 |
+
$_tyr3yk5jfuw8q47.each(list, function (details, r) {
|
| 1817 |
+
var currentRow = [];
|
| 1818 |
+
$_tyr3yk5jfuw8q47.each(details.cells(), function (detail, c) {
|
| 1819 |
+
var start = 0;
|
| 1820 |
+
while (access[key(r, start)] !== undefined) {
|
| 1821 |
+
start++;
|
| 1822 |
+
}
|
| 1823 |
+
var current = $_ce5pyrkgjfuw8q5v.extended(detail.element(), detail.rowspan(), detail.colspan(), r, start);
|
| 1824 |
+
for (var i = 0; i < detail.colspan(); i++) {
|
| 1825 |
+
for (var j = 0; j < detail.rowspan(); j++) {
|
| 1826 |
+
var cr = r + j;
|
| 1827 |
+
var cc = start + i;
|
| 1828 |
+
var newpos = key(cr, cc);
|
| 1829 |
+
access[newpos] = current;
|
| 1830 |
+
maxColumns = Math.max(maxColumns, cc + 1);
|
| 1831 |
+
}
|
| 1832 |
+
}
|
| 1833 |
+
currentRow.push(current);
|
| 1834 |
+
});
|
| 1835 |
+
cells.push($_ce5pyrkgjfuw8q5v.rowdata(details.element(), currentRow, details.section()));
|
| 1836 |
+
});
|
| 1837 |
+
var grid = $_ce5pyrkgjfuw8q5v.grid(maxRows, maxColumns);
|
| 1838 |
+
return {
|
| 1839 |
+
grid: $_20nfr6k7jfuw8q4g.constant(grid),
|
| 1840 |
+
access: $_20nfr6k7jfuw8q4g.constant(access),
|
| 1841 |
+
all: $_20nfr6k7jfuw8q4g.constant(cells)
|
| 1842 |
+
};
|
| 1843 |
+
};
|
| 1844 |
+
var justCells = function (warehouse) {
|
| 1845 |
+
var rows = $_tyr3yk5jfuw8q47.map(warehouse.all(), function (w) {
|
| 1846 |
+
return w.cells();
|
| 1847 |
+
});
|
| 1848 |
+
return $_tyr3yk5jfuw8q47.flatten(rows);
|
| 1849 |
+
};
|
| 1850 |
+
var $_2ge24cldjfuw8qa3 = {
|
| 1851 |
+
generate: generate,
|
| 1852 |
+
getAt: getAt,
|
| 1853 |
+
findItem: findItem,
|
| 1854 |
+
filterItems: filterItems,
|
| 1855 |
+
justCells: justCells
|
| 1856 |
+
};
|
| 1857 |
+
|
| 1858 |
+
var isSupported = function (dom) {
|
| 1859 |
+
return dom.style !== undefined;
|
| 1860 |
+
};
|
| 1861 |
+
var $_b75qp5lfjfuw8qau = { isSupported: isSupported };
|
| 1862 |
+
|
| 1863 |
+
var internalSet = function (dom, property, value) {
|
| 1864 |
+
if (!$_g6mvnrk8jfuw8q4k.isString(value)) {
|
| 1865 |
+
console.error('Invalid call to CSS.set. Property ', property, ':: Value ', value, ':: Element ', dom);
|
| 1866 |
+
throw new Error('CSS value must be a string: ' + value);
|
| 1867 |
+
}
|
| 1868 |
+
if ($_b75qp5lfjfuw8qau.isSupported(dom))
|
| 1869 |
+
dom.style.setProperty(property, value);
|
| 1870 |
+
};
|
| 1871 |
+
var internalRemove = function (dom, property) {
|
| 1872 |
+
if ($_b75qp5lfjfuw8qau.isSupported(dom))
|
| 1873 |
+
dom.style.removeProperty(property);
|
| 1874 |
+
};
|
| 1875 |
+
var set$1 = function (element, property, value) {
|
| 1876 |
+
var dom = element.dom();
|
| 1877 |
+
internalSet(dom, property, value);
|
| 1878 |
+
};
|
| 1879 |
+
var setAll$1 = function (element, css) {
|
| 1880 |
+
var dom = element.dom();
|
| 1881 |
+
$_11yiupkajfuw8q5c.each(css, function (v, k) {
|
| 1882 |
+
internalSet(dom, k, v);
|
| 1883 |
+
});
|
| 1884 |
+
};
|
| 1885 |
+
var setOptions = function (element, css) {
|
| 1886 |
+
var dom = element.dom();
|
| 1887 |
+
$_11yiupkajfuw8q5c.each(css, function (v, k) {
|
| 1888 |
+
v.fold(function () {
|
| 1889 |
+
internalRemove(dom, k);
|
| 1890 |
+
}, function (value) {
|
| 1891 |
+
internalSet(dom, k, value);
|
| 1892 |
+
});
|
| 1893 |
+
});
|
| 1894 |
+
};
|
| 1895 |
+
var get$1 = function (element, property) {
|
| 1896 |
+
var dom = element.dom();
|
| 1897 |
+
var styles = window.getComputedStyle(dom);
|
| 1898 |
+
var r = styles.getPropertyValue(property);
|
| 1899 |
+
var v = r === '' && !$_atd1tul9jfuw8q9i.inBody(element) ? getUnsafeProperty(dom, property) : r;
|
| 1900 |
+
return v === null ? undefined : v;
|
| 1901 |
+
};
|
| 1902 |
+
var getUnsafeProperty = function (dom, property) {
|
| 1903 |
+
return $_b75qp5lfjfuw8qau.isSupported(dom) ? dom.style.getPropertyValue(property) : '';
|
| 1904 |
+
};
|
| 1905 |
+
var getRaw = function (element, property) {
|
| 1906 |
+
var dom = element.dom();
|
| 1907 |
+
var raw = getUnsafeProperty(dom, property);
|
| 1908 |
+
return Option.from(raw).filter(function (r) {
|
| 1909 |
+
return r.length > 0;
|
| 1910 |
+
});
|
| 1911 |
+
};
|
| 1912 |
+
var getAllRaw = function (element) {
|
| 1913 |
+
var css = {};
|
| 1914 |
+
var dom = element.dom();
|
| 1915 |
+
if ($_b75qp5lfjfuw8qau.isSupported(dom)) {
|
| 1916 |
+
for (var i = 0; i < dom.style.length; i++) {
|
| 1917 |
+
var ruleName = dom.style.item(i);
|
| 1918 |
+
css[ruleName] = dom.style[ruleName];
|
| 1919 |
+
}
|
| 1920 |
+
}
|
| 1921 |
+
return css;
|
| 1922 |
+
};
|
| 1923 |
+
var isValidValue = function (tag, property, value) {
|
| 1924 |
+
var element = $_xbeoqkkjfuw8q73.fromTag(tag);
|
| 1925 |
+
set$1(element, property, value);
|
| 1926 |
+
var style = getRaw(element, property);
|
| 1927 |
+
return style.isSome();
|
| 1928 |
+
};
|
| 1929 |
+
var remove$1 = function (element, property) {
|
| 1930 |
+
var dom = element.dom();
|
| 1931 |
+
internalRemove(dom, property);
|
| 1932 |
+
if ($_3q82t2l5jfuw8q93.has(element, 'style') && $_ey09l9l2jfuw8q8y.trim($_3q82t2l5jfuw8q93.get(element, 'style')) === '') {
|
| 1933 |
+
$_3q82t2l5jfuw8q93.remove(element, 'style');
|
| 1934 |
+
}
|
| 1935 |
+
};
|
| 1936 |
+
var preserve = function (element, f) {
|
| 1937 |
+
var oldStyles = $_3q82t2l5jfuw8q93.get(element, 'style');
|
| 1938 |
+
var result = f(element);
|
| 1939 |
+
var restore = oldStyles === undefined ? $_3q82t2l5jfuw8q93.remove : $_3q82t2l5jfuw8q93.set;
|
| 1940 |
+
restore(element, 'style', oldStyles);
|
| 1941 |
+
return result;
|
| 1942 |
+
};
|
| 1943 |
+
var copy = function (source, target) {
|
| 1944 |
+
var sourceDom = source.dom();
|
| 1945 |
+
var targetDom = target.dom();
|
| 1946 |
+
if ($_b75qp5lfjfuw8qau.isSupported(sourceDom) && $_b75qp5lfjfuw8qau.isSupported(targetDom)) {
|
| 1947 |
+
targetDom.style.cssText = sourceDom.style.cssText;
|
| 1948 |
+
}
|
| 1949 |
+
};
|
| 1950 |
+
var reflow = function (e) {
|
| 1951 |
+
return e.dom().offsetWidth;
|
| 1952 |
+
};
|
| 1953 |
+
var transferOne$1 = function (source, destination, style) {
|
| 1954 |
+
getRaw(source, style).each(function (value) {
|
| 1955 |
+
if (getRaw(destination, style).isNone())
|
| 1956 |
+
set$1(destination, style, value);
|
| 1957 |
+
});
|
| 1958 |
+
};
|
| 1959 |
+
var transfer$1 = function (source, destination, styles) {
|
| 1960 |
+
if (!$_a8gk30l6jfuw8q9c.isElement(source) || !$_a8gk30l6jfuw8q9c.isElement(destination))
|
| 1961 |
+
return;
|
| 1962 |
+
$_tyr3yk5jfuw8q47.each(styles, function (style) {
|
| 1963 |
+
transferOne$1(source, destination, style);
|
| 1964 |
+
});
|
| 1965 |
+
};
|
| 1966 |
+
var $_bfod2hlejfuw8qac = {
|
| 1967 |
+
copy: copy,
|
| 1968 |
+
set: set$1,
|
| 1969 |
+
preserve: preserve,
|
| 1970 |
+
setAll: setAll$1,
|
| 1971 |
+
setOptions: setOptions,
|
| 1972 |
+
remove: remove$1,
|
| 1973 |
+
get: get$1,
|
| 1974 |
+
getRaw: getRaw,
|
| 1975 |
+
getAllRaw: getAllRaw,
|
| 1976 |
+
isValidValue: isValidValue,
|
| 1977 |
+
reflow: reflow,
|
| 1978 |
+
transfer: transfer$1
|
| 1979 |
+
};
|
| 1980 |
+
|
| 1981 |
+
var before = function (marker, element) {
|
| 1982 |
+
var parent = $_s8scrkmjfuw8q7a.parent(marker);
|
| 1983 |
+
parent.each(function (v) {
|
| 1984 |
+
v.dom().insertBefore(element.dom(), marker.dom());
|
| 1985 |
+
});
|
| 1986 |
+
};
|
| 1987 |
+
var after = function (marker, element) {
|
| 1988 |
+
var sibling = $_s8scrkmjfuw8q7a.nextSibling(marker);
|
| 1989 |
+
sibling.fold(function () {
|
| 1990 |
+
var parent = $_s8scrkmjfuw8q7a.parent(marker);
|
| 1991 |
+
parent.each(function (v) {
|
| 1992 |
+
append(v, element);
|
| 1993 |
+
});
|
| 1994 |
+
}, function (v) {
|
| 1995 |
+
before(v, element);
|
| 1996 |
+
});
|
| 1997 |
+
};
|
| 1998 |
+
var prepend = function (parent, element) {
|
| 1999 |
+
var firstChild = $_s8scrkmjfuw8q7a.firstChild(parent);
|
| 2000 |
+
firstChild.fold(function () {
|
| 2001 |
+
append(parent, element);
|
| 2002 |
+
}, function (v) {
|
| 2003 |
+
parent.dom().insertBefore(element.dom(), v.dom());
|
| 2004 |
+
});
|
| 2005 |
+
};
|
| 2006 |
+
var append = function (parent, element) {
|
| 2007 |
+
parent.dom().appendChild(element.dom());
|
| 2008 |
+
};
|
| 2009 |
+
var appendAt = function (parent, element, index) {
|
| 2010 |
+
$_s8scrkmjfuw8q7a.child(parent, index).fold(function () {
|
| 2011 |
+
append(parent, element);
|
| 2012 |
+
}, function (v) {
|
| 2013 |
+
before(v, element);
|
| 2014 |
+
});
|
| 2015 |
+
};
|
| 2016 |
+
var wrap = function (element, wrapper) {
|
| 2017 |
+
before(element, wrapper);
|
| 2018 |
+
append(wrapper, element);
|
| 2019 |
+
};
|
| 2020 |
+
var $_fatuxylgjfuw8qav = {
|
| 2021 |
+
before: before,
|
| 2022 |
+
after: after,
|
| 2023 |
+
prepend: prepend,
|
| 2024 |
+
append: append,
|
| 2025 |
+
appendAt: appendAt,
|
| 2026 |
+
wrap: wrap
|
| 2027 |
+
};
|
| 2028 |
+
|
| 2029 |
+
var before$1 = function (marker, elements) {
|
| 2030 |
+
$_tyr3yk5jfuw8q47.each(elements, function (x) {
|
| 2031 |
+
$_fatuxylgjfuw8qav.before(marker, x);
|
| 2032 |
+
});
|
| 2033 |
+
};
|
| 2034 |
+
var after$1 = function (marker, elements) {
|
| 2035 |
+
$_tyr3yk5jfuw8q47.each(elements, function (x, i) {
|
| 2036 |
+
var e = i === 0 ? marker : elements[i - 1];
|
| 2037 |
+
$_fatuxylgjfuw8qav.after(e, x);
|
| 2038 |
+
});
|
| 2039 |
+
};
|
| 2040 |
+
var prepend$1 = function (parent, elements) {
|
| 2041 |
+
$_tyr3yk5jfuw8q47.each(elements.slice().reverse(), function (x) {
|
| 2042 |
+
$_fatuxylgjfuw8qav.prepend(parent, x);
|
| 2043 |
+
});
|
| 2044 |
+
};
|
| 2045 |
+
var append$1 = function (parent, elements) {
|
| 2046 |
+
$_tyr3yk5jfuw8q47.each(elements, function (x) {
|
| 2047 |
+
$_fatuxylgjfuw8qav.append(parent, x);
|
| 2048 |
+
});
|
| 2049 |
+
};
|
| 2050 |
+
var $_9zaoqflijfuw8qb0 = {
|
| 2051 |
+
before: before$1,
|
| 2052 |
+
after: after$1,
|
| 2053 |
+
prepend: prepend$1,
|
| 2054 |
+
append: append$1
|
| 2055 |
+
};
|
| 2056 |
+
|
| 2057 |
+
var empty = function (element) {
|
| 2058 |
+
element.dom().textContent = '';
|
| 2059 |
+
$_tyr3yk5jfuw8q47.each($_s8scrkmjfuw8q7a.children(element), function (rogue) {
|
| 2060 |
+
remove$2(rogue);
|
| 2061 |
+
});
|
| 2062 |
+
};
|
| 2063 |
+
var remove$2 = function (element) {
|
| 2064 |
+
var dom = element.dom();
|
| 2065 |
+
if (dom.parentNode !== null)
|
| 2066 |
+
dom.parentNode.removeChild(dom);
|
| 2067 |
+
};
|
| 2068 |
+
var unwrap = function (wrapper) {
|
| 2069 |
+
var children = $_s8scrkmjfuw8q7a.children(wrapper);
|
| 2070 |
+
if (children.length > 0)
|
| 2071 |
+
$_9zaoqflijfuw8qb0.before(wrapper, children);
|
| 2072 |
+
remove$2(wrapper);
|
| 2073 |
+
};
|
| 2074 |
+
var $_fl1deelhjfuw8qax = {
|
| 2075 |
+
empty: empty,
|
| 2076 |
+
remove: remove$2,
|
| 2077 |
+
unwrap: unwrap
|
| 2078 |
+
};
|
| 2079 |
+
|
| 2080 |
+
var stats = $_5now9kbjfuw8q5e.immutable('minRow', 'minCol', 'maxRow', 'maxCol');
|
| 2081 |
+
var findSelectedStats = function (house, isSelected) {
|
| 2082 |
+
var totalColumns = house.grid().columns();
|
| 2083 |
+
var totalRows = house.grid().rows();
|
| 2084 |
+
var minRow = totalRows;
|
| 2085 |
+
var minCol = totalColumns;
|
| 2086 |
+
var maxRow = 0;
|
| 2087 |
+
var maxCol = 0;
|
| 2088 |
+
$_11yiupkajfuw8q5c.each(house.access(), function (detail) {
|
| 2089 |
+
if (isSelected(detail)) {
|
| 2090 |
+
var startRow = detail.row();
|
| 2091 |
+
var endRow = startRow + detail.rowspan() - 1;
|
| 2092 |
+
var startCol = detail.column();
|
| 2093 |
+
var endCol = startCol + detail.colspan() - 1;
|
| 2094 |
+
if (startRow < minRow)
|
| 2095 |
+
minRow = startRow;
|
| 2096 |
+
else if (endRow > maxRow)
|
| 2097 |
+
maxRow = endRow;
|
| 2098 |
+
if (startCol < minCol)
|
| 2099 |
+
minCol = startCol;
|
| 2100 |
+
else if (endCol > maxCol)
|
| 2101 |
+
maxCol = endCol;
|
| 2102 |
+
}
|
| 2103 |
+
});
|
| 2104 |
+
return stats(minRow, minCol, maxRow, maxCol);
|
| 2105 |
+
};
|
| 2106 |
+
var makeCell = function (list, seenSelected, rowIndex) {
|
| 2107 |
+
var row = list[rowIndex].element();
|
| 2108 |
+
var td = $_xbeoqkkjfuw8q73.fromTag('td');
|
| 2109 |
+
$_fatuxylgjfuw8qav.append(td, $_xbeoqkkjfuw8q73.fromTag('br'));
|
| 2110 |
+
var f = seenSelected ? $_fatuxylgjfuw8qav.append : $_fatuxylgjfuw8qav.prepend;
|
| 2111 |
+
f(row, td);
|
| 2112 |
+
};
|
| 2113 |
+
var fillInGaps = function (list, house, stats, isSelected) {
|
| 2114 |
+
var totalColumns = house.grid().columns();
|
| 2115 |
+
var totalRows = house.grid().rows();
|
| 2116 |
+
for (var i = 0; i < totalRows; i++) {
|
| 2117 |
+
var seenSelected = false;
|
| 2118 |
+
for (var j = 0; j < totalColumns; j++) {
|
| 2119 |
+
if (!(i < stats.minRow() || i > stats.maxRow() || j < stats.minCol() || j > stats.maxCol())) {
|
| 2120 |
+
var needCell = $_2ge24cldjfuw8qa3.getAt(house, i, j).filter(isSelected).isNone();
|
| 2121 |
+
if (needCell)
|
| 2122 |
+
makeCell(list, seenSelected, i);
|
| 2123 |
+
else
|
| 2124 |
+
seenSelected = true;
|
| 2125 |
+
}
|
| 2126 |
+
}
|
| 2127 |
+
}
|
| 2128 |
+
};
|
| 2129 |
+
var clean = function (table, stats) {
|
| 2130 |
+
var emptyRows = $_tyr3yk5jfuw8q47.filter($_2g609akijfuw8q6n.firstLayer(table, 'tr'), function (row) {
|
| 2131 |
+
return row.dom().childElementCount === 0;
|
| 2132 |
+
});
|
| 2133 |
+
$_tyr3yk5jfuw8q47.each(emptyRows, $_fl1deelhjfuw8qax.remove);
|
| 2134 |
+
if (stats.minCol() === stats.maxCol() || stats.minRow() === stats.maxRow()) {
|
| 2135 |
+
$_tyr3yk5jfuw8q47.each($_2g609akijfuw8q6n.firstLayer(table, 'th,td'), function (cell) {
|
| 2136 |
+
$_3q82t2l5jfuw8q93.remove(cell, 'rowspan');
|
| 2137 |
+
$_3q82t2l5jfuw8q93.remove(cell, 'colspan');
|
| 2138 |
+
});
|
| 2139 |
+
}
|
| 2140 |
+
$_3q82t2l5jfuw8q93.remove(table, 'width');
|
| 2141 |
+
$_3q82t2l5jfuw8q93.remove(table, 'height');
|
| 2142 |
+
$_bfod2hlejfuw8qac.remove(table, 'width');
|
| 2143 |
+
$_bfod2hlejfuw8qac.remove(table, 'height');
|
| 2144 |
+
};
|
| 2145 |
+
var extract = function (table, selectedSelector) {
|
| 2146 |
+
var isSelected = function (detail) {
|
| 2147 |
+
return $_enn9uikjjfuw8q6w.is(detail.element(), selectedSelector);
|
| 2148 |
+
};
|
| 2149 |
+
var list = $_dy3x0nkfjfuw8q5l.fromTable(table);
|
| 2150 |
+
var house = $_2ge24cldjfuw8qa3.generate(list);
|
| 2151 |
+
var stats = findSelectedStats(house, isSelected);
|
| 2152 |
+
var selector = 'th:not(' + selectedSelector + ')' + ',td:not(' + selectedSelector + ')';
|
| 2153 |
+
var unselectedCells = $_2g609akijfuw8q6n.filterFirstLayer(table, 'th,td', function (cell) {
|
| 2154 |
+
return $_enn9uikjjfuw8q6w.is(cell, selector);
|
| 2155 |
+
});
|
| 2156 |
+
$_tyr3yk5jfuw8q47.each(unselectedCells, $_fl1deelhjfuw8qax.remove);
|
| 2157 |
+
fillInGaps(list, house, stats, isSelected);
|
| 2158 |
+
clean(table, stats);
|
| 2159 |
+
return table;
|
| 2160 |
+
};
|
| 2161 |
+
var $_bbpooak9jfuw8q4m = { extract: extract };
|
| 2162 |
+
|
| 2163 |
+
var clone$1 = function (original, deep) {
|
| 2164 |
+
return $_xbeoqkkjfuw8q73.fromDom(original.dom().cloneNode(deep));
|
| 2165 |
+
};
|
| 2166 |
+
var shallow = function (original) {
|
| 2167 |
+
return clone$1(original, false);
|
| 2168 |
+
};
|
| 2169 |
+
var deep = function (original) {
|
| 2170 |
+
return clone$1(original, true);
|
| 2171 |
+
};
|
| 2172 |
+
var shallowAs = function (original, tag) {
|
| 2173 |
+
var nu = $_xbeoqkkjfuw8q73.fromTag(tag);
|
| 2174 |
+
var attributes = $_3q82t2l5jfuw8q93.clone(original);
|
| 2175 |
+
$_3q82t2l5jfuw8q93.setAll(nu, attributes);
|
| 2176 |
+
return nu;
|
| 2177 |
+
};
|
| 2178 |
+
var copy$1 = function (original, tag) {
|
| 2179 |
+
var nu = shallowAs(original, tag);
|
| 2180 |
+
var cloneChildren = $_s8scrkmjfuw8q7a.children(deep(original));
|
| 2181 |
+
$_9zaoqflijfuw8qb0.append(nu, cloneChildren);
|
| 2182 |
+
return nu;
|
| 2183 |
+
};
|
| 2184 |
+
var mutate = function (original, tag) {
|
| 2185 |
+
var nu = shallowAs(original, tag);
|
| 2186 |
+
$_fatuxylgjfuw8qav.before(original, nu);
|
| 2187 |
+
var children = $_s8scrkmjfuw8q7a.children(original);
|
| 2188 |
+
$_9zaoqflijfuw8qb0.append(nu, children);
|
| 2189 |
+
$_fl1deelhjfuw8qax.remove(original);
|
| 2190 |
+
return nu;
|
| 2191 |
+
};
|
| 2192 |
+
var $_ddvp06lkjfuw8qbt = {
|
| 2193 |
+
shallow: shallow,
|
| 2194 |
+
shallowAs: shallowAs,
|
| 2195 |
+
deep: deep,
|
| 2196 |
+
copy: copy$1,
|
| 2197 |
+
mutate: mutate
|
| 2198 |
+
};
|
| 2199 |
+
|
| 2200 |
+
function NodeValue (is, name) {
|
| 2201 |
+
var get = function (element) {
|
| 2202 |
+
if (!is(element))
|
| 2203 |
+
throw new Error('Can only get ' + name + ' value of a ' + name + ' node');
|
| 2204 |
+
return getOption(element).getOr('');
|
| 2205 |
+
};
|
| 2206 |
+
var getOptionIE10 = function (element) {
|
| 2207 |
+
try {
|
| 2208 |
+
return getOptionSafe(element);
|
| 2209 |
+
} catch (e) {
|
| 2210 |
+
return Option.none();
|
| 2211 |
+
}
|
| 2212 |
+
};
|
| 2213 |
+
var getOptionSafe = function (element) {
|
| 2214 |
+
return is(element) ? Option.from(element.dom().nodeValue) : Option.none();
|
| 2215 |
+
};
|
| 2216 |
+
var browser = $_fqgee0ktjfuw8q83.detect().browser;
|
| 2217 |
+
var getOption = browser.isIE() && browser.version.major === 10 ? getOptionIE10 : getOptionSafe;
|
| 2218 |
+
var set = function (element, value) {
|
| 2219 |
+
if (!is(element))
|
| 2220 |
+
throw new Error('Can only set raw ' + name + ' value of a ' + name + ' node');
|
| 2221 |
+
element.dom().nodeValue = value;
|
| 2222 |
+
};
|
| 2223 |
+
return {
|
| 2224 |
+
get: get,
|
| 2225 |
+
getOption: getOption,
|
| 2226 |
+
set: set
|
| 2227 |
+
};
|
| 2228 |
+
}
|
| 2229 |
+
|
| 2230 |
+
var api = NodeValue($_a8gk30l6jfuw8q9c.isText, 'text');
|
| 2231 |
+
var get$2 = function (element) {
|
| 2232 |
+
return api.get(element);
|
| 2233 |
+
};
|
| 2234 |
+
var getOption = function (element) {
|
| 2235 |
+
return api.getOption(element);
|
| 2236 |
+
};
|
| 2237 |
+
var set$2 = function (element, value) {
|
| 2238 |
+
api.set(element, value);
|
| 2239 |
+
};
|
| 2240 |
+
var $_6j8y7blnjfuw8qc3 = {
|
| 2241 |
+
get: get$2,
|
| 2242 |
+
getOption: getOption,
|
| 2243 |
+
set: set$2
|
| 2244 |
+
};
|
| 2245 |
+
|
| 2246 |
+
var getEnd = function (element) {
|
| 2247 |
+
return $_a8gk30l6jfuw8q9c.name(element) === 'img' ? 1 : $_6j8y7blnjfuw8qc3.getOption(element).fold(function () {
|
| 2248 |
+
return $_s8scrkmjfuw8q7a.children(element).length;
|
| 2249 |
+
}, function (v) {
|
| 2250 |
+
return v.length;
|
| 2251 |
+
});
|
| 2252 |
+
};
|
| 2253 |
+
var isEnd = function (element, offset) {
|
| 2254 |
+
return getEnd(element) === offset;
|
| 2255 |
+
};
|
| 2256 |
+
var isStart = function (element, offset) {
|
| 2257 |
+
return offset === 0;
|
| 2258 |
+
};
|
| 2259 |
+
var NBSP = '\xA0';
|
| 2260 |
+
var isTextNodeWithCursorPosition = function (el) {
|
| 2261 |
+
return $_6j8y7blnjfuw8qc3.getOption(el).filter(function (text) {
|
| 2262 |
+
return text.trim().length !== 0 || text.indexOf(NBSP) > -1;
|
| 2263 |
+
}).isSome();
|
| 2264 |
+
};
|
| 2265 |
+
var elementsWithCursorPosition = [
|
| 2266 |
+
'img',
|
| 2267 |
+
'br'
|
| 2268 |
+
];
|
| 2269 |
+
var isCursorPosition = function (elem) {
|
| 2270 |
+
var hasCursorPosition = isTextNodeWithCursorPosition(elem);
|
| 2271 |
+
return hasCursorPosition || $_tyr3yk5jfuw8q47.contains(elementsWithCursorPosition, $_a8gk30l6jfuw8q9c.name(elem));
|
| 2272 |
+
};
|
| 2273 |
+
var $_6vfowrlmjfuw8qbz = {
|
| 2274 |
+
getEnd: getEnd,
|
| 2275 |
+
isEnd: isEnd,
|
| 2276 |
+
isStart: isStart,
|
| 2277 |
+
isCursorPosition: isCursorPosition
|
| 2278 |
+
};
|
| 2279 |
+
|
| 2280 |
+
var first$3 = function (element) {
|
| 2281 |
+
return $_11ympzlbjfuw8q9n.descendant(element, $_6vfowrlmjfuw8qbz.isCursorPosition);
|
| 2282 |
+
};
|
| 2283 |
+
var last$2 = function (element) {
|
| 2284 |
+
return descendantRtl(element, $_6vfowrlmjfuw8qbz.isCursorPosition);
|
| 2285 |
+
};
|
| 2286 |
+
var descendantRtl = function (scope, predicate) {
|
| 2287 |
+
var descend = function (element) {
|
| 2288 |
+
var children = $_s8scrkmjfuw8q7a.children(element);
|
| 2289 |
+
for (var i = children.length - 1; i >= 0; i--) {
|
| 2290 |
+
var child = children[i];
|
| 2291 |
+
if (predicate(child))
|
| 2292 |
+
return Option.some(child);
|
| 2293 |
+
var res = descend(child);
|
| 2294 |
+
if (res.isSome())
|
| 2295 |
+
return res;
|
| 2296 |
+
}
|
| 2297 |
+
return Option.none();
|
| 2298 |
+
};
|
| 2299 |
+
return descend(scope);
|
| 2300 |
+
};
|
| 2301 |
+
var $_ejrzj4lljfuw8qbw = {
|
| 2302 |
+
first: first$3,
|
| 2303 |
+
last: last$2
|
| 2304 |
+
};
|
| 2305 |
+
|
| 2306 |
+
var cell$1 = function () {
|
| 2307 |
+
var td = $_xbeoqkkjfuw8q73.fromTag('td');
|
| 2308 |
+
$_fatuxylgjfuw8qav.append(td, $_xbeoqkkjfuw8q73.fromTag('br'));
|
| 2309 |
+
return td;
|
| 2310 |
+
};
|
| 2311 |
+
var replace = function (cell, tag, attrs) {
|
| 2312 |
+
var replica = $_ddvp06lkjfuw8qbt.copy(cell, tag);
|
| 2313 |
+
$_11yiupkajfuw8q5c.each(attrs, function (v, k) {
|
| 2314 |
+
if (v === null)
|
| 2315 |
+
$_3q82t2l5jfuw8q93.remove(replica, k);
|
| 2316 |
+
else
|
| 2317 |
+
$_3q82t2l5jfuw8q93.set(replica, k, v);
|
| 2318 |
+
});
|
| 2319 |
+
return replica;
|
| 2320 |
+
};
|
| 2321 |
+
var pasteReplace = function (cellContent) {
|
| 2322 |
+
return cellContent;
|
| 2323 |
+
};
|
| 2324 |
+
var newRow = function (doc) {
|
| 2325 |
+
return function () {
|
| 2326 |
+
return $_xbeoqkkjfuw8q73.fromTag('tr', doc.dom());
|
| 2327 |
+
};
|
| 2328 |
+
};
|
| 2329 |
+
var cloneFormats = function (oldCell, newCell, formats) {
|
| 2330 |
+
var first = $_ejrzj4lljfuw8qbw.first(oldCell);
|
| 2331 |
+
return first.map(function (firstText) {
|
| 2332 |
+
var formatSelector = formats.join(',');
|
| 2333 |
+
var parents = $_6c9d0hl7jfuw8q9d.ancestors(firstText, formatSelector, function (element) {
|
| 2334 |
+
return $_e8rn66kojfuw8q7n.eq(element, oldCell);
|
| 2335 |
+
});
|
| 2336 |
+
return $_tyr3yk5jfuw8q47.foldr(parents, function (last, parent) {
|
| 2337 |
+
var clonedFormat = $_ddvp06lkjfuw8qbt.shallow(parent);
|
| 2338 |
+
$_fatuxylgjfuw8qav.append(last, clonedFormat);
|
| 2339 |
+
return clonedFormat;
|
| 2340 |
+
}, newCell);
|
| 2341 |
+
}).getOr(newCell);
|
| 2342 |
+
};
|
| 2343 |
+
var cellOperations = function (mutate, doc, formatsToClone) {
|
| 2344 |
+
var newCell = function (prev) {
|
| 2345 |
+
var doc = $_s8scrkmjfuw8q7a.owner(prev.element());
|
| 2346 |
+
var td = $_xbeoqkkjfuw8q73.fromTag($_a8gk30l6jfuw8q9c.name(prev.element()), doc.dom());
|
| 2347 |
+
var formats = formatsToClone.getOr([
|
| 2348 |
+
'strong',
|
| 2349 |
+
'em',
|
| 2350 |
+
'b',
|
| 2351 |
+
'i',
|
| 2352 |
+
'span',
|
| 2353 |
+
'font',
|
| 2354 |
+
'h1',
|
| 2355 |
+
'h2',
|
| 2356 |
+
'h3',
|
| 2357 |
+
'h4',
|
| 2358 |
+
'h5',
|
| 2359 |
+
'h6',
|
| 2360 |
+
'p',
|
| 2361 |
+
'div'
|
| 2362 |
+
]);
|
| 2363 |
+
var lastNode = formats.length > 0 ? cloneFormats(prev.element(), td, formats) : td;
|
| 2364 |
+
$_fatuxylgjfuw8qav.append(lastNode, $_xbeoqkkjfuw8q73.fromTag('br'));
|
| 2365 |
+
$_bfod2hlejfuw8qac.copy(prev.element(), td);
|
| 2366 |
+
$_bfod2hlejfuw8qac.remove(td, 'height');
|
| 2367 |
+
if (prev.colspan() !== 1)
|
| 2368 |
+
$_bfod2hlejfuw8qac.remove(prev.element(), 'width');
|
| 2369 |
+
mutate(prev.element(), td);
|
| 2370 |
+
return td;
|
| 2371 |
+
};
|
| 2372 |
+
return {
|
| 2373 |
+
row: newRow(doc),
|
| 2374 |
+
cell: newCell,
|
| 2375 |
+
replace: replace,
|
| 2376 |
+
gap: cell$1
|
| 2377 |
+
};
|
| 2378 |
+
};
|
| 2379 |
+
var paste = function (doc) {
|
| 2380 |
+
return {
|
| 2381 |
+
row: newRow(doc),
|
| 2382 |
+
cell: cell$1,
|
| 2383 |
+
replace: pasteReplace,
|
| 2384 |
+
gap: cell$1
|
| 2385 |
+
};
|
| 2386 |
+
};
|
| 2387 |
+
var $_5ohg1eljjfuw8qb4 = {
|
| 2388 |
+
cellOperations: cellOperations,
|
| 2389 |
+
paste: paste
|
| 2390 |
+
};
|
| 2391 |
+
|
| 2392 |
+
var fromHtml$1 = function (html, scope) {
|
| 2393 |
+
var doc = scope || document;
|
| 2394 |
+
var div = doc.createElement('div');
|
| 2395 |
+
div.innerHTML = html;
|
| 2396 |
+
return $_s8scrkmjfuw8q7a.children($_xbeoqkkjfuw8q73.fromDom(div));
|
| 2397 |
+
};
|
| 2398 |
+
var fromTags = function (tags, scope) {
|
| 2399 |
+
return $_tyr3yk5jfuw8q47.map(tags, function (x) {
|
| 2400 |
+
return $_xbeoqkkjfuw8q73.fromTag(x, scope);
|
| 2401 |
+
});
|
| 2402 |
+
};
|
| 2403 |
+
var fromText$1 = function (texts, scope) {
|
| 2404 |
+
return $_tyr3yk5jfuw8q47.map(texts, function (x) {
|
| 2405 |
+
return $_xbeoqkkjfuw8q73.fromText(x, scope);
|
| 2406 |
+
});
|
| 2407 |
+
};
|
| 2408 |
+
var fromDom$1 = function (nodes) {
|
| 2409 |
+
return $_tyr3yk5jfuw8q47.map(nodes, $_xbeoqkkjfuw8q73.fromDom);
|
| 2410 |
+
};
|
| 2411 |
+
var $_du13u9lpjfuw8qce = {
|
| 2412 |
+
fromHtml: fromHtml$1,
|
| 2413 |
+
fromTags: fromTags,
|
| 2414 |
+
fromText: fromText$1,
|
| 2415 |
+
fromDom: fromDom$1
|
| 2416 |
+
};
|
| 2417 |
+
|
| 2418 |
+
var TagBoundaries = [
|
| 2419 |
+
'body',
|
| 2420 |
+
'p',
|
| 2421 |
+
'div',
|
| 2422 |
+
'article',
|
| 2423 |
+
'aside',
|
| 2424 |
+
'figcaption',
|
| 2425 |
+
'figure',
|
| 2426 |
+
'footer',
|
| 2427 |
+
'header',
|
| 2428 |
+
'nav',
|
| 2429 |
+
'section',
|
| 2430 |
+
'ol',
|
| 2431 |
+
'ul',
|
| 2432 |
+
'li',
|
| 2433 |
+
'table',
|
| 2434 |
+
'thead',
|
| 2435 |
+
'tbody',
|
| 2436 |
+
'tfoot',
|
| 2437 |
+
'caption',
|
| 2438 |
+
'tr',
|
| 2439 |
+
'td',
|
| 2440 |
+
'th',
|
| 2441 |
+
'h1',
|
| 2442 |
+
'h2',
|
| 2443 |
+
'h3',
|
| 2444 |
+
'h4',
|
| 2445 |
+
'h5',
|
| 2446 |
+
'h6',
|
| 2447 |
+
'blockquote',
|
| 2448 |
+
'pre',
|
| 2449 |
+
'address'
|
| 2450 |
+
];
|
| 2451 |
+
|
| 2452 |
+
function DomUniverse () {
|
| 2453 |
+
var clone = function (element) {
|
| 2454 |
+
return $_xbeoqkkjfuw8q73.fromDom(element.dom().cloneNode(false));
|
| 2455 |
+
};
|
| 2456 |
+
var isBoundary = function (element) {
|
| 2457 |
+
if (!$_a8gk30l6jfuw8q9c.isElement(element))
|
| 2458 |
+
return false;
|
| 2459 |
+
if ($_a8gk30l6jfuw8q9c.name(element) === 'body')
|
| 2460 |
+
return true;
|
| 2461 |
+
return $_tyr3yk5jfuw8q47.contains(TagBoundaries, $_a8gk30l6jfuw8q9c.name(element));
|
| 2462 |
+
};
|
| 2463 |
+
var isEmptyTag = function (element) {
|
| 2464 |
+
if (!$_a8gk30l6jfuw8q9c.isElement(element))
|
| 2465 |
+
return false;
|
| 2466 |
+
return $_tyr3yk5jfuw8q47.contains([
|
| 2467 |
+
'br',
|
| 2468 |
+
'img',
|
| 2469 |
+
'hr',
|
| 2470 |
+
'input'
|
| 2471 |
+
], $_a8gk30l6jfuw8q9c.name(element));
|
| 2472 |
+
};
|
| 2473 |
+
var comparePosition = function (element, other) {
|
| 2474 |
+
return element.dom().compareDocumentPosition(other.dom());
|
| 2475 |
+
};
|
| 2476 |
+
var copyAttributesTo = function (source, destination) {
|
| 2477 |
+
var as = $_3q82t2l5jfuw8q93.clone(source);
|
| 2478 |
+
$_3q82t2l5jfuw8q93.setAll(destination, as);
|
| 2479 |
+
};
|
| 2480 |
+
return {
|
| 2481 |
+
up: $_20nfr6k7jfuw8q4g.constant({
|
| 2482 |
+
selector: $_8wdrbmlajfuw8q9m.ancestor,
|
| 2483 |
+
closest: $_8wdrbmlajfuw8q9m.closest,
|
| 2484 |
+
predicate: $_11ympzlbjfuw8q9n.ancestor,
|
| 2485 |
+
all: $_s8scrkmjfuw8q7a.parents
|
| 2486 |
+
}),
|
| 2487 |
+
down: $_20nfr6k7jfuw8q4g.constant({
|
| 2488 |
+
selector: $_6c9d0hl7jfuw8q9d.descendants,
|
| 2489 |
+
predicate: $_4d3nfbl8jfuw8q9f.descendants
|
| 2490 |
+
}),
|
| 2491 |
+
styles: $_20nfr6k7jfuw8q4g.constant({
|
| 2492 |
+
get: $_bfod2hlejfuw8qac.get,
|
| 2493 |
+
getRaw: $_bfod2hlejfuw8qac.getRaw,
|
| 2494 |
+
set: $_bfod2hlejfuw8qac.set,
|
| 2495 |
+
remove: $_bfod2hlejfuw8qac.remove
|
| 2496 |
+
}),
|
| 2497 |
+
attrs: $_20nfr6k7jfuw8q4g.constant({
|
| 2498 |
+
get: $_3q82t2l5jfuw8q93.get,
|
| 2499 |
+
set: $_3q82t2l5jfuw8q93.set,
|
| 2500 |
+
remove: $_3q82t2l5jfuw8q93.remove,
|
| 2501 |
+
copyTo: copyAttributesTo
|
| 2502 |
+
}),
|
| 2503 |
+
insert: $_20nfr6k7jfuw8q4g.constant({
|
| 2504 |
+
before: $_fatuxylgjfuw8qav.before,
|
| 2505 |
+
after: $_fatuxylgjfuw8qav.after,
|
| 2506 |
+
afterAll: $_9zaoqflijfuw8qb0.after,
|
| 2507 |
+
append: $_fatuxylgjfuw8qav.append,
|
| 2508 |
+
appendAll: $_9zaoqflijfuw8qb0.append,
|
| 2509 |
+
prepend: $_fatuxylgjfuw8qav.prepend,
|
| 2510 |
+
wrap: $_fatuxylgjfuw8qav.wrap
|
| 2511 |
+
}),
|
| 2512 |
+
remove: $_20nfr6k7jfuw8q4g.constant({
|
| 2513 |
+
unwrap: $_fl1deelhjfuw8qax.unwrap,
|
| 2514 |
+
remove: $_fl1deelhjfuw8qax.remove
|
| 2515 |
+
}),
|
| 2516 |
+
create: $_20nfr6k7jfuw8q4g.constant({
|
| 2517 |
+
nu: $_xbeoqkkjfuw8q73.fromTag,
|
| 2518 |
+
clone: clone,
|
| 2519 |
+
text: $_xbeoqkkjfuw8q73.fromText
|
| 2520 |
+
}),
|
| 2521 |
+
query: $_20nfr6k7jfuw8q4g.constant({
|
| 2522 |
+
comparePosition: comparePosition,
|
| 2523 |
+
prevSibling: $_s8scrkmjfuw8q7a.prevSibling,
|
| 2524 |
+
nextSibling: $_s8scrkmjfuw8q7a.nextSibling
|
| 2525 |
+
}),
|
| 2526 |
+
property: $_20nfr6k7jfuw8q4g.constant({
|
| 2527 |
+
children: $_s8scrkmjfuw8q7a.children,
|
| 2528 |
+
name: $_a8gk30l6jfuw8q9c.name,
|
| 2529 |
+
parent: $_s8scrkmjfuw8q7a.parent,
|
| 2530 |
+
isText: $_a8gk30l6jfuw8q9c.isText,
|
| 2531 |
+
isComment: $_a8gk30l6jfuw8q9c.isComment,
|
| 2532 |
+
isElement: $_a8gk30l6jfuw8q9c.isElement,
|
| 2533 |
+
getText: $_6j8y7blnjfuw8qc3.get,
|
| 2534 |
+
setText: $_6j8y7blnjfuw8qc3.set,
|
| 2535 |
+
isBoundary: isBoundary,
|
| 2536 |
+
isEmptyTag: isEmptyTag
|
| 2537 |
+
}),
|
| 2538 |
+
eq: $_e8rn66kojfuw8q7n.eq,
|
| 2539 |
+
is: $_e8rn66kojfuw8q7n.is
|
| 2540 |
+
};
|
| 2541 |
+
}
|
| 2542 |
+
|
| 2543 |
+
var leftRight = $_5now9kbjfuw8q5e.immutable('left', 'right');
|
| 2544 |
+
var bisect = function (universe, parent, child) {
|
| 2545 |
+
var children = universe.property().children(parent);
|
| 2546 |
+
var index = $_tyr3yk5jfuw8q47.findIndex(children, $_20nfr6k7jfuw8q4g.curry(universe.eq, child));
|
| 2547 |
+
return index.map(function (ind) {
|
| 2548 |
+
return {
|
| 2549 |
+
before: $_20nfr6k7jfuw8q4g.constant(children.slice(0, ind)),
|
| 2550 |
+
after: $_20nfr6k7jfuw8q4g.constant(children.slice(ind + 1))
|
| 2551 |
+
};
|
| 2552 |
+
});
|
| 2553 |
+
};
|
| 2554 |
+
var breakToRight = function (universe, parent, child) {
|
| 2555 |
+
return bisect(universe, parent, child).map(function (parts) {
|
| 2556 |
+
var second = universe.create().clone(parent);
|
| 2557 |
+
universe.insert().appendAll(second, parts.after());
|
| 2558 |
+
universe.insert().after(parent, second);
|
| 2559 |
+
return leftRight(parent, second);
|
| 2560 |
+
});
|
| 2561 |
+
};
|
| 2562 |
+
var breakToLeft = function (universe, parent, child) {
|
| 2563 |
+
return bisect(universe, parent, child).map(function (parts) {
|
| 2564 |
+
var prior = universe.create().clone(parent);
|
| 2565 |
+
universe.insert().appendAll(prior, parts.before().concat([child]));
|
| 2566 |
+
universe.insert().appendAll(parent, parts.after());
|
| 2567 |
+
universe.insert().before(parent, prior);
|
| 2568 |
+
return leftRight(prior, parent);
|
| 2569 |
+
});
|
| 2570 |
+
};
|
| 2571 |
+
var breakPath = function (universe, item, isTop, breaker) {
|
| 2572 |
+
var result = $_5now9kbjfuw8q5e.immutable('first', 'second', 'splits');
|
| 2573 |
+
var next = function (child, group, splits) {
|
| 2574 |
+
var fallback = result(child, Option.none(), splits);
|
| 2575 |
+
if (isTop(child))
|
| 2576 |
+
return result(child, group, splits);
|
| 2577 |
+
else {
|
| 2578 |
+
return universe.property().parent(child).bind(function (parent) {
|
| 2579 |
+
return breaker(universe, parent, child).map(function (breakage) {
|
| 2580 |
+
var extra = [{
|
| 2581 |
+
first: breakage.left,
|
| 2582 |
+
second: breakage.right
|
| 2583 |
+
}];
|
| 2584 |
+
var nextChild = isTop(parent) ? parent : breakage.left();
|
| 2585 |
+
return next(nextChild, Option.some(breakage.right()), splits.concat(extra));
|
| 2586 |
+
}).getOr(fallback);
|
| 2587 |
+
});
|
| 2588 |
+
}
|
| 2589 |
+
};
|
| 2590 |
+
return next(item, Option.none(), []);
|
| 2591 |
+
};
|
| 2592 |
+
var $_fx4c5ilyjfuw8qf8 = {
|
| 2593 |
+
breakToLeft: breakToLeft,
|
| 2594 |
+
breakToRight: breakToRight,
|
| 2595 |
+
breakPath: breakPath
|
| 2596 |
+
};
|
| 2597 |
+
|
| 2598 |
+
var all$3 = function (universe, look, elements, f) {
|
| 2599 |
+
var head = elements[0];
|
| 2600 |
+
var tail = elements.slice(1);
|
| 2601 |
+
return f(universe, look, head, tail);
|
| 2602 |
+
};
|
| 2603 |
+
var oneAll = function (universe, look, elements) {
|
| 2604 |
+
return elements.length > 0 ? all$3(universe, look, elements, unsafeOne) : Option.none();
|
| 2605 |
+
};
|
| 2606 |
+
var unsafeOne = function (universe, look, head, tail) {
|
| 2607 |
+
var start = look(universe, head);
|
| 2608 |
+
return $_tyr3yk5jfuw8q47.foldr(tail, function (b, a) {
|
| 2609 |
+
var current = look(universe, a);
|
| 2610 |
+
return commonElement(universe, b, current);
|
| 2611 |
+
}, start);
|
| 2612 |
+
};
|
| 2613 |
+
var commonElement = function (universe, start, end) {
|
| 2614 |
+
return start.bind(function (s) {
|
| 2615 |
+
return end.filter($_20nfr6k7jfuw8q4g.curry(universe.eq, s));
|
| 2616 |
+
});
|
| 2617 |
+
};
|
| 2618 |
+
var $_40yiy6lzjfuw8qfi = { oneAll: oneAll };
|
| 2619 |
+
|
| 2620 |
+
var eq$1 = function (universe, item) {
|
| 2621 |
+
return $_20nfr6k7jfuw8q4g.curry(universe.eq, item);
|
| 2622 |
+
};
|
| 2623 |
+
var unsafeSubset = function (universe, common, ps1, ps2) {
|
| 2624 |
+
var children = universe.property().children(common);
|
| 2625 |
+
if (universe.eq(common, ps1[0]))
|
| 2626 |
+
return Option.some([ps1[0]]);
|
| 2627 |
+
if (universe.eq(common, ps2[0]))
|
| 2628 |
+
return Option.some([ps2[0]]);
|
| 2629 |
+
var finder = function (ps) {
|
| 2630 |
+
var topDown = $_tyr3yk5jfuw8q47.reverse(ps);
|
| 2631 |
+
var index = $_tyr3yk5jfuw8q47.findIndex(topDown, eq$1(universe, common)).getOr(-1);
|
| 2632 |
+
var item = index < topDown.length - 1 ? topDown[index + 1] : topDown[index];
|
| 2633 |
+
return $_tyr3yk5jfuw8q47.findIndex(children, eq$1(universe, item));
|
| 2634 |
+
};
|
| 2635 |
+
var startIndex = finder(ps1);
|
| 2636 |
+
var endIndex = finder(ps2);
|
| 2637 |
+
return startIndex.bind(function (sIndex) {
|
| 2638 |
+
return endIndex.map(function (eIndex) {
|
| 2639 |
+
var first = Math.min(sIndex, eIndex);
|
| 2640 |
+
var last = Math.max(sIndex, eIndex);
|
| 2641 |
+
return children.slice(first, last + 1);
|
| 2642 |
+
});
|
| 2643 |
+
});
|
| 2644 |
+
};
|
| 2645 |
+
var ancestors$2 = function (universe, start, end, _isRoot) {
|
| 2646 |
+
var isRoot = _isRoot !== undefined ? _isRoot : $_20nfr6k7jfuw8q4g.constant(false);
|
| 2647 |
+
var ps1 = [start].concat(universe.up().all(start));
|
| 2648 |
+
var ps2 = [end].concat(universe.up().all(end));
|
| 2649 |
+
var prune = function (path) {
|
| 2650 |
+
var index = $_tyr3yk5jfuw8q47.findIndex(path, isRoot);
|
| 2651 |
+
return index.fold(function () {
|
| 2652 |
+
return path;
|
| 2653 |
+
}, function (ind) {
|
| 2654 |
+
return path.slice(0, ind + 1);
|
| 2655 |
+
});
|
| 2656 |
+
};
|
| 2657 |
+
var pruned1 = prune(ps1);
|
| 2658 |
+
var pruned2 = prune(ps2);
|
| 2659 |
+
var shared = $_tyr3yk5jfuw8q47.find(pruned1, function (x) {
|
| 2660 |
+
return $_tyr3yk5jfuw8q47.exists(pruned2, eq$1(universe, x));
|
| 2661 |
+
});
|
| 2662 |
+
return {
|
| 2663 |
+
firstpath: $_20nfr6k7jfuw8q4g.constant(pruned1),
|
| 2664 |
+
secondpath: $_20nfr6k7jfuw8q4g.constant(pruned2),
|
| 2665 |
+
shared: $_20nfr6k7jfuw8q4g.constant(shared)
|
| 2666 |
+
};
|
| 2667 |
+
};
|
| 2668 |
+
var subset = function (universe, start, end) {
|
| 2669 |
+
var ancs = ancestors$2(universe, start, end);
|
| 2670 |
+
return ancs.shared().bind(function (shared) {
|
| 2671 |
+
return unsafeSubset(universe, shared, ancs.firstpath(), ancs.secondpath());
|
| 2672 |
+
});
|
| 2673 |
+
};
|
| 2674 |
+
var $_7m4t8jm0jfuw8qfq = {
|
| 2675 |
+
subset: subset,
|
| 2676 |
+
ancestors: ancestors$2
|
| 2677 |
+
};
|
| 2678 |
+
|
| 2679 |
+
var sharedOne = function (universe, look, elements) {
|
| 2680 |
+
return $_40yiy6lzjfuw8qfi.oneAll(universe, look, elements);
|
| 2681 |
+
};
|
| 2682 |
+
var subset$1 = function (universe, start, finish) {
|
| 2683 |
+
return $_7m4t8jm0jfuw8qfq.subset(universe, start, finish);
|
| 2684 |
+
};
|
| 2685 |
+
var ancestors$3 = function (universe, start, finish, _isRoot) {
|
| 2686 |
+
return $_7m4t8jm0jfuw8qfq.ancestors(universe, start, finish, _isRoot);
|
| 2687 |
+
};
|
| 2688 |
+
var breakToLeft$1 = function (universe, parent, child) {
|
| 2689 |
+
return $_fx4c5ilyjfuw8qf8.breakToLeft(universe, parent, child);
|
| 2690 |
+
};
|
| 2691 |
+
var breakToRight$1 = function (universe, parent, child) {
|
| 2692 |
+
return $_fx4c5ilyjfuw8qf8.breakToRight(universe, parent, child);
|
| 2693 |
+
};
|
| 2694 |
+
var breakPath$1 = function (universe, child, isTop, breaker) {
|
| 2695 |
+
return $_fx4c5ilyjfuw8qf8.breakPath(universe, child, isTop, breaker);
|
| 2696 |
+
};
|
| 2697 |
+
var $_23lsh2lxjfuw8qf5 = {
|
| 2698 |
+
sharedOne: sharedOne,
|
| 2699 |
+
subset: subset$1,
|
| 2700 |
+
ancestors: ancestors$3,
|
| 2701 |
+
breakToLeft: breakToLeft$1,
|
| 2702 |
+
breakToRight: breakToRight$1,
|
| 2703 |
+
breakPath: breakPath$1
|
| 2704 |
+
};
|
| 2705 |
+
|
| 2706 |
+
var universe = DomUniverse();
|
| 2707 |
+
var sharedOne$1 = function (look, elements) {
|
| 2708 |
+
return $_23lsh2lxjfuw8qf5.sharedOne(universe, function (universe, element) {
|
| 2709 |
+
return look(element);
|
| 2710 |
+
}, elements);
|
| 2711 |
+
};
|
| 2712 |
+
var subset$2 = function (start, finish) {
|
| 2713 |
+
return $_23lsh2lxjfuw8qf5.subset(universe, start, finish);
|
| 2714 |
+
};
|
| 2715 |
+
var ancestors$4 = function (start, finish, _isRoot) {
|
| 2716 |
+
return $_23lsh2lxjfuw8qf5.ancestors(universe, start, finish, _isRoot);
|
| 2717 |
+
};
|
| 2718 |
+
var breakToLeft$2 = function (parent, child) {
|
| 2719 |
+
return $_23lsh2lxjfuw8qf5.breakToLeft(universe, parent, child);
|
| 2720 |
+
};
|
| 2721 |
+
var breakToRight$2 = function (parent, child) {
|
| 2722 |
+
return $_23lsh2lxjfuw8qf5.breakToRight(universe, parent, child);
|
| 2723 |
+
};
|
| 2724 |
+
var breakPath$2 = function (child, isTop, breaker) {
|
| 2725 |
+
return $_23lsh2lxjfuw8qf5.breakPath(universe, child, isTop, function (u, p, c) {
|
| 2726 |
+
return breaker(p, c);
|
| 2727 |
+
});
|
| 2728 |
+
};
|
| 2729 |
+
var $_583a2nlujfuw8qdw = {
|
| 2730 |
+
sharedOne: sharedOne$1,
|
| 2731 |
+
subset: subset$2,
|
| 2732 |
+
ancestors: ancestors$4,
|
| 2733 |
+
breakToLeft: breakToLeft$2,
|
| 2734 |
+
breakToRight: breakToRight$2,
|
| 2735 |
+
breakPath: breakPath$2
|
| 2736 |
+
};
|
| 2737 |
+
|
| 2738 |
+
var inSelection = function (bounds, detail) {
|
| 2739 |
+
var leftEdge = detail.column();
|
| 2740 |
+
var rightEdge = detail.column() + detail.colspan() - 1;
|
| 2741 |
+
var topEdge = detail.row();
|
| 2742 |
+
var bottomEdge = detail.row() + detail.rowspan() - 1;
|
| 2743 |
+
return leftEdge <= bounds.finishCol() && rightEdge >= bounds.startCol() && (topEdge <= bounds.finishRow() && bottomEdge >= bounds.startRow());
|
| 2744 |
+
};
|
| 2745 |
+
var isWithin = function (bounds, detail) {
|
| 2746 |
+
return detail.column() >= bounds.startCol() && detail.column() + detail.colspan() - 1 <= bounds.finishCol() && detail.row() >= bounds.startRow() && detail.row() + detail.rowspan() - 1 <= bounds.finishRow();
|
| 2747 |
+
};
|
| 2748 |
+
var isRectangular = function (warehouse, bounds) {
|
| 2749 |
+
var isRect = true;
|
| 2750 |
+
var detailIsWithin = $_20nfr6k7jfuw8q4g.curry(isWithin, bounds);
|
| 2751 |
+
for (var i = bounds.startRow(); i <= bounds.finishRow(); i++) {
|
| 2752 |
+
for (var j = bounds.startCol(); j <= bounds.finishCol(); j++) {
|
| 2753 |
+
isRect = isRect && $_2ge24cldjfuw8qa3.getAt(warehouse, i, j).exists(detailIsWithin);
|
| 2754 |
+
}
|
| 2755 |
+
}
|
| 2756 |
+
return isRect ? Option.some(bounds) : Option.none();
|
| 2757 |
+
};
|
| 2758 |
+
var $_6nqrbhm3jfuw8qgd = {
|
| 2759 |
+
inSelection: inSelection,
|
| 2760 |
+
isWithin: isWithin,
|
| 2761 |
+
isRectangular: isRectangular
|
| 2762 |
+
};
|
| 2763 |
+
|
| 2764 |
+
var getBounds = function (detailA, detailB) {
|
| 2765 |
+
return $_ce5pyrkgjfuw8q5v.bounds(Math.min(detailA.row(), detailB.row()), Math.min(detailA.column(), detailB.column()), Math.max(detailA.row() + detailA.rowspan() - 1, detailB.row() + detailB.rowspan() - 1), Math.max(detailA.column() + detailA.colspan() - 1, detailB.column() + detailB.colspan() - 1));
|
| 2766 |
+
};
|
| 2767 |
+
var getAnyBox = function (warehouse, startCell, finishCell) {
|
| 2768 |
+
var startCoords = $_2ge24cldjfuw8qa3.findItem(warehouse, startCell, $_e8rn66kojfuw8q7n.eq);
|
| 2769 |
+
var finishCoords = $_2ge24cldjfuw8qa3.findItem(warehouse, finishCell, $_e8rn66kojfuw8q7n.eq);
|
| 2770 |
+
return startCoords.bind(function (sc) {
|
| 2771 |
+
return finishCoords.map(function (fc) {
|
| 2772 |
+
return getBounds(sc, fc);
|
| 2773 |
+
});
|
| 2774 |
+
});
|
| 2775 |
+
};
|
| 2776 |
+
var getBox = function (warehouse, startCell, finishCell) {
|
| 2777 |
+
return getAnyBox(warehouse, startCell, finishCell).bind(function (bounds) {
|
| 2778 |
+
return $_6nqrbhm3jfuw8qgd.isRectangular(warehouse, bounds);
|
| 2779 |
+
});
|
| 2780 |
+
};
|
| 2781 |
+
var $_ceqdh6m4jfuw8qgj = {
|
| 2782 |
+
getAnyBox: getAnyBox,
|
| 2783 |
+
getBox: getBox
|
| 2784 |
+
};
|
| 2785 |
+
|
| 2786 |
+
var moveBy = function (warehouse, cell, row, column) {
|
| 2787 |
+
return $_2ge24cldjfuw8qa3.findItem(warehouse, cell, $_e8rn66kojfuw8q7n.eq).bind(function (detail) {
|
| 2788 |
+
var startRow = row > 0 ? detail.row() + detail.rowspan() - 1 : detail.row();
|
| 2789 |
+
var startCol = column > 0 ? detail.column() + detail.colspan() - 1 : detail.column();
|
| 2790 |
+
var dest = $_2ge24cldjfuw8qa3.getAt(warehouse, startRow + row, startCol + column);
|
| 2791 |
+
return dest.map(function (d) {
|
| 2792 |
+
return d.element();
|
| 2793 |
+
});
|
| 2794 |
+
});
|
| 2795 |
+
};
|
| 2796 |
+
var intercepts = function (warehouse, start, finish) {
|
| 2797 |
+
return $_ceqdh6m4jfuw8qgj.getAnyBox(warehouse, start, finish).map(function (bounds) {
|
| 2798 |
+
var inside = $_2ge24cldjfuw8qa3.filterItems(warehouse, $_20nfr6k7jfuw8q4g.curry($_6nqrbhm3jfuw8qgd.inSelection, bounds));
|
| 2799 |
+
return $_tyr3yk5jfuw8q47.map(inside, function (detail) {
|
| 2800 |
+
return detail.element();
|
| 2801 |
+
});
|
| 2802 |
+
});
|
| 2803 |
+
};
|
| 2804 |
+
var parentCell = function (warehouse, innerCell) {
|
| 2805 |
+
var isContainedBy = function (c1, c2) {
|
| 2806 |
+
return $_e8rn66kojfuw8q7n.contains(c2, c1);
|
| 2807 |
+
};
|
| 2808 |
+
return $_2ge24cldjfuw8qa3.findItem(warehouse, innerCell, isContainedBy).bind(function (detail) {
|
| 2809 |
+
return detail.element();
|
| 2810 |
+
});
|
| 2811 |
+
};
|
| 2812 |
+
var $_fej9f9m2jfuw8qg6 = {
|
| 2813 |
+
moveBy: moveBy,
|
| 2814 |
+
intercepts: intercepts,
|
| 2815 |
+
parentCell: parentCell
|
| 2816 |
+
};
|
| 2817 |
+
|
| 2818 |
+
var moveBy$1 = function (cell, deltaRow, deltaColumn) {
|
| 2819 |
+
return $_aqhz9okhjfuw8q5y.table(cell).bind(function (table) {
|
| 2820 |
+
var warehouse = getWarehouse(table);
|
| 2821 |
+
return $_fej9f9m2jfuw8qg6.moveBy(warehouse, cell, deltaRow, deltaColumn);
|
| 2822 |
+
});
|
| 2823 |
+
};
|
| 2824 |
+
var intercepts$1 = function (table, first, last) {
|
| 2825 |
+
var warehouse = getWarehouse(table);
|
| 2826 |
+
return $_fej9f9m2jfuw8qg6.intercepts(warehouse, first, last);
|
| 2827 |
+
};
|
| 2828 |
+
var nestedIntercepts = function (table, first, firstTable, last, lastTable) {
|
| 2829 |
+
var warehouse = getWarehouse(table);
|
| 2830 |
+
var startCell = $_e8rn66kojfuw8q7n.eq(table, firstTable) ? first : $_fej9f9m2jfuw8qg6.parentCell(warehouse, first);
|
| 2831 |
+
var lastCell = $_e8rn66kojfuw8q7n.eq(table, lastTable) ? last : $_fej9f9m2jfuw8qg6.parentCell(warehouse, last);
|
| 2832 |
+
return $_fej9f9m2jfuw8qg6.intercepts(warehouse, startCell, lastCell);
|
| 2833 |
+
};
|
| 2834 |
+
var getBox$1 = function (table, first, last) {
|
| 2835 |
+
var warehouse = getWarehouse(table);
|
| 2836 |
+
return $_ceqdh6m4jfuw8qgj.getBox(warehouse, first, last);
|
| 2837 |
+
};
|
| 2838 |
+
var getWarehouse = function (table) {
|
| 2839 |
+
var list = $_dy3x0nkfjfuw8q5l.fromTable(table);
|
| 2840 |
+
return $_2ge24cldjfuw8qa3.generate(list);
|
| 2841 |
+
};
|
| 2842 |
+
var $_53tlnwm1jfuw8qg2 = {
|
| 2843 |
+
moveBy: moveBy$1,
|
| 2844 |
+
intercepts: intercepts$1,
|
| 2845 |
+
nestedIntercepts: nestedIntercepts,
|
| 2846 |
+
getBox: getBox$1
|
| 2847 |
+
};
|
| 2848 |
+
|
| 2849 |
+
var lookupTable = function (container, isRoot) {
|
| 2850 |
+
return $_8wdrbmlajfuw8q9m.ancestor(container, 'table');
|
| 2851 |
+
};
|
| 2852 |
+
var identified = $_5now9kbjfuw8q5e.immutableBag([
|
| 2853 |
+
'boxes',
|
| 2854 |
+
'start',
|
| 2855 |
+
'finish'
|
| 2856 |
+
], []);
|
| 2857 |
+
var identify = function (start, finish, isRoot) {
|
| 2858 |
+
var getIsRoot = function (rootTable) {
|
| 2859 |
+
return function (element) {
|
| 2860 |
+
return isRoot(element) || $_e8rn66kojfuw8q7n.eq(element, rootTable);
|
| 2861 |
+
};
|
| 2862 |
+
};
|
| 2863 |
+
if ($_e8rn66kojfuw8q7n.eq(start, finish)) {
|
| 2864 |
+
return Option.some(identified({
|
| 2865 |
+
boxes: Option.some([start]),
|
| 2866 |
+
start: start,
|
| 2867 |
+
finish: finish
|
| 2868 |
+
}));
|
| 2869 |
+
} else {
|
| 2870 |
+
return lookupTable(start, isRoot).bind(function (startTable) {
|
| 2871 |
+
return lookupTable(finish, isRoot).bind(function (finishTable) {
|
| 2872 |
+
if ($_e8rn66kojfuw8q7n.eq(startTable, finishTable)) {
|
| 2873 |
+
return Option.some(identified({
|
| 2874 |
+
boxes: $_53tlnwm1jfuw8qg2.intercepts(startTable, start, finish),
|
| 2875 |
+
start: start,
|
| 2876 |
+
finish: finish
|
| 2877 |
+
}));
|
| 2878 |
+
} else if ($_e8rn66kojfuw8q7n.contains(startTable, finishTable)) {
|
| 2879 |
+
var ancestorCells = $_6c9d0hl7jfuw8q9d.ancestors(finish, 'td,th', getIsRoot(startTable));
|
| 2880 |
+
var finishCell = ancestorCells.length > 0 ? ancestorCells[ancestorCells.length - 1] : finish;
|
| 2881 |
+
return Option.some(identified({
|
| 2882 |
+
boxes: $_53tlnwm1jfuw8qg2.nestedIntercepts(startTable, start, startTable, finish, finishTable),
|
| 2883 |
+
start: start,
|
| 2884 |
+
finish: finishCell
|
| 2885 |
+
}));
|
| 2886 |
+
} else if ($_e8rn66kojfuw8q7n.contains(finishTable, startTable)) {
|
| 2887 |
+
var ancestorCells = $_6c9d0hl7jfuw8q9d.ancestors(start, 'td,th', getIsRoot(finishTable));
|
| 2888 |
+
var startCell = ancestorCells.length > 0 ? ancestorCells[ancestorCells.length - 1] : start;
|
| 2889 |
+
return Option.some(identified({
|
| 2890 |
+
boxes: $_53tlnwm1jfuw8qg2.nestedIntercepts(finishTable, start, startTable, finish, finishTable),
|
| 2891 |
+
start: start,
|
| 2892 |
+
finish: startCell
|
| 2893 |
+
}));
|
| 2894 |
+
} else {
|
| 2895 |
+
return $_583a2nlujfuw8qdw.ancestors(start, finish).shared().bind(function (lca) {
|
| 2896 |
+
return $_8wdrbmlajfuw8q9m.closest(lca, 'table', isRoot).bind(function (lcaTable) {
|
| 2897 |
+
var finishAncestorCells = $_6c9d0hl7jfuw8q9d.ancestors(finish, 'td,th', getIsRoot(lcaTable));
|
| 2898 |
+
var finishCell = finishAncestorCells.length > 0 ? finishAncestorCells[finishAncestorCells.length - 1] : finish;
|
| 2899 |
+
var startAncestorCells = $_6c9d0hl7jfuw8q9d.ancestors(start, 'td,th', getIsRoot(lcaTable));
|
| 2900 |
+
var startCell = startAncestorCells.length > 0 ? startAncestorCells[startAncestorCells.length - 1] : start;
|
| 2901 |
+
return Option.some(identified({
|
| 2902 |
+
boxes: $_53tlnwm1jfuw8qg2.nestedIntercepts(lcaTable, start, startTable, finish, finishTable),
|
| 2903 |
+
start: startCell,
|
| 2904 |
+
finish: finishCell
|
| 2905 |
+
}));
|
| 2906 |
+
});
|
| 2907 |
+
});
|
| 2908 |
+
}
|
| 2909 |
+
});
|
| 2910 |
+
});
|
| 2911 |
+
}
|
| 2912 |
+
};
|
| 2913 |
+
var retrieve = function (container, selector) {
|
| 2914 |
+
var sels = $_6c9d0hl7jfuw8q9d.descendants(container, selector);
|
| 2915 |
+
return sels.length > 0 ? Option.some(sels) : Option.none();
|
| 2916 |
+
};
|
| 2917 |
+
var getLast = function (boxes, lastSelectedSelector) {
|
| 2918 |
+
return $_tyr3yk5jfuw8q47.find(boxes, function (box) {
|
| 2919 |
+
return $_enn9uikjjfuw8q6w.is(box, lastSelectedSelector);
|
| 2920 |
+
});
|
| 2921 |
+
};
|
| 2922 |
+
var getEdges = function (container, firstSelectedSelector, lastSelectedSelector) {
|
| 2923 |
+
return $_8wdrbmlajfuw8q9m.descendant(container, firstSelectedSelector).bind(function (first) {
|
| 2924 |
+
return $_8wdrbmlajfuw8q9m.descendant(container, lastSelectedSelector).bind(function (last) {
|
| 2925 |
+
return $_583a2nlujfuw8qdw.sharedOne(lookupTable, [
|
| 2926 |
+
first,
|
| 2927 |
+
last
|
| 2928 |
+
]).map(function (tbl) {
|
| 2929 |
+
return {
|
| 2930 |
+
first: $_20nfr6k7jfuw8q4g.constant(first),
|
| 2931 |
+
last: $_20nfr6k7jfuw8q4g.constant(last),
|
| 2932 |
+
table: $_20nfr6k7jfuw8q4g.constant(tbl)
|
| 2933 |
+
};
|
| 2934 |
+
});
|
| 2935 |
+
});
|
| 2936 |
+
});
|
| 2937 |
+
};
|
| 2938 |
+
var expandTo = function (finish, firstSelectedSelector) {
|
| 2939 |
+
return $_8wdrbmlajfuw8q9m.ancestor(finish, 'table').bind(function (table) {
|
| 2940 |
+
return $_8wdrbmlajfuw8q9m.descendant(table, firstSelectedSelector).bind(function (start) {
|
| 2941 |
+
return identify(start, finish).bind(function (identified) {
|
| 2942 |
+
return identified.boxes().map(function (boxes) {
|
| 2943 |
+
return {
|
| 2944 |
+
boxes: $_20nfr6k7jfuw8q4g.constant(boxes),
|
| 2945 |
+
start: $_20nfr6k7jfuw8q4g.constant(identified.start()),
|
| 2946 |
+
finish: $_20nfr6k7jfuw8q4g.constant(identified.finish())
|
| 2947 |
+
};
|
| 2948 |
+
});
|
| 2949 |
+
});
|
| 2950 |
+
});
|
| 2951 |
+
});
|
| 2952 |
+
};
|
| 2953 |
+
var shiftSelection = function (boxes, deltaRow, deltaColumn, firstSelectedSelector, lastSelectedSelector) {
|
| 2954 |
+
return getLast(boxes, lastSelectedSelector).bind(function (last) {
|
| 2955 |
+
return $_53tlnwm1jfuw8qg2.moveBy(last, deltaRow, deltaColumn).bind(function (finish) {
|
| 2956 |
+
return expandTo(finish, firstSelectedSelector);
|
| 2957 |
+
});
|
| 2958 |
+
});
|
| 2959 |
+
};
|
| 2960 |
+
var $_dpd405ltjfuw8qd8 = {
|
| 2961 |
+
identify: identify,
|
| 2962 |
+
retrieve: retrieve,
|
| 2963 |
+
shiftSelection: shiftSelection,
|
| 2964 |
+
getEdges: getEdges
|
| 2965 |
+
};
|
| 2966 |
+
|
| 2967 |
+
var retrieve$1 = function (container, selector) {
|
| 2968 |
+
return $_dpd405ltjfuw8qd8.retrieve(container, selector);
|
| 2969 |
+
};
|
| 2970 |
+
var retrieveBox = function (container, firstSelectedSelector, lastSelectedSelector) {
|
| 2971 |
+
return $_dpd405ltjfuw8qd8.getEdges(container, firstSelectedSelector, lastSelectedSelector).bind(function (edges) {
|
| 2972 |
+
var isRoot = function (ancestor) {
|
| 2973 |
+
return $_e8rn66kojfuw8q7n.eq(container, ancestor);
|
| 2974 |
+
};
|
| 2975 |
+
var firstAncestor = $_8wdrbmlajfuw8q9m.ancestor(edges.first(), 'thead,tfoot,tbody,table', isRoot);
|
| 2976 |
+
var lastAncestor = $_8wdrbmlajfuw8q9m.ancestor(edges.last(), 'thead,tfoot,tbody,table', isRoot);
|
| 2977 |
+
return firstAncestor.bind(function (fA) {
|
| 2978 |
+
return lastAncestor.bind(function (lA) {
|
| 2979 |
+
return $_e8rn66kojfuw8q7n.eq(fA, lA) ? $_53tlnwm1jfuw8qg2.getBox(edges.table(), edges.first(), edges.last()) : Option.none();
|
| 2980 |
+
});
|
| 2981 |
+
});
|
| 2982 |
+
});
|
| 2983 |
+
};
|
| 2984 |
+
var $_1mynollsjfuw8qcy = {
|
| 2985 |
+
retrieve: retrieve$1,
|
| 2986 |
+
retrieveBox: retrieveBox
|
| 2987 |
+
};
|
| 2988 |
+
|
| 2989 |
+
var selected = 'data-mce-selected';
|
| 2990 |
+
var selectedSelector = 'td[' + selected + '],th[' + selected + ']';
|
| 2991 |
+
var attributeSelector = '[' + selected + ']';
|
| 2992 |
+
var firstSelected = 'data-mce-first-selected';
|
| 2993 |
+
var firstSelectedSelector = 'td[' + firstSelected + '],th[' + firstSelected + ']';
|
| 2994 |
+
var lastSelected = 'data-mce-last-selected';
|
| 2995 |
+
var lastSelectedSelector = 'td[' + lastSelected + '],th[' + lastSelected + ']';
|
| 2996 |
+
var $_f8tr2nm5jfuw8qgp = {
|
| 2997 |
+
selected: $_20nfr6k7jfuw8q4g.constant(selected),
|
| 2998 |
+
selectedSelector: $_20nfr6k7jfuw8q4g.constant(selectedSelector),
|
| 2999 |
+
attributeSelector: $_20nfr6k7jfuw8q4g.constant(attributeSelector),
|
| 3000 |
+
firstSelected: $_20nfr6k7jfuw8q4g.constant(firstSelected),
|
| 3001 |
+
firstSelectedSelector: $_20nfr6k7jfuw8q4g.constant(firstSelectedSelector),
|
| 3002 |
+
lastSelected: $_20nfr6k7jfuw8q4g.constant(lastSelected),
|
| 3003 |
+
lastSelectedSelector: $_20nfr6k7jfuw8q4g.constant(lastSelectedSelector)
|
| 3004 |
+
};
|
| 3005 |
+
|
| 3006 |
+
var generate$1 = function (cases) {
|
| 3007 |
+
if (!$_g6mvnrk8jfuw8q4k.isArray(cases)) {
|
| 3008 |
+
throw new Error('cases must be an array');
|
| 3009 |
+
}
|
| 3010 |
+
if (cases.length === 0) {
|
| 3011 |
+
throw new Error('there must be at least one case');
|
| 3012 |
+
}
|
| 3013 |
+
var constructors = [];
|
| 3014 |
+
var adt = {};
|
| 3015 |
+
$_tyr3yk5jfuw8q47.each(cases, function (acase, count) {
|
| 3016 |
+
var keys = $_11yiupkajfuw8q5c.keys(acase);
|
| 3017 |
+
if (keys.length !== 1) {
|
| 3018 |
+
throw new Error('one and only one name per case');
|
| 3019 |
+
}
|
| 3020 |
+
var key = keys[0];
|
| 3021 |
+
var value = acase[key];
|
| 3022 |
+
if (adt[key] !== undefined) {
|
| 3023 |
+
throw new Error('duplicate key detected:' + key);
|
| 3024 |
+
} else if (key === 'cata') {
|
| 3025 |
+
throw new Error('cannot have a case named cata (sorry)');
|
| 3026 |
+
} else if (!$_g6mvnrk8jfuw8q4k.isArray(value)) {
|
| 3027 |
+
throw new Error('case arguments must be an array');
|
| 3028 |
+
}
|
| 3029 |
+
constructors.push(key);
|
| 3030 |
+
adt[key] = function () {
|
| 3031 |
+
var argLength = arguments.length;
|
| 3032 |
+
if (argLength !== value.length) {
|
| 3033 |
+
throw new Error('Wrong number of arguments to case ' + key + '. Expected ' + value.length + ' (' + value + '), got ' + argLength);
|
| 3034 |
+
}
|
| 3035 |
+
var args = new Array(argLength);
|
| 3036 |
+
for (var i = 0; i < args.length; i++)
|
| 3037 |
+
args[i] = arguments[i];
|
| 3038 |
+
var match = function (branches) {
|
| 3039 |
+
var branchKeys = $_11yiupkajfuw8q5c.keys(branches);
|
| 3040 |
+
if (constructors.length !== branchKeys.length) {
|
| 3041 |
+
throw new Error('Wrong number of arguments to match. Expected: ' + constructors.join(',') + '\nActual: ' + branchKeys.join(','));
|
| 3042 |
+
}
|
| 3043 |
+
var allReqd = $_tyr3yk5jfuw8q47.forall(constructors, function (reqKey) {
|
| 3044 |
+
return $_tyr3yk5jfuw8q47.contains(branchKeys, reqKey);
|
| 3045 |
+
});
|
| 3046 |
+
if (!allReqd)
|
| 3047 |
+
throw new Error('Not all branches were specified when using match. Specified: ' + branchKeys.join(', ') + '\nRequired: ' + constructors.join(', '));
|
| 3048 |
+
return branches[key].apply(null, args);
|
| 3049 |
+
};
|
| 3050 |
+
return {
|
| 3051 |
+
fold: function () {
|
| 3052 |
+
if (arguments.length !== cases.length) {
|
| 3053 |
+
throw new Error('Wrong number of arguments to fold. Expected ' + cases.length + ', got ' + arguments.length);
|
| 3054 |
+
}
|
| 3055 |
+
var target = arguments[count];
|
| 3056 |
+
return target.apply(null, args);
|
| 3057 |
+
},
|
| 3058 |
+
match: match,
|
| 3059 |
+
log: function (label) {
|
| 3060 |
+
console.log(label, {
|
| 3061 |
+
constructors: constructors,
|
| 3062 |
+
constructor: key,
|
| 3063 |
+
params: args
|
| 3064 |
+
});
|
| 3065 |
+
}
|
| 3066 |
+
};
|
| 3067 |
+
};
|
| 3068 |
+
});
|
| 3069 |
+
return adt;
|
| 3070 |
+
};
|
| 3071 |
+
var $_7sbzam7jfuw8qgu = { generate: generate$1 };
|
| 3072 |
+
|
| 3073 |
+
var type$1 = $_7sbzam7jfuw8qgu.generate([
|
| 3074 |
+
{ none: [] },
|
| 3075 |
+
{ multiple: ['elements'] },
|
| 3076 |
+
{ single: ['selection'] }
|
| 3077 |
+
]);
|
| 3078 |
+
var cata = function (subject, onNone, onMultiple, onSingle) {
|
| 3079 |
+
return subject.fold(onNone, onMultiple, onSingle);
|
| 3080 |
+
};
|
| 3081 |
+
var $_cx0pwam6jfuw8qgr = {
|
| 3082 |
+
cata: cata,
|
| 3083 |
+
none: type$1.none,
|
| 3084 |
+
multiple: type$1.multiple,
|
| 3085 |
+
single: type$1.single
|
| 3086 |
+
};
|
| 3087 |
+
|
| 3088 |
+
var selection = function (cell, selections) {
|
| 3089 |
+
return $_cx0pwam6jfuw8qgr.cata(selections.get(), $_20nfr6k7jfuw8q4g.constant([]), $_20nfr6k7jfuw8q4g.identity, $_20nfr6k7jfuw8q4g.constant([cell]));
|
| 3090 |
+
};
|
| 3091 |
+
var unmergable = function (cell, selections) {
|
| 3092 |
+
var hasSpan = function (elem) {
|
| 3093 |
+
return $_3q82t2l5jfuw8q93.has(elem, 'rowspan') && parseInt($_3q82t2l5jfuw8q93.get(elem, 'rowspan'), 10) > 1 || $_3q82t2l5jfuw8q93.has(elem, 'colspan') && parseInt($_3q82t2l5jfuw8q93.get(elem, 'colspan'), 10) > 1;
|
| 3094 |
+
};
|
| 3095 |
+
var candidates = selection(cell, selections);
|
| 3096 |
+
return candidates.length > 0 && $_tyr3yk5jfuw8q47.forall(candidates, hasSpan) ? Option.some(candidates) : Option.none();
|
| 3097 |
+
};
|
| 3098 |
+
var mergable = function (table, selections) {
|
| 3099 |
+
return $_cx0pwam6jfuw8qgr.cata(selections.get(), Option.none, function (cells, _env) {
|
| 3100 |
+
if (cells.length === 0) {
|
| 3101 |
+
return Option.none();
|
| 3102 |
+
}
|
| 3103 |
+
return $_1mynollsjfuw8qcy.retrieveBox(table, $_f8tr2nm5jfuw8qgp.firstSelectedSelector(), $_f8tr2nm5jfuw8qgp.lastSelectedSelector()).bind(function (bounds) {
|
| 3104 |
+
return cells.length > 1 ? Option.some({
|
| 3105 |
+
bounds: $_20nfr6k7jfuw8q4g.constant(bounds),
|
| 3106 |
+
cells: $_20nfr6k7jfuw8q4g.constant(cells)
|
| 3107 |
+
}) : Option.none();
|
| 3108 |
+
});
|
| 3109 |
+
}, Option.none);
|
| 3110 |
+
};
|
| 3111 |
+
var $_3xucu8lrjfuw8qco = {
|
| 3112 |
+
mergable: mergable,
|
| 3113 |
+
unmergable: unmergable,
|
| 3114 |
+
selection: selection
|
| 3115 |
+
};
|
| 3116 |
+
|
| 3117 |
+
var noMenu = function (cell) {
|
| 3118 |
+
return {
|
| 3119 |
+
element: $_20nfr6k7jfuw8q4g.constant(cell),
|
| 3120 |
+
mergable: Option.none,
|
| 3121 |
+
unmergable: Option.none,
|
| 3122 |
+
selection: $_20nfr6k7jfuw8q4g.constant([cell])
|
| 3123 |
+
};
|
| 3124 |
+
};
|
| 3125 |
+
var forMenu = function (selections, table, cell) {
|
| 3126 |
+
return {
|
| 3127 |
+
element: $_20nfr6k7jfuw8q4g.constant(cell),
|
| 3128 |
+
mergable: $_20nfr6k7jfuw8q4g.constant($_3xucu8lrjfuw8qco.mergable(table, selections)),
|
| 3129 |
+
unmergable: $_20nfr6k7jfuw8q4g.constant($_3xucu8lrjfuw8qco.unmergable(cell, selections)),
|
| 3130 |
+
selection: $_20nfr6k7jfuw8q4g.constant($_3xucu8lrjfuw8qco.selection(cell, selections))
|
| 3131 |
+
};
|
| 3132 |
+
};
|
| 3133 |
+
var notCell$1 = function (element) {
|
| 3134 |
+
return noMenu(element);
|
| 3135 |
+
};
|
| 3136 |
+
var paste$1 = $_5now9kbjfuw8q5e.immutable('element', 'clipboard', 'generators');
|
| 3137 |
+
var pasteRows = function (selections, table, cell, clipboard, generators) {
|
| 3138 |
+
return {
|
| 3139 |
+
element: $_20nfr6k7jfuw8q4g.constant(cell),
|
| 3140 |
+
mergable: Option.none,
|
| 3141 |
+
unmergable: Option.none,
|
| 3142 |
+
selection: $_20nfr6k7jfuw8q4g.constant($_3xucu8lrjfuw8qco.selection(cell, selections)),
|
| 3143 |
+
clipboard: $_20nfr6k7jfuw8q4g.constant(clipboard),
|
| 3144 |
+
generators: $_20nfr6k7jfuw8q4g.constant(generators)
|
| 3145 |
+
};
|
| 3146 |
+
};
|
| 3147 |
+
var $_5b7h1hlqjfuw8qci = {
|
| 3148 |
+
noMenu: noMenu,
|
| 3149 |
+
forMenu: forMenu,
|
| 3150 |
+
notCell: notCell$1,
|
| 3151 |
+
paste: paste$1,
|
| 3152 |
+
pasteRows: pasteRows
|
| 3153 |
+
};
|
| 3154 |
+
|
| 3155 |
+
var extractSelected = function (cells) {
|
| 3156 |
+
return $_aqhz9okhjfuw8q5y.table(cells[0]).map($_ddvp06lkjfuw8qbt.deep).map(function (replica) {
|
| 3157 |
+
return [$_bbpooak9jfuw8q4m.extract(replica, $_f8tr2nm5jfuw8qgp.attributeSelector())];
|
| 3158 |
+
});
|
| 3159 |
+
};
|
| 3160 |
+
var serializeElement = function (editor, elm) {
|
| 3161 |
+
return editor.selection.serializer.serialize(elm.dom(), {});
|
| 3162 |
+
};
|
| 3163 |
+
var registerEvents = function (editor, selections, actions, cellSelection) {
|
| 3164 |
+
editor.on('BeforeGetContent', function (e) {
|
| 3165 |
+
var multiCellContext = function (cells) {
|
| 3166 |
+
e.preventDefault();
|
| 3167 |
+
extractSelected(cells).each(function (elements) {
|
| 3168 |
+
e.content = $_tyr3yk5jfuw8q47.map(elements, function (elm) {
|
| 3169 |
+
return serializeElement(editor, elm);
|
| 3170 |
+
}).join('');
|
| 3171 |
+
});
|
| 3172 |
+
};
|
| 3173 |
+
if (e.selection === true) {
|
| 3174 |
+
$_cx0pwam6jfuw8qgr.cata(selections.get(), $_20nfr6k7jfuw8q4g.noop, multiCellContext, $_20nfr6k7jfuw8q4g.noop);
|
| 3175 |
+
}
|
| 3176 |
+
});
|
| 3177 |
+
editor.on('BeforeSetContent', function (e) {
|
| 3178 |
+
if (e.selection === true && e.paste === true) {
|
| 3179 |
+
var cellOpt = Option.from(editor.dom.getParent(editor.selection.getStart(), 'th,td'));
|
| 3180 |
+
cellOpt.each(function (domCell) {
|
| 3181 |
+
var cell = $_xbeoqkkjfuw8q73.fromDom(domCell);
|
| 3182 |
+
var table = $_aqhz9okhjfuw8q5y.table(cell);
|
| 3183 |
+
table.bind(function (table) {
|
| 3184 |
+
var elements = $_tyr3yk5jfuw8q47.filter($_du13u9lpjfuw8qce.fromHtml(e.content), function (content) {
|
| 3185 |
+
return $_a8gk30l6jfuw8q9c.name(content) !== 'meta';
|
| 3186 |
+
});
|
| 3187 |
+
if (elements.length === 1 && $_a8gk30l6jfuw8q9c.name(elements[0]) === 'table') {
|
| 3188 |
+
e.preventDefault();
|
| 3189 |
+
var doc = $_xbeoqkkjfuw8q73.fromDom(editor.getDoc());
|
| 3190 |
+
var generators = $_5ohg1eljjfuw8qb4.paste(doc);
|
| 3191 |
+
var targets = $_5b7h1hlqjfuw8qci.paste(cell, elements[0], generators);
|
| 3192 |
+
actions.pasteCells(table, targets).each(function (rng) {
|
| 3193 |
+
editor.selection.setRng(rng);
|
| 3194 |
+
editor.focus();
|
| 3195 |
+
cellSelection.clear(table);
|
| 3196 |
+
});
|
| 3197 |
+
}
|
| 3198 |
+
});
|
| 3199 |
+
});
|
| 3200 |
+
}
|
| 3201 |
+
});
|
| 3202 |
+
};
|
| 3203 |
+
var $_3y1hv8k4jfuw8q3l = { registerEvents: registerEvents };
|
| 3204 |
+
|
| 3205 |
+
function Dimension (name, getOffset) {
|
| 3206 |
+
var set = function (element, h) {
|
| 3207 |
+
if (!$_g6mvnrk8jfuw8q4k.isNumber(h) && !h.match(/^[0-9]+$/))
|
| 3208 |
+
throw name + '.set accepts only positive integer values. Value was ' + h;
|
| 3209 |
+
var dom = element.dom();
|
| 3210 |
+
if ($_b75qp5lfjfuw8qau.isSupported(dom))
|
| 3211 |
+
dom.style[name] = h + 'px';
|
| 3212 |
+
};
|
| 3213 |
+
var get = function (element) {
|
| 3214 |
+
var r = getOffset(element);
|
| 3215 |
+
if (r <= 0 || r === null) {
|
| 3216 |
+
var css = $_bfod2hlejfuw8qac.get(element, name);
|
| 3217 |
+
return parseFloat(css) || 0;
|
| 3218 |
+
}
|
| 3219 |
+
return r;
|
| 3220 |
+
};
|
| 3221 |
+
var getOuter = get;
|
| 3222 |
+
var aggregate = function (element, properties) {
|
| 3223 |
+
return $_tyr3yk5jfuw8q47.foldl(properties, function (acc, property) {
|
| 3224 |
+
var val = $_bfod2hlejfuw8qac.get(element, property);
|
| 3225 |
+
var value = val === undefined ? 0 : parseInt(val, 10);
|
| 3226 |
+
return isNaN(value) ? acc : acc + value;
|
| 3227 |
+
}, 0);
|
| 3228 |
+
};
|
| 3229 |
+
var max = function (element, value, properties) {
|
| 3230 |
+
var cumulativeInclusions = aggregate(element, properties);
|
| 3231 |
+
var absoluteMax = value > cumulativeInclusions ? value - cumulativeInclusions : 0;
|
| 3232 |
+
return absoluteMax;
|
| 3233 |
+
};
|
| 3234 |
+
return {
|
| 3235 |
+
set: set,
|
| 3236 |
+
get: get,
|
| 3237 |
+
getOuter: getOuter,
|
| 3238 |
+
aggregate: aggregate,
|
| 3239 |
+
max: max
|
| 3240 |
+
};
|
| 3241 |
+
}
|
| 3242 |
+
|
| 3243 |
+
var api$1 = Dimension('height', function (element) {
|
| 3244 |
+
return $_atd1tul9jfuw8q9i.inBody(element) ? element.dom().getBoundingClientRect().height : element.dom().offsetHeight;
|
| 3245 |
+
});
|
| 3246 |
+
var set$3 = function (element, h) {
|
| 3247 |
+
api$1.set(element, h);
|
| 3248 |
+
};
|
| 3249 |
+
var get$3 = function (element) {
|
| 3250 |
+
return api$1.get(element);
|
| 3251 |
+
};
|
| 3252 |
+
var getOuter = function (element) {
|
| 3253 |
+
return api$1.getOuter(element);
|
| 3254 |
+
};
|
| 3255 |
+
var setMax = function (element, value) {
|
| 3256 |
+
var inclusions = [
|
| 3257 |
+
'margin-top',
|
| 3258 |
+
'border-top-width',
|
| 3259 |
+
'padding-top',
|
| 3260 |
+
'padding-bottom',
|
| 3261 |
+
'border-bottom-width',
|
| 3262 |
+
'margin-bottom'
|
| 3263 |
+
];
|
| 3264 |
+
var absMax = api$1.max(element, value, inclusions);
|
| 3265 |
+
$_bfod2hlejfuw8qac.set(element, 'max-height', absMax + 'px');
|
| 3266 |
+
};
|
| 3267 |
+
var $_cymdhgmcjfuw8qif = {
|
| 3268 |
+
set: set$3,
|
| 3269 |
+
get: get$3,
|
| 3270 |
+
getOuter: getOuter,
|
| 3271 |
+
setMax: setMax
|
| 3272 |
+
};
|
| 3273 |
+
|
| 3274 |
+
var api$2 = Dimension('width', function (element) {
|
| 3275 |
+
return element.dom().offsetWidth;
|
| 3276 |
+
});
|
| 3277 |
+
var set$4 = function (element, h) {
|
| 3278 |
+
api$2.set(element, h);
|
| 3279 |
+
};
|
| 3280 |
+
var get$4 = function (element) {
|
| 3281 |
+
return api$2.get(element);
|
| 3282 |
+
};
|
| 3283 |
+
var getOuter$1 = function (element) {
|
| 3284 |
+
return api$2.getOuter(element);
|
| 3285 |
+
};
|
| 3286 |
+
var setMax$1 = function (element, value) {
|
| 3287 |
+
var inclusions = [
|
| 3288 |
+
'margin-left',
|
| 3289 |
+
'border-left-width',
|
| 3290 |
+
'padding-left',
|
| 3291 |
+
'padding-right',
|
| 3292 |
+
'border-right-width',
|
| 3293 |
+
'margin-right'
|
| 3294 |
+
];
|
| 3295 |
+
var absMax = api$2.max(element, value, inclusions);
|
| 3296 |
+
$_bfod2hlejfuw8qac.set(element, 'max-width', absMax + 'px');
|
| 3297 |
+
};
|
| 3298 |
+
var $_fj252lmejfuw8qin = {
|
| 3299 |
+
set: set$4,
|
| 3300 |
+
get: get$4,
|
| 3301 |
+
getOuter: getOuter$1,
|
| 3302 |
+
setMax: setMax$1
|
| 3303 |
+
};
|
| 3304 |
+
|
| 3305 |
+
var platform = $_fqgee0ktjfuw8q83.detect();
|
| 3306 |
+
var needManualCalc = function () {
|
| 3307 |
+
return platform.browser.isIE() || platform.browser.isEdge();
|
| 3308 |
+
};
|
| 3309 |
+
var toNumber = function (px, fallback) {
|
| 3310 |
+
var num = parseFloat(px);
|
| 3311 |
+
return isNaN(num) ? fallback : num;
|
| 3312 |
+
};
|
| 3313 |
+
var getProp = function (elm, name, fallback) {
|
| 3314 |
+
return toNumber($_bfod2hlejfuw8qac.get(elm, name), fallback);
|
| 3315 |
+
};
|
| 3316 |
+
var getCalculatedHeight = function (cell) {
|
| 3317 |
+
var paddingTop = getProp(cell, 'padding-top', 0);
|
| 3318 |
+
var paddingBottom = getProp(cell, 'padding-bottom', 0);
|
| 3319 |
+
var borderTop = getProp(cell, 'border-top-width', 0);
|
| 3320 |
+
var borderBottom = getProp(cell, 'border-bottom-width', 0);
|
| 3321 |
+
var height = cell.dom().getBoundingClientRect().height;
|
| 3322 |
+
var boxSizing = $_bfod2hlejfuw8qac.get(cell, 'box-sizing');
|
| 3323 |
+
var borders = borderTop + borderBottom;
|
| 3324 |
+
return boxSizing === 'border-box' ? height : height - paddingTop - paddingBottom - borders;
|
| 3325 |
+
};
|
| 3326 |
+
var getWidth = function (cell) {
|
| 3327 |
+
return getProp(cell, 'width', $_fj252lmejfuw8qin.get(cell));
|
| 3328 |
+
};
|
| 3329 |
+
var getHeight = function (cell) {
|
| 3330 |
+
return needManualCalc() ? getCalculatedHeight(cell) : getProp(cell, 'height', $_cymdhgmcjfuw8qif.get(cell));
|
| 3331 |
+
};
|
| 3332 |
+
var $_ddwgqpmbjfuw8qi6 = {
|
| 3333 |
+
getWidth: getWidth,
|
| 3334 |
+
getHeight: getHeight
|
| 3335 |
+
};
|
| 3336 |
+
|
| 3337 |
+
var genericSizeRegex = /(\d+(\.\d+)?)(\w|%)*/;
|
| 3338 |
+
var percentageBasedSizeRegex = /(\d+(\.\d+)?)%/;
|
| 3339 |
+
var pixelBasedSizeRegex = /(\d+(\.\d+)?)px|em/;
|
| 3340 |
+
var setPixelWidth = function (cell, amount) {
|
| 3341 |
+
$_bfod2hlejfuw8qac.set(cell, 'width', amount + 'px');
|
| 3342 |
+
};
|
| 3343 |
+
var setPercentageWidth = function (cell, amount) {
|
| 3344 |
+
$_bfod2hlejfuw8qac.set(cell, 'width', amount + '%');
|
| 3345 |
+
};
|
| 3346 |
+
var setHeight = function (cell, amount) {
|
| 3347 |
+
$_bfod2hlejfuw8qac.set(cell, 'height', amount + 'px');
|
| 3348 |
+
};
|
| 3349 |
+
var getHeightValue = function (cell) {
|
| 3350 |
+
return $_bfod2hlejfuw8qac.getRaw(cell, 'height').getOrThunk(function () {
|
| 3351 |
+
return $_ddwgqpmbjfuw8qi6.getHeight(cell) + 'px';
|
| 3352 |
+
});
|
| 3353 |
+
};
|
| 3354 |
+
var convert = function (cell, number, getter, setter) {
|
| 3355 |
+
var newSize = $_aqhz9okhjfuw8q5y.table(cell).map(function (table) {
|
| 3356 |
+
var total = getter(table);
|
| 3357 |
+
return Math.floor(number / 100 * total);
|
| 3358 |
+
}).getOr(number);
|
| 3359 |
+
setter(cell, newSize);
|
| 3360 |
+
return newSize;
|
| 3361 |
+
};
|
| 3362 |
+
var normalizePixelSize = function (value, cell, getter, setter) {
|
| 3363 |
+
var number = parseInt(value, 10);
|
| 3364 |
+
return $_ey09l9l2jfuw8q8y.endsWith(value, '%') && $_a8gk30l6jfuw8q9c.name(cell) !== 'table' ? convert(cell, number, getter, setter) : number;
|
| 3365 |
+
};
|
| 3366 |
+
var getTotalHeight = function (cell) {
|
| 3367 |
+
var value = getHeightValue(cell);
|
| 3368 |
+
if (!value)
|
| 3369 |
+
return $_cymdhgmcjfuw8qif.get(cell);
|
| 3370 |
+
return normalizePixelSize(value, cell, $_cymdhgmcjfuw8qif.get, setHeight);
|
| 3371 |
+
};
|
| 3372 |
+
var get$5 = function (cell, type, f) {
|
| 3373 |
+
var v = f(cell);
|
| 3374 |
+
var span = getSpan(cell, type);
|
| 3375 |
+
return v / span;
|
| 3376 |
+
};
|
| 3377 |
+
var getSpan = function (cell, type) {
|
| 3378 |
+
return $_3q82t2l5jfuw8q93.has(cell, type) ? parseInt($_3q82t2l5jfuw8q93.get(cell, type), 10) : 1;
|
| 3379 |
+
};
|
| 3380 |
+
var getRawWidth = function (element) {
|
| 3381 |
+
var cssWidth = $_bfod2hlejfuw8qac.getRaw(element, 'width');
|
| 3382 |
+
return cssWidth.fold(function () {
|
| 3383 |
+
return Option.from($_3q82t2l5jfuw8q93.get(element, 'width'));
|
| 3384 |
+
}, function (width) {
|
| 3385 |
+
return Option.some(width);
|
| 3386 |
+
});
|
| 3387 |
+
};
|
| 3388 |
+
var normalizePercentageWidth = function (cellWidth, tableSize) {
|
| 3389 |
+
return cellWidth / tableSize.pixelWidth() * 100;
|
| 3390 |
+
};
|
| 3391 |
+
var choosePercentageSize = function (element, width, tableSize) {
|
| 3392 |
+
if (percentageBasedSizeRegex.test(width)) {
|
| 3393 |
+
var percentMatch = percentageBasedSizeRegex.exec(width);
|
| 3394 |
+
return parseFloat(percentMatch[1]);
|
| 3395 |
+
} else {
|
| 3396 |
+
var fallbackWidth = $_fj252lmejfuw8qin.get(element);
|
| 3397 |
+
var intWidth = parseInt(fallbackWidth, 10);
|
| 3398 |
+
return normalizePercentageWidth(intWidth, tableSize);
|
| 3399 |
+
}
|
| 3400 |
+
};
|
| 3401 |
+
var getPercentageWidth = function (cell, tableSize) {
|
| 3402 |
+
var width = getRawWidth(cell);
|
| 3403 |
+
return width.fold(function () {
|
| 3404 |
+
var width = $_fj252lmejfuw8qin.get(cell);
|
| 3405 |
+
var intWidth = parseInt(width, 10);
|
| 3406 |
+
return normalizePercentageWidth(intWidth, tableSize);
|
| 3407 |
+
}, function (width) {
|
| 3408 |
+
return choosePercentageSize(cell, width, tableSize);
|
| 3409 |
+
});
|
| 3410 |
+
};
|
| 3411 |
+
var normalizePixelWidth = function (cellWidth, tableSize) {
|
| 3412 |
+
return cellWidth / 100 * tableSize.pixelWidth();
|
| 3413 |
+
};
|
| 3414 |
+
var choosePixelSize = function (element, width, tableSize) {
|
| 3415 |
+
if (pixelBasedSizeRegex.test(width)) {
|
| 3416 |
+
var pixelMatch = pixelBasedSizeRegex.exec(width);
|
| 3417 |
+
return parseInt(pixelMatch[1], 10);
|
| 3418 |
+
} else if (percentageBasedSizeRegex.test(width)) {
|
| 3419 |
+
var percentMatch = percentageBasedSizeRegex.exec(width);
|
| 3420 |
+
var floatWidth = parseFloat(percentMatch[1]);
|
| 3421 |
+
return normalizePixelWidth(floatWidth, tableSize);
|
| 3422 |
+
} else {
|
| 3423 |
+
var fallbackWidth = $_fj252lmejfuw8qin.get(element);
|
| 3424 |
+
return parseInt(fallbackWidth, 10);
|
| 3425 |
+
}
|
| 3426 |
+
};
|
| 3427 |
+
var getPixelWidth = function (cell, tableSize) {
|
| 3428 |
+
var width = getRawWidth(cell);
|
| 3429 |
+
return width.fold(function () {
|
| 3430 |
+
var width = $_fj252lmejfuw8qin.get(cell);
|
| 3431 |
+
var intWidth = parseInt(width, 10);
|
| 3432 |
+
return intWidth;
|
| 3433 |
+
}, function (width) {
|
| 3434 |
+
return choosePixelSize(cell, width, tableSize);
|
| 3435 |
+
});
|
| 3436 |
+
};
|
| 3437 |
+
var getHeight$1 = function (cell) {
|
| 3438 |
+
return get$5(cell, 'rowspan', getTotalHeight);
|
| 3439 |
+
};
|
| 3440 |
+
var getGenericWidth = function (cell) {
|
| 3441 |
+
var width = getRawWidth(cell);
|
| 3442 |
+
return width.bind(function (width) {
|
| 3443 |
+
if (genericSizeRegex.test(width)) {
|
| 3444 |
+
var match = genericSizeRegex.exec(width);
|
| 3445 |
+
return Option.some({
|
| 3446 |
+
width: $_20nfr6k7jfuw8q4g.constant(match[1]),
|
| 3447 |
+
unit: $_20nfr6k7jfuw8q4g.constant(match[3])
|
| 3448 |
+
});
|
| 3449 |
+
} else {
|
| 3450 |
+
return Option.none();
|
| 3451 |
+
}
|
| 3452 |
+
});
|
| 3453 |
+
};
|
| 3454 |
+
var setGenericWidth = function (cell, amount, unit) {
|
| 3455 |
+
$_bfod2hlejfuw8qac.set(cell, 'width', amount + unit);
|
| 3456 |
+
};
|
| 3457 |
+
var $_by2skemajfuw8qhj = {
|
| 3458 |
+
percentageBasedSizeRegex: $_20nfr6k7jfuw8q4g.constant(percentageBasedSizeRegex),
|
| 3459 |
+
pixelBasedSizeRegex: $_20nfr6k7jfuw8q4g.constant(pixelBasedSizeRegex),
|
| 3460 |
+
setPixelWidth: setPixelWidth,
|
| 3461 |
+
setPercentageWidth: setPercentageWidth,
|
| 3462 |
+
setHeight: setHeight,
|
| 3463 |
+
getPixelWidth: getPixelWidth,
|
| 3464 |
+
getPercentageWidth: getPercentageWidth,
|
| 3465 |
+
getGenericWidth: getGenericWidth,
|
| 3466 |
+
setGenericWidth: setGenericWidth,
|
| 3467 |
+
getHeight: getHeight$1,
|
| 3468 |
+
getRawWidth: getRawWidth
|
| 3469 |
+
};
|
| 3470 |
+
|
| 3471 |
+
var halve = function (main, other) {
|
| 3472 |
+
var width = $_by2skemajfuw8qhj.getGenericWidth(main);
|
| 3473 |
+
width.each(function (width) {
|
| 3474 |
+
var newWidth = width.width() / 2;
|
| 3475 |
+
$_by2skemajfuw8qhj.setGenericWidth(main, newWidth, width.unit());
|
| 3476 |
+
$_by2skemajfuw8qhj.setGenericWidth(other, newWidth, width.unit());
|
| 3477 |
+
});
|
| 3478 |
+
};
|
| 3479 |
+
var $_57e49gm9jfuw8qhh = { halve: halve };
|
| 3480 |
+
|
| 3481 |
+
var attached = function (element, scope) {
|
| 3482 |
+
var doc = scope || $_xbeoqkkjfuw8q73.fromDom(document.documentElement);
|
| 3483 |
+
return $_11ympzlbjfuw8q9n.ancestor(element, $_20nfr6k7jfuw8q4g.curry($_e8rn66kojfuw8q7n.eq, doc)).isSome();
|
| 3484 |
+
};
|
| 3485 |
+
var windowOf = function (element) {
|
| 3486 |
+
var dom = element.dom();
|
| 3487 |
+
if (dom === dom.window)
|
| 3488 |
+
return element;
|
| 3489 |
+
return $_a8gk30l6jfuw8q9c.isDocument(element) ? dom.defaultView || dom.parentWindow : null;
|
| 3490 |
+
};
|
| 3491 |
+
var $_a9ygj4mjjfuw8qj6 = {
|
| 3492 |
+
attached: attached,
|
| 3493 |
+
windowOf: windowOf
|
| 3494 |
+
};
|
| 3495 |
+
|
| 3496 |
+
var r = function (left, top) {
|
| 3497 |
+
var translate = function (x, y) {
|
| 3498 |
+
return r(left + x, top + y);
|
| 3499 |
+
};
|
| 3500 |
+
return {
|
| 3501 |
+
left: $_20nfr6k7jfuw8q4g.constant(left),
|
| 3502 |
+
top: $_20nfr6k7jfuw8q4g.constant(top),
|
| 3503 |
+
translate: translate
|
| 3504 |
+
};
|
| 3505 |
+
};
|
| 3506 |
+
|
| 3507 |
+
var boxPosition = function (dom) {
|
| 3508 |
+
var box = dom.getBoundingClientRect();
|
| 3509 |
+
return r(box.left, box.top);
|
| 3510 |
+
};
|
| 3511 |
+
var firstDefinedOrZero = function (a, b) {
|
| 3512 |
+
return a !== undefined ? a : b !== undefined ? b : 0;
|
| 3513 |
+
};
|
| 3514 |
+
var absolute = function (element) {
|
| 3515 |
+
var doc = element.dom().ownerDocument;
|
| 3516 |
+
var body = doc.body;
|
| 3517 |
+
var win = $_a9ygj4mjjfuw8qj6.windowOf($_xbeoqkkjfuw8q73.fromDom(doc));
|
| 3518 |
+
var html = doc.documentElement;
|
| 3519 |
+
var scrollTop = firstDefinedOrZero(win.pageYOffset, html.scrollTop);
|
| 3520 |
+
var scrollLeft = firstDefinedOrZero(win.pageXOffset, html.scrollLeft);
|
| 3521 |
+
var clientTop = firstDefinedOrZero(html.clientTop, body.clientTop);
|
| 3522 |
+
var clientLeft = firstDefinedOrZero(html.clientLeft, body.clientLeft);
|
| 3523 |
+
return viewport(element).translate(scrollLeft - clientLeft, scrollTop - clientTop);
|
| 3524 |
+
};
|
| 3525 |
+
var relative = function (element) {
|
| 3526 |
+
var dom = element.dom();
|
| 3527 |
+
return r(dom.offsetLeft, dom.offsetTop);
|
| 3528 |
+
};
|
| 3529 |
+
var viewport = function (element) {
|
| 3530 |
+
var dom = element.dom();
|
| 3531 |
+
var doc = dom.ownerDocument;
|
| 3532 |
+
var body = doc.body;
|
| 3533 |
+
var html = $_xbeoqkkjfuw8q73.fromDom(doc.documentElement);
|
| 3534 |
+
if (body === dom)
|
| 3535 |
+
return r(body.offsetLeft, body.offsetTop);
|
| 3536 |
+
if (!$_a9ygj4mjjfuw8qj6.attached(element, html))
|
| 3537 |
+
return r(0, 0);
|
| 3538 |
+
return boxPosition(dom);
|
| 3539 |
+
};
|
| 3540 |
+
var $_hsvzlmijfuw8qj4 = {
|
| 3541 |
+
absolute: absolute,
|
| 3542 |
+
relative: relative,
|
| 3543 |
+
viewport: viewport
|
| 3544 |
+
};
|
| 3545 |
+
|
| 3546 |
+
var rowInfo = $_5now9kbjfuw8q5e.immutable('row', 'y');
|
| 3547 |
+
var colInfo = $_5now9kbjfuw8q5e.immutable('col', 'x');
|
| 3548 |
+
var rtlEdge = function (cell) {
|
| 3549 |
+
var pos = $_hsvzlmijfuw8qj4.absolute(cell);
|
| 3550 |
+
return pos.left() + $_fj252lmejfuw8qin.getOuter(cell);
|
| 3551 |
+
};
|
| 3552 |
+
var ltrEdge = function (cell) {
|
| 3553 |
+
return $_hsvzlmijfuw8qj4.absolute(cell).left();
|
| 3554 |
+
};
|
| 3555 |
+
var getLeftEdge = function (index, cell) {
|
| 3556 |
+
return colInfo(index, ltrEdge(cell));
|
| 3557 |
+
};
|
| 3558 |
+
var getRightEdge = function (index, cell) {
|
| 3559 |
+
return colInfo(index, rtlEdge(cell));
|
| 3560 |
+
};
|
| 3561 |
+
var getTop = function (cell) {
|
| 3562 |
+
return $_hsvzlmijfuw8qj4.absolute(cell).top();
|
| 3563 |
+
};
|
| 3564 |
+
var getTopEdge = function (index, cell) {
|
| 3565 |
+
return rowInfo(index, getTop(cell));
|
| 3566 |
+
};
|
| 3567 |
+
var getBottomEdge = function (index, cell) {
|
| 3568 |
+
return rowInfo(index, getTop(cell) + $_cymdhgmcjfuw8qif.getOuter(cell));
|
| 3569 |
+
};
|
| 3570 |
+
var findPositions = function (getInnerEdge, getOuterEdge, array) {
|
| 3571 |
+
if (array.length === 0)
|
| 3572 |
+
return [];
|
| 3573 |
+
var lines = $_tyr3yk5jfuw8q47.map(array.slice(1), function (cellOption, index) {
|
| 3574 |
+
return cellOption.map(function (cell) {
|
| 3575 |
+
return getInnerEdge(index, cell);
|
| 3576 |
+
});
|
| 3577 |
+
});
|
| 3578 |
+
var lastLine = array[array.length - 1].map(function (cell) {
|
| 3579 |
+
return getOuterEdge(array.length - 1, cell);
|
| 3580 |
+
});
|
| 3581 |
+
return lines.concat([lastLine]);
|
| 3582 |
+
};
|
| 3583 |
+
var negate = function (step, _table) {
|
| 3584 |
+
return -step;
|
| 3585 |
+
};
|
| 3586 |
+
var height = {
|
| 3587 |
+
delta: $_20nfr6k7jfuw8q4g.identity,
|
| 3588 |
+
positions: $_20nfr6k7jfuw8q4g.curry(findPositions, getTopEdge, getBottomEdge),
|
| 3589 |
+
edge: getTop
|
| 3590 |
+
};
|
| 3591 |
+
var ltr = {
|
| 3592 |
+
delta: $_20nfr6k7jfuw8q4g.identity,
|
| 3593 |
+
edge: ltrEdge,
|
| 3594 |
+
positions: $_20nfr6k7jfuw8q4g.curry(findPositions, getLeftEdge, getRightEdge)
|
| 3595 |
+
};
|
| 3596 |
+
var rtl = {
|
| 3597 |
+
delta: negate,
|
| 3598 |
+
edge: rtlEdge,
|
| 3599 |
+
positions: $_20nfr6k7jfuw8q4g.curry(findPositions, getRightEdge, getLeftEdge)
|
| 3600 |
+
};
|
| 3601 |
+
var $_16z2iamhjfuw8qir = {
|
| 3602 |
+
height: height,
|
| 3603 |
+
rtl: rtl,
|
| 3604 |
+
ltr: ltr
|
| 3605 |
+
};
|
| 3606 |
+
|
| 3607 |
+
var $_26mw5tmgjfuw8qiq = {
|
| 3608 |
+
ltr: $_16z2iamhjfuw8qir.ltr,
|
| 3609 |
+
rtl: $_16z2iamhjfuw8qir.rtl
|
| 3610 |
+
};
|
| 3611 |
+
|
| 3612 |
+
function TableDirection (directionAt) {
|
| 3613 |
+
var auto = function (table) {
|
| 3614 |
+
return directionAt(table).isRtl() ? $_26mw5tmgjfuw8qiq.rtl : $_26mw5tmgjfuw8qiq.ltr;
|
| 3615 |
+
};
|
| 3616 |
+
var delta = function (amount, table) {
|
| 3617 |
+
return auto(table).delta(amount, table);
|
| 3618 |
+
};
|
| 3619 |
+
var positions = function (cols, table) {
|
| 3620 |
+
return auto(table).positions(cols, table);
|
| 3621 |
+
};
|
| 3622 |
+
var edge = function (cell) {
|
| 3623 |
+
return auto(cell).edge(cell);
|
| 3624 |
+
};
|
| 3625 |
+
return {
|
| 3626 |
+
delta: delta,
|
| 3627 |
+
edge: edge,
|
| 3628 |
+
positions: positions
|
| 3629 |
+
};
|
| 3630 |
+
}
|
| 3631 |
+
|
| 3632 |
+
var getGridSize = function (table) {
|
| 3633 |
+
var input = $_dy3x0nkfjfuw8q5l.fromTable(table);
|
| 3634 |
+
var warehouse = $_2ge24cldjfuw8qa3.generate(input);
|
| 3635 |
+
return warehouse.grid();
|
| 3636 |
+
};
|
| 3637 |
+
var $_b452wimljfuw8qjd = { getGridSize: getGridSize };
|
| 3638 |
+
|
| 3639 |
+
var Cell = function (initial) {
|
| 3640 |
+
var value = initial;
|
| 3641 |
+
var get = function () {
|
| 3642 |
+
return value;
|
| 3643 |
+
};
|
| 3644 |
+
var set = function (v) {
|
| 3645 |
+
value = v;
|
| 3646 |
+
};
|
| 3647 |
+
var clone = function () {
|
| 3648 |
+
return Cell(get());
|
| 3649 |
+
};
|
| 3650 |
+
return {
|
| 3651 |
+
get: get,
|
| 3652 |
+
set: set,
|
| 3653 |
+
clone: clone
|
| 3654 |
+
};
|
| 3655 |
+
};
|
| 3656 |
+
|
| 3657 |
+
var base = function (handleUnsupported, required) {
|
| 3658 |
+
return baseWith(handleUnsupported, required, {
|
| 3659 |
+
validate: $_g6mvnrk8jfuw8q4k.isFunction,
|
| 3660 |
+
label: 'function'
|
| 3661 |
+
});
|
| 3662 |
+
};
|
| 3663 |
+
var baseWith = function (handleUnsupported, required, pred) {
|
| 3664 |
+
if (required.length === 0)
|
| 3665 |
+
throw new Error('You must specify at least one required field.');
|
| 3666 |
+
$_2j2nzkkejfuw8q5j.validateStrArr('required', required);
|
| 3667 |
+
$_2j2nzkkejfuw8q5j.checkDupes(required);
|
| 3668 |
+
return function (obj) {
|
| 3669 |
+
var keys = $_11yiupkajfuw8q5c.keys(obj);
|
| 3670 |
+
var allReqd = $_tyr3yk5jfuw8q47.forall(required, function (req) {
|
| 3671 |
+
return $_tyr3yk5jfuw8q47.contains(keys, req);
|
| 3672 |
+
});
|
| 3673 |
+
if (!allReqd)
|
| 3674 |
+
$_2j2nzkkejfuw8q5j.reqMessage(required, keys);
|
| 3675 |
+
handleUnsupported(required, keys);
|
| 3676 |
+
var invalidKeys = $_tyr3yk5jfuw8q47.filter(required, function (key) {
|
| 3677 |
+
return !pred.validate(obj[key], key);
|
| 3678 |
+
});
|
| 3679 |
+
if (invalidKeys.length > 0)
|
| 3680 |
+
$_2j2nzkkejfuw8q5j.invalidTypeMessage(invalidKeys, pred.label);
|
| 3681 |
+
return obj;
|
| 3682 |
+
};
|
| 3683 |
+
};
|
| 3684 |
+
var handleExact = function (required, keys) {
|
| 3685 |
+
var unsupported = $_tyr3yk5jfuw8q47.filter(keys, function (key) {
|
| 3686 |
+
return !$_tyr3yk5jfuw8q47.contains(required, key);
|
| 3687 |
+
});
|
| 3688 |
+
if (unsupported.length > 0)
|
| 3689 |
+
$_2j2nzkkejfuw8q5j.unsuppMessage(unsupported);
|
| 3690 |
+
};
|
| 3691 |
+
var allowExtra = $_20nfr6k7jfuw8q4g.noop;
|
| 3692 |
+
var $_7z97w5mpjfuw8qkk = {
|
| 3693 |
+
exactly: $_20nfr6k7jfuw8q4g.curry(base, handleExact),
|
| 3694 |
+
ensure: $_20nfr6k7jfuw8q4g.curry(base, allowExtra),
|
| 3695 |
+
ensureWith: $_20nfr6k7jfuw8q4g.curry(baseWith, allowExtra)
|
| 3696 |
+
};
|
| 3697 |
+
|
| 3698 |
+
var elementToData = function (element) {
|
| 3699 |
+
var colspan = $_3q82t2l5jfuw8q93.has(element, 'colspan') ? parseInt($_3q82t2l5jfuw8q93.get(element, 'colspan'), 10) : 1;
|
| 3700 |
+
var rowspan = $_3q82t2l5jfuw8q93.has(element, 'rowspan') ? parseInt($_3q82t2l5jfuw8q93.get(element, 'rowspan'), 10) : 1;
|
| 3701 |
+
return {
|
| 3702 |
+
element: $_20nfr6k7jfuw8q4g.constant(element),
|
| 3703 |
+
colspan: $_20nfr6k7jfuw8q4g.constant(colspan),
|
| 3704 |
+
rowspan: $_20nfr6k7jfuw8q4g.constant(rowspan)
|
| 3705 |
+
};
|
| 3706 |
+
};
|
| 3707 |
+
var modification = function (generators, _toData) {
|
| 3708 |
+
contract(generators);
|
| 3709 |
+
var position = Cell(Option.none());
|
| 3710 |
+
var toData = _toData !== undefined ? _toData : elementToData;
|
| 3711 |
+
var nu = function (data) {
|
| 3712 |
+
return generators.cell(data);
|
| 3713 |
+
};
|
| 3714 |
+
var nuFrom = function (element) {
|
| 3715 |
+
var data = toData(element);
|
| 3716 |
+
return nu(data);
|
| 3717 |
+
};
|
| 3718 |
+
var add = function (element) {
|
| 3719 |
+
var replacement = nuFrom(element);
|
| 3720 |
+
if (position.get().isNone())
|
| 3721 |
+
position.set(Option.some(replacement));
|
| 3722 |
+
recent = Option.some({
|
| 3723 |
+
item: element,
|
| 3724 |
+
replacement: replacement
|
| 3725 |
+
});
|
| 3726 |
+
return replacement;
|
| 3727 |
+
};
|
| 3728 |
+
var recent = Option.none();
|
| 3729 |
+
var getOrInit = function (element, comparator) {
|
| 3730 |
+
return recent.fold(function () {
|
| 3731 |
+
return add(element);
|
| 3732 |
+
}, function (p) {
|
| 3733 |
+
return comparator(element, p.item) ? p.replacement : add(element);
|
| 3734 |
+
});
|
| 3735 |
+
};
|
| 3736 |
+
return {
|
| 3737 |
+
getOrInit: getOrInit,
|
| 3738 |
+
cursor: position.get
|
| 3739 |
+
};
|
| 3740 |
+
};
|
| 3741 |
+
var transform = function (scope, tag) {
|
| 3742 |
+
return function (generators) {
|
| 3743 |
+
var position = Cell(Option.none());
|
| 3744 |
+
contract(generators);
|
| 3745 |
+
var list = [];
|
| 3746 |
+
var find = function (element, comparator) {
|
| 3747 |
+
return $_tyr3yk5jfuw8q47.find(list, function (x) {
|
| 3748 |
+
return comparator(x.item, element);
|
| 3749 |
+
});
|
| 3750 |
+
};
|
| 3751 |
+
var makeNew = function (element) {
|
| 3752 |
+
var cell = generators.replace(element, tag, { scope: scope });
|
| 3753 |
+
list.push({
|
| 3754 |
+
item: element,
|
| 3755 |
+
sub: cell
|
| 3756 |
+
});
|
| 3757 |
+
if (position.get().isNone())
|
| 3758 |
+
position.set(Option.some(cell));
|
| 3759 |
+
return cell;
|
| 3760 |
+
};
|
| 3761 |
+
var replaceOrInit = function (element, comparator) {
|
| 3762 |
+
return find(element, comparator).fold(function () {
|
| 3763 |
+
return makeNew(element);
|
| 3764 |
+
}, function (p) {
|
| 3765 |
+
return comparator(element, p.item) ? p.sub : makeNew(element);
|
| 3766 |
+
});
|
| 3767 |
+
};
|
| 3768 |
+
return {
|
| 3769 |
+
replaceOrInit: replaceOrInit,
|
| 3770 |
+
cursor: position.get
|
| 3771 |
+
};
|
| 3772 |
+
};
|
| 3773 |
+
};
|
| 3774 |
+
var merging = function (generators) {
|
| 3775 |
+
contract(generators);
|
| 3776 |
+
var position = Cell(Option.none());
|
| 3777 |
+
var combine = function (cell) {
|
| 3778 |
+
if (position.get().isNone())
|
| 3779 |
+
position.set(Option.some(cell));
|
| 3780 |
+
return function () {
|
| 3781 |
+
var raw = generators.cell({
|
| 3782 |
+
element: $_20nfr6k7jfuw8q4g.constant(cell),
|
| 3783 |
+
colspan: $_20nfr6k7jfuw8q4g.constant(1),
|
| 3784 |
+
rowspan: $_20nfr6k7jfuw8q4g.constant(1)
|
| 3785 |
+
});
|
| 3786 |
+
$_bfod2hlejfuw8qac.remove(raw, 'width');
|
| 3787 |
+
$_bfod2hlejfuw8qac.remove(cell, 'width');
|
| 3788 |
+
return raw;
|
| 3789 |
+
};
|
| 3790 |
+
};
|
| 3791 |
+
return {
|
| 3792 |
+
combine: combine,
|
| 3793 |
+
cursor: position.get
|
| 3794 |
+
};
|
| 3795 |
+
};
|
| 3796 |
+
var contract = $_7z97w5mpjfuw8qkk.exactly([
|
| 3797 |
+
'cell',
|
| 3798 |
+
'row',
|
| 3799 |
+
'replace',
|
| 3800 |
+
'gap'
|
| 3801 |
+
]);
|
| 3802 |
+
var $_eoocrvmnjfuw8qk1 = {
|
| 3803 |
+
modification: modification,
|
| 3804 |
+
transform: transform,
|
| 3805 |
+
merging: merging
|
| 3806 |
+
};
|
| 3807 |
+
|
| 3808 |
+
var blockList = [
|
| 3809 |
+
'body',
|
| 3810 |
+
'p',
|
| 3811 |
+
'div',
|
| 3812 |
+
'article',
|
| 3813 |
+
'aside',
|
| 3814 |
+
'figcaption',
|
| 3815 |
+
'figure',
|
| 3816 |
+
'footer',
|
| 3817 |
+
'header',
|
| 3818 |
+
'nav',
|
| 3819 |
+
'section',
|
| 3820 |
+
'ol',
|
| 3821 |
+
'ul',
|
| 3822 |
+
'table',
|
| 3823 |
+
'thead',
|
| 3824 |
+
'tfoot',
|
| 3825 |
+
'tbody',
|
| 3826 |
+
'caption',
|
| 3827 |
+
'tr',
|
| 3828 |
+
'td',
|
| 3829 |
+
'th',
|
| 3830 |
+
'h1',
|
| 3831 |
+
'h2',
|
| 3832 |
+
'h3',
|
| 3833 |
+
'h4',
|
| 3834 |
+
'h5',
|
| 3835 |
+
'h6',
|
| 3836 |
+
'blockquote',
|
| 3837 |
+
'pre',
|
| 3838 |
+
'address'
|
| 3839 |
+
];
|
| 3840 |
+
var isList = function (universe, item) {
|
| 3841 |
+
var tagName = universe.property().name(item);
|
| 3842 |
+
return $_tyr3yk5jfuw8q47.contains([
|
| 3843 |
+
'ol',
|
| 3844 |
+
'ul'
|
| 3845 |
+
], tagName);
|
| 3846 |
+
};
|
| 3847 |
+
var isBlock = function (universe, item) {
|
| 3848 |
+
var tagName = universe.property().name(item);
|
| 3849 |
+
return $_tyr3yk5jfuw8q47.contains(blockList, tagName);
|
| 3850 |
+
};
|
| 3851 |
+
var isFormatting = function (universe, item) {
|
| 3852 |
+
var tagName = universe.property().name(item);
|
| 3853 |
+
return $_tyr3yk5jfuw8q47.contains([
|
| 3854 |
+
'address',
|
| 3855 |
+
'pre',
|
| 3856 |
+
'p',
|
| 3857 |
+
'h1',
|
| 3858 |
+
'h2',
|
| 3859 |
+
'h3',
|
| 3860 |
+
'h4',
|
| 3861 |
+
'h5',
|
| 3862 |
+
'h6'
|
| 3863 |
+
], tagName);
|
| 3864 |
+
};
|
| 3865 |
+
var isHeading = function (universe, item) {
|
| 3866 |
+
var tagName = universe.property().name(item);
|
| 3867 |
+
return $_tyr3yk5jfuw8q47.contains([
|
| 3868 |
+
'h1',
|
| 3869 |
+
'h2',
|
| 3870 |
+
'h3',
|
| 3871 |
+
'h4',
|
| 3872 |
+
'h5',
|
| 3873 |
+
'h6'
|
| 3874 |
+
], tagName);
|
| 3875 |
+
};
|
| 3876 |
+
var isContainer = function (universe, item) {
|
| 3877 |
+
return $_tyr3yk5jfuw8q47.contains([
|
| 3878 |
+
'div',
|
| 3879 |
+
'li',
|
| 3880 |
+
'td',
|
| 3881 |
+
'th',
|
| 3882 |
+
'blockquote',
|
| 3883 |
+
'body',
|
| 3884 |
+
'caption'
|
| 3885 |
+
], universe.property().name(item));
|
| 3886 |
+
};
|
| 3887 |
+
var isEmptyTag = function (universe, item) {
|
| 3888 |
+
return $_tyr3yk5jfuw8q47.contains([
|
| 3889 |
+
'br',
|
| 3890 |
+
'img',
|
| 3891 |
+
'hr',
|
| 3892 |
+
'input'
|
| 3893 |
+
], universe.property().name(item));
|
| 3894 |
+
};
|
| 3895 |
+
var isFrame = function (universe, item) {
|
| 3896 |
+
return universe.property().name(item) === 'iframe';
|
| 3897 |
+
};
|
| 3898 |
+
var isInline = function (universe, item) {
|
| 3899 |
+
return !(isBlock(universe, item) || isEmptyTag(universe, item)) && universe.property().name(item) !== 'li';
|
| 3900 |
+
};
|
| 3901 |
+
var $_325i5bmsjfuw8qle = {
|
| 3902 |
+
isBlock: isBlock,
|
| 3903 |
+
isList: isList,
|
| 3904 |
+
isFormatting: isFormatting,
|
| 3905 |
+
isHeading: isHeading,
|
| 3906 |
+
isContainer: isContainer,
|
| 3907 |
+
isEmptyTag: isEmptyTag,
|
| 3908 |
+
isFrame: isFrame,
|
| 3909 |
+
isInline: isInline
|
| 3910 |
+
};
|
| 3911 |
+
|
| 3912 |
+
var universe$1 = DomUniverse();
|
| 3913 |
+
var isBlock$1 = function (element) {
|
| 3914 |
+
return $_325i5bmsjfuw8qle.isBlock(universe$1, element);
|
| 3915 |
+
};
|
| 3916 |
+
var isList$1 = function (element) {
|
| 3917 |
+
return $_325i5bmsjfuw8qle.isList(universe$1, element);
|
| 3918 |
+
};
|
| 3919 |
+
var isFormatting$1 = function (element) {
|
| 3920 |
+
return $_325i5bmsjfuw8qle.isFormatting(universe$1, element);
|
| 3921 |
+
};
|
| 3922 |
+
var isHeading$1 = function (element) {
|
| 3923 |
+
return $_325i5bmsjfuw8qle.isHeading(universe$1, element);
|
| 3924 |
+
};
|
| 3925 |
+
var isContainer$1 = function (element) {
|
| 3926 |
+
return $_325i5bmsjfuw8qle.isContainer(universe$1, element);
|
| 3927 |
+
};
|
| 3928 |
+
var isEmptyTag$1 = function (element) {
|
| 3929 |
+
return $_325i5bmsjfuw8qle.isEmptyTag(universe$1, element);
|
| 3930 |
+
};
|
| 3931 |
+
var isFrame$1 = function (element) {
|
| 3932 |
+
return $_325i5bmsjfuw8qle.isFrame(universe$1, element);
|
| 3933 |
+
};
|
| 3934 |
+
var isInline$1 = function (element) {
|
| 3935 |
+
return $_325i5bmsjfuw8qle.isInline(universe$1, element);
|
| 3936 |
+
};
|
| 3937 |
+
var $_d9tdqtmrjfuw8ql9 = {
|
| 3938 |
+
isBlock: isBlock$1,
|
| 3939 |
+
isList: isList$1,
|
| 3940 |
+
isFormatting: isFormatting$1,
|
| 3941 |
+
isHeading: isHeading$1,
|
| 3942 |
+
isContainer: isContainer$1,
|
| 3943 |
+
isEmptyTag: isEmptyTag$1,
|
| 3944 |
+
isFrame: isFrame$1,
|
| 3945 |
+
isInline: isInline$1
|
| 3946 |
+
};
|
| 3947 |
+
|
| 3948 |
+
var merge = function (cells) {
|
| 3949 |
+
var isBr = function (el) {
|
| 3950 |
+
return $_a8gk30l6jfuw8q9c.name(el) === 'br';
|
| 3951 |
+
};
|
| 3952 |
+
var advancedBr = function (children) {
|
| 3953 |
+
return $_tyr3yk5jfuw8q47.forall(children, function (c) {
|
| 3954 |
+
return isBr(c) || $_a8gk30l6jfuw8q9c.isText(c) && $_6j8y7blnjfuw8qc3.get(c).trim().length === 0;
|
| 3955 |
+
});
|
| 3956 |
+
};
|
| 3957 |
+
var isListItem = function (el) {
|
| 3958 |
+
return $_a8gk30l6jfuw8q9c.name(el) === 'li' || $_11ympzlbjfuw8q9n.ancestor(el, $_d9tdqtmrjfuw8ql9.isList).isSome();
|
| 3959 |
+
};
|
| 3960 |
+
var siblingIsBlock = function (el) {
|
| 3961 |
+
return $_s8scrkmjfuw8q7a.nextSibling(el).map(function (rightSibling) {
|
| 3962 |
+
if ($_d9tdqtmrjfuw8ql9.isBlock(rightSibling))
|
| 3963 |
+
return true;
|
| 3964 |
+
if ($_d9tdqtmrjfuw8ql9.isEmptyTag(rightSibling)) {
|
| 3965 |
+
return $_a8gk30l6jfuw8q9c.name(rightSibling) === 'img' ? false : true;
|
| 3966 |
+
}
|
| 3967 |
+
}).getOr(false);
|
| 3968 |
+
};
|
| 3969 |
+
var markCell = function (cell) {
|
| 3970 |
+
return $_ejrzj4lljfuw8qbw.last(cell).bind(function (rightEdge) {
|
| 3971 |
+
var rightSiblingIsBlock = siblingIsBlock(rightEdge);
|
| 3972 |
+
return $_s8scrkmjfuw8q7a.parent(rightEdge).map(function (parent) {
|
| 3973 |
+
return rightSiblingIsBlock === true || isListItem(parent) || isBr(rightEdge) || $_d9tdqtmrjfuw8ql9.isBlock(parent) && !$_e8rn66kojfuw8q7n.eq(cell, parent) ? [] : [$_xbeoqkkjfuw8q73.fromTag('br')];
|
| 3974 |
+
});
|
| 3975 |
+
}).getOr([]);
|
| 3976 |
+
};
|
| 3977 |
+
var markContent = function () {
|
| 3978 |
+
var content = $_tyr3yk5jfuw8q47.bind(cells, function (cell) {
|
| 3979 |
+
var children = $_s8scrkmjfuw8q7a.children(cell);
|
| 3980 |
+
return advancedBr(children) ? [] : children.concat(markCell(cell));
|
| 3981 |
+
});
|
| 3982 |
+
return content.length === 0 ? [$_xbeoqkkjfuw8q73.fromTag('br')] : content;
|
| 3983 |
+
};
|
| 3984 |
+
var contents = markContent();
|
| 3985 |
+
$_fl1deelhjfuw8qax.empty(cells[0]);
|
| 3986 |
+
$_9zaoqflijfuw8qb0.append(cells[0], contents);
|
| 3987 |
+
};
|
| 3988 |
+
var $_ancl40mqjfuw8qkm = { merge: merge };
|
| 3989 |
+
|
| 3990 |
+
var shallow$1 = function (old, nu) {
|
| 3991 |
+
return nu;
|
| 3992 |
+
};
|
| 3993 |
+
var deep$1 = function (old, nu) {
|
| 3994 |
+
var bothObjects = $_g6mvnrk8jfuw8q4k.isObject(old) && $_g6mvnrk8jfuw8q4k.isObject(nu);
|
| 3995 |
+
return bothObjects ? deepMerge(old, nu) : nu;
|
| 3996 |
+
};
|
| 3997 |
+
var baseMerge = function (merger) {
|
| 3998 |
+
return function () {
|
| 3999 |
+
var objects = new Array(arguments.length);
|
| 4000 |
+
for (var i = 0; i < objects.length; i++)
|
| 4001 |
+
objects[i] = arguments[i];
|
| 4002 |
+
if (objects.length === 0)
|
| 4003 |
+
throw new Error('Can\'t merge zero objects');
|
| 4004 |
+
var ret = {};
|
| 4005 |
+
for (var j = 0; j < objects.length; j++) {
|
| 4006 |
+
var curObject = objects[j];
|
| 4007 |
+
for (var key in curObject)
|
| 4008 |
+
if (curObject.hasOwnProperty(key)) {
|
| 4009 |
+
ret[key] = merger(ret[key], curObject[key]);
|
| 4010 |
+
}
|
| 4011 |
+
}
|
| 4012 |
+
return ret;
|
| 4013 |
+
};
|
| 4014 |
+
};
|
| 4015 |
+
var deepMerge = baseMerge(deep$1);
|
| 4016 |
+
var merge$1 = baseMerge(shallow$1);
|
| 4017 |
+
var $_91sgzmujfuw8qm5 = {
|
| 4018 |
+
deepMerge: deepMerge,
|
| 4019 |
+
merge: merge$1
|
| 4020 |
+
};
|
| 4021 |
+
|
| 4022 |
+
var cat = function (arr) {
|
| 4023 |
+
var r = [];
|
| 4024 |
+
var push = function (x) {
|
| 4025 |
+
r.push(x);
|
| 4026 |
+
};
|
| 4027 |
+
for (var i = 0; i < arr.length; i++) {
|
| 4028 |
+
arr[i].each(push);
|
| 4029 |
+
}
|
| 4030 |
+
return r;
|
| 4031 |
+
};
|
| 4032 |
+
var findMap = function (arr, f) {
|
| 4033 |
+
for (var i = 0; i < arr.length; i++) {
|
| 4034 |
+
var r = f(arr[i], i);
|
| 4035 |
+
if (r.isSome()) {
|
| 4036 |
+
return r;
|
| 4037 |
+
}
|
| 4038 |
+
}
|
| 4039 |
+
return Option.none();
|
| 4040 |
+
};
|
| 4041 |
+
var liftN = function (arr, f) {
|
| 4042 |
+
var r = [];
|
| 4043 |
+
for (var i = 0; i < arr.length; i++) {
|
| 4044 |
+
var x = arr[i];
|
| 4045 |
+
if (x.isSome()) {
|
| 4046 |
+
r.push(x.getOrDie());
|
| 4047 |
+
} else {
|
| 4048 |
+
return Option.none();
|
| 4049 |
+
}
|
| 4050 |
+
}
|
| 4051 |
+
return Option.some(f.apply(null, r));
|
| 4052 |
+
};
|
| 4053 |
+
var $_cul8qomvjfuw8qm7 = {
|
| 4054 |
+
cat: cat,
|
| 4055 |
+
findMap: findMap,
|
| 4056 |
+
liftN: liftN
|
| 4057 |
+
};
|
| 4058 |
+
|
| 4059 |
+
var addCell = function (gridRow, index, cell) {
|
| 4060 |
+
var cells = gridRow.cells();
|
| 4061 |
+
var before = cells.slice(0, index);
|
| 4062 |
+
var after = cells.slice(index);
|
| 4063 |
+
var newCells = before.concat([cell]).concat(after);
|
| 4064 |
+
return setCells(gridRow, newCells);
|
| 4065 |
+
};
|
| 4066 |
+
var mutateCell = function (gridRow, index, cell) {
|
| 4067 |
+
var cells = gridRow.cells();
|
| 4068 |
+
cells[index] = cell;
|
| 4069 |
+
};
|
| 4070 |
+
var setCells = function (gridRow, cells) {
|
| 4071 |
+
return $_ce5pyrkgjfuw8q5v.rowcells(cells, gridRow.section());
|
| 4072 |
+
};
|
| 4073 |
+
var mapCells = function (gridRow, f) {
|
| 4074 |
+
var cells = gridRow.cells();
|
| 4075 |
+
var r = $_tyr3yk5jfuw8q47.map(cells, f);
|
| 4076 |
+
return $_ce5pyrkgjfuw8q5v.rowcells(r, gridRow.section());
|
| 4077 |
+
};
|
| 4078 |
+
var getCell = function (gridRow, index) {
|
| 4079 |
+
return gridRow.cells()[index];
|
| 4080 |
+
};
|
| 4081 |
+
var getCellElement = function (gridRow, index) {
|
| 4082 |
+
return getCell(gridRow, index).element();
|
| 4083 |
+
};
|
| 4084 |
+
var cellLength = function (gridRow) {
|
| 4085 |
+
return gridRow.cells().length;
|
| 4086 |
+
};
|
| 4087 |
+
var $_aylxzgmyjfuw8qmj = {
|
| 4088 |
+
addCell: addCell,
|
| 4089 |
+
setCells: setCells,
|
| 4090 |
+
mutateCell: mutateCell,
|
| 4091 |
+
getCell: getCell,
|
| 4092 |
+
getCellElement: getCellElement,
|
| 4093 |
+
mapCells: mapCells,
|
| 4094 |
+
cellLength: cellLength
|
| 4095 |
+
};
|
| 4096 |
+
|
| 4097 |
+
var getColumn = function (grid, index) {
|
| 4098 |
+
return $_tyr3yk5jfuw8q47.map(grid, function (row) {
|
| 4099 |
+
return $_aylxzgmyjfuw8qmj.getCell(row, index);
|
| 4100 |
+
});
|
| 4101 |
+
};
|
| 4102 |
+
var getRow = function (grid, index) {
|
| 4103 |
+
return grid[index];
|
| 4104 |
+
};
|
| 4105 |
+
var findDiff = function (xs, comp) {
|
| 4106 |
+
if (xs.length === 0)
|
| 4107 |
+
return 0;
|
| 4108 |
+
var first = xs[0];
|
| 4109 |
+
var index = $_tyr3yk5jfuw8q47.findIndex(xs, function (x) {
|
| 4110 |
+
return !comp(first.element(), x.element());
|
| 4111 |
+
});
|
| 4112 |
+
return index.fold(function () {
|
| 4113 |
+
return xs.length;
|
| 4114 |
+
}, function (ind) {
|
| 4115 |
+
return ind;
|
| 4116 |
+
});
|
| 4117 |
+
};
|
| 4118 |
+
var subgrid = function (grid, row, column, comparator) {
|
| 4119 |
+
var restOfRow = getRow(grid, row).cells().slice(column);
|
| 4120 |
+
var endColIndex = findDiff(restOfRow, comparator);
|
| 4121 |
+
var restOfColumn = getColumn(grid, column).slice(row);
|
| 4122 |
+
var endRowIndex = findDiff(restOfColumn, comparator);
|
| 4123 |
+
return {
|
| 4124 |
+
colspan: $_20nfr6k7jfuw8q4g.constant(endColIndex),
|
| 4125 |
+
rowspan: $_20nfr6k7jfuw8q4g.constant(endRowIndex)
|
| 4126 |
+
};
|
| 4127 |
+
};
|
| 4128 |
+
var $_8v4imgmxjfuw8qme = { subgrid: subgrid };
|
| 4129 |
+
|
| 4130 |
+
var toDetails = function (grid, comparator) {
|
| 4131 |
+
var seen = $_tyr3yk5jfuw8q47.map(grid, function (row, ri) {
|
| 4132 |
+
return $_tyr3yk5jfuw8q47.map(row.cells(), function (col, ci) {
|
| 4133 |
+
return false;
|
| 4134 |
+
});
|
| 4135 |
+
});
|
| 4136 |
+
var updateSeen = function (ri, ci, rowspan, colspan) {
|
| 4137 |
+
for (var r = ri; r < ri + rowspan; r++) {
|
| 4138 |
+
for (var c = ci; c < ci + colspan; c++) {
|
| 4139 |
+
seen[r][c] = true;
|
| 4140 |
+
}
|
| 4141 |
+
}
|
| 4142 |
+
};
|
| 4143 |
+
return $_tyr3yk5jfuw8q47.map(grid, function (row, ri) {
|
| 4144 |
+
var details = $_tyr3yk5jfuw8q47.bind(row.cells(), function (cell, ci) {
|
| 4145 |
+
if (seen[ri][ci] === false) {
|
| 4146 |
+
var result = $_8v4imgmxjfuw8qme.subgrid(grid, ri, ci, comparator);
|
| 4147 |
+
updateSeen(ri, ci, result.rowspan(), result.colspan());
|
| 4148 |
+
return [$_ce5pyrkgjfuw8q5v.detailnew(cell.element(), result.rowspan(), result.colspan(), cell.isNew())];
|
| 4149 |
+
} else {
|
| 4150 |
+
return [];
|
| 4151 |
+
}
|
| 4152 |
+
});
|
| 4153 |
+
return $_ce5pyrkgjfuw8q5v.rowdetails(details, row.section());
|
| 4154 |
+
});
|
| 4155 |
+
};
|
| 4156 |
+
var toGrid = function (warehouse, generators, isNew) {
|
| 4157 |
+
var grid = [];
|
| 4158 |
+
for (var i = 0; i < warehouse.grid().rows(); i++) {
|
| 4159 |
+
var rowCells = [];
|
| 4160 |
+
for (var j = 0; j < warehouse.grid().columns(); j++) {
|
| 4161 |
+
var element = $_2ge24cldjfuw8qa3.getAt(warehouse, i, j).map(function (item) {
|
| 4162 |
+
return $_ce5pyrkgjfuw8q5v.elementnew(item.element(), isNew);
|
| 4163 |
+
}).getOrThunk(function () {
|
| 4164 |
+
return $_ce5pyrkgjfuw8q5v.elementnew(generators.gap(), true);
|
| 4165 |
+
});
|
| 4166 |
+
rowCells.push(element);
|
| 4167 |
+
}
|
| 4168 |
+
var row = $_ce5pyrkgjfuw8q5v.rowcells(rowCells, warehouse.all()[i].section());
|
| 4169 |
+
grid.push(row);
|
| 4170 |
+
}
|
| 4171 |
+
return grid;
|
| 4172 |
+
};
|
| 4173 |
+
var $_cw9o3smwjfuw8qm9 = {
|
| 4174 |
+
toDetails: toDetails,
|
| 4175 |
+
toGrid: toGrid
|
| 4176 |
+
};
|
| 4177 |
+
|
| 4178 |
+
var setIfNot = function (element, property, value, ignore) {
|
| 4179 |
+
if (value === ignore)
|
| 4180 |
+
$_3q82t2l5jfuw8q93.remove(element, property);
|
| 4181 |
+
else
|
| 4182 |
+
$_3q82t2l5jfuw8q93.set(element, property, value);
|
| 4183 |
+
};
|
| 4184 |
+
var render = function (table, grid) {
|
| 4185 |
+
var newRows = [];
|
| 4186 |
+
var newCells = [];
|
| 4187 |
+
var renderSection = function (gridSection, sectionName) {
|
| 4188 |
+
var section = $_8wdrbmlajfuw8q9m.child(table, sectionName).getOrThunk(function () {
|
| 4189 |
+
var tb = $_xbeoqkkjfuw8q73.fromTag(sectionName, $_s8scrkmjfuw8q7a.owner(table).dom());
|
| 4190 |
+
$_fatuxylgjfuw8qav.append(table, tb);
|
| 4191 |
+
return tb;
|
| 4192 |
+
});
|
| 4193 |
+
$_fl1deelhjfuw8qax.empty(section);
|
| 4194 |
+
var rows = $_tyr3yk5jfuw8q47.map(gridSection, function (row) {
|
| 4195 |
+
if (row.isNew()) {
|
| 4196 |
+
newRows.push(row.element());
|
| 4197 |
+
}
|
| 4198 |
+
var tr = row.element();
|
| 4199 |
+
$_fl1deelhjfuw8qax.empty(tr);
|
| 4200 |
+
$_tyr3yk5jfuw8q47.each(row.cells(), function (cell) {
|
| 4201 |
+
if (cell.isNew()) {
|
| 4202 |
+
newCells.push(cell.element());
|
| 4203 |
+
}
|
| 4204 |
+
setIfNot(cell.element(), 'colspan', cell.colspan(), 1);
|
| 4205 |
+
setIfNot(cell.element(), 'rowspan', cell.rowspan(), 1);
|
| 4206 |
+
$_fatuxylgjfuw8qav.append(tr, cell.element());
|
| 4207 |
+
});
|
| 4208 |
+
return tr;
|
| 4209 |
+
});
|
| 4210 |
+
$_9zaoqflijfuw8qb0.append(section, rows);
|
| 4211 |
+
};
|
| 4212 |
+
var removeSection = function (sectionName) {
|
| 4213 |
+
$_8wdrbmlajfuw8q9m.child(table, sectionName).bind($_fl1deelhjfuw8qax.remove);
|
| 4214 |
+
};
|
| 4215 |
+
var renderOrRemoveSection = function (gridSection, sectionName) {
|
| 4216 |
+
if (gridSection.length > 0) {
|
| 4217 |
+
renderSection(gridSection, sectionName);
|
| 4218 |
+
} else {
|
| 4219 |
+
removeSection(sectionName);
|
| 4220 |
+
}
|
| 4221 |
+
};
|
| 4222 |
+
var headSection = [];
|
| 4223 |
+
var bodySection = [];
|
| 4224 |
+
var footSection = [];
|
| 4225 |
+
$_tyr3yk5jfuw8q47.each(grid, function (row) {
|
| 4226 |
+
switch (row.section()) {
|
| 4227 |
+
case 'thead':
|
| 4228 |
+
headSection.push(row);
|
| 4229 |
+
break;
|
| 4230 |
+
case 'tbody':
|
| 4231 |
+
bodySection.push(row);
|
| 4232 |
+
break;
|
| 4233 |
+
case 'tfoot':
|
| 4234 |
+
footSection.push(row);
|
| 4235 |
+
break;
|
| 4236 |
+
}
|
| 4237 |
+
});
|
| 4238 |
+
renderOrRemoveSection(headSection, 'thead');
|
| 4239 |
+
renderOrRemoveSection(bodySection, 'tbody');
|
| 4240 |
+
renderOrRemoveSection(footSection, 'tfoot');
|
| 4241 |
+
return {
|
| 4242 |
+
newRows: $_20nfr6k7jfuw8q4g.constant(newRows),
|
| 4243 |
+
newCells: $_20nfr6k7jfuw8q4g.constant(newCells)
|
| 4244 |
+
};
|
| 4245 |
+
};
|
| 4246 |
+
var copy$2 = function (grid) {
|
| 4247 |
+
var rows = $_tyr3yk5jfuw8q47.map(grid, function (row) {
|
| 4248 |
+
var tr = $_ddvp06lkjfuw8qbt.shallow(row.element());
|
| 4249 |
+
$_tyr3yk5jfuw8q47.each(row.cells(), function (cell) {
|
| 4250 |
+
var clonedCell = $_ddvp06lkjfuw8qbt.deep(cell.element());
|
| 4251 |
+
setIfNot(clonedCell, 'colspan', cell.colspan(), 1);
|
| 4252 |
+
setIfNot(clonedCell, 'rowspan', cell.rowspan(), 1);
|
| 4253 |
+
$_fatuxylgjfuw8qav.append(tr, clonedCell);
|
| 4254 |
+
});
|
| 4255 |
+
return tr;
|
| 4256 |
+
});
|
| 4257 |
+
return rows;
|
| 4258 |
+
};
|
| 4259 |
+
var $_c9mejomzjfuw8qmn = {
|
| 4260 |
+
render: render,
|
| 4261 |
+
copy: copy$2
|
| 4262 |
+
};
|
| 4263 |
+
|
| 4264 |
+
var repeat = function (repititions, f) {
|
| 4265 |
+
var r = [];
|
| 4266 |
+
for (var i = 0; i < repititions; i++) {
|
| 4267 |
+
r.push(f(i));
|
| 4268 |
+
}
|
| 4269 |
+
return r;
|
| 4270 |
+
};
|
| 4271 |
+
var range$1 = function (start, end) {
|
| 4272 |
+
var r = [];
|
| 4273 |
+
for (var i = start; i < end; i++) {
|
| 4274 |
+
r.push(i);
|
| 4275 |
+
}
|
| 4276 |
+
return r;
|
| 4277 |
+
};
|
| 4278 |
+
var unique = function (xs, comparator) {
|
| 4279 |
+
var result = [];
|
| 4280 |
+
$_tyr3yk5jfuw8q47.each(xs, function (x, i) {
|
| 4281 |
+
if (i < xs.length - 1 && !comparator(x, xs[i + 1])) {
|
| 4282 |
+
result.push(x);
|
| 4283 |
+
} else if (i === xs.length - 1) {
|
| 4284 |
+
result.push(x);
|
| 4285 |
+
}
|
| 4286 |
+
});
|
| 4287 |
+
return result;
|
| 4288 |
+
};
|
| 4289 |
+
var deduce = function (xs, index) {
|
| 4290 |
+
if (index < 0 || index >= xs.length - 1)
|
| 4291 |
+
return Option.none();
|
| 4292 |
+
var current = xs[index].fold(function () {
|
| 4293 |
+
var rest = $_tyr3yk5jfuw8q47.reverse(xs.slice(0, index));
|
| 4294 |
+
return $_cul8qomvjfuw8qm7.findMap(rest, function (a, i) {
|
| 4295 |
+
return a.map(function (aa) {
|
| 4296 |
+
return {
|
| 4297 |
+
value: aa,
|
| 4298 |
+
delta: i + 1
|
| 4299 |
+
};
|
| 4300 |
+
});
|
| 4301 |
+
});
|
| 4302 |
+
}, function (c) {
|
| 4303 |
+
return Option.some({
|
| 4304 |
+
value: c,
|
| 4305 |
+
delta: 0
|
| 4306 |
+
});
|
| 4307 |
+
});
|
| 4308 |
+
var next = xs[index + 1].fold(function () {
|
| 4309 |
+
var rest = xs.slice(index + 1);
|
| 4310 |
+
return $_cul8qomvjfuw8qm7.findMap(rest, function (a, i) {
|
| 4311 |
+
return a.map(function (aa) {
|
| 4312 |
+
return {
|
| 4313 |
+
value: aa,
|
| 4314 |
+
delta: i + 1
|
| 4315 |
+
};
|
| 4316 |
+
});
|
| 4317 |
+
});
|
| 4318 |
+
}, function (n) {
|
| 4319 |
+
return Option.some({
|
| 4320 |
+
value: n,
|
| 4321 |
+
delta: 1
|
| 4322 |
+
});
|
| 4323 |
+
});
|
| 4324 |
+
return current.bind(function (c) {
|
| 4325 |
+
return next.map(function (n) {
|
| 4326 |
+
var extras = n.delta + c.delta;
|
| 4327 |
+
return Math.abs(n.value - c.value) / extras;
|
| 4328 |
+
});
|
| 4329 |
+
});
|
| 4330 |
+
};
|
| 4331 |
+
var $_fcnwwbn2jfuw8qoa = {
|
| 4332 |
+
repeat: repeat,
|
| 4333 |
+
range: range$1,
|
| 4334 |
+
unique: unique,
|
| 4335 |
+
deduce: deduce
|
| 4336 |
+
};
|
| 4337 |
+
|
| 4338 |
+
var columns = function (warehouse) {
|
| 4339 |
+
var grid = warehouse.grid();
|
| 4340 |
+
var cols = $_fcnwwbn2jfuw8qoa.range(0, grid.columns());
|
| 4341 |
+
var rows = $_fcnwwbn2jfuw8qoa.range(0, grid.rows());
|
| 4342 |
+
return $_tyr3yk5jfuw8q47.map(cols, function (col) {
|
| 4343 |
+
var getBlock = function () {
|
| 4344 |
+
return $_tyr3yk5jfuw8q47.bind(rows, function (r) {
|
| 4345 |
+
return $_2ge24cldjfuw8qa3.getAt(warehouse, r, col).filter(function (detail) {
|
| 4346 |
+
return detail.column() === col;
|
| 4347 |
+
}).fold($_20nfr6k7jfuw8q4g.constant([]), function (detail) {
|
| 4348 |
+
return [detail];
|
| 4349 |
+
});
|
| 4350 |
+
});
|
| 4351 |
+
};
|
| 4352 |
+
var isSingle = function (detail) {
|
| 4353 |
+
return detail.colspan() === 1;
|
| 4354 |
+
};
|
| 4355 |
+
var getFallback = function () {
|
| 4356 |
+
return $_2ge24cldjfuw8qa3.getAt(warehouse, 0, col);
|
| 4357 |
+
};
|
| 4358 |
+
return decide(getBlock, isSingle, getFallback);
|
| 4359 |
+
});
|
| 4360 |
+
};
|
| 4361 |
+
var decide = function (getBlock, isSingle, getFallback) {
|
| 4362 |
+
var inBlock = getBlock();
|
| 4363 |
+
var singleInBlock = $_tyr3yk5jfuw8q47.find(inBlock, isSingle);
|
| 4364 |
+
var detailOption = singleInBlock.orThunk(function () {
|
| 4365 |
+
return Option.from(inBlock[0]).orThunk(getFallback);
|
| 4366 |
+
});
|
| 4367 |
+
return detailOption.map(function (detail) {
|
| 4368 |
+
return detail.element();
|
| 4369 |
+
});
|
| 4370 |
+
};
|
| 4371 |
+
var rows$1 = function (warehouse) {
|
| 4372 |
+
var grid = warehouse.grid();
|
| 4373 |
+
var rows = $_fcnwwbn2jfuw8qoa.range(0, grid.rows());
|
| 4374 |
+
var cols = $_fcnwwbn2jfuw8qoa.range(0, grid.columns());
|
| 4375 |
+
return $_tyr3yk5jfuw8q47.map(rows, function (row) {
|
| 4376 |
+
var getBlock = function () {
|
| 4377 |
+
return $_tyr3yk5jfuw8q47.bind(cols, function (c) {
|
| 4378 |
+
return $_2ge24cldjfuw8qa3.getAt(warehouse, row, c).filter(function (detail) {
|
| 4379 |
+
return detail.row() === row;
|
| 4380 |
+
}).fold($_20nfr6k7jfuw8q4g.constant([]), function (detail) {
|
| 4381 |
+
return [detail];
|
| 4382 |
+
});
|
| 4383 |
+
});
|
| 4384 |
+
};
|
| 4385 |
+
var isSingle = function (detail) {
|
| 4386 |
+
return detail.rowspan() === 1;
|
| 4387 |
+
};
|
| 4388 |
+
var getFallback = function () {
|
| 4389 |
+
return $_2ge24cldjfuw8qa3.getAt(warehouse, row, 0);
|
| 4390 |
+
};
|
| 4391 |
+
return decide(getBlock, isSingle, getFallback);
|
| 4392 |
+
});
|
| 4393 |
+
};
|
| 4394 |
+
var $_9oko5pn1jfuw8qo0 = {
|
| 4395 |
+
columns: columns,
|
| 4396 |
+
rows: rows$1
|
| 4397 |
+
};
|
| 4398 |
+
|
| 4399 |
+
var col = function (column, x, y, w, h) {
|
| 4400 |
+
var blocker = $_xbeoqkkjfuw8q73.fromTag('div');
|
| 4401 |
+
$_bfod2hlejfuw8qac.setAll(blocker, {
|
| 4402 |
+
position: 'absolute',
|
| 4403 |
+
left: x - w / 2 + 'px',
|
| 4404 |
+
top: y + 'px',
|
| 4405 |
+
height: h + 'px',
|
| 4406 |
+
width: w + 'px'
|
| 4407 |
+
});
|
| 4408 |
+
$_3q82t2l5jfuw8q93.setAll(blocker, {
|
| 4409 |
+
'data-column': column,
|
| 4410 |
+
'role': 'presentation'
|
| 4411 |
+
});
|
| 4412 |
+
return blocker;
|
| 4413 |
+
};
|
| 4414 |
+
var row$1 = function (row, x, y, w, h) {
|
| 4415 |
+
var blocker = $_xbeoqkkjfuw8q73.fromTag('div');
|
| 4416 |
+
$_bfod2hlejfuw8qac.setAll(blocker, {
|
| 4417 |
+
position: 'absolute',
|
| 4418 |
+
left: x + 'px',
|
| 4419 |
+
top: y - h / 2 + 'px',
|
| 4420 |
+
height: h + 'px',
|
| 4421 |
+
width: w + 'px'
|
| 4422 |
+
});
|
| 4423 |
+
$_3q82t2l5jfuw8q93.setAll(blocker, {
|
| 4424 |
+
'data-row': row,
|
| 4425 |
+
'role': 'presentation'
|
| 4426 |
+
});
|
| 4427 |
+
return blocker;
|
| 4428 |
+
};
|
| 4429 |
+
var $_bis8idn3jfuw8qoi = {
|
| 4430 |
+
col: col,
|
| 4431 |
+
row: row$1
|
| 4432 |
+
};
|
| 4433 |
+
|
| 4434 |
+
var css = function (namespace) {
|
| 4435 |
+
var dashNamespace = namespace.replace(/\./g, '-');
|
| 4436 |
+
var resolve = function (str) {
|
| 4437 |
+
return dashNamespace + '-' + str;
|
| 4438 |
+
};
|
| 4439 |
+
return { resolve: resolve };
|
| 4440 |
+
};
|
| 4441 |
+
var $_63w6atn5jfuw8qot = { css: css };
|
| 4442 |
+
|
| 4443 |
+
var styles = $_63w6atn5jfuw8qot.css('ephox-snooker');
|
| 4444 |
+
var $_f6r94sn4jfuw8qoq = { resolve: styles.resolve };
|
| 4445 |
+
|
| 4446 |
+
function Toggler (turnOff, turnOn, initial) {
|
| 4447 |
+
var active = initial || false;
|
| 4448 |
+
var on = function () {
|
| 4449 |
+
turnOn();
|
| 4450 |
+
active = true;
|
| 4451 |
+
};
|
| 4452 |
+
var off = function () {
|
| 4453 |
+
turnOff();
|
| 4454 |
+
active = false;
|
| 4455 |
+
};
|
| 4456 |
+
var toggle = function () {
|
| 4457 |
+
var f = active ? off : on;
|
| 4458 |
+
f();
|
| 4459 |
+
};
|
| 4460 |
+
var isOn = function () {
|
| 4461 |
+
return active;
|
| 4462 |
+
};
|
| 4463 |
+
return {
|
| 4464 |
+
on: on,
|
| 4465 |
+
off: off,
|
| 4466 |
+
toggle: toggle,
|
| 4467 |
+
isOn: isOn
|
| 4468 |
+
};
|
| 4469 |
+
}
|
| 4470 |
+
|
| 4471 |
+
var read = function (element, attr) {
|
| 4472 |
+
var value = $_3q82t2l5jfuw8q93.get(element, attr);
|
| 4473 |
+
return value === undefined || value === '' ? [] : value.split(' ');
|
| 4474 |
+
};
|
| 4475 |
+
var add = function (element, attr, id) {
|
| 4476 |
+
var old = read(element, attr);
|
| 4477 |
+
var nu = old.concat([id]);
|
| 4478 |
+
$_3q82t2l5jfuw8q93.set(element, attr, nu.join(' '));
|
| 4479 |
+
};
|
| 4480 |
+
var remove$3 = function (element, attr, id) {
|
| 4481 |
+
var nu = $_tyr3yk5jfuw8q47.filter(read(element, attr), function (v) {
|
| 4482 |
+
return v !== id;
|
| 4483 |
+
});
|
| 4484 |
+
if (nu.length > 0)
|
| 4485 |
+
$_3q82t2l5jfuw8q93.set(element, attr, nu.join(' '));
|
| 4486 |
+
else
|
| 4487 |
+
$_3q82t2l5jfuw8q93.remove(element, attr);
|
| 4488 |
+
};
|
| 4489 |
+
var $_61h5lon9jfuw8qp0 = {
|
| 4490 |
+
read: read,
|
| 4491 |
+
add: add,
|
| 4492 |
+
remove: remove$3
|
| 4493 |
+
};
|
| 4494 |
+
|
| 4495 |
+
var supports = function (element) {
|
| 4496 |
+
return element.dom().classList !== undefined;
|
| 4497 |
+
};
|
| 4498 |
+
var get$6 = function (element) {
|
| 4499 |
+
return $_61h5lon9jfuw8qp0.read(element, 'class');
|
| 4500 |
+
};
|
| 4501 |
+
var add$1 = function (element, clazz) {
|
| 4502 |
+
return $_61h5lon9jfuw8qp0.add(element, 'class', clazz);
|
| 4503 |
+
};
|
| 4504 |
+
var remove$4 = function (element, clazz) {
|
| 4505 |
+
return $_61h5lon9jfuw8qp0.remove(element, 'class', clazz);
|
| 4506 |
+
};
|
| 4507 |
+
var toggle = function (element, clazz) {
|
| 4508 |
+
if ($_tyr3yk5jfuw8q47.contains(get$6(element), clazz)) {
|
| 4509 |
+
remove$4(element, clazz);
|
| 4510 |
+
} else {
|
| 4511 |
+
add$1(element, clazz);
|
| 4512 |
+
}
|
| 4513 |
+
};
|
| 4514 |
+
var $_f4rpvun8jfuw8qox = {
|
| 4515 |
+
get: get$6,
|
| 4516 |
+
add: add$1,
|
| 4517 |
+
remove: remove$4,
|
| 4518 |
+
toggle: toggle,
|
| 4519 |
+
supports: supports
|
| 4520 |
+
};
|
| 4521 |
+
|
| 4522 |
+
var add$2 = function (element, clazz) {
|
| 4523 |
+
if ($_f4rpvun8jfuw8qox.supports(element))
|
| 4524 |
+
element.dom().classList.add(clazz);
|
| 4525 |
+
else
|
| 4526 |
+
$_f4rpvun8jfuw8qox.add(element, clazz);
|
| 4527 |
+
};
|
| 4528 |
+
var cleanClass = function (element) {
|
| 4529 |
+
var classList = $_f4rpvun8jfuw8qox.supports(element) ? element.dom().classList : $_f4rpvun8jfuw8qox.get(element);
|
| 4530 |
+
if (classList.length === 0) {
|
| 4531 |
+
$_3q82t2l5jfuw8q93.remove(element, 'class');
|
| 4532 |
+
}
|
| 4533 |
+
};
|
| 4534 |
+
var remove$5 = function (element, clazz) {
|
| 4535 |
+
if ($_f4rpvun8jfuw8qox.supports(element)) {
|
| 4536 |
+
var classList = element.dom().classList;
|
| 4537 |
+
classList.remove(clazz);
|
| 4538 |
+
} else
|
| 4539 |
+
$_f4rpvun8jfuw8qox.remove(element, clazz);
|
| 4540 |
+
cleanClass(element);
|
| 4541 |
+
};
|
| 4542 |
+
var toggle$1 = function (element, clazz) {
|
| 4543 |
+
return $_f4rpvun8jfuw8qox.supports(element) ? element.dom().classList.toggle(clazz) : $_f4rpvun8jfuw8qox.toggle(element, clazz);
|
| 4544 |
+
};
|
| 4545 |
+
var toggler = function (element, clazz) {
|
| 4546 |
+
var hasClasslist = $_f4rpvun8jfuw8qox.supports(element);
|
| 4547 |
+
var classList = element.dom().classList;
|
| 4548 |
+
var off = function () {
|
| 4549 |
+
if (hasClasslist)
|
| 4550 |
+
classList.remove(clazz);
|
| 4551 |
+
else
|
| 4552 |
+
$_f4rpvun8jfuw8qox.remove(element, clazz);
|
| 4553 |
+
};
|
| 4554 |
+
var on = function () {
|
| 4555 |
+
if (hasClasslist)
|
| 4556 |
+
classList.add(clazz);
|
| 4557 |
+
else
|
| 4558 |
+
$_f4rpvun8jfuw8qox.add(element, clazz);
|
| 4559 |
+
};
|
| 4560 |
+
return Toggler(off, on, has$1(element, clazz));
|
| 4561 |
+
};
|
| 4562 |
+
var has$1 = function (element, clazz) {
|
| 4563 |
+
return $_f4rpvun8jfuw8qox.supports(element) && element.dom().classList.contains(clazz);
|
| 4564 |
+
};
|
| 4565 |
+
var $_fmcseon6jfuw8qou = {
|
| 4566 |
+
add: add$2,
|
| 4567 |
+
remove: remove$5,
|
| 4568 |
+
toggle: toggle$1,
|
| 4569 |
+
toggler: toggler,
|
| 4570 |
+
has: has$1
|
| 4571 |
+
};
|
| 4572 |
+
|
| 4573 |
+
var resizeBar = $_f6r94sn4jfuw8qoq.resolve('resizer-bar');
|
| 4574 |
+
var resizeRowBar = $_f6r94sn4jfuw8qoq.resolve('resizer-rows');
|
| 4575 |
+
var resizeColBar = $_f6r94sn4jfuw8qoq.resolve('resizer-cols');
|
| 4576 |
+
var BAR_THICKNESS = 7;
|
| 4577 |
+
var clear = function (wire) {
|
| 4578 |
+
var previous = $_6c9d0hl7jfuw8q9d.descendants(wire.parent(), '.' + resizeBar);
|
| 4579 |
+
$_tyr3yk5jfuw8q47.each(previous, $_fl1deelhjfuw8qax.remove);
|
| 4580 |
+
};
|
| 4581 |
+
var drawBar = function (wire, positions, create) {
|
| 4582 |
+
var origin = wire.origin();
|
| 4583 |
+
$_tyr3yk5jfuw8q47.each(positions, function (cpOption, i) {
|
| 4584 |
+
cpOption.each(function (cp) {
|
| 4585 |
+
var bar = create(origin, cp);
|
| 4586 |
+
$_fmcseon6jfuw8qou.add(bar, resizeBar);
|
| 4587 |
+
$_fatuxylgjfuw8qav.append(wire.parent(), bar);
|
| 4588 |
+
});
|
| 4589 |
+
});
|
| 4590 |
+
};
|
| 4591 |
+
var refreshCol = function (wire, colPositions, position, tableHeight) {
|
| 4592 |
+
drawBar(wire, colPositions, function (origin, cp) {
|
| 4593 |
+
var colBar = $_bis8idn3jfuw8qoi.col(cp.col(), cp.x() - origin.left(), position.top() - origin.top(), BAR_THICKNESS, tableHeight);
|
| 4594 |
+
$_fmcseon6jfuw8qou.add(colBar, resizeColBar);
|
| 4595 |
+
return colBar;
|
| 4596 |
+
});
|
| 4597 |
+
};
|
| 4598 |
+
var refreshRow = function (wire, rowPositions, position, tableWidth) {
|
| 4599 |
+
drawBar(wire, rowPositions, function (origin, cp) {
|
| 4600 |
+
var rowBar = $_bis8idn3jfuw8qoi.row(cp.row(), position.left() - origin.left(), cp.y() - origin.top(), tableWidth, BAR_THICKNESS);
|
| 4601 |
+
$_fmcseon6jfuw8qou.add(rowBar, resizeRowBar);
|
| 4602 |
+
return rowBar;
|
| 4603 |
+
});
|
| 4604 |
+
};
|
| 4605 |
+
var refreshGrid = function (wire, table, rows, cols, hdirection, vdirection) {
|
| 4606 |
+
var position = $_hsvzlmijfuw8qj4.absolute(table);
|
| 4607 |
+
var rowPositions = rows.length > 0 ? hdirection.positions(rows, table) : [];
|
| 4608 |
+
refreshRow(wire, rowPositions, position, $_fj252lmejfuw8qin.getOuter(table));
|
| 4609 |
+
var colPositions = cols.length > 0 ? vdirection.positions(cols, table) : [];
|
| 4610 |
+
refreshCol(wire, colPositions, position, $_cymdhgmcjfuw8qif.getOuter(table));
|
| 4611 |
+
};
|
| 4612 |
+
var refresh = function (wire, table, hdirection, vdirection) {
|
| 4613 |
+
clear(wire);
|
| 4614 |
+
var list = $_dy3x0nkfjfuw8q5l.fromTable(table);
|
| 4615 |
+
var warehouse = $_2ge24cldjfuw8qa3.generate(list);
|
| 4616 |
+
var rows = $_9oko5pn1jfuw8qo0.rows(warehouse);
|
| 4617 |
+
var cols = $_9oko5pn1jfuw8qo0.columns(warehouse);
|
| 4618 |
+
refreshGrid(wire, table, rows, cols, hdirection, vdirection);
|
| 4619 |
+
};
|
| 4620 |
+
var each$2 = function (wire, f) {
|
| 4621 |
+
var bars = $_6c9d0hl7jfuw8q9d.descendants(wire.parent(), '.' + resizeBar);
|
| 4622 |
+
$_tyr3yk5jfuw8q47.each(bars, f);
|
| 4623 |
+
};
|
| 4624 |
+
var hide = function (wire) {
|
| 4625 |
+
each$2(wire, function (bar) {
|
| 4626 |
+
$_bfod2hlejfuw8qac.set(bar, 'display', 'none');
|
| 4627 |
+
});
|
| 4628 |
+
};
|
| 4629 |
+
var show = function (wire) {
|
| 4630 |
+
each$2(wire, function (bar) {
|
| 4631 |
+
$_bfod2hlejfuw8qac.set(bar, 'display', 'block');
|
| 4632 |
+
});
|
| 4633 |
+
};
|
| 4634 |
+
var isRowBar = function (element) {
|
| 4635 |
+
return $_fmcseon6jfuw8qou.has(element, resizeRowBar);
|
| 4636 |
+
};
|
| 4637 |
+
var isColBar = function (element) {
|
| 4638 |
+
return $_fmcseon6jfuw8qou.has(element, resizeColBar);
|
| 4639 |
+
};
|
| 4640 |
+
var $_jc1w5n0jfuw8qng = {
|
| 4641 |
+
refresh: refresh,
|
| 4642 |
+
hide: hide,
|
| 4643 |
+
show: show,
|
| 4644 |
+
destroy: clear,
|
| 4645 |
+
isRowBar: isRowBar,
|
| 4646 |
+
isColBar: isColBar
|
| 4647 |
+
};
|
| 4648 |
+
|
| 4649 |
+
var fromWarehouse = function (warehouse, generators) {
|
| 4650 |
+
return $_cw9o3smwjfuw8qm9.toGrid(warehouse, generators, false);
|
| 4651 |
+
};
|
| 4652 |
+
var deriveRows = function (rendered, generators) {
|
| 4653 |
+
var findRow = function (details) {
|
| 4654 |
+
var rowOfCells = $_cul8qomvjfuw8qm7.findMap(details, function (detail) {
|
| 4655 |
+
return $_s8scrkmjfuw8q7a.parent(detail.element()).map(function (row) {
|
| 4656 |
+
var isNew = $_s8scrkmjfuw8q7a.parent(row).isNone();
|
| 4657 |
+
return $_ce5pyrkgjfuw8q5v.elementnew(row, isNew);
|
| 4658 |
+
});
|
| 4659 |
+
});
|
| 4660 |
+
return rowOfCells.getOrThunk(function () {
|
| 4661 |
+
return $_ce5pyrkgjfuw8q5v.elementnew(generators.row(), true);
|
| 4662 |
+
});
|
| 4663 |
+
};
|
| 4664 |
+
return $_tyr3yk5jfuw8q47.map(rendered, function (details) {
|
| 4665 |
+
var row = findRow(details.details());
|
| 4666 |
+
return $_ce5pyrkgjfuw8q5v.rowdatanew(row.element(), details.details(), details.section(), row.isNew());
|
| 4667 |
+
});
|
| 4668 |
+
};
|
| 4669 |
+
var toDetailList = function (grid, generators) {
|
| 4670 |
+
var rendered = $_cw9o3smwjfuw8qm9.toDetails(grid, $_e8rn66kojfuw8q7n.eq);
|
| 4671 |
+
return deriveRows(rendered, generators);
|
| 4672 |
+
};
|
| 4673 |
+
var findInWarehouse = function (warehouse, element) {
|
| 4674 |
+
var all = $_tyr3yk5jfuw8q47.flatten($_tyr3yk5jfuw8q47.map(warehouse.all(), function (r) {
|
| 4675 |
+
return r.cells();
|
| 4676 |
+
}));
|
| 4677 |
+
return $_tyr3yk5jfuw8q47.find(all, function (e) {
|
| 4678 |
+
return $_e8rn66kojfuw8q7n.eq(element, e.element());
|
| 4679 |
+
});
|
| 4680 |
+
};
|
| 4681 |
+
var run = function (operation, extract, adjustment, postAction, genWrappers) {
|
| 4682 |
+
return function (wire, table, target, generators, direction) {
|
| 4683 |
+
var input = $_dy3x0nkfjfuw8q5l.fromTable(table);
|
| 4684 |
+
var warehouse = $_2ge24cldjfuw8qa3.generate(input);
|
| 4685 |
+
var output = extract(warehouse, target).map(function (info) {
|
| 4686 |
+
var model = fromWarehouse(warehouse, generators);
|
| 4687 |
+
var result = operation(model, info, $_e8rn66kojfuw8q7n.eq, genWrappers(generators));
|
| 4688 |
+
var grid = toDetailList(result.grid(), generators);
|
| 4689 |
+
return {
|
| 4690 |
+
grid: $_20nfr6k7jfuw8q4g.constant(grid),
|
| 4691 |
+
cursor: result.cursor
|
| 4692 |
+
};
|
| 4693 |
+
});
|
| 4694 |
+
return output.fold(function () {
|
| 4695 |
+
return Option.none();
|
| 4696 |
+
}, function (out) {
|
| 4697 |
+
var newElements = $_c9mejomzjfuw8qmn.render(table, out.grid());
|
| 4698 |
+
adjustment(table, out.grid(), direction);
|
| 4699 |
+
postAction(table);
|
| 4700 |
+
$_jc1w5n0jfuw8qng.refresh(wire, table, $_16z2iamhjfuw8qir.height, direction);
|
| 4701 |
+
return Option.some({
|
| 4702 |
+
cursor: out.cursor,
|
| 4703 |
+
newRows: newElements.newRows,
|
| 4704 |
+
newCells: newElements.newCells
|
| 4705 |
+
});
|
| 4706 |
+
});
|
| 4707 |
+
};
|
| 4708 |
+
};
|
| 4709 |
+
var onCell = function (warehouse, target) {
|
| 4710 |
+
return $_aqhz9okhjfuw8q5y.cell(target.element()).bind(function (cell) {
|
| 4711 |
+
return findInWarehouse(warehouse, cell);
|
| 4712 |
+
});
|
| 4713 |
+
};
|
| 4714 |
+
var onPaste = function (warehouse, target) {
|
| 4715 |
+
return $_aqhz9okhjfuw8q5y.cell(target.element()).bind(function (cell) {
|
| 4716 |
+
return findInWarehouse(warehouse, cell).map(function (details) {
|
| 4717 |
+
return $_91sgzmujfuw8qm5.merge(details, {
|
| 4718 |
+
generators: target.generators,
|
| 4719 |
+
clipboard: target.clipboard
|
| 4720 |
+
});
|
| 4721 |
+
});
|
| 4722 |
+
});
|
| 4723 |
+
};
|
| 4724 |
+
var onPasteRows = function (warehouse, target) {
|
| 4725 |
+
var details = $_tyr3yk5jfuw8q47.map(target.selection(), function (cell) {
|
| 4726 |
+
return $_aqhz9okhjfuw8q5y.cell(cell).bind(function (lc) {
|
| 4727 |
+
return findInWarehouse(warehouse, lc);
|
| 4728 |
+
});
|
| 4729 |
+
});
|
| 4730 |
+
var cells = $_cul8qomvjfuw8qm7.cat(details);
|
| 4731 |
+
return cells.length > 0 ? Option.some($_91sgzmujfuw8qm5.merge({ cells: cells }, {
|
| 4732 |
+
generators: target.generators,
|
| 4733 |
+
clipboard: target.clipboard
|
| 4734 |
+
})) : Option.none();
|
| 4735 |
+
};
|
| 4736 |
+
var onMergable = function (warehouse, target) {
|
| 4737 |
+
return target.mergable();
|
| 4738 |
+
};
|
| 4739 |
+
var onUnmergable = function (warehouse, target) {
|
| 4740 |
+
return target.unmergable();
|
| 4741 |
+
};
|
| 4742 |
+
var onCells = function (warehouse, target) {
|
| 4743 |
+
var details = $_tyr3yk5jfuw8q47.map(target.selection(), function (cell) {
|
| 4744 |
+
return $_aqhz9okhjfuw8q5y.cell(cell).bind(function (lc) {
|
| 4745 |
+
return findInWarehouse(warehouse, lc);
|
| 4746 |
+
});
|
| 4747 |
+
});
|
| 4748 |
+
var cells = $_cul8qomvjfuw8qm7.cat(details);
|
| 4749 |
+
return cells.length > 0 ? Option.some(cells) : Option.none();
|
| 4750 |
+
};
|
| 4751 |
+
var $_dis709mtjfuw8qlp = {
|
| 4752 |
+
run: run,
|
| 4753 |
+
toDetailList: toDetailList,
|
| 4754 |
+
onCell: onCell,
|
| 4755 |
+
onCells: onCells,
|
| 4756 |
+
onPaste: onPaste,
|
| 4757 |
+
onPasteRows: onPasteRows,
|
| 4758 |
+
onMergable: onMergable,
|
| 4759 |
+
onUnmergable: onUnmergable
|
| 4760 |
+
};
|
| 4761 |
+
|
| 4762 |
+
var value$1 = function (o) {
|
| 4763 |
+
var is = function (v) {
|
| 4764 |
+
return o === v;
|
| 4765 |
+
};
|
| 4766 |
+
var or = function (opt) {
|
| 4767 |
+
return value$1(o);
|
| 4768 |
+
};
|
| 4769 |
+
var orThunk = function (f) {
|
| 4770 |
+
return value$1(o);
|
| 4771 |
+
};
|
| 4772 |
+
var map = function (f) {
|
| 4773 |
+
return value$1(f(o));
|
| 4774 |
+
};
|
| 4775 |
+
var each = function (f) {
|
| 4776 |
+
f(o);
|
| 4777 |
+
};
|
| 4778 |
+
var bind = function (f) {
|
| 4779 |
+
return f(o);
|
| 4780 |
+
};
|
| 4781 |
+
var fold = function (_, onValue) {
|
| 4782 |
+
return onValue(o);
|
| 4783 |
+
};
|
| 4784 |
+
var exists = function (f) {
|
| 4785 |
+
return f(o);
|
| 4786 |
+
};
|
| 4787 |
+
var forall = function (f) {
|
| 4788 |
+
return f(o);
|
| 4789 |
+
};
|
| 4790 |
+
var toOption = function () {
|
| 4791 |
+
return Option.some(o);
|
| 4792 |
+
};
|
| 4793 |
+
return {
|
| 4794 |
+
is: is,
|
| 4795 |
+
isValue: $_20nfr6k7jfuw8q4g.always,
|
| 4796 |
+
isError: $_20nfr6k7jfuw8q4g.never,
|
| 4797 |
+
getOr: $_20nfr6k7jfuw8q4g.constant(o),
|
| 4798 |
+
getOrThunk: $_20nfr6k7jfuw8q4g.constant(o),
|
| 4799 |
+
getOrDie: $_20nfr6k7jfuw8q4g.constant(o),
|
| 4800 |
+
or: or,
|
| 4801 |
+
orThunk: orThunk,
|
| 4802 |
+
fold: fold,
|
| 4803 |
+
map: map,
|
| 4804 |
+
each: each,
|
| 4805 |
+
bind: bind,
|
| 4806 |
+
exists: exists,
|
| 4807 |
+
forall: forall,
|
| 4808 |
+
toOption: toOption
|
| 4809 |
+
};
|
| 4810 |
+
};
|
| 4811 |
+
var error = function (message) {
|
| 4812 |
+
var getOrThunk = function (f) {
|
| 4813 |
+
return f();
|
| 4814 |
+
};
|
| 4815 |
+
var getOrDie = function () {
|
| 4816 |
+
return $_20nfr6k7jfuw8q4g.die(String(message))();
|
| 4817 |
+
};
|
| 4818 |
+
var or = function (opt) {
|
| 4819 |
+
return opt;
|
| 4820 |
+
};
|
| 4821 |
+
var orThunk = function (f) {
|
| 4822 |
+
return f();
|
| 4823 |
+
};
|
| 4824 |
+
var map = function (f) {
|
| 4825 |
+
return error(message);
|
| 4826 |
+
};
|
| 4827 |
+
var bind = function (f) {
|
| 4828 |
+
return error(message);
|
| 4829 |
+
};
|
| 4830 |
+
var fold = function (onError, _) {
|
| 4831 |
+
return onError(message);
|
| 4832 |
+
};
|
| 4833 |
+
return {
|
| 4834 |
+
is: $_20nfr6k7jfuw8q4g.never,
|
| 4835 |
+
isValue: $_20nfr6k7jfuw8q4g.never,
|
| 4836 |
+
isError: $_20nfr6k7jfuw8q4g.always,
|
| 4837 |
+
getOr: $_20nfr6k7jfuw8q4g.identity,
|
| 4838 |
+
getOrThunk: getOrThunk,
|
| 4839 |
+
getOrDie: getOrDie,
|
| 4840 |
+
or: or,
|
| 4841 |
+
orThunk: orThunk,
|
| 4842 |
+
fold: fold,
|
| 4843 |
+
map: map,
|
| 4844 |
+
each: $_20nfr6k7jfuw8q4g.noop,
|
| 4845 |
+
bind: bind,
|
| 4846 |
+
exists: $_20nfr6k7jfuw8q4g.never,
|
| 4847 |
+
forall: $_20nfr6k7jfuw8q4g.always,
|
| 4848 |
+
toOption: Option.none
|
| 4849 |
+
};
|
| 4850 |
+
};
|
| 4851 |
+
var Result = {
|
| 4852 |
+
value: value$1,
|
| 4853 |
+
error: error
|
| 4854 |
+
};
|
| 4855 |
+
|
| 4856 |
+
var measure = function (startAddress, gridA, gridB) {
|
| 4857 |
+
if (startAddress.row() >= gridA.length || startAddress.column() > $_aylxzgmyjfuw8qmj.cellLength(gridA[0]))
|
| 4858 |
+
return Result.error('invalid start address out of table bounds, row: ' + startAddress.row() + ', column: ' + startAddress.column());
|
| 4859 |
+
var rowRemainder = gridA.slice(startAddress.row());
|
| 4860 |
+
var colRemainder = rowRemainder[0].cells().slice(startAddress.column());
|
| 4861 |
+
var colRequired = $_aylxzgmyjfuw8qmj.cellLength(gridB[0]);
|
| 4862 |
+
var rowRequired = gridB.length;
|
| 4863 |
+
return Result.value({
|
| 4864 |
+
rowDelta: $_20nfr6k7jfuw8q4g.constant(rowRemainder.length - rowRequired),
|
| 4865 |
+
colDelta: $_20nfr6k7jfuw8q4g.constant(colRemainder.length - colRequired)
|
| 4866 |
+
});
|
| 4867 |
+
};
|
| 4868 |
+
var measureWidth = function (gridA, gridB) {
|
| 4869 |
+
var colLengthA = $_aylxzgmyjfuw8qmj.cellLength(gridA[0]);
|
| 4870 |
+
var colLengthB = $_aylxzgmyjfuw8qmj.cellLength(gridB[0]);
|
| 4871 |
+
return {
|
| 4872 |
+
rowDelta: $_20nfr6k7jfuw8q4g.constant(0),
|
| 4873 |
+
colDelta: $_20nfr6k7jfuw8q4g.constant(colLengthA - colLengthB)
|
| 4874 |
+
};
|
| 4875 |
+
};
|
| 4876 |
+
var fill = function (cells, generator) {
|
| 4877 |
+
return $_tyr3yk5jfuw8q47.map(cells, function () {
|
| 4878 |
+
return $_ce5pyrkgjfuw8q5v.elementnew(generator.cell(), true);
|
| 4879 |
+
});
|
| 4880 |
+
};
|
| 4881 |
+
var rowFill = function (grid, amount, generator) {
|
| 4882 |
+
return grid.concat($_fcnwwbn2jfuw8qoa.repeat(amount, function (_row) {
|
| 4883 |
+
return $_aylxzgmyjfuw8qmj.setCells(grid[grid.length - 1], fill(grid[grid.length - 1].cells(), generator));
|
| 4884 |
+
}));
|
| 4885 |
+
};
|
| 4886 |
+
var colFill = function (grid, amount, generator) {
|
| 4887 |
+
return $_tyr3yk5jfuw8q47.map(grid, function (row) {
|
| 4888 |
+
return $_aylxzgmyjfuw8qmj.setCells(row, row.cells().concat(fill($_fcnwwbn2jfuw8qoa.range(0, amount), generator)));
|
| 4889 |
+
});
|
| 4890 |
+
};
|
| 4891 |
+
var tailor = function (gridA, delta, generator) {
|
| 4892 |
+
var fillCols = delta.colDelta() < 0 ? colFill : $_20nfr6k7jfuw8q4g.identity;
|
| 4893 |
+
var fillRows = delta.rowDelta() < 0 ? rowFill : $_20nfr6k7jfuw8q4g.identity;
|
| 4894 |
+
var modifiedCols = fillCols(gridA, Math.abs(delta.colDelta()), generator);
|
| 4895 |
+
var tailoredGrid = fillRows(modifiedCols, Math.abs(delta.rowDelta()), generator);
|
| 4896 |
+
return tailoredGrid;
|
| 4897 |
+
};
|
| 4898 |
+
var $_pbbdjnbjfuw8qpe = {
|
| 4899 |
+
measure: measure,
|
| 4900 |
+
measureWidth: measureWidth,
|
| 4901 |
+
tailor: tailor
|
| 4902 |
+
};
|
| 4903 |
+
|
| 4904 |
+
var merge$2 = function (grid, bounds, comparator, substitution) {
|
| 4905 |
+
if (grid.length === 0)
|
| 4906 |
+
return grid;
|
| 4907 |
+
for (var i = bounds.startRow(); i <= bounds.finishRow(); i++) {
|
| 4908 |
+
for (var j = bounds.startCol(); j <= bounds.finishCol(); j++) {
|
| 4909 |
+
$_aylxzgmyjfuw8qmj.mutateCell(grid[i], j, $_ce5pyrkgjfuw8q5v.elementnew(substitution(), false));
|
| 4910 |
+
}
|
| 4911 |
+
}
|
| 4912 |
+
return grid;
|
| 4913 |
+
};
|
| 4914 |
+
var unmerge = function (grid, target, comparator, substitution) {
|
| 4915 |
+
var first = true;
|
| 4916 |
+
for (var i = 0; i < grid.length; i++) {
|
| 4917 |
+
for (var j = 0; j < $_aylxzgmyjfuw8qmj.cellLength(grid[0]); j++) {
|
| 4918 |
+
var current = $_aylxzgmyjfuw8qmj.getCellElement(grid[i], j);
|
| 4919 |
+
var isToReplace = comparator(current, target);
|
| 4920 |
+
if (isToReplace === true && first === false) {
|
| 4921 |
+
$_aylxzgmyjfuw8qmj.mutateCell(grid[i], j, $_ce5pyrkgjfuw8q5v.elementnew(substitution(), true));
|
| 4922 |
+
} else if (isToReplace === true) {
|
| 4923 |
+
first = false;
|
| 4924 |
+
}
|
| 4925 |
+
}
|
| 4926 |
+
}
|
| 4927 |
+
return grid;
|
| 4928 |
+
};
|
| 4929 |
+
var uniqueCells = function (row, comparator) {
|
| 4930 |
+
return $_tyr3yk5jfuw8q47.foldl(row, function (rest, cell) {
|
| 4931 |
+
return $_tyr3yk5jfuw8q47.exists(rest, function (currentCell) {
|
| 4932 |
+
return comparator(currentCell.element(), cell.element());
|
| 4933 |
+
}) ? rest : rest.concat([cell]);
|
| 4934 |
+
}, []);
|
| 4935 |
+
};
|
| 4936 |
+
var splitRows = function (grid, index, comparator, substitution) {
|
| 4937 |
+
if (index > 0 && index < grid.length) {
|
| 4938 |
+
var rowPrevCells = grid[index - 1].cells();
|
| 4939 |
+
var cells = uniqueCells(rowPrevCells, comparator);
|
| 4940 |
+
$_tyr3yk5jfuw8q47.each(cells, function (cell) {
|
| 4941 |
+
var replacement = Option.none();
|
| 4942 |
+
for (var i = index; i < grid.length; i++) {
|
| 4943 |
+
for (var j = 0; j < $_aylxzgmyjfuw8qmj.cellLength(grid[0]); j++) {
|
| 4944 |
+
var current = grid[i].cells()[j];
|
| 4945 |
+
var isToReplace = comparator(current.element(), cell.element());
|
| 4946 |
+
if (isToReplace) {
|
| 4947 |
+
if (replacement.isNone()) {
|
| 4948 |
+
replacement = Option.some(substitution());
|
| 4949 |
+
}
|
| 4950 |
+
replacement.each(function (sub) {
|
| 4951 |
+
$_aylxzgmyjfuw8qmj.mutateCell(grid[i], j, $_ce5pyrkgjfuw8q5v.elementnew(sub, true));
|
| 4952 |
+
});
|
| 4953 |
+
}
|
| 4954 |
+
}
|
| 4955 |
+
}
|
| 4956 |
+
});
|
| 4957 |
+
}
|
| 4958 |
+
return grid;
|
| 4959 |
+
};
|
| 4960 |
+
var $_72fqzkndjfuw8qpp = {
|
| 4961 |
+
merge: merge$2,
|
| 4962 |
+
unmerge: unmerge,
|
| 4963 |
+
splitRows: splitRows
|
| 4964 |
+
};
|
| 4965 |
+
|
| 4966 |
+
var isSpanning = function (grid, row, col, comparator) {
|
| 4967 |
+
var candidate = $_aylxzgmyjfuw8qmj.getCell(grid[row], col);
|
| 4968 |
+
var matching = $_20nfr6k7jfuw8q4g.curry(comparator, candidate.element());
|
| 4969 |
+
var currentRow = grid[row];
|
| 4970 |
+
return grid.length > 1 && $_aylxzgmyjfuw8qmj.cellLength(currentRow) > 1 && (col > 0 && matching($_aylxzgmyjfuw8qmj.getCellElement(currentRow, col - 1)) || col < currentRow.length - 1 && matching($_aylxzgmyjfuw8qmj.getCellElement(currentRow, col + 1)) || row > 0 && matching($_aylxzgmyjfuw8qmj.getCellElement(grid[row - 1], col)) || row < grid.length - 1 && matching($_aylxzgmyjfuw8qmj.getCellElement(grid[row + 1], col)));
|
| 4971 |
+
};
|
| 4972 |
+
var mergeTables = function (startAddress, gridA, gridB, generator, comparator) {
|
| 4973 |
+
var startRow = startAddress.row();
|
| 4974 |
+
var startCol = startAddress.column();
|
| 4975 |
+
var mergeHeight = gridB.length;
|
| 4976 |
+
var mergeWidth = $_aylxzgmyjfuw8qmj.cellLength(gridB[0]);
|
| 4977 |
+
var endRow = startRow + mergeHeight;
|
| 4978 |
+
var endCol = startCol + mergeWidth;
|
| 4979 |
+
for (var r = startRow; r < endRow; r++) {
|
| 4980 |
+
for (var c = startCol; c < endCol; c++) {
|
| 4981 |
+
if (isSpanning(gridA, r, c, comparator)) {
|
| 4982 |
+
$_72fqzkndjfuw8qpp.unmerge(gridA, $_aylxzgmyjfuw8qmj.getCellElement(gridA[r], c), comparator, generator.cell);
|
| 4983 |
+
}
|
| 4984 |
+
var newCell = $_aylxzgmyjfuw8qmj.getCellElement(gridB[r - startRow], c - startCol);
|
| 4985 |
+
var replacement = generator.replace(newCell);
|
| 4986 |
+
$_aylxzgmyjfuw8qmj.mutateCell(gridA[r], c, $_ce5pyrkgjfuw8q5v.elementnew(replacement, true));
|
| 4987 |
+
}
|
| 4988 |
+
}
|
| 4989 |
+
return gridA;
|
| 4990 |
+
};
|
| 4991 |
+
var merge$3 = function (startAddress, gridA, gridB, generator, comparator) {
|
| 4992 |
+
var result = $_pbbdjnbjfuw8qpe.measure(startAddress, gridA, gridB);
|
| 4993 |
+
return result.map(function (delta) {
|
| 4994 |
+
var fittedGrid = $_pbbdjnbjfuw8qpe.tailor(gridA, delta, generator);
|
| 4995 |
+
return mergeTables(startAddress, fittedGrid, gridB, generator, comparator);
|
| 4996 |
+
});
|
| 4997 |
+
};
|
| 4998 |
+
var insert = function (index, gridA, gridB, generator, comparator) {
|
| 4999 |
+
$_72fqzkndjfuw8qpp.splitRows(gridA, index, comparator, generator.cell);
|
| 5000 |
+
var delta = $_pbbdjnbjfuw8qpe.measureWidth(gridB, gridA);
|
| 5001 |
+
var fittedNewGrid = $_pbbdjnbjfuw8qpe.tailor(gridB, delta, generator);
|
| 5002 |
+
var secondDelta = $_pbbdjnbjfuw8qpe.measureWidth(gridA, fittedNewGrid);
|
| 5003 |
+
var fittedOldGrid = $_pbbdjnbjfuw8qpe.tailor(gridA, secondDelta, generator);
|
| 5004 |
+
return fittedOldGrid.slice(0, index).concat(fittedNewGrid).concat(fittedOldGrid.slice(index, fittedOldGrid.length));
|
| 5005 |
+
};
|
| 5006 |
+
var $_5jycvqnajfuw8qp5 = {
|
| 5007 |
+
merge: merge$3,
|
| 5008 |
+
insert: insert
|
| 5009 |
+
};
|
| 5010 |
+
|
| 5011 |
+
var insertRowAt = function (grid, index, example, comparator, substitution) {
|
| 5012 |
+
var before = grid.slice(0, index);
|
| 5013 |
+
var after = grid.slice(index);
|
| 5014 |
+
var between = $_aylxzgmyjfuw8qmj.mapCells(grid[example], function (ex, c) {
|
| 5015 |
+
var withinSpan = index > 0 && index < grid.length && comparator($_aylxzgmyjfuw8qmj.getCellElement(grid[index - 1], c), $_aylxzgmyjfuw8qmj.getCellElement(grid[index], c));
|
| 5016 |
+
var ret = withinSpan ? $_aylxzgmyjfuw8qmj.getCell(grid[index], c) : $_ce5pyrkgjfuw8q5v.elementnew(substitution(ex.element(), comparator), true);
|
| 5017 |
+
return ret;
|
| 5018 |
+
});
|
| 5019 |
+
return before.concat([between]).concat(after);
|
| 5020 |
+
};
|
| 5021 |
+
var insertColumnAt = function (grid, index, example, comparator, substitution) {
|
| 5022 |
+
return $_tyr3yk5jfuw8q47.map(grid, function (row) {
|
| 5023 |
+
var withinSpan = index > 0 && index < $_aylxzgmyjfuw8qmj.cellLength(row) && comparator($_aylxzgmyjfuw8qmj.getCellElement(row, index - 1), $_aylxzgmyjfuw8qmj.getCellElement(row, index));
|
| 5024 |
+
var sub = withinSpan ? $_aylxzgmyjfuw8qmj.getCell(row, index) : $_ce5pyrkgjfuw8q5v.elementnew(substitution($_aylxzgmyjfuw8qmj.getCellElement(row, example), comparator), true);
|
| 5025 |
+
return $_aylxzgmyjfuw8qmj.addCell(row, index, sub);
|
| 5026 |
+
});
|
| 5027 |
+
};
|
| 5028 |
+
var splitCellIntoColumns = function (grid, exampleRow, exampleCol, comparator, substitution) {
|
| 5029 |
+
var index = exampleCol + 1;
|
| 5030 |
+
return $_tyr3yk5jfuw8q47.map(grid, function (row, i) {
|
| 5031 |
+
var isTargetCell = i === exampleRow;
|
| 5032 |
+
var sub = isTargetCell ? $_ce5pyrkgjfuw8q5v.elementnew(substitution($_aylxzgmyjfuw8qmj.getCellElement(row, exampleCol), comparator), true) : $_aylxzgmyjfuw8qmj.getCell(row, exampleCol);
|
| 5033 |
+
return $_aylxzgmyjfuw8qmj.addCell(row, index, sub);
|
| 5034 |
+
});
|
| 5035 |
+
};
|
| 5036 |
+
var splitCellIntoRows = function (grid, exampleRow, exampleCol, comparator, substitution) {
|
| 5037 |
+
var index = exampleRow + 1;
|
| 5038 |
+
var before = grid.slice(0, index);
|
| 5039 |
+
var after = grid.slice(index);
|
| 5040 |
+
var between = $_aylxzgmyjfuw8qmj.mapCells(grid[exampleRow], function (ex, i) {
|
| 5041 |
+
var isTargetCell = i === exampleCol;
|
| 5042 |
+
return isTargetCell ? $_ce5pyrkgjfuw8q5v.elementnew(substitution(ex.element(), comparator), true) : ex;
|
| 5043 |
+
});
|
| 5044 |
+
return before.concat([between]).concat(after);
|
| 5045 |
+
};
|
| 5046 |
+
var deleteColumnsAt = function (grid, start, finish) {
|
| 5047 |
+
var rows = $_tyr3yk5jfuw8q47.map(grid, function (row) {
|
| 5048 |
+
var cells = row.cells().slice(0, start).concat(row.cells().slice(finish + 1));
|
| 5049 |
+
return $_ce5pyrkgjfuw8q5v.rowcells(cells, row.section());
|
| 5050 |
+
});
|
| 5051 |
+
return $_tyr3yk5jfuw8q47.filter(rows, function (row) {
|
| 5052 |
+
return row.cells().length > 0;
|
| 5053 |
+
});
|
| 5054 |
+
};
|
| 5055 |
+
var deleteRowsAt = function (grid, start, finish) {
|
| 5056 |
+
return grid.slice(0, start).concat(grid.slice(finish + 1));
|
| 5057 |
+
};
|
| 5058 |
+
var $_22uvfenejfuw8qpx = {
|
| 5059 |
+
insertRowAt: insertRowAt,
|
| 5060 |
+
insertColumnAt: insertColumnAt,
|
| 5061 |
+
splitCellIntoColumns: splitCellIntoColumns,
|
| 5062 |
+
splitCellIntoRows: splitCellIntoRows,
|
| 5063 |
+
deleteRowsAt: deleteRowsAt,
|
| 5064 |
+
deleteColumnsAt: deleteColumnsAt
|
| 5065 |
+
};
|
| 5066 |
+
|
| 5067 |
+
var replaceIn = function (grid, targets, comparator, substitution) {
|
| 5068 |
+
var isTarget = function (cell) {
|
| 5069 |
+
return $_tyr3yk5jfuw8q47.exists(targets, function (target) {
|
| 5070 |
+
return comparator(cell.element(), target.element());
|
| 5071 |
+
});
|
| 5072 |
+
};
|
| 5073 |
+
return $_tyr3yk5jfuw8q47.map(grid, function (row) {
|
| 5074 |
+
return $_aylxzgmyjfuw8qmj.mapCells(row, function (cell) {
|
| 5075 |
+
return isTarget(cell) ? $_ce5pyrkgjfuw8q5v.elementnew(substitution(cell.element(), comparator), true) : cell;
|
| 5076 |
+
});
|
| 5077 |
+
});
|
| 5078 |
+
};
|
| 5079 |
+
var notStartRow = function (grid, rowIndex, colIndex, comparator) {
|
| 5080 |
+
return $_aylxzgmyjfuw8qmj.getCellElement(grid[rowIndex], colIndex) !== undefined && (rowIndex > 0 && comparator($_aylxzgmyjfuw8qmj.getCellElement(grid[rowIndex - 1], colIndex), $_aylxzgmyjfuw8qmj.getCellElement(grid[rowIndex], colIndex)));
|
| 5081 |
+
};
|
| 5082 |
+
var notStartColumn = function (row, index, comparator) {
|
| 5083 |
+
return index > 0 && comparator($_aylxzgmyjfuw8qmj.getCellElement(row, index - 1), $_aylxzgmyjfuw8qmj.getCellElement(row, index));
|
| 5084 |
+
};
|
| 5085 |
+
var replaceColumn = function (grid, index, comparator, substitution) {
|
| 5086 |
+
var targets = $_tyr3yk5jfuw8q47.bind(grid, function (row, i) {
|
| 5087 |
+
var alreadyAdded = notStartRow(grid, i, index, comparator) || notStartColumn(row, index, comparator);
|
| 5088 |
+
return alreadyAdded ? [] : [$_aylxzgmyjfuw8qmj.getCell(row, index)];
|
| 5089 |
+
});
|
| 5090 |
+
return replaceIn(grid, targets, comparator, substitution);
|
| 5091 |
+
};
|
| 5092 |
+
var replaceRow = function (grid, index, comparator, substitution) {
|
| 5093 |
+
var targetRow = grid[index];
|
| 5094 |
+
var targets = $_tyr3yk5jfuw8q47.bind(targetRow.cells(), function (item, i) {
|
| 5095 |
+
var alreadyAdded = notStartRow(grid, index, i, comparator) || notStartColumn(targetRow, i, comparator);
|
| 5096 |
+
return alreadyAdded ? [] : [item];
|
| 5097 |
+
});
|
| 5098 |
+
return replaceIn(grid, targets, comparator, substitution);
|
| 5099 |
+
};
|
| 5100 |
+
var $_507pt2nfjfuw8qq2 = {
|
| 5101 |
+
replaceColumn: replaceColumn,
|
| 5102 |
+
replaceRow: replaceRow
|
| 5103 |
+
};
|
| 5104 |
+
|
| 5105 |
+
var none$1 = function () {
|
| 5106 |
+
return folder(function (n, o, l, m, r) {
|
| 5107 |
+
return n();
|
| 5108 |
+
});
|
| 5109 |
+
};
|
| 5110 |
+
var only = function (index) {
|
| 5111 |
+
return folder(function (n, o, l, m, r) {
|
| 5112 |
+
return o(index);
|
| 5113 |
+
});
|
| 5114 |
+
};
|
| 5115 |
+
var left = function (index, next) {
|
| 5116 |
+
return folder(function (n, o, l, m, r) {
|
| 5117 |
+
return l(index, next);
|
| 5118 |
+
});
|
| 5119 |
+
};
|
| 5120 |
+
var middle = function (prev, index, next) {
|
| 5121 |
+
return folder(function (n, o, l, m, r) {
|
| 5122 |
+
return m(prev, index, next);
|
| 5123 |
+
});
|
| 5124 |
+
};
|
| 5125 |
+
var right = function (prev, index) {
|
| 5126 |
+
return folder(function (n, o, l, m, r) {
|
| 5127 |
+
return r(prev, index);
|
| 5128 |
+
});
|
| 5129 |
+
};
|
| 5130 |
+
var folder = function (fold) {
|
| 5131 |
+
return { fold: fold };
|
| 5132 |
+
};
|
| 5133 |
+
var $_17zkjbnijfuw8qqk = {
|
| 5134 |
+
none: none$1,
|
| 5135 |
+
only: only,
|
| 5136 |
+
left: left,
|
| 5137 |
+
middle: middle,
|
| 5138 |
+
right: right
|
| 5139 |
+
};
|
| 5140 |
+
|
| 5141 |
+
var neighbours$1 = function (input, index) {
|
| 5142 |
+
if (input.length === 0)
|
| 5143 |
+
return $_17zkjbnijfuw8qqk.none();
|
| 5144 |
+
if (input.length === 1)
|
| 5145 |
+
return $_17zkjbnijfuw8qqk.only(0);
|
| 5146 |
+
if (index === 0)
|
| 5147 |
+
return $_17zkjbnijfuw8qqk.left(0, 1);
|
| 5148 |
+
if (index === input.length - 1)
|
| 5149 |
+
return $_17zkjbnijfuw8qqk.right(index - 1, index);
|
| 5150 |
+
if (index > 0 && index < input.length - 1)
|
| 5151 |
+
return $_17zkjbnijfuw8qqk.middle(index - 1, index, index + 1);
|
| 5152 |
+
return $_17zkjbnijfuw8qqk.none();
|
| 5153 |
+
};
|
| 5154 |
+
var determine = function (input, column, step, tableSize) {
|
| 5155 |
+
var result = input.slice(0);
|
| 5156 |
+
var context = neighbours$1(input, column);
|
| 5157 |
+
var zero = function (array) {
|
| 5158 |
+
return $_tyr3yk5jfuw8q47.map(array, $_20nfr6k7jfuw8q4g.constant(0));
|
| 5159 |
+
};
|
| 5160 |
+
var onNone = $_20nfr6k7jfuw8q4g.constant(zero(result));
|
| 5161 |
+
var onOnly = function (index) {
|
| 5162 |
+
return tableSize.singleColumnWidth(result[index], step);
|
| 5163 |
+
};
|
| 5164 |
+
var onChange = function (index, next) {
|
| 5165 |
+
if (step >= 0) {
|
| 5166 |
+
var newNext = Math.max(tableSize.minCellWidth(), result[next] - step);
|
| 5167 |
+
return zero(result.slice(0, index)).concat([
|
| 5168 |
+
step,
|
| 5169 |
+
newNext - result[next]
|
| 5170 |
+
]).concat(zero(result.slice(next + 1)));
|
| 5171 |
+
} else {
|
| 5172 |
+
var newThis = Math.max(tableSize.minCellWidth(), result[index] + step);
|
| 5173 |
+
var diffx = result[index] - newThis;
|
| 5174 |
+
return zero(result.slice(0, index)).concat([
|
| 5175 |
+
newThis - result[index],
|
| 5176 |
+
diffx
|
| 5177 |
+
]).concat(zero(result.slice(next + 1)));
|
| 5178 |
+
}
|
| 5179 |
+
};
|
| 5180 |
+
var onLeft = onChange;
|
| 5181 |
+
var onMiddle = function (prev, index, next) {
|
| 5182 |
+
return onChange(index, next);
|
| 5183 |
+
};
|
| 5184 |
+
var onRight = function (prev, index) {
|
| 5185 |
+
if (step >= 0) {
|
| 5186 |
+
return zero(result.slice(0, index)).concat([step]);
|
| 5187 |
+
} else {
|
| 5188 |
+
var size = Math.max(tableSize.minCellWidth(), result[index] + step);
|
| 5189 |
+
return zero(result.slice(0, index)).concat([size - result[index]]);
|
| 5190 |
+
}
|
| 5191 |
+
};
|
| 5192 |
+
return context.fold(onNone, onOnly, onLeft, onMiddle, onRight);
|
| 5193 |
+
};
|
| 5194 |
+
var $_7b8knbnhjfuw8qqd = { determine: determine };
|
| 5195 |
+
|
| 5196 |
+
var getSpan$1 = function (cell, type) {
|
| 5197 |
+
return $_3q82t2l5jfuw8q93.has(cell, type) && parseInt($_3q82t2l5jfuw8q93.get(cell, type), 10) > 1;
|
| 5198 |
+
};
|
| 5199 |
+
var hasColspan = function (cell) {
|
| 5200 |
+
return getSpan$1(cell, 'colspan');
|
| 5201 |
+
};
|
| 5202 |
+
var hasRowspan = function (cell) {
|
| 5203 |
+
return getSpan$1(cell, 'rowspan');
|
| 5204 |
+
};
|
| 5205 |
+
var getInt = function (element, property) {
|
| 5206 |
+
return parseInt($_bfod2hlejfuw8qac.get(element, property), 10);
|
| 5207 |
+
};
|
| 5208 |
+
var $_63qtcvnkjfuw8qqu = {
|
| 5209 |
+
hasColspan: hasColspan,
|
| 5210 |
+
hasRowspan: hasRowspan,
|
| 5211 |
+
minWidth: $_20nfr6k7jfuw8q4g.constant(10),
|
| 5212 |
+
minHeight: $_20nfr6k7jfuw8q4g.constant(10),
|
| 5213 |
+
getInt: getInt
|
| 5214 |
+
};
|
| 5215 |
+
|
| 5216 |
+
var getRaw$1 = function (cell, property, getter) {
|
| 5217 |
+
return $_bfod2hlejfuw8qac.getRaw(cell, property).fold(function () {
|
| 5218 |
+
return getter(cell) + 'px';
|
| 5219 |
+
}, function (raw) {
|
| 5220 |
+
return raw;
|
| 5221 |
+
});
|
| 5222 |
+
};
|
| 5223 |
+
var getRawW = function (cell) {
|
| 5224 |
+
return getRaw$1(cell, 'width', $_by2skemajfuw8qhj.getPixelWidth);
|
| 5225 |
+
};
|
| 5226 |
+
var getRawH = function (cell) {
|
| 5227 |
+
return getRaw$1(cell, 'height', $_by2skemajfuw8qhj.getHeight);
|
| 5228 |
+
};
|
| 5229 |
+
var getWidthFrom = function (warehouse, direction, getWidth, fallback, tableSize) {
|
| 5230 |
+
var columns = $_9oko5pn1jfuw8qo0.columns(warehouse);
|
| 5231 |
+
var backups = $_tyr3yk5jfuw8q47.map(columns, function (cellOption) {
|
| 5232 |
+
return cellOption.map(direction.edge);
|
| 5233 |
+
});
|
| 5234 |
+
return $_tyr3yk5jfuw8q47.map(columns, function (cellOption, c) {
|
| 5235 |
+
var columnCell = cellOption.filter($_20nfr6k7jfuw8q4g.not($_63qtcvnkjfuw8qqu.hasColspan));
|
| 5236 |
+
return columnCell.fold(function () {
|
| 5237 |
+
var deduced = $_fcnwwbn2jfuw8qoa.deduce(backups, c);
|
| 5238 |
+
return fallback(deduced);
|
| 5239 |
+
}, function (cell) {
|
| 5240 |
+
return getWidth(cell, tableSize);
|
| 5241 |
+
});
|
| 5242 |
+
});
|
| 5243 |
+
};
|
| 5244 |
+
var getDeduced = function (deduced) {
|
| 5245 |
+
return deduced.map(function (d) {
|
| 5246 |
+
return d + 'px';
|
| 5247 |
+
}).getOr('');
|
| 5248 |
+
};
|
| 5249 |
+
var getRawWidths = function (warehouse, direction) {
|
| 5250 |
+
return getWidthFrom(warehouse, direction, getRawW, getDeduced);
|
| 5251 |
+
};
|
| 5252 |
+
var getPercentageWidths = function (warehouse, direction, tableSize) {
|
| 5253 |
+
return getWidthFrom(warehouse, direction, $_by2skemajfuw8qhj.getPercentageWidth, function (deduced) {
|
| 5254 |
+
return deduced.fold(function () {
|
| 5255 |
+
return tableSize.minCellWidth();
|
| 5256 |
+
}, function (cellWidth) {
|
| 5257 |
+
return cellWidth / tableSize.pixelWidth() * 100;
|
| 5258 |
+
});
|
| 5259 |
+
}, tableSize);
|
| 5260 |
+
};
|
| 5261 |
+
var getPixelWidths = function (warehouse, direction, tableSize) {
|
| 5262 |
+
return getWidthFrom(warehouse, direction, $_by2skemajfuw8qhj.getPixelWidth, function (deduced) {
|
| 5263 |
+
return deduced.getOrThunk(tableSize.minCellWidth);
|
| 5264 |
+
}, tableSize);
|
| 5265 |
+
};
|
| 5266 |
+
var getHeightFrom = function (warehouse, direction, getHeight, fallback) {
|
| 5267 |
+
var rows = $_9oko5pn1jfuw8qo0.rows(warehouse);
|
| 5268 |
+
var backups = $_tyr3yk5jfuw8q47.map(rows, function (cellOption) {
|
| 5269 |
+
return cellOption.map(direction.edge);
|
| 5270 |
+
});
|
| 5271 |
+
return $_tyr3yk5jfuw8q47.map(rows, function (cellOption, c) {
|
| 5272 |
+
var rowCell = cellOption.filter($_20nfr6k7jfuw8q4g.not($_63qtcvnkjfuw8qqu.hasRowspan));
|
| 5273 |
+
return rowCell.fold(function () {
|
| 5274 |
+
var deduced = $_fcnwwbn2jfuw8qoa.deduce(backups, c);
|
| 5275 |
+
return fallback(deduced);
|
| 5276 |
+
}, function (cell) {
|
| 5277 |
+
return getHeight(cell);
|
| 5278 |
+
});
|
| 5279 |
+
});
|
| 5280 |
+
};
|
| 5281 |
+
var getPixelHeights = function (warehouse, direction) {
|
| 5282 |
+
return getHeightFrom(warehouse, direction, $_by2skemajfuw8qhj.getHeight, function (deduced) {
|
| 5283 |
+
return deduced.getOrThunk($_63qtcvnkjfuw8qqu.minHeight);
|
| 5284 |
+
});
|
| 5285 |
+
};
|
| 5286 |
+
var getRawHeights = function (warehouse, direction) {
|
| 5287 |
+
return getHeightFrom(warehouse, direction, getRawH, getDeduced);
|
| 5288 |
+
};
|
| 5289 |
+
var $_694691njjfuw8qqm = {
|
| 5290 |
+
getRawWidths: getRawWidths,
|
| 5291 |
+
getPixelWidths: getPixelWidths,
|
| 5292 |
+
getPercentageWidths: getPercentageWidths,
|
| 5293 |
+
getPixelHeights: getPixelHeights,
|
| 5294 |
+
getRawHeights: getRawHeights
|
| 5295 |
+
};
|
| 5296 |
+
|
| 5297 |
+
var total = function (start, end, measures) {
|
| 5298 |
+
var r = 0;
|
| 5299 |
+
for (var i = start; i < end; i++) {
|
| 5300 |
+
r += measures[i] !== undefined ? measures[i] : 0;
|
| 5301 |
+
}
|
| 5302 |
+
return r;
|
| 5303 |
+
};
|
| 5304 |
+
var recalculateWidth = function (warehouse, widths) {
|
| 5305 |
+
var all = $_2ge24cldjfuw8qa3.justCells(warehouse);
|
| 5306 |
+
return $_tyr3yk5jfuw8q47.map(all, function (cell) {
|
| 5307 |
+
var width = total(cell.column(), cell.column() + cell.colspan(), widths);
|
| 5308 |
+
return {
|
| 5309 |
+
element: cell.element,
|
| 5310 |
+
width: $_20nfr6k7jfuw8q4g.constant(width),
|
| 5311 |
+
colspan: cell.colspan
|
| 5312 |
+
};
|
| 5313 |
+
});
|
| 5314 |
+
};
|
| 5315 |
+
var recalculateHeight = function (warehouse, heights) {
|
| 5316 |
+
var all = $_2ge24cldjfuw8qa3.justCells(warehouse);
|
| 5317 |
+
return $_tyr3yk5jfuw8q47.map(all, function (cell) {
|
| 5318 |
+
var height = total(cell.row(), cell.row() + cell.rowspan(), heights);
|
| 5319 |
+
return {
|
| 5320 |
+
element: cell.element,
|
| 5321 |
+
height: $_20nfr6k7jfuw8q4g.constant(height),
|
| 5322 |
+
rowspan: cell.rowspan
|
| 5323 |
+
};
|
| 5324 |
+
});
|
| 5325 |
+
};
|
| 5326 |
+
var matchRowHeight = function (warehouse, heights) {
|
| 5327 |
+
return $_tyr3yk5jfuw8q47.map(warehouse.all(), function (row, i) {
|
| 5328 |
+
return {
|
| 5329 |
+
element: row.element,
|
| 5330 |
+
height: $_20nfr6k7jfuw8q4g.constant(heights[i])
|
| 5331 |
+
};
|
| 5332 |
+
});
|
| 5333 |
+
};
|
| 5334 |
+
var $_2ltb63nljfuw8qr5 = {
|
| 5335 |
+
recalculateWidth: recalculateWidth,
|
| 5336 |
+
recalculateHeight: recalculateHeight,
|
| 5337 |
+
matchRowHeight: matchRowHeight
|
| 5338 |
+
};
|
| 5339 |
+
|
| 5340 |
+
var percentageSize = function (width, element) {
|
| 5341 |
+
var floatWidth = parseFloat(width);
|
| 5342 |
+
var pixelWidth = $_fj252lmejfuw8qin.get(element);
|
| 5343 |
+
var getCellDelta = function (delta) {
|
| 5344 |
+
return delta / pixelWidth * 100;
|
| 5345 |
+
};
|
| 5346 |
+
var singleColumnWidth = function (width, _delta) {
|
| 5347 |
+
return [100 - width];
|
| 5348 |
+
};
|
| 5349 |
+
var minCellWidth = function () {
|
| 5350 |
+
return $_63qtcvnkjfuw8qqu.minWidth() / pixelWidth * 100;
|
| 5351 |
+
};
|
| 5352 |
+
var setTableWidth = function (table, _newWidths, delta) {
|
| 5353 |
+
var total = floatWidth + delta;
|
| 5354 |
+
$_by2skemajfuw8qhj.setPercentageWidth(table, total);
|
| 5355 |
+
};
|
| 5356 |
+
return {
|
| 5357 |
+
width: $_20nfr6k7jfuw8q4g.constant(floatWidth),
|
| 5358 |
+
pixelWidth: $_20nfr6k7jfuw8q4g.constant(pixelWidth),
|
| 5359 |
+
getWidths: $_694691njjfuw8qqm.getPercentageWidths,
|
| 5360 |
+
getCellDelta: getCellDelta,
|
| 5361 |
+
singleColumnWidth: singleColumnWidth,
|
| 5362 |
+
minCellWidth: minCellWidth,
|
| 5363 |
+
setElementWidth: $_by2skemajfuw8qhj.setPercentageWidth,
|
| 5364 |
+
setTableWidth: setTableWidth
|
| 5365 |
+
};
|
| 5366 |
+
};
|
| 5367 |
+
var pixelSize = function (width) {
|
| 5368 |
+
var intWidth = parseInt(width, 10);
|
| 5369 |
+
var getCellDelta = $_20nfr6k7jfuw8q4g.identity;
|
| 5370 |
+
var singleColumnWidth = function (width, delta) {
|
| 5371 |
+
var newNext = Math.max($_63qtcvnkjfuw8qqu.minWidth(), width + delta);
|
| 5372 |
+
return [newNext - width];
|
| 5373 |
+
};
|
| 5374 |
+
var setTableWidth = function (table, newWidths, _delta) {
|
| 5375 |
+
var total = $_tyr3yk5jfuw8q47.foldr(newWidths, function (b, a) {
|
| 5376 |
+
return b + a;
|
| 5377 |
+
}, 0);
|
| 5378 |
+
$_by2skemajfuw8qhj.setPixelWidth(table, total);
|
| 5379 |
+
};
|
| 5380 |
+
return {
|
| 5381 |
+
width: $_20nfr6k7jfuw8q4g.constant(intWidth),
|
| 5382 |
+
pixelWidth: $_20nfr6k7jfuw8q4g.constant(intWidth),
|
| 5383 |
+
getWidths: $_694691njjfuw8qqm.getPixelWidths,
|
| 5384 |
+
getCellDelta: getCellDelta,
|
| 5385 |
+
singleColumnWidth: singleColumnWidth,
|
| 5386 |
+
minCellWidth: $_63qtcvnkjfuw8qqu.minWidth,
|
| 5387 |
+
setElementWidth: $_by2skemajfuw8qhj.setPixelWidth,
|
| 5388 |
+
setTableWidth: setTableWidth
|
| 5389 |
+
};
|
| 5390 |
+
};
|
| 5391 |
+
var chooseSize = function (element, width) {
|
| 5392 |
+
if ($_by2skemajfuw8qhj.percentageBasedSizeRegex().test(width)) {
|
| 5393 |
+
var percentMatch = $_by2skemajfuw8qhj.percentageBasedSizeRegex().exec(width);
|
| 5394 |
+
return percentageSize(percentMatch[1], element);
|
| 5395 |
+
} else if ($_by2skemajfuw8qhj.pixelBasedSizeRegex().test(width)) {
|
| 5396 |
+
var pixelMatch = $_by2skemajfuw8qhj.pixelBasedSizeRegex().exec(width);
|
| 5397 |
+
return pixelSize(pixelMatch[1]);
|
| 5398 |
+
} else {
|
| 5399 |
+
var fallbackWidth = $_fj252lmejfuw8qin.get(element);
|
| 5400 |
+
return pixelSize(fallbackWidth);
|
| 5401 |
+
}
|
| 5402 |
+
};
|
| 5403 |
+
var getTableSize = function (element) {
|
| 5404 |
+
var width = $_by2skemajfuw8qhj.getRawWidth(element);
|
| 5405 |
+
return width.fold(function () {
|
| 5406 |
+
var fallbackWidth = $_fj252lmejfuw8qin.get(element);
|
| 5407 |
+
return pixelSize(fallbackWidth);
|
| 5408 |
+
}, function (width) {
|
| 5409 |
+
return chooseSize(element, width);
|
| 5410 |
+
});
|
| 5411 |
+
};
|
| 5412 |
+
var $_2o9g1qnmjfuw8qrh = { getTableSize: getTableSize };
|
| 5413 |
+
|
| 5414 |
+
var getWarehouse$1 = function (list) {
|
| 5415 |
+
return $_2ge24cldjfuw8qa3.generate(list);
|
| 5416 |
+
};
|
| 5417 |
+
var sumUp = function (newSize) {
|
| 5418 |
+
return $_tyr3yk5jfuw8q47.foldr(newSize, function (b, a) {
|
| 5419 |
+
return b + a;
|
| 5420 |
+
}, 0);
|
| 5421 |
+
};
|
| 5422 |
+
var getTableWarehouse = function (table) {
|
| 5423 |
+
var list = $_dy3x0nkfjfuw8q5l.fromTable(table);
|
| 5424 |
+
return getWarehouse$1(list);
|
| 5425 |
+
};
|
| 5426 |
+
var adjustWidth = function (table, delta, index, direction) {
|
| 5427 |
+
var tableSize = $_2o9g1qnmjfuw8qrh.getTableSize(table);
|
| 5428 |
+
var step = tableSize.getCellDelta(delta);
|
| 5429 |
+
var warehouse = getTableWarehouse(table);
|
| 5430 |
+
var widths = tableSize.getWidths(warehouse, direction, tableSize);
|
| 5431 |
+
var deltas = $_7b8knbnhjfuw8qqd.determine(widths, index, step, tableSize);
|
| 5432 |
+
var newWidths = $_tyr3yk5jfuw8q47.map(deltas, function (dx, i) {
|
| 5433 |
+
return dx + widths[i];
|
| 5434 |
+
});
|
| 5435 |
+
var newSizes = $_2ltb63nljfuw8qr5.recalculateWidth(warehouse, newWidths);
|
| 5436 |
+
$_tyr3yk5jfuw8q47.each(newSizes, function (cell) {
|
| 5437 |
+
tableSize.setElementWidth(cell.element(), cell.width());
|
| 5438 |
+
});
|
| 5439 |
+
if (index === warehouse.grid().columns() - 1) {
|
| 5440 |
+
tableSize.setTableWidth(table, newWidths, step);
|
| 5441 |
+
}
|
| 5442 |
+
};
|
| 5443 |
+
var adjustHeight = function (table, delta, index, direction) {
|
| 5444 |
+
var warehouse = getTableWarehouse(table);
|
| 5445 |
+
var heights = $_694691njjfuw8qqm.getPixelHeights(warehouse, direction);
|
| 5446 |
+
var newHeights = $_tyr3yk5jfuw8q47.map(heights, function (dy, i) {
|
| 5447 |
+
return index === i ? Math.max(delta + dy, $_63qtcvnkjfuw8qqu.minHeight()) : dy;
|
| 5448 |
+
});
|
| 5449 |
+
var newCellSizes = $_2ltb63nljfuw8qr5.recalculateHeight(warehouse, newHeights);
|
| 5450 |
+
var newRowSizes = $_2ltb63nljfuw8qr5.matchRowHeight(warehouse, newHeights);
|
| 5451 |
+
$_tyr3yk5jfuw8q47.each(newRowSizes, function (row) {
|
| 5452 |
+
$_by2skemajfuw8qhj.setHeight(row.element(), row.height());
|
| 5453 |
+
});
|
| 5454 |
+
$_tyr3yk5jfuw8q47.each(newCellSizes, function (cell) {
|
| 5455 |
+
$_by2skemajfuw8qhj.setHeight(cell.element(), cell.height());
|
| 5456 |
+
});
|
| 5457 |
+
var total = sumUp(newHeights);
|
| 5458 |
+
$_by2skemajfuw8qhj.setHeight(table, total);
|
| 5459 |
+
};
|
| 5460 |
+
var adjustWidthTo = function (table, list, direction) {
|
| 5461 |
+
var tableSize = $_2o9g1qnmjfuw8qrh.getTableSize(table);
|
| 5462 |
+
var warehouse = getWarehouse$1(list);
|
| 5463 |
+
var widths = tableSize.getWidths(warehouse, direction, tableSize);
|
| 5464 |
+
var newSizes = $_2ltb63nljfuw8qr5.recalculateWidth(warehouse, widths);
|
| 5465 |
+
$_tyr3yk5jfuw8q47.each(newSizes, function (cell) {
|
| 5466 |
+
tableSize.setElementWidth(cell.element(), cell.width());
|
| 5467 |
+
});
|
| 5468 |
+
var total = $_tyr3yk5jfuw8q47.foldr(widths, function (b, a) {
|
| 5469 |
+
return a + b;
|
| 5470 |
+
}, 0);
|
| 5471 |
+
if (newSizes.length > 0) {
|
| 5472 |
+
tableSize.setElementWidth(table, total);
|
| 5473 |
+
}
|
| 5474 |
+
};
|
| 5475 |
+
var $_cwciisngjfuw8qq6 = {
|
| 5476 |
+
adjustWidth: adjustWidth,
|
| 5477 |
+
adjustHeight: adjustHeight,
|
| 5478 |
+
adjustWidthTo: adjustWidthTo
|
| 5479 |
+
};
|
| 5480 |
+
|
| 5481 |
+
var prune = function (table) {
|
| 5482 |
+
var cells = $_aqhz9okhjfuw8q5y.cells(table);
|
| 5483 |
+
if (cells.length === 0)
|
| 5484 |
+
$_fl1deelhjfuw8qax.remove(table);
|
| 5485 |
+
};
|
| 5486 |
+
var outcome = $_5now9kbjfuw8q5e.immutable('grid', 'cursor');
|
| 5487 |
+
var elementFromGrid = function (grid, row, column) {
|
| 5488 |
+
return findIn(grid, row, column).orThunk(function () {
|
| 5489 |
+
return findIn(grid, 0, 0);
|
| 5490 |
+
});
|
| 5491 |
+
};
|
| 5492 |
+
var findIn = function (grid, row, column) {
|
| 5493 |
+
return Option.from(grid[row]).bind(function (r) {
|
| 5494 |
+
return Option.from(r.cells()[column]).bind(function (c) {
|
| 5495 |
+
return Option.from(c.element());
|
| 5496 |
+
});
|
| 5497 |
+
});
|
| 5498 |
+
};
|
| 5499 |
+
var bundle = function (grid, row, column) {
|
| 5500 |
+
return outcome(grid, findIn(grid, row, column));
|
| 5501 |
+
};
|
| 5502 |
+
var uniqueRows = function (details) {
|
| 5503 |
+
return $_tyr3yk5jfuw8q47.foldl(details, function (rest, detail) {
|
| 5504 |
+
return $_tyr3yk5jfuw8q47.exists(rest, function (currentDetail) {
|
| 5505 |
+
return currentDetail.row() === detail.row();
|
| 5506 |
+
}) ? rest : rest.concat([detail]);
|
| 5507 |
+
}, []).sort(function (detailA, detailB) {
|
| 5508 |
+
return detailA.row() - detailB.row();
|
| 5509 |
+
});
|
| 5510 |
+
};
|
| 5511 |
+
var uniqueColumns = function (details) {
|
| 5512 |
+
return $_tyr3yk5jfuw8q47.foldl(details, function (rest, detail) {
|
| 5513 |
+
return $_tyr3yk5jfuw8q47.exists(rest, function (currentDetail) {
|
| 5514 |
+
return currentDetail.column() === detail.column();
|
| 5515 |
+
}) ? rest : rest.concat([detail]);
|
| 5516 |
+
}, []).sort(function (detailA, detailB) {
|
| 5517 |
+
return detailA.column() - detailB.column();
|
| 5518 |
+
});
|
| 5519 |
+
};
|
| 5520 |
+
var insertRowBefore = function (grid, detail, comparator, genWrappers) {
|
| 5521 |
+
var example = detail.row();
|
| 5522 |
+
var targetIndex = detail.row();
|
| 5523 |
+
var newGrid = $_22uvfenejfuw8qpx.insertRowAt(grid, targetIndex, example, comparator, genWrappers.getOrInit);
|
| 5524 |
+
return bundle(newGrid, targetIndex, detail.column());
|
| 5525 |
+
};
|
| 5526 |
+
var insertRowsBefore = function (grid, details, comparator, genWrappers) {
|
| 5527 |
+
var example = details[0].row();
|
| 5528 |
+
var targetIndex = details[0].row();
|
| 5529 |
+
var rows = uniqueRows(details);
|
| 5530 |
+
var newGrid = $_tyr3yk5jfuw8q47.foldl(rows, function (newGrid, _row) {
|
| 5531 |
+
return $_22uvfenejfuw8qpx.insertRowAt(newGrid, targetIndex, example, comparator, genWrappers.getOrInit);
|
| 5532 |
+
}, grid);
|
| 5533 |
+
return bundle(newGrid, targetIndex, details[0].column());
|
| 5534 |
+
};
|
| 5535 |
+
var insertRowAfter = function (grid, detail, comparator, genWrappers) {
|
| 5536 |
+
var example = detail.row();
|
| 5537 |
+
var targetIndex = detail.row() + detail.rowspan();
|
| 5538 |
+
var newGrid = $_22uvfenejfuw8qpx.insertRowAt(grid, targetIndex, example, comparator, genWrappers.getOrInit);
|
| 5539 |
+
return bundle(newGrid, targetIndex, detail.column());
|
| 5540 |
+
};
|
| 5541 |
+
var insertRowsAfter = function (grid, details, comparator, genWrappers) {
|
| 5542 |
+
var rows = uniqueRows(details);
|
| 5543 |
+
var example = rows[rows.length - 1].row();
|
| 5544 |
+
var targetIndex = rows[rows.length - 1].row() + rows[rows.length - 1].rowspan();
|
| 5545 |
+
var newGrid = $_tyr3yk5jfuw8q47.foldl(rows, function (newGrid, _row) {
|
| 5546 |
+
return $_22uvfenejfuw8qpx.insertRowAt(newGrid, targetIndex, example, comparator, genWrappers.getOrInit);
|
| 5547 |
+
}, grid);
|
| 5548 |
+
return bundle(newGrid, targetIndex, details[0].column());
|
| 5549 |
+
};
|
| 5550 |
+
var insertColumnBefore = function (grid, detail, comparator, genWrappers) {
|
| 5551 |
+
var example = detail.column();
|
| 5552 |
+
var targetIndex = detail.column();
|
| 5553 |
+
var newGrid = $_22uvfenejfuw8qpx.insertColumnAt(grid, targetIndex, example, comparator, genWrappers.getOrInit);
|
| 5554 |
+
return bundle(newGrid, detail.row(), targetIndex);
|
| 5555 |
+
};
|
| 5556 |
+
var insertColumnsBefore = function (grid, details, comparator, genWrappers) {
|
| 5557 |
+
var columns = uniqueColumns(details);
|
| 5558 |
+
var example = columns[0].column();
|
| 5559 |
+
var targetIndex = columns[0].column();
|
| 5560 |
+
var newGrid = $_tyr3yk5jfuw8q47.foldl(columns, function (newGrid, _row) {
|
| 5561 |
+
return $_22uvfenejfuw8qpx.insertColumnAt(newGrid, targetIndex, example, comparator, genWrappers.getOrInit);
|
| 5562 |
+
}, grid);
|
| 5563 |
+
return bundle(newGrid, details[0].row(), targetIndex);
|
| 5564 |
+
};
|
| 5565 |
+
var insertColumnAfter = function (grid, detail, comparator, genWrappers) {
|
| 5566 |
+
var example = detail.column();
|
| 5567 |
+
var targetIndex = detail.column() + detail.colspan();
|
| 5568 |
+
var newGrid = $_22uvfenejfuw8qpx.insertColumnAt(grid, targetIndex, example, comparator, genWrappers.getOrInit);
|
| 5569 |
+
return bundle(newGrid, detail.row(), targetIndex);
|
| 5570 |
+
};
|
| 5571 |
+
var insertColumnsAfter = function (grid, details, comparator, genWrappers) {
|
| 5572 |
+
var example = details[details.length - 1].column();
|
| 5573 |
+
var targetIndex = details[details.length - 1].column() + details[details.length - 1].colspan();
|
| 5574 |
+
var columns = uniqueColumns(details);
|
| 5575 |
+
var newGrid = $_tyr3yk5jfuw8q47.foldl(columns, function (newGrid, _row) {
|
| 5576 |
+
return $_22uvfenejfuw8qpx.insertColumnAt(newGrid, targetIndex, example, comparator, genWrappers.getOrInit);
|
| 5577 |
+
}, grid);
|
| 5578 |
+
return bundle(newGrid, details[0].row(), targetIndex);
|
| 5579 |
+
};
|
| 5580 |
+
var makeRowHeader = function (grid, detail, comparator, genWrappers) {
|
| 5581 |
+
var newGrid = $_507pt2nfjfuw8qq2.replaceRow(grid, detail.row(), comparator, genWrappers.replaceOrInit);
|
| 5582 |
+
return bundle(newGrid, detail.row(), detail.column());
|
| 5583 |
+
};
|
| 5584 |
+
var makeColumnHeader = function (grid, detail, comparator, genWrappers) {
|
| 5585 |
+
var newGrid = $_507pt2nfjfuw8qq2.replaceColumn(grid, detail.column(), comparator, genWrappers.replaceOrInit);
|
| 5586 |
+
return bundle(newGrid, detail.row(), detail.column());
|
| 5587 |
+
};
|
| 5588 |
+
var unmakeRowHeader = function (grid, detail, comparator, genWrappers) {
|
| 5589 |
+
var newGrid = $_507pt2nfjfuw8qq2.replaceRow(grid, detail.row(), comparator, genWrappers.replaceOrInit);
|
| 5590 |
+
return bundle(newGrid, detail.row(), detail.column());
|
| 5591 |
+
};
|
| 5592 |
+
var unmakeColumnHeader = function (grid, detail, comparator, genWrappers) {
|
| 5593 |
+
var newGrid = $_507pt2nfjfuw8qq2.replaceColumn(grid, detail.column(), comparator, genWrappers.replaceOrInit);
|
| 5594 |
+
return bundle(newGrid, detail.row(), detail.column());
|
| 5595 |
+
};
|
| 5596 |
+
var splitCellIntoColumns$1 = function (grid, detail, comparator, genWrappers) {
|
| 5597 |
+
var newGrid = $_22uvfenejfuw8qpx.splitCellIntoColumns(grid, detail.row(), detail.column(), comparator, genWrappers.getOrInit);
|
| 5598 |
+
return bundle(newGrid, detail.row(), detail.column());
|
| 5599 |
+
};
|
| 5600 |
+
var splitCellIntoRows$1 = function (grid, detail, comparator, genWrappers) {
|
| 5601 |
+
var newGrid = $_22uvfenejfuw8qpx.splitCellIntoRows(grid, detail.row(), detail.column(), comparator, genWrappers.getOrInit);
|
| 5602 |
+
return bundle(newGrid, detail.row(), detail.column());
|
| 5603 |
+
};
|
| 5604 |
+
var eraseColumns = function (grid, details, comparator, _genWrappers) {
|
| 5605 |
+
var columns = uniqueColumns(details);
|
| 5606 |
+
var newGrid = $_22uvfenejfuw8qpx.deleteColumnsAt(grid, columns[0].column(), columns[columns.length - 1].column());
|
| 5607 |
+
var cursor = elementFromGrid(newGrid, details[0].row(), details[0].column());
|
| 5608 |
+
return outcome(newGrid, cursor);
|
| 5609 |
+
};
|
| 5610 |
+
var eraseRows = function (grid, details, comparator, _genWrappers) {
|
| 5611 |
+
var rows = uniqueRows(details);
|
| 5612 |
+
var newGrid = $_22uvfenejfuw8qpx.deleteRowsAt(grid, rows[0].row(), rows[rows.length - 1].row());
|
| 5613 |
+
var cursor = elementFromGrid(newGrid, details[0].row(), details[0].column());
|
| 5614 |
+
return outcome(newGrid, cursor);
|
| 5615 |
+
};
|
| 5616 |
+
var mergeCells = function (grid, mergable, comparator, _genWrappers) {
|
| 5617 |
+
var cells = mergable.cells();
|
| 5618 |
+
$_ancl40mqjfuw8qkm.merge(cells);
|
| 5619 |
+
var newGrid = $_72fqzkndjfuw8qpp.merge(grid, mergable.bounds(), comparator, $_20nfr6k7jfuw8q4g.constant(cells[0]));
|
| 5620 |
+
return outcome(newGrid, Option.from(cells[0]));
|
| 5621 |
+
};
|
| 5622 |
+
var unmergeCells = function (grid, unmergable, comparator, genWrappers) {
|
| 5623 |
+
var newGrid = $_tyr3yk5jfuw8q47.foldr(unmergable, function (b, cell) {
|
| 5624 |
+
return $_72fqzkndjfuw8qpp.unmerge(b, cell, comparator, genWrappers.combine(cell));
|
| 5625 |
+
}, grid);
|
| 5626 |
+
return outcome(newGrid, Option.from(unmergable[0]));
|
| 5627 |
+
};
|
| 5628 |
+
var pasteCells = function (grid, pasteDetails, comparator, genWrappers) {
|
| 5629 |
+
var gridify = function (table, generators) {
|
| 5630 |
+
var list = $_dy3x0nkfjfuw8q5l.fromTable(table);
|
| 5631 |
+
var wh = $_2ge24cldjfuw8qa3.generate(list);
|
| 5632 |
+
return $_cw9o3smwjfuw8qm9.toGrid(wh, generators, true);
|
| 5633 |
+
};
|
| 5634 |
+
var gridB = gridify(pasteDetails.clipboard(), pasteDetails.generators());
|
| 5635 |
+
var startAddress = $_ce5pyrkgjfuw8q5v.address(pasteDetails.row(), pasteDetails.column());
|
| 5636 |
+
var mergedGrid = $_5jycvqnajfuw8qp5.merge(startAddress, grid, gridB, pasteDetails.generators(), comparator);
|
| 5637 |
+
return mergedGrid.fold(function () {
|
| 5638 |
+
return outcome(grid, Option.some(pasteDetails.element()));
|
| 5639 |
+
}, function (nuGrid) {
|
| 5640 |
+
var cursor = elementFromGrid(nuGrid, pasteDetails.row(), pasteDetails.column());
|
| 5641 |
+
return outcome(nuGrid, cursor);
|
| 5642 |
+
});
|
| 5643 |
+
};
|
| 5644 |
+
var gridifyRows = function (rows, generators, example) {
|
| 5645 |
+
var pasteDetails = $_dy3x0nkfjfuw8q5l.fromPastedRows(rows, example);
|
| 5646 |
+
var wh = $_2ge24cldjfuw8qa3.generate(pasteDetails);
|
| 5647 |
+
return $_cw9o3smwjfuw8qm9.toGrid(wh, generators, true);
|
| 5648 |
+
};
|
| 5649 |
+
var pasteRowsBefore = function (grid, pasteDetails, comparator, genWrappers) {
|
| 5650 |
+
var example = grid[pasteDetails.cells[0].row()];
|
| 5651 |
+
var index = pasteDetails.cells[0].row();
|
| 5652 |
+
var gridB = gridifyRows(pasteDetails.clipboard(), pasteDetails.generators(), example);
|
| 5653 |
+
var mergedGrid = $_5jycvqnajfuw8qp5.insert(index, grid, gridB, pasteDetails.generators(), comparator);
|
| 5654 |
+
var cursor = elementFromGrid(mergedGrid, pasteDetails.cells[0].row(), pasteDetails.cells[0].column());
|
| 5655 |
+
return outcome(mergedGrid, cursor);
|
| 5656 |
+
};
|
| 5657 |
+
var pasteRowsAfter = function (grid, pasteDetails, comparator, genWrappers) {
|
| 5658 |
+
var example = grid[pasteDetails.cells[0].row()];
|
| 5659 |
+
var index = pasteDetails.cells[pasteDetails.cells.length - 1].row() + pasteDetails.cells[pasteDetails.cells.length - 1].rowspan();
|
| 5660 |
+
var gridB = gridifyRows(pasteDetails.clipboard(), pasteDetails.generators(), example);
|
| 5661 |
+
var mergedGrid = $_5jycvqnajfuw8qp5.insert(index, grid, gridB, pasteDetails.generators(), comparator);
|
| 5662 |
+
var cursor = elementFromGrid(mergedGrid, pasteDetails.cells[0].row(), pasteDetails.cells[0].column());
|
| 5663 |
+
return outcome(mergedGrid, cursor);
|
| 5664 |
+
};
|
| 5665 |
+
var resize = $_cwciisngjfuw8qq6.adjustWidthTo;
|
| 5666 |
+
var $_2i21xzmmjfuw8qjg = {
|
| 5667 |
+
insertRowBefore: $_dis709mtjfuw8qlp.run(insertRowBefore, $_dis709mtjfuw8qlp.onCell, $_20nfr6k7jfuw8q4g.noop, $_20nfr6k7jfuw8q4g.noop, $_eoocrvmnjfuw8qk1.modification),
|
| 5668 |
+
insertRowsBefore: $_dis709mtjfuw8qlp.run(insertRowsBefore, $_dis709mtjfuw8qlp.onCells, $_20nfr6k7jfuw8q4g.noop, $_20nfr6k7jfuw8q4g.noop, $_eoocrvmnjfuw8qk1.modification),
|
| 5669 |
+
insertRowAfter: $_dis709mtjfuw8qlp.run(insertRowAfter, $_dis709mtjfuw8qlp.onCell, $_20nfr6k7jfuw8q4g.noop, $_20nfr6k7jfuw8q4g.noop, $_eoocrvmnjfuw8qk1.modification),
|
| 5670 |
+
insertRowsAfter: $_dis709mtjfuw8qlp.run(insertRowsAfter, $_dis709mtjfuw8qlp.onCells, $_20nfr6k7jfuw8q4g.noop, $_20nfr6k7jfuw8q4g.noop, $_eoocrvmnjfuw8qk1.modification),
|
| 5671 |
+
insertColumnBefore: $_dis709mtjfuw8qlp.run(insertColumnBefore, $_dis709mtjfuw8qlp.onCell, resize, $_20nfr6k7jfuw8q4g.noop, $_eoocrvmnjfuw8qk1.modification),
|
| 5672 |
+
insertColumnsBefore: $_dis709mtjfuw8qlp.run(insertColumnsBefore, $_dis709mtjfuw8qlp.onCells, resize, $_20nfr6k7jfuw8q4g.noop, $_eoocrvmnjfuw8qk1.modification),
|
| 5673 |
+
insertColumnAfter: $_dis709mtjfuw8qlp.run(insertColumnAfter, $_dis709mtjfuw8qlp.onCell, resize, $_20nfr6k7jfuw8q4g.noop, $_eoocrvmnjfuw8qk1.modification),
|
| 5674 |
+
insertColumnsAfter: $_dis709mtjfuw8qlp.run(insertColumnsAfter, $_dis709mtjfuw8qlp.onCells, resize, $_20nfr6k7jfuw8q4g.noop, $_eoocrvmnjfuw8qk1.modification),
|
| 5675 |
+
splitCellIntoColumns: $_dis709mtjfuw8qlp.run(splitCellIntoColumns$1, $_dis709mtjfuw8qlp.onCell, resize, $_20nfr6k7jfuw8q4g.noop, $_eoocrvmnjfuw8qk1.modification),
|
| 5676 |
+
splitCellIntoRows: $_dis709mtjfuw8qlp.run(splitCellIntoRows$1, $_dis709mtjfuw8qlp.onCell, $_20nfr6k7jfuw8q4g.noop, $_20nfr6k7jfuw8q4g.noop, $_eoocrvmnjfuw8qk1.modification),
|
| 5677 |
+
eraseColumns: $_dis709mtjfuw8qlp.run(eraseColumns, $_dis709mtjfuw8qlp.onCells, resize, prune, $_eoocrvmnjfuw8qk1.modification),
|
| 5678 |
+
eraseRows: $_dis709mtjfuw8qlp.run(eraseRows, $_dis709mtjfuw8qlp.onCells, $_20nfr6k7jfuw8q4g.noop, prune, $_eoocrvmnjfuw8qk1.modification),
|
| 5679 |
+
makeColumnHeader: $_dis709mtjfuw8qlp.run(makeColumnHeader, $_dis709mtjfuw8qlp.onCell, $_20nfr6k7jfuw8q4g.noop, $_20nfr6k7jfuw8q4g.noop, $_eoocrvmnjfuw8qk1.transform('row', 'th')),
|
| 5680 |
+
unmakeColumnHeader: $_dis709mtjfuw8qlp.run(unmakeColumnHeader, $_dis709mtjfuw8qlp.onCell, $_20nfr6k7jfuw8q4g.noop, $_20nfr6k7jfuw8q4g.noop, $_eoocrvmnjfuw8qk1.transform(null, 'td')),
|
| 5681 |
+
makeRowHeader: $_dis709mtjfuw8qlp.run(makeRowHeader, $_dis709mtjfuw8qlp.onCell, $_20nfr6k7jfuw8q4g.noop, $_20nfr6k7jfuw8q4g.noop, $_eoocrvmnjfuw8qk1.transform('col', 'th')),
|
| 5682 |
+
unmakeRowHeader: $_dis709mtjfuw8qlp.run(unmakeRowHeader, $_dis709mtjfuw8qlp.onCell, $_20nfr6k7jfuw8q4g.noop, $_20nfr6k7jfuw8q4g.noop, $_eoocrvmnjfuw8qk1.transform(null, 'td')),
|
| 5683 |
+
mergeCells: $_dis709mtjfuw8qlp.run(mergeCells, $_dis709mtjfuw8qlp.onMergable, $_20nfr6k7jfuw8q4g.noop, $_20nfr6k7jfuw8q4g.noop, $_eoocrvmnjfuw8qk1.merging),
|
| 5684 |
+
unmergeCells: $_dis709mtjfuw8qlp.run(unmergeCells, $_dis709mtjfuw8qlp.onUnmergable, resize, $_20nfr6k7jfuw8q4g.noop, $_eoocrvmnjfuw8qk1.merging),
|
| 5685 |
+
pasteCells: $_dis709mtjfuw8qlp.run(pasteCells, $_dis709mtjfuw8qlp.onPaste, resize, $_20nfr6k7jfuw8q4g.noop, $_eoocrvmnjfuw8qk1.modification),
|
| 5686 |
+
pasteRowsBefore: $_dis709mtjfuw8qlp.run(pasteRowsBefore, $_dis709mtjfuw8qlp.onPasteRows, $_20nfr6k7jfuw8q4g.noop, $_20nfr6k7jfuw8q4g.noop, $_eoocrvmnjfuw8qk1.modification),
|
| 5687 |
+
pasteRowsAfter: $_dis709mtjfuw8qlp.run(pasteRowsAfter, $_dis709mtjfuw8qlp.onPasteRows, $_20nfr6k7jfuw8q4g.noop, $_20nfr6k7jfuw8q4g.noop, $_eoocrvmnjfuw8qk1.modification)
|
| 5688 |
+
};
|
| 5689 |
+
|
| 5690 |
+
var getBody$1 = function (editor) {
|
| 5691 |
+
return $_xbeoqkkjfuw8q73.fromDom(editor.getBody());
|
| 5692 |
+
};
|
| 5693 |
+
var getIsRoot = function (editor) {
|
| 5694 |
+
return function (element) {
|
| 5695 |
+
return $_e8rn66kojfuw8q7n.eq(element, getBody$1(editor));
|
| 5696 |
+
};
|
| 5697 |
+
};
|
| 5698 |
+
var removePxSuffix = function (size) {
|
| 5699 |
+
return size ? size.replace(/px$/, '') : '';
|
| 5700 |
+
};
|
| 5701 |
+
var addSizeSuffix = function (size) {
|
| 5702 |
+
if (/^[0-9]+$/.test(size)) {
|
| 5703 |
+
size += 'px';
|
| 5704 |
+
}
|
| 5705 |
+
return size;
|
| 5706 |
+
};
|
| 5707 |
+
var $_5xkhf2nnjfuw8qrq = {
|
| 5708 |
+
getBody: getBody$1,
|
| 5709 |
+
getIsRoot: getIsRoot,
|
| 5710 |
+
addSizeSuffix: addSizeSuffix,
|
| 5711 |
+
removePxSuffix: removePxSuffix
|
| 5712 |
+
};
|
| 5713 |
+
|
| 5714 |
+
var onDirection = function (isLtr, isRtl) {
|
| 5715 |
+
return function (element) {
|
| 5716 |
+
return getDirection(element) === 'rtl' ? isRtl : isLtr;
|
| 5717 |
+
};
|
| 5718 |
+
};
|
| 5719 |
+
var getDirection = function (element) {
|
| 5720 |
+
return $_bfod2hlejfuw8qac.get(element, 'direction') === 'rtl' ? 'rtl' : 'ltr';
|
| 5721 |
+
};
|
| 5722 |
+
var $_a5xia4npjfuw8qs0 = {
|
| 5723 |
+
onDirection: onDirection,
|
| 5724 |
+
getDirection: getDirection
|
| 5725 |
+
};
|
| 5726 |
+
|
| 5727 |
+
var ltr$1 = { isRtl: $_20nfr6k7jfuw8q4g.constant(false) };
|
| 5728 |
+
var rtl$1 = { isRtl: $_20nfr6k7jfuw8q4g.constant(true) };
|
| 5729 |
+
var directionAt = function (element) {
|
| 5730 |
+
var dir = $_a5xia4npjfuw8qs0.getDirection(element);
|
| 5731 |
+
return dir === 'rtl' ? rtl$1 : ltr$1;
|
| 5732 |
+
};
|
| 5733 |
+
var $_4xd1udnojfuw8qrw = { directionAt: directionAt };
|
| 5734 |
+
|
| 5735 |
+
var defaultTableToolbar = [
|
| 5736 |
+
'tableprops',
|
| 5737 |
+
'tabledelete',
|
| 5738 |
+
'|',
|
| 5739 |
+
'tableinsertrowbefore',
|
| 5740 |
+
'tableinsertrowafter',
|
| 5741 |
+
'tabledeleterow',
|
| 5742 |
+
'|',
|
| 5743 |
+
'tableinsertcolbefore',
|
| 5744 |
+
'tableinsertcolafter',
|
| 5745 |
+
'tabledeletecol'
|
| 5746 |
+
];
|
| 5747 |
+
var defaultStyles = {
|
| 5748 |
+
'border-collapse': 'collapse',
|
| 5749 |
+
'width': '100%'
|
| 5750 |
+
};
|
| 5751 |
+
var defaultAttributes = { border: '1' };
|
| 5752 |
+
var getDefaultAttributes = function (editor) {
|
| 5753 |
+
return editor.getParam('table_default_attributes', defaultAttributes, 'object');
|
| 5754 |
+
};
|
| 5755 |
+
var getDefaultStyles = function (editor) {
|
| 5756 |
+
return editor.getParam('table_default_styles', defaultStyles, 'object');
|
| 5757 |
+
};
|
| 5758 |
+
var hasTableResizeBars = function (editor) {
|
| 5759 |
+
return editor.getParam('table_resize_bars', true, 'boolean');
|
| 5760 |
+
};
|
| 5761 |
+
var hasTabNavigation = function (editor) {
|
| 5762 |
+
return editor.getParam('table_tab_navigation', true, 'boolean');
|
| 5763 |
+
};
|
| 5764 |
+
var hasAdvancedCellTab = function (editor) {
|
| 5765 |
+
return editor.getParam('table_cell_advtab', true, 'boolean');
|
| 5766 |
+
};
|
| 5767 |
+
var hasAdvancedRowTab = function (editor) {
|
| 5768 |
+
return editor.getParam('table_row_advtab', true, 'boolean');
|
| 5769 |
+
};
|
| 5770 |
+
var hasAdvancedTableTab = function (editor) {
|
| 5771 |
+
return editor.getParam('table_advtab', true, 'boolean');
|
| 5772 |
+
};
|
| 5773 |
+
var hasAppearanceOptions = function (editor) {
|
| 5774 |
+
return editor.getParam('table_appearance_options', true, 'boolean');
|
| 5775 |
+
};
|
| 5776 |
+
var hasTableGrid = function (editor) {
|
| 5777 |
+
return editor.getParam('table_grid', true, 'boolean');
|
| 5778 |
+
};
|
| 5779 |
+
var shouldStyleWithCss = function (editor) {
|
| 5780 |
+
return editor.getParam('table_style_by_css', false, 'boolean');
|
| 5781 |
+
};
|
| 5782 |
+
var getCellClassList = function (editor) {
|
| 5783 |
+
return editor.getParam('table_cell_class_list', [], 'array');
|
| 5784 |
+
};
|
| 5785 |
+
var getRowClassList = function (editor) {
|
| 5786 |
+
return editor.getParam('table_row_class_list', [], 'array');
|
| 5787 |
+
};
|
| 5788 |
+
var getTableClassList = function (editor) {
|
| 5789 |
+
return editor.getParam('table_class_list', [], 'array');
|
| 5790 |
+
};
|
| 5791 |
+
var getColorPickerCallback = function (editor) {
|
| 5792 |
+
return editor.getParam('color_picker_callback');
|
| 5793 |
+
};
|
| 5794 |
+
var isPixelsForced = function (editor) {
|
| 5795 |
+
return editor.getParam('table_responsive_width') === false;
|
| 5796 |
+
};
|
| 5797 |
+
var getCloneElements = function (editor) {
|
| 5798 |
+
var cloneElements = editor.getParam('table_clone_elements');
|
| 5799 |
+
if ($_g6mvnrk8jfuw8q4k.isString(cloneElements)) {
|
| 5800 |
+
return Option.some(cloneElements.split(/[ ,]/));
|
| 5801 |
+
} else if (Array.isArray(cloneElements)) {
|
| 5802 |
+
return Option.some(cloneElements);
|
| 5803 |
+
} else {
|
| 5804 |
+
return Option.none();
|
| 5805 |
+
}
|
| 5806 |
+
};
|
| 5807 |
+
var hasObjectResizing = function (editor) {
|
| 5808 |
+
var objectResizing = editor.getParam('object_resizing', true);
|
| 5809 |
+
return objectResizing === 'table' || objectResizing;
|
| 5810 |
+
};
|
| 5811 |
+
var getToolbar = function (editor) {
|
| 5812 |
+
var toolbar = editor.getParam('table_toolbar', defaultTableToolbar);
|
| 5813 |
+
if (toolbar === '' || toolbar === false) {
|
| 5814 |
+
return [];
|
| 5815 |
+
} else if ($_g6mvnrk8jfuw8q4k.isString(toolbar)) {
|
| 5816 |
+
return toolbar.split(/[ ,]/);
|
| 5817 |
+
} else if ($_g6mvnrk8jfuw8q4k.isArray(toolbar)) {
|
| 5818 |
+
return toolbar;
|
| 5819 |
+
} else {
|
| 5820 |
+
return [];
|
| 5821 |
+
}
|
| 5822 |
+
};
|
| 5823 |
+
|
| 5824 |
+
var fireNewRow = function (editor, row) {
|
| 5825 |
+
return editor.fire('newrow', { node: row });
|
| 5826 |
+
};
|
| 5827 |
+
var fireNewCell = function (editor, cell) {
|
| 5828 |
+
return editor.fire('newcell', { node: cell });
|
| 5829 |
+
};
|
| 5830 |
+
|
| 5831 |
+
var TableActions = function (editor, lazyWire) {
|
| 5832 |
+
var isTableBody = function (editor) {
|
| 5833 |
+
return $_a8gk30l6jfuw8q9c.name($_5xkhf2nnjfuw8qrq.getBody(editor)) === 'table';
|
| 5834 |
+
};
|
| 5835 |
+
var lastRowGuard = function (table) {
|
| 5836 |
+
var size = $_b452wimljfuw8qjd.getGridSize(table);
|
| 5837 |
+
return isTableBody(editor) === false || size.rows() > 1;
|
| 5838 |
+
};
|
| 5839 |
+
var lastColumnGuard = function (table) {
|
| 5840 |
+
var size = $_b452wimljfuw8qjd.getGridSize(table);
|
| 5841 |
+
return isTableBody(editor) === false || size.columns() > 1;
|
| 5842 |
+
};
|
| 5843 |
+
var cloneFormats = getCloneElements(editor);
|
| 5844 |
+
var execute = function (operation, guard, mutate, lazyWire) {
|
| 5845 |
+
return function (table, target) {
|
| 5846 |
+
var dataStyleCells = $_6c9d0hl7jfuw8q9d.descendants(table, 'td[data-mce-style],th[data-mce-style]');
|
| 5847 |
+
$_tyr3yk5jfuw8q47.each(dataStyleCells, function (cell) {
|
| 5848 |
+
$_3q82t2l5jfuw8q93.remove(cell, 'data-mce-style');
|
| 5849 |
+
});
|
| 5850 |
+
var wire = lazyWire();
|
| 5851 |
+
var doc = $_xbeoqkkjfuw8q73.fromDom(editor.getDoc());
|
| 5852 |
+
var direction = TableDirection($_4xd1udnojfuw8qrw.directionAt);
|
| 5853 |
+
var generators = $_5ohg1eljjfuw8qb4.cellOperations(mutate, doc, cloneFormats);
|
| 5854 |
+
return guard(table) ? operation(wire, table, target, generators, direction).bind(function (result) {
|
| 5855 |
+
$_tyr3yk5jfuw8q47.each(result.newRows(), function (row) {
|
| 5856 |
+
fireNewRow(editor, row.dom());
|
| 5857 |
+
});
|
| 5858 |
+
$_tyr3yk5jfuw8q47.each(result.newCells(), function (cell) {
|
| 5859 |
+
fireNewCell(editor, cell.dom());
|
| 5860 |
+
});
|
| 5861 |
+
return result.cursor().map(function (cell) {
|
| 5862 |
+
var rng = editor.dom.createRng();
|
| 5863 |
+
rng.setStart(cell.dom(), 0);
|
| 5864 |
+
rng.setEnd(cell.dom(), 0);
|
| 5865 |
+
return rng;
|
| 5866 |
+
});
|
| 5867 |
+
}) : Option.none();
|
| 5868 |
+
};
|
| 5869 |
+
};
|
| 5870 |
+
var deleteRow = execute($_2i21xzmmjfuw8qjg.eraseRows, lastRowGuard, $_20nfr6k7jfuw8q4g.noop, lazyWire);
|
| 5871 |
+
var deleteColumn = execute($_2i21xzmmjfuw8qjg.eraseColumns, lastColumnGuard, $_20nfr6k7jfuw8q4g.noop, lazyWire);
|
| 5872 |
+
var insertRowsBefore = execute($_2i21xzmmjfuw8qjg.insertRowsBefore, $_20nfr6k7jfuw8q4g.always, $_20nfr6k7jfuw8q4g.noop, lazyWire);
|
| 5873 |
+
var insertRowsAfter = execute($_2i21xzmmjfuw8qjg.insertRowsAfter, $_20nfr6k7jfuw8q4g.always, $_20nfr6k7jfuw8q4g.noop, lazyWire);
|
| 5874 |
+
var insertColumnsBefore = execute($_2i21xzmmjfuw8qjg.insertColumnsBefore, $_20nfr6k7jfuw8q4g.always, $_57e49gm9jfuw8qhh.halve, lazyWire);
|
| 5875 |
+
var insertColumnsAfter = execute($_2i21xzmmjfuw8qjg.insertColumnsAfter, $_20nfr6k7jfuw8q4g.always, $_57e49gm9jfuw8qhh.halve, lazyWire);
|
| 5876 |
+
var mergeCells = execute($_2i21xzmmjfuw8qjg.mergeCells, $_20nfr6k7jfuw8q4g.always, $_20nfr6k7jfuw8q4g.noop, lazyWire);
|
| 5877 |
+
var unmergeCells = execute($_2i21xzmmjfuw8qjg.unmergeCells, $_20nfr6k7jfuw8q4g.always, $_20nfr6k7jfuw8q4g.noop, lazyWire);
|
| 5878 |
+
var pasteRowsBefore = execute($_2i21xzmmjfuw8qjg.pasteRowsBefore, $_20nfr6k7jfuw8q4g.always, $_20nfr6k7jfuw8q4g.noop, lazyWire);
|
| 5879 |
+
var pasteRowsAfter = execute($_2i21xzmmjfuw8qjg.pasteRowsAfter, $_20nfr6k7jfuw8q4g.always, $_20nfr6k7jfuw8q4g.noop, lazyWire);
|
| 5880 |
+
var pasteCells = execute($_2i21xzmmjfuw8qjg.pasteCells, $_20nfr6k7jfuw8q4g.always, $_20nfr6k7jfuw8q4g.noop, lazyWire);
|
| 5881 |
+
return {
|
| 5882 |
+
deleteRow: deleteRow,
|
| 5883 |
+
deleteColumn: deleteColumn,
|
| 5884 |
+
insertRowsBefore: insertRowsBefore,
|
| 5885 |
+
insertRowsAfter: insertRowsAfter,
|
| 5886 |
+
insertColumnsBefore: insertColumnsBefore,
|
| 5887 |
+
insertColumnsAfter: insertColumnsAfter,
|
| 5888 |
+
mergeCells: mergeCells,
|
| 5889 |
+
unmergeCells: unmergeCells,
|
| 5890 |
+
pasteRowsBefore: pasteRowsBefore,
|
| 5891 |
+
pasteRowsAfter: pasteRowsAfter,
|
| 5892 |
+
pasteCells: pasteCells
|
| 5893 |
+
};
|
| 5894 |
+
};
|
| 5895 |
+
|
| 5896 |
+
var copyRows = function (table, target, generators) {
|
| 5897 |
+
var list = $_dy3x0nkfjfuw8q5l.fromTable(table);
|
| 5898 |
+
var house = $_2ge24cldjfuw8qa3.generate(list);
|
| 5899 |
+
var details = $_dis709mtjfuw8qlp.onCells(house, target);
|
| 5900 |
+
return details.map(function (selectedCells) {
|
| 5901 |
+
var grid = $_cw9o3smwjfuw8qm9.toGrid(house, generators, false);
|
| 5902 |
+
var slicedGrid = grid.slice(selectedCells[0].row(), selectedCells[selectedCells.length - 1].row() + selectedCells[selectedCells.length - 1].rowspan());
|
| 5903 |
+
var slicedDetails = $_dis709mtjfuw8qlp.toDetailList(slicedGrid, generators);
|
| 5904 |
+
return $_c9mejomzjfuw8qmn.copy(slicedDetails);
|
| 5905 |
+
});
|
| 5906 |
+
};
|
| 5907 |
+
var $_8a78aqntjfuw8qsp = { copyRows: copyRows };
|
| 5908 |
+
|
| 5909 |
+
var global$2 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
| 5910 |
+
|
| 5911 |
+
var getTDTHOverallStyle = function (dom, elm, name) {
|
| 5912 |
+
var cells = dom.select('td,th', elm);
|
| 5913 |
+
var firstChildStyle;
|
| 5914 |
+
var checkChildren = function (firstChildStyle, elms) {
|
| 5915 |
+
for (var i = 0; i < elms.length; i++) {
|
| 5916 |
+
var currentStyle = dom.getStyle(elms[i], name);
|
| 5917 |
+
if (typeof firstChildStyle === 'undefined') {
|
| 5918 |
+
firstChildStyle = currentStyle;
|
| 5919 |
+
}
|
| 5920 |
+
if (firstChildStyle !== currentStyle) {
|
| 5921 |
+
return '';
|
| 5922 |
+
}
|
| 5923 |
+
}
|
| 5924 |
+
return firstChildStyle;
|
| 5925 |
+
};
|
| 5926 |
+
firstChildStyle = checkChildren(firstChildStyle, cells);
|
| 5927 |
+
return firstChildStyle;
|
| 5928 |
+
};
|
| 5929 |
+
var applyAlign = function (editor, elm, name) {
|
| 5930 |
+
if (name) {
|
| 5931 |
+
editor.formatter.apply('align' + name, {}, elm);
|
| 5932 |
+
}
|
| 5933 |
+
};
|
| 5934 |
+
var applyVAlign = function (editor, elm, name) {
|
| 5935 |
+
if (name) {
|
| 5936 |
+
editor.formatter.apply('valign' + name, {}, elm);
|
| 5937 |
+
}
|
| 5938 |
+
};
|
| 5939 |
+
var unApplyAlign = function (editor, elm) {
|
| 5940 |
+
global$2.each('left center right'.split(' '), function (name) {
|
| 5941 |
+
editor.formatter.remove('align' + name, {}, elm);
|
| 5942 |
+
});
|
| 5943 |
+
};
|
| 5944 |
+
var unApplyVAlign = function (editor, elm) {
|
| 5945 |
+
global$2.each('top middle bottom'.split(' '), function (name) {
|
| 5946 |
+
editor.formatter.remove('valign' + name, {}, elm);
|
| 5947 |
+
});
|
| 5948 |
+
};
|
| 5949 |
+
var $_ch6rvmnwjfuw8qt7 = {
|
| 5950 |
+
applyAlign: applyAlign,
|
| 5951 |
+
applyVAlign: applyVAlign,
|
| 5952 |
+
unApplyAlign: unApplyAlign,
|
| 5953 |
+
unApplyVAlign: unApplyVAlign,
|
| 5954 |
+
getTDTHOverallStyle: getTDTHOverallStyle
|
| 5955 |
+
};
|
| 5956 |
+
|
| 5957 |
+
var buildListItems = function (inputList, itemCallback, startItems) {
|
| 5958 |
+
var appendItems = function (values, output) {
|
| 5959 |
+
output = output || [];
|
| 5960 |
+
global$2.each(values, function (item) {
|
| 5961 |
+
var menuItem = { text: item.text || item.title };
|
| 5962 |
+
if (item.menu) {
|
| 5963 |
+
menuItem.menu = appendItems(item.menu);
|
| 5964 |
+
} else {
|
| 5965 |
+
menuItem.value = item.value;
|
| 5966 |
+
if (itemCallback) {
|
| 5967 |
+
itemCallback(menuItem);
|
| 5968 |
+
}
|
| 5969 |
+
}
|
| 5970 |
+
output.push(menuItem);
|
| 5971 |
+
});
|
| 5972 |
+
return output;
|
| 5973 |
+
};
|
| 5974 |
+
return appendItems(inputList, startItems || []);
|
| 5975 |
+
};
|
| 5976 |
+
var updateStyleField = function (editor, evt) {
|
| 5977 |
+
var dom = editor.dom;
|
| 5978 |
+
var rootControl = evt.control.rootControl;
|
| 5979 |
+
var data = rootControl.toJSON();
|
| 5980 |
+
var css = dom.parseStyle(data.style);
|
| 5981 |
+
if (evt.control.name() === 'style') {
|
| 5982 |
+
rootControl.find('#borderStyle').value(css['border-style'] || '')[0].fire('select');
|
| 5983 |
+
rootControl.find('#borderColor').value(css['border-color'] || '')[0].fire('change');
|
| 5984 |
+
rootControl.find('#backgroundColor').value(css['background-color'] || '')[0].fire('change');
|
| 5985 |
+
rootControl.find('#width').value(css.width || '').fire('change');
|
| 5986 |
+
rootControl.find('#height').value(css.height || '').fire('change');
|
| 5987 |
+
} else {
|
| 5988 |
+
css['border-style'] = data.borderStyle;
|
| 5989 |
+
css['border-color'] = data.borderColor;
|
| 5990 |
+
css['background-color'] = data.backgroundColor;
|
| 5991 |
+
css.width = data.width ? $_5xkhf2nnjfuw8qrq.addSizeSuffix(data.width) : '';
|
| 5992 |
+
css.height = data.height ? $_5xkhf2nnjfuw8qrq.addSizeSuffix(data.height) : '';
|
| 5993 |
+
}
|
| 5994 |
+
rootControl.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css))));
|
| 5995 |
+
};
|
| 5996 |
+
var extractAdvancedStyles = function (dom, elm) {
|
| 5997 |
+
var css = dom.parseStyle(dom.getAttrib(elm, 'style'));
|
| 5998 |
+
var data = {};
|
| 5999 |
+
if (css['border-style']) {
|
| 6000 |
+
data.borderStyle = css['border-style'];
|
| 6001 |
+
}
|
| 6002 |
+
if (css['border-color']) {
|
| 6003 |
+
data.borderColor = css['border-color'];
|
| 6004 |
+
}
|
| 6005 |
+
if (css['background-color']) {
|
| 6006 |
+
data.backgroundColor = css['background-color'];
|
| 6007 |
+
}
|
| 6008 |
+
data.style = dom.serializeStyle(css);
|
| 6009 |
+
return data;
|
| 6010 |
+
};
|
| 6011 |
+
var createStyleForm = function (editor) {
|
| 6012 |
+
var createColorPickAction = function () {
|
| 6013 |
+
var colorPickerCallback = getColorPickerCallback(editor);
|
| 6014 |
+
if (colorPickerCallback) {
|
| 6015 |
+
return function (evt) {
|
| 6016 |
+
return colorPickerCallback.call(editor, function (value) {
|
| 6017 |
+
evt.control.value(value).fire('change');
|
| 6018 |
+
}, evt.control.value());
|
| 6019 |
+
};
|
| 6020 |
+
}
|
| 6021 |
+
};
|
| 6022 |
+
return {
|
| 6023 |
+
title: 'Advanced',
|
| 6024 |
+
type: 'form',
|
| 6025 |
+
defaults: { onchange: $_20nfr6k7jfuw8q4g.curry(updateStyleField, editor) },
|
| 6026 |
+
items: [
|
| 6027 |
+
{
|
| 6028 |
+
label: 'Style',
|
| 6029 |
+
name: 'style',
|
| 6030 |
+
type: 'textbox'
|
| 6031 |
+
},
|
| 6032 |
+
{
|
| 6033 |
+
type: 'form',
|
| 6034 |
+
padding: 0,
|
| 6035 |
+
formItemDefaults: {
|
| 6036 |
+
layout: 'grid',
|
| 6037 |
+
alignH: [
|
| 6038 |
+
'start',
|
| 6039 |
+
'right'
|
| 6040 |
+
]
|
| 6041 |
+
},
|
| 6042 |
+
defaults: { size: 7 },
|
| 6043 |
+
items: [
|
| 6044 |
+
{
|
| 6045 |
+
label: 'Border style',
|
| 6046 |
+
type: 'listbox',
|
| 6047 |
+
name: 'borderStyle',
|
| 6048 |
+
width: 90,
|
| 6049 |
+
onselect: $_20nfr6k7jfuw8q4g.curry(updateStyleField, editor),
|
| 6050 |
+
values: [
|
| 6051 |
+
{
|
| 6052 |
+
text: 'Select...',
|
| 6053 |
+
value: ''
|
| 6054 |
+
},
|
| 6055 |
+
{
|
| 6056 |
+
text: 'Solid',
|
| 6057 |
+
value: 'solid'
|
| 6058 |
+
},
|
| 6059 |
+
{
|
| 6060 |
+
text: 'Dotted',
|
| 6061 |
+
value: 'dotted'
|
| 6062 |
+
},
|
| 6063 |
+
{
|
| 6064 |
+
text: 'Dashed',
|
| 6065 |
+
value: 'dashed'
|
| 6066 |
+
},
|
| 6067 |
+
{
|
| 6068 |
+
text: 'Double',
|
| 6069 |
+
value: 'double'
|
| 6070 |
+
},
|
| 6071 |
+
{
|
| 6072 |
+
text: 'Groove',
|
| 6073 |
+
value: 'groove'
|
| 6074 |
+
},
|
| 6075 |
+
{
|
| 6076 |
+
text: 'Ridge',
|
| 6077 |
+
value: 'ridge'
|
| 6078 |
+
},
|
| 6079 |
+
{
|
| 6080 |
+
text: 'Inset',
|
| 6081 |
+
value: 'inset'
|
| 6082 |
+
},
|
| 6083 |
+
{
|
| 6084 |
+
text: 'Outset',
|
| 6085 |
+
value: 'outset'
|
| 6086 |
+
},
|
| 6087 |
+
{
|
| 6088 |
+
text: 'None',
|
| 6089 |
+
value: 'none'
|
| 6090 |
+
},
|
| 6091 |
+
{
|
| 6092 |
+
text: 'Hidden',
|
| 6093 |
+
value: 'hidden'
|
| 6094 |
+
}
|
| 6095 |
+
]
|
| 6096 |
+
},
|
| 6097 |
+
{
|
| 6098 |
+
label: 'Border color',
|
| 6099 |
+
type: 'colorbox',
|
| 6100 |
+
name: 'borderColor',
|
| 6101 |
+
onaction: createColorPickAction()
|
| 6102 |
+
},
|
| 6103 |
+
{
|
| 6104 |
+
label: 'Background color',
|
| 6105 |
+
type: 'colorbox',
|
| 6106 |
+
name: 'backgroundColor',
|
| 6107 |
+
onaction: createColorPickAction()
|
| 6108 |
+
}
|
| 6109 |
+
]
|
| 6110 |
+
}
|
| 6111 |
+
]
|
| 6112 |
+
};
|
| 6113 |
+
};
|
| 6114 |
+
var $_2fnzp5nxjfuw8qt9 = {
|
| 6115 |
+
createStyleForm: createStyleForm,
|
| 6116 |
+
buildListItems: buildListItems,
|
| 6117 |
+
updateStyleField: updateStyleField,
|
| 6118 |
+
extractAdvancedStyles: extractAdvancedStyles
|
| 6119 |
+
};
|
| 6120 |
+
|
| 6121 |
+
var updateStyles = function (elm, cssText) {
|
| 6122 |
+
delete elm.dataset.mceStyle;
|
| 6123 |
+
elm.style.cssText += ';' + cssText;
|
| 6124 |
+
};
|
| 6125 |
+
var extractDataFromElement = function (editor, elm) {
|
| 6126 |
+
var dom = editor.dom;
|
| 6127 |
+
var data = {
|
| 6128 |
+
width: dom.getStyle(elm, 'width') || dom.getAttrib(elm, 'width'),
|
| 6129 |
+
height: dom.getStyle(elm, 'height') || dom.getAttrib(elm, 'height'),
|
| 6130 |
+
scope: dom.getAttrib(elm, 'scope'),
|
| 6131 |
+
class: dom.getAttrib(elm, 'class'),
|
| 6132 |
+
type: elm.nodeName.toLowerCase(),
|
| 6133 |
+
style: '',
|
| 6134 |
+
align: '',
|
| 6135 |
+
valign: ''
|
| 6136 |
+
};
|
| 6137 |
+
global$2.each('left center right'.split(' '), function (name) {
|
| 6138 |
+
if (editor.formatter.matchNode(elm, 'align' + name)) {
|
| 6139 |
+
data.align = name;
|
| 6140 |
+
}
|
| 6141 |
+
});
|
| 6142 |
+
global$2.each('top middle bottom'.split(' '), function (name) {
|
| 6143 |
+
if (editor.formatter.matchNode(elm, 'valign' + name)) {
|
| 6144 |
+
data.valign = name;
|
| 6145 |
+
}
|
| 6146 |
+
});
|
| 6147 |
+
if (hasAdvancedCellTab(editor)) {
|
| 6148 |
+
global$2.extend(data, $_2fnzp5nxjfuw8qt9.extractAdvancedStyles(dom, elm));
|
| 6149 |
+
}
|
| 6150 |
+
return data;
|
| 6151 |
+
};
|
| 6152 |
+
var onSubmitCellForm = function (editor, cells, evt) {
|
| 6153 |
+
var dom = editor.dom;
|
| 6154 |
+
var data;
|
| 6155 |
+
function setAttrib(elm, name, value) {
|
| 6156 |
+
if (value) {
|
| 6157 |
+
dom.setAttrib(elm, name, value);
|
| 6158 |
+
}
|
| 6159 |
+
}
|
| 6160 |
+
function setStyle(elm, name, value) {
|
| 6161 |
+
if (value) {
|
| 6162 |
+
dom.setStyle(elm, name, value);
|
| 6163 |
+
}
|
| 6164 |
+
}
|
| 6165 |
+
$_2fnzp5nxjfuw8qt9.updateStyleField(editor, evt);
|
| 6166 |
+
data = evt.control.rootControl.toJSON();
|
| 6167 |
+
editor.undoManager.transact(function () {
|
| 6168 |
+
global$2.each(cells, function (cellElm) {
|
| 6169 |
+
setAttrib(cellElm, 'scope', data.scope);
|
| 6170 |
+
if (cells.length === 1) {
|
| 6171 |
+
setAttrib(cellElm, 'style', data.style);
|
| 6172 |
+
} else {
|
| 6173 |
+
updateStyles(cellElm, data.style);
|
| 6174 |
+
}
|
| 6175 |
+
setAttrib(cellElm, 'class', data.class);
|
| 6176 |
+
setStyle(cellElm, 'width', $_5xkhf2nnjfuw8qrq.addSizeSuffix(data.width));
|
| 6177 |
+
setStyle(cellElm, 'height', $_5xkhf2nnjfuw8qrq.addSizeSuffix(data.height));
|
| 6178 |
+
if (data.type && cellElm.nodeName.toLowerCase() !== data.type) {
|
| 6179 |
+
cellElm = dom.rename(cellElm, data.type);
|
| 6180 |
+
}
|
| 6181 |
+
if (cells.length === 1) {
|
| 6182 |
+
$_ch6rvmnwjfuw8qt7.unApplyAlign(editor, cellElm);
|
| 6183 |
+
$_ch6rvmnwjfuw8qt7.unApplyVAlign(editor, cellElm);
|
| 6184 |
+
}
|
| 6185 |
+
if (data.align) {
|
| 6186 |
+
$_ch6rvmnwjfuw8qt7.applyAlign(editor, cellElm, data.align);
|
| 6187 |
+
}
|
| 6188 |
+
if (data.valign) {
|
| 6189 |
+
$_ch6rvmnwjfuw8qt7.applyVAlign(editor, cellElm, data.valign);
|
| 6190 |
+
}
|
| 6191 |
+
});
|
| 6192 |
+
editor.focus();
|
| 6193 |
+
});
|
| 6194 |
+
};
|
| 6195 |
+
var open = function (editor) {
|
| 6196 |
+
var cellElm, data, classListCtrl, cells = [];
|
| 6197 |
+
cells = editor.dom.select('td[data-mce-selected],th[data-mce-selected]');
|
| 6198 |
+
cellElm = editor.dom.getParent(editor.selection.getStart(), 'td,th');
|
| 6199 |
+
if (!cells.length && cellElm) {
|
| 6200 |
+
cells.push(cellElm);
|
| 6201 |
+
}
|
| 6202 |
+
cellElm = cellElm || cells[0];
|
| 6203 |
+
if (!cellElm) {
|
| 6204 |
+
return;
|
| 6205 |
+
}
|
| 6206 |
+
if (cells.length > 1) {
|
| 6207 |
+
data = {
|
| 6208 |
+
width: '',
|
| 6209 |
+
height: '',
|
| 6210 |
+
scope: '',
|
| 6211 |
+
class: '',
|
| 6212 |
+
align: '',
|
| 6213 |
+
valign: '',
|
| 6214 |
+
style: '',
|
| 6215 |
+
type: cellElm.nodeName.toLowerCase()
|
| 6216 |
+
};
|
| 6217 |
+
} else {
|
| 6218 |
+
data = extractDataFromElement(editor, cellElm);
|
| 6219 |
+
}
|
| 6220 |
+
if (getCellClassList(editor).length > 0) {
|
| 6221 |
+
classListCtrl = {
|
| 6222 |
+
name: 'class',
|
| 6223 |
+
type: 'listbox',
|
| 6224 |
+
label: 'Class',
|
| 6225 |
+
values: $_2fnzp5nxjfuw8qt9.buildListItems(getCellClassList(editor), function (item) {
|
| 6226 |
+
if (item.value) {
|
| 6227 |
+
item.textStyle = function () {
|
| 6228 |
+
return editor.formatter.getCssText({
|
| 6229 |
+
block: 'td',
|
| 6230 |
+
classes: [item.value]
|
| 6231 |
+
});
|
| 6232 |
+
};
|
| 6233 |
+
}
|
| 6234 |
+
})
|
| 6235 |
+
};
|
| 6236 |
+
}
|
| 6237 |
+
var generalCellForm = {
|
| 6238 |
+
type: 'form',
|
| 6239 |
+
layout: 'flex',
|
| 6240 |
+
direction: 'column',
|
| 6241 |
+
labelGapCalc: 'children',
|
| 6242 |
+
padding: 0,
|
| 6243 |
+
items: [
|
| 6244 |
+
{
|
| 6245 |
+
type: 'form',
|
| 6246 |
+
layout: 'grid',
|
| 6247 |
+
columns: 2,
|
| 6248 |
+
labelGapCalc: false,
|
| 6249 |
+
padding: 0,
|
| 6250 |
+
defaults: {
|
| 6251 |
+
type: 'textbox',
|
| 6252 |
+
maxWidth: 50
|
| 6253 |
+
},
|
| 6254 |
+
items: [
|
| 6255 |
+
{
|
| 6256 |
+
label: 'Width',
|
| 6257 |
+
name: 'width',
|
| 6258 |
+
onchange: $_20nfr6k7jfuw8q4g.curry($_2fnzp5nxjfuw8qt9.updateStyleField, editor)
|
| 6259 |
+
},
|
| 6260 |
+
{
|
| 6261 |
+
label: 'Height',
|
| 6262 |
+
name: 'height',
|
| 6263 |
+
onchange: $_20nfr6k7jfuw8q4g.curry($_2fnzp5nxjfuw8qt9.updateStyleField, editor)
|
| 6264 |
+
},
|
| 6265 |
+
{
|
| 6266 |
+
label: 'Cell type',
|
| 6267 |
+
name: 'type',
|
| 6268 |
+
type: 'listbox',
|
| 6269 |
+
text: 'None',
|
| 6270 |
+
minWidth: 90,
|
| 6271 |
+
maxWidth: null,
|
| 6272 |
+
values: [
|
| 6273 |
+
{
|
| 6274 |
+
text: 'Cell',
|
| 6275 |
+
value: 'td'
|
| 6276 |
+
},
|
| 6277 |
+
{
|
| 6278 |
+
text: 'Header cell',
|
| 6279 |
+
value: 'th'
|
| 6280 |
+
}
|
| 6281 |
+
]
|
| 6282 |
+
},
|
| 6283 |
+
{
|
| 6284 |
+
label: 'Scope',
|
| 6285 |
+
name: 'scope',
|
| 6286 |
+
type: 'listbox',
|
| 6287 |
+
text: 'None',
|
| 6288 |
+
minWidth: 90,
|
| 6289 |
+
maxWidth: null,
|
| 6290 |
+
values: [
|
| 6291 |
+
{
|
| 6292 |
+
text: 'None',
|
| 6293 |
+
value: ''
|
| 6294 |
+
},
|
| 6295 |
+
{
|
| 6296 |
+
text: 'Row',
|
| 6297 |
+
value: 'row'
|
| 6298 |
+
},
|
| 6299 |
+
{
|
| 6300 |
+
text: 'Column',
|
| 6301 |
+
value: 'col'
|
| 6302 |
+
},
|
| 6303 |
+
{
|
| 6304 |
+
text: 'Row group',
|
| 6305 |
+
value: 'rowgroup'
|
| 6306 |
+
},
|
| 6307 |
+
{
|
| 6308 |
+
text: 'Column group',
|
| 6309 |
+
value: 'colgroup'
|
| 6310 |
+
}
|
| 6311 |
+
]
|
| 6312 |
+
},
|
| 6313 |
+
{
|
| 6314 |
+
label: 'H Align',
|
| 6315 |
+
name: 'align',
|
| 6316 |
+
type: 'listbox',
|
| 6317 |
+
text: 'None',
|
| 6318 |
+
minWidth: 90,
|
| 6319 |
+
maxWidth: null,
|
| 6320 |
+
values: [
|
| 6321 |
+
{
|
| 6322 |
+
text: 'None',
|
| 6323 |
+
value: ''
|
| 6324 |
+
},
|
| 6325 |
+
{
|
| 6326 |
+
text: 'Left',
|
| 6327 |
+
value: 'left'
|
| 6328 |
+
},
|
| 6329 |
+
{
|
| 6330 |
+
text: 'Center',
|
| 6331 |
+
value: 'center'
|
| 6332 |
+
},
|
| 6333 |
+
{
|
| 6334 |
+
text: 'Right',
|
| 6335 |
+
value: 'right'
|
| 6336 |
+
}
|
| 6337 |
+
]
|
| 6338 |
+
},
|
| 6339 |
+
{
|
| 6340 |
+
label: 'V Align',
|
| 6341 |
+
name: 'valign',
|
| 6342 |
+
type: 'listbox',
|
| 6343 |
+
text: 'None',
|
| 6344 |
+
minWidth: 90,
|
| 6345 |
+
maxWidth: null,
|
| 6346 |
+
values: [
|
| 6347 |
+
{
|
| 6348 |
+
text: 'None',
|
| 6349 |
+
value: ''
|
| 6350 |
+
},
|
| 6351 |
+
{
|
| 6352 |
+
text: 'Top',
|
| 6353 |
+
value: 'top'
|
| 6354 |
+
},
|
| 6355 |
+
{
|
| 6356 |
+
text: 'Middle',
|
| 6357 |
+
value: 'middle'
|
| 6358 |
+
},
|
| 6359 |
+
{
|
| 6360 |
+
text: 'Bottom',
|
| 6361 |
+
value: 'bottom'
|
| 6362 |
+
}
|
| 6363 |
+
]
|
| 6364 |
+
}
|
| 6365 |
+
]
|
| 6366 |
+
},
|
| 6367 |
+
classListCtrl
|
| 6368 |
+
]
|
| 6369 |
+
};
|
| 6370 |
+
if (hasAdvancedCellTab(editor)) {
|
| 6371 |
+
editor.windowManager.open({
|
| 6372 |
+
title: 'Cell properties',
|
| 6373 |
+
bodyType: 'tabpanel',
|
| 6374 |
+
data: data,
|
| 6375 |
+
body: [
|
| 6376 |
+
{
|
| 6377 |
+
title: 'General',
|
| 6378 |
+
type: 'form',
|
| 6379 |
+
items: generalCellForm
|
| 6380 |
+
},
|
| 6381 |
+
$_2fnzp5nxjfuw8qt9.createStyleForm(editor)
|
| 6382 |
+
],
|
| 6383 |
+
onsubmit: $_20nfr6k7jfuw8q4g.curry(onSubmitCellForm, editor, cells)
|
| 6384 |
+
});
|
| 6385 |
+
} else {
|
| 6386 |
+
editor.windowManager.open({
|
| 6387 |
+
title: 'Cell properties',
|
| 6388 |
+
data: data,
|
| 6389 |
+
body: generalCellForm,
|
| 6390 |
+
onsubmit: $_20nfr6k7jfuw8q4g.curry(onSubmitCellForm, editor, cells)
|
| 6391 |
+
});
|
| 6392 |
+
}
|
| 6393 |
+
};
|
| 6394 |
+
var $_48j9iinvjfuw8qsu = { open: open };
|
| 6395 |
+
|
| 6396 |
+
var extractDataFromElement$1 = function (editor, elm) {
|
| 6397 |
+
var dom = editor.dom;
|
| 6398 |
+
var data = {
|
| 6399 |
+
height: dom.getStyle(elm, 'height') || dom.getAttrib(elm, 'height'),
|
| 6400 |
+
scope: dom.getAttrib(elm, 'scope'),
|
| 6401 |
+
class: dom.getAttrib(elm, 'class'),
|
| 6402 |
+
align: '',
|
| 6403 |
+
style: '',
|
| 6404 |
+
type: elm.parentNode.nodeName.toLowerCase()
|
| 6405 |
+
};
|
| 6406 |
+
global$2.each('left center right'.split(' '), function (name) {
|
| 6407 |
+
if (editor.formatter.matchNode(elm, 'align' + name)) {
|
| 6408 |
+
data.align = name;
|
| 6409 |
+
}
|
| 6410 |
+
});
|
| 6411 |
+
if (hasAdvancedRowTab(editor)) {
|
| 6412 |
+
global$2.extend(data, $_2fnzp5nxjfuw8qt9.extractAdvancedStyles(dom, elm));
|
| 6413 |
+
}
|
| 6414 |
+
return data;
|
| 6415 |
+
};
|
| 6416 |
+
var switchRowType = function (dom, rowElm, toType) {
|
| 6417 |
+
var tableElm = dom.getParent(rowElm, 'table');
|
| 6418 |
+
var oldParentElm = rowElm.parentNode;
|
| 6419 |
+
var parentElm = dom.select(toType, tableElm)[0];
|
| 6420 |
+
if (!parentElm) {
|
| 6421 |
+
parentElm = dom.create(toType);
|
| 6422 |
+
if (tableElm.firstChild) {
|
| 6423 |
+
if (tableElm.firstChild.nodeName === 'CAPTION') {
|
| 6424 |
+
dom.insertAfter(parentElm, tableElm.firstChild);
|
| 6425 |
+
} else {
|
| 6426 |
+
tableElm.insertBefore(parentElm, tableElm.firstChild);
|
| 6427 |
+
}
|
| 6428 |
+
} else {
|
| 6429 |
+
tableElm.appendChild(parentElm);
|
| 6430 |
+
}
|
| 6431 |
+
}
|
| 6432 |
+
parentElm.appendChild(rowElm);
|
| 6433 |
+
if (!oldParentElm.hasChildNodes()) {
|
| 6434 |
+
dom.remove(oldParentElm);
|
| 6435 |
+
}
|
| 6436 |
+
};
|
| 6437 |
+
function onSubmitRowForm(editor, rows, oldData, evt) {
|
| 6438 |
+
var dom = editor.dom;
|
| 6439 |
+
function setAttrib(elm, name, value) {
|
| 6440 |
+
if (value) {
|
| 6441 |
+
dom.setAttrib(elm, name, value);
|
| 6442 |
+
}
|
| 6443 |
+
}
|
| 6444 |
+
function setStyle(elm, name, value) {
|
| 6445 |
+
if (value) {
|
| 6446 |
+
dom.setStyle(elm, name, value);
|
| 6447 |
+
}
|
| 6448 |
+
}
|
| 6449 |
+
$_2fnzp5nxjfuw8qt9.updateStyleField(editor, evt);
|
| 6450 |
+
var data = evt.control.rootControl.toJSON();
|
| 6451 |
+
editor.undoManager.transact(function () {
|
| 6452 |
+
global$2.each(rows, function (rowElm) {
|
| 6453 |
+
setAttrib(rowElm, 'scope', data.scope);
|
| 6454 |
+
setAttrib(rowElm, 'style', data.style);
|
| 6455 |
+
setAttrib(rowElm, 'class', data.class);
|
| 6456 |
+
setStyle(rowElm, 'height', $_5xkhf2nnjfuw8qrq.addSizeSuffix(data.height));
|
| 6457 |
+
if (data.type !== rowElm.parentNode.nodeName.toLowerCase()) {
|
| 6458 |
+
switchRowType(editor.dom, rowElm, data.type);
|
| 6459 |
+
}
|
| 6460 |
+
if (data.align !== oldData.align) {
|
| 6461 |
+
$_ch6rvmnwjfuw8qt7.unApplyAlign(editor, rowElm);
|
| 6462 |
+
$_ch6rvmnwjfuw8qt7.applyAlign(editor, rowElm, data.align);
|
| 6463 |
+
}
|
| 6464 |
+
});
|
| 6465 |
+
editor.focus();
|
| 6466 |
+
});
|
| 6467 |
+
}
|
| 6468 |
+
var open$1 = function (editor) {
|
| 6469 |
+
var dom = editor.dom;
|
| 6470 |
+
var tableElm, cellElm, rowElm, classListCtrl, data;
|
| 6471 |
+
var rows = [];
|
| 6472 |
+
var generalRowForm;
|
| 6473 |
+
tableElm = dom.getParent(editor.selection.getStart(), 'table');
|
| 6474 |
+
cellElm = dom.getParent(editor.selection.getStart(), 'td,th');
|
| 6475 |
+
global$2.each(tableElm.rows, function (row) {
|
| 6476 |
+
global$2.each(row.cells, function (cell) {
|
| 6477 |
+
if (dom.getAttrib(cell, 'data-mce-selected') || cell === cellElm) {
|
| 6478 |
+
rows.push(row);
|
| 6479 |
+
return false;
|
| 6480 |
+
}
|
| 6481 |
+
});
|
| 6482 |
+
});
|
| 6483 |
+
rowElm = rows[0];
|
| 6484 |
+
if (!rowElm) {
|
| 6485 |
+
return;
|
| 6486 |
+
}
|
| 6487 |
+
if (rows.length > 1) {
|
| 6488 |
+
data = {
|
| 6489 |
+
height: '',
|
| 6490 |
+
scope: '',
|
| 6491 |
+
style: '',
|
| 6492 |
+
class: '',
|
| 6493 |
+
align: '',
|
| 6494 |
+
type: rowElm.parentNode.nodeName.toLowerCase()
|
| 6495 |
+
};
|
| 6496 |
+
} else {
|
| 6497 |
+
data = extractDataFromElement$1(editor, rowElm);
|
| 6498 |
+
}
|
| 6499 |
+
if (getRowClassList(editor).length > 0) {
|
| 6500 |
+
classListCtrl = {
|
| 6501 |
+
name: 'class',
|
| 6502 |
+
type: 'listbox',
|
| 6503 |
+
label: 'Class',
|
| 6504 |
+
values: $_2fnzp5nxjfuw8qt9.buildListItems(getRowClassList(editor), function (item) {
|
| 6505 |
+
if (item.value) {
|
| 6506 |
+
item.textStyle = function () {
|
| 6507 |
+
return editor.formatter.getCssText({
|
| 6508 |
+
block: 'tr',
|
| 6509 |
+
classes: [item.value]
|
| 6510 |
+
});
|
| 6511 |
+
};
|
| 6512 |
+
}
|
| 6513 |
+
})
|
| 6514 |
+
};
|
| 6515 |
+
}
|
| 6516 |
+
generalRowForm = {
|
| 6517 |
+
type: 'form',
|
| 6518 |
+
columns: 2,
|
| 6519 |
+
padding: 0,
|
| 6520 |
+
defaults: { type: 'textbox' },
|
| 6521 |
+
items: [
|
| 6522 |
+
{
|
| 6523 |
+
type: 'listbox',
|
| 6524 |
+
name: 'type',
|
| 6525 |
+
label: 'Row type',
|
| 6526 |
+
text: 'Header',
|
| 6527 |
+
maxWidth: null,
|
| 6528 |
+
values: [
|
| 6529 |
+
{
|
| 6530 |
+
text: 'Header',
|
| 6531 |
+
value: 'thead'
|
| 6532 |
+
},
|
| 6533 |
+
{
|
| 6534 |
+
text: 'Body',
|
| 6535 |
+
value: 'tbody'
|
| 6536 |
+
},
|
| 6537 |
+
{
|
| 6538 |
+
text: 'Footer',
|
| 6539 |
+
value: 'tfoot'
|
| 6540 |
+
}
|
| 6541 |
+
]
|
| 6542 |
+
},
|
| 6543 |
+
{
|
| 6544 |
+
type: 'listbox',
|
| 6545 |
+
name: 'align',
|
| 6546 |
+
label: 'Alignment',
|
| 6547 |
+
text: 'None',
|
| 6548 |
+
maxWidth: null,
|
| 6549 |
+
values: [
|
| 6550 |
+
{
|
| 6551 |
+
text: 'None',
|
| 6552 |
+
value: ''
|
| 6553 |
+
},
|
| 6554 |
+
{
|
| 6555 |
+
text: 'Left',
|
| 6556 |
+
value: 'left'
|
| 6557 |
+
},
|
| 6558 |
+
{
|
| 6559 |
+
text: 'Center',
|
| 6560 |
+
value: 'center'
|
| 6561 |
+
},
|
| 6562 |
+
{
|
| 6563 |
+
text: 'Right',
|
| 6564 |
+
value: 'right'
|
| 6565 |
+
}
|
| 6566 |
+
]
|
| 6567 |
+
},
|
| 6568 |
+
{
|
| 6569 |
+
label: 'Height',
|
| 6570 |
+
name: 'height'
|
| 6571 |
+
},
|
| 6572 |
+
classListCtrl
|
| 6573 |
+
]
|
| 6574 |
+
};
|
| 6575 |
+
if (hasAdvancedRowTab(editor)) {
|
| 6576 |
+
editor.windowManager.open({
|
| 6577 |
+
title: 'Row properties',
|
| 6578 |
+
data: data,
|
| 6579 |
+
bodyType: 'tabpanel',
|
| 6580 |
+
body: [
|
| 6581 |
+
{
|
| 6582 |
+
title: 'General',
|
| 6583 |
+
type: 'form',
|
| 6584 |
+
items: generalRowForm
|
| 6585 |
+
},
|
| 6586 |
+
$_2fnzp5nxjfuw8qt9.createStyleForm(editor)
|
| 6587 |
+
],
|
| 6588 |
+
onsubmit: $_20nfr6k7jfuw8q4g.curry(onSubmitRowForm, editor, rows, data)
|
| 6589 |
+
});
|
| 6590 |
+
} else {
|
| 6591 |
+
editor.windowManager.open({
|
| 6592 |
+
title: 'Row properties',
|
| 6593 |
+
data: data,
|
| 6594 |
+
body: generalRowForm,
|
| 6595 |
+
onsubmit: $_20nfr6k7jfuw8q4g.curry(onSubmitRowForm, editor, rows, data)
|
| 6596 |
+
});
|
| 6597 |
+
}
|
| 6598 |
+
};
|
| 6599 |
+
var $_cshv4qnyjfuw8qtf = { open: open$1 };
|
| 6600 |
+
|
| 6601 |
+
var global$3 = tinymce.util.Tools.resolve('tinymce.Env');
|
| 6602 |
+
|
| 6603 |
+
var DefaultRenderOptions = {
|
| 6604 |
+
styles: {
|
| 6605 |
+
'border-collapse': 'collapse',
|
| 6606 |
+
width: '100%'
|
| 6607 |
+
},
|
| 6608 |
+
attributes: { border: '1' },
|
| 6609 |
+
percentages: true
|
| 6610 |
+
};
|
| 6611 |
+
var makeTable = function () {
|
| 6612 |
+
return $_xbeoqkkjfuw8q73.fromTag('table');
|
| 6613 |
+
};
|
| 6614 |
+
var tableBody = function () {
|
| 6615 |
+
return $_xbeoqkkjfuw8q73.fromTag('tbody');
|
| 6616 |
+
};
|
| 6617 |
+
var tableRow = function () {
|
| 6618 |
+
return $_xbeoqkkjfuw8q73.fromTag('tr');
|
| 6619 |
+
};
|
| 6620 |
+
var tableHeaderCell = function () {
|
| 6621 |
+
return $_xbeoqkkjfuw8q73.fromTag('th');
|
| 6622 |
+
};
|
| 6623 |
+
var tableCell = function () {
|
| 6624 |
+
return $_xbeoqkkjfuw8q73.fromTag('td');
|
| 6625 |
+
};
|
| 6626 |
+
var render$1 = function (rows, columns, rowHeaders, columnHeaders, renderOpts) {
|
| 6627 |
+
if (renderOpts === void 0) {
|
| 6628 |
+
renderOpts = DefaultRenderOptions;
|
| 6629 |
+
}
|
| 6630 |
+
var table = makeTable();
|
| 6631 |
+
$_bfod2hlejfuw8qac.setAll(table, renderOpts.styles);
|
| 6632 |
+
$_3q82t2l5jfuw8q93.setAll(table, renderOpts.attributes);
|
| 6633 |
+
var tbody = tableBody();
|
| 6634 |
+
$_fatuxylgjfuw8qav.append(table, tbody);
|
| 6635 |
+
var trs = [];
|
| 6636 |
+
for (var i = 0; i < rows; i++) {
|
| 6637 |
+
var tr = tableRow();
|
| 6638 |
+
for (var j = 0; j < columns; j++) {
|
| 6639 |
+
var td = i < rowHeaders || j < columnHeaders ? tableHeaderCell() : tableCell();
|
| 6640 |
+
if (j < columnHeaders) {
|
| 6641 |
+
$_3q82t2l5jfuw8q93.set(td, 'scope', 'row');
|
| 6642 |
+
}
|
| 6643 |
+
if (i < rowHeaders) {
|
| 6644 |
+
$_3q82t2l5jfuw8q93.set(td, 'scope', 'col');
|
| 6645 |
+
}
|
| 6646 |
+
$_fatuxylgjfuw8qav.append(td, $_xbeoqkkjfuw8q73.fromTag('br'));
|
| 6647 |
+
if (renderOpts.percentages) {
|
| 6648 |
+
$_bfod2hlejfuw8qac.set(td, 'width', 100 / columns + '%');
|
| 6649 |
+
}
|
| 6650 |
+
$_fatuxylgjfuw8qav.append(tr, td);
|
| 6651 |
+
}
|
| 6652 |
+
trs.push(tr);
|
| 6653 |
+
}
|
| 6654 |
+
$_9zaoqflijfuw8qb0.append(tbody, trs);
|
| 6655 |
+
return table;
|
| 6656 |
+
};
|
| 6657 |
+
|
| 6658 |
+
var get$7 = function (element) {
|
| 6659 |
+
return element.dom().innerHTML;
|
| 6660 |
+
};
|
| 6661 |
+
var set$5 = function (element, content) {
|
| 6662 |
+
var owner = $_s8scrkmjfuw8q7a.owner(element);
|
| 6663 |
+
var docDom = owner.dom();
|
| 6664 |
+
var fragment = $_xbeoqkkjfuw8q73.fromDom(docDom.createDocumentFragment());
|
| 6665 |
+
var contentElements = $_du13u9lpjfuw8qce.fromHtml(content, docDom);
|
| 6666 |
+
$_9zaoqflijfuw8qb0.append(fragment, contentElements);
|
| 6667 |
+
$_fl1deelhjfuw8qax.empty(element);
|
| 6668 |
+
$_fatuxylgjfuw8qav.append(element, fragment);
|
| 6669 |
+
};
|
| 6670 |
+
var getOuter$2 = function (element) {
|
| 6671 |
+
var container = $_xbeoqkkjfuw8q73.fromTag('div');
|
| 6672 |
+
var clone = $_xbeoqkkjfuw8q73.fromDom(element.dom().cloneNode(true));
|
| 6673 |
+
$_fatuxylgjfuw8qav.append(container, clone);
|
| 6674 |
+
return get$7(container);
|
| 6675 |
+
};
|
| 6676 |
+
var $_76qisuo4jfuw8qut = {
|
| 6677 |
+
get: get$7,
|
| 6678 |
+
set: set$5,
|
| 6679 |
+
getOuter: getOuter$2
|
| 6680 |
+
};
|
| 6681 |
+
|
| 6682 |
+
var placeCaretInCell = function (editor, cell) {
|
| 6683 |
+
editor.selection.select(cell.dom(), true);
|
| 6684 |
+
editor.selection.collapse(true);
|
| 6685 |
+
};
|
| 6686 |
+
var selectFirstCellInTable = function (editor, tableElm) {
|
| 6687 |
+
$_8wdrbmlajfuw8q9m.descendant(tableElm, 'td,th').each($_20nfr6k7jfuw8q4g.curry(placeCaretInCell, editor));
|
| 6688 |
+
};
|
| 6689 |
+
var fireEvents = function (editor, table) {
|
| 6690 |
+
$_tyr3yk5jfuw8q47.each($_6c9d0hl7jfuw8q9d.descendants(table, 'tr'), function (row) {
|
| 6691 |
+
fireNewRow(editor, row.dom());
|
| 6692 |
+
$_tyr3yk5jfuw8q47.each($_6c9d0hl7jfuw8q9d.descendants(row, 'th,td'), function (cell) {
|
| 6693 |
+
fireNewCell(editor, cell.dom());
|
| 6694 |
+
});
|
| 6695 |
+
});
|
| 6696 |
+
};
|
| 6697 |
+
var isPercentage = function (width) {
|
| 6698 |
+
return $_g6mvnrk8jfuw8q4k.isString(width) && width.indexOf('%') !== -1;
|
| 6699 |
+
};
|
| 6700 |
+
var insert$1 = function (editor, columns, rows) {
|
| 6701 |
+
var defaultStyles = getDefaultStyles(editor);
|
| 6702 |
+
var options = {
|
| 6703 |
+
styles: defaultStyles,
|
| 6704 |
+
attributes: getDefaultAttributes(editor),
|
| 6705 |
+
percentages: isPercentage(defaultStyles.width) && !isPixelsForced(editor)
|
| 6706 |
+
};
|
| 6707 |
+
var table = render$1(rows, columns, 0, 0, options);
|
| 6708 |
+
$_3q82t2l5jfuw8q93.set(table, 'data-mce-id', '__mce');
|
| 6709 |
+
var html = $_76qisuo4jfuw8qut.getOuter(table);
|
| 6710 |
+
editor.insertContent(html);
|
| 6711 |
+
return $_8wdrbmlajfuw8q9m.descendant($_5xkhf2nnjfuw8qrq.getBody(editor), 'table[data-mce-id="__mce"]').map(function (table) {
|
| 6712 |
+
if (isPixelsForced(editor)) {
|
| 6713 |
+
$_bfod2hlejfuw8qac.set(table, 'width', $_bfod2hlejfuw8qac.get(table, 'width'));
|
| 6714 |
+
}
|
| 6715 |
+
$_3q82t2l5jfuw8q93.remove(table, 'data-mce-id');
|
| 6716 |
+
fireEvents(editor, table);
|
| 6717 |
+
selectFirstCellInTable(editor, table);
|
| 6718 |
+
return table.dom();
|
| 6719 |
+
}).getOr(null);
|
| 6720 |
+
};
|
| 6721 |
+
var $_1mq3b3o1jfuw8qtu = { insert: insert$1 };
|
| 6722 |
+
|
| 6723 |
+
function styleTDTH(dom, elm, name, value) {
|
| 6724 |
+
if (elm.tagName === 'TD' || elm.tagName === 'TH') {
|
| 6725 |
+
dom.setStyle(elm, name, value);
|
| 6726 |
+
} else {
|
| 6727 |
+
if (elm.children) {
|
| 6728 |
+
for (var i = 0; i < elm.children.length; i++) {
|
| 6729 |
+
styleTDTH(dom, elm.children[i], name, value);
|
| 6730 |
+
}
|
| 6731 |
+
}
|
| 6732 |
+
}
|
| 6733 |
+
}
|
| 6734 |
+
var extractDataFromElement$2 = function (editor, tableElm) {
|
| 6735 |
+
var dom = editor.dom;
|
| 6736 |
+
var data = {
|
| 6737 |
+
width: dom.getStyle(tableElm, 'width') || dom.getAttrib(tableElm, 'width'),
|
| 6738 |
+
height: dom.getStyle(tableElm, 'height') || dom.getAttrib(tableElm, 'height'),
|
| 6739 |
+
cellspacing: dom.getStyle(tableElm, 'border-spacing') || dom.getAttrib(tableElm, 'cellspacing'),
|
| 6740 |
+
cellpadding: dom.getAttrib(tableElm, 'data-mce-cell-padding') || dom.getAttrib(tableElm, 'cellpadding') || $_ch6rvmnwjfuw8qt7.getTDTHOverallStyle(editor.dom, tableElm, 'padding'),
|
| 6741 |
+
border: dom.getAttrib(tableElm, 'data-mce-border') || dom.getAttrib(tableElm, 'border') || $_ch6rvmnwjfuw8qt7.getTDTHOverallStyle(editor.dom, tableElm, 'border'),
|
| 6742 |
+
borderColor: dom.getAttrib(tableElm, 'data-mce-border-color'),
|
| 6743 |
+
caption: !!dom.select('caption', tableElm)[0],
|
| 6744 |
+
class: dom.getAttrib(tableElm, 'class')
|
| 6745 |
+
};
|
| 6746 |
+
global$2.each('left center right'.split(' '), function (name) {
|
| 6747 |
+
if (editor.formatter.matchNode(tableElm, 'align' + name)) {
|
| 6748 |
+
data.align = name;
|
| 6749 |
+
}
|
| 6750 |
+
});
|
| 6751 |
+
if (hasAdvancedTableTab(editor)) {
|
| 6752 |
+
global$2.extend(data, $_2fnzp5nxjfuw8qt9.extractAdvancedStyles(dom, tableElm));
|
| 6753 |
+
}
|
| 6754 |
+
return data;
|
| 6755 |
+
};
|
| 6756 |
+
var applyDataToElement = function (editor, tableElm, data) {
|
| 6757 |
+
var dom = editor.dom;
|
| 6758 |
+
var attrs = {};
|
| 6759 |
+
var styles = {};
|
| 6760 |
+
attrs.class = data.class;
|
| 6761 |
+
styles.height = $_5xkhf2nnjfuw8qrq.addSizeSuffix(data.height);
|
| 6762 |
+
if (dom.getAttrib(tableElm, 'width') && !shouldStyleWithCss(editor)) {
|
| 6763 |
+
attrs.width = $_5xkhf2nnjfuw8qrq.removePxSuffix(data.width);
|
| 6764 |
+
} else {
|
| 6765 |
+
styles.width = $_5xkhf2nnjfuw8qrq.addSizeSuffix(data.width);
|
| 6766 |
+
}
|
| 6767 |
+
if (shouldStyleWithCss(editor)) {
|
| 6768 |
+
styles['border-width'] = $_5xkhf2nnjfuw8qrq.addSizeSuffix(data.border);
|
| 6769 |
+
styles['border-spacing'] = $_5xkhf2nnjfuw8qrq.addSizeSuffix(data.cellspacing);
|
| 6770 |
+
global$2.extend(attrs, {
|
| 6771 |
+
'data-mce-border-color': data.borderColor,
|
| 6772 |
+
'data-mce-cell-padding': data.cellpadding,
|
| 6773 |
+
'data-mce-border': data.border
|
| 6774 |
+
});
|
| 6775 |
+
} else {
|
| 6776 |
+
global$2.extend(attrs, {
|
| 6777 |
+
border: data.border,
|
| 6778 |
+
cellpadding: data.cellpadding,
|
| 6779 |
+
cellspacing: data.cellspacing
|
| 6780 |
+
});
|
| 6781 |
+
}
|
| 6782 |
+
if (shouldStyleWithCss(editor)) {
|
| 6783 |
+
if (tableElm.children) {
|
| 6784 |
+
for (var i = 0; i < tableElm.children.length; i++) {
|
| 6785 |
+
styleTDTH(dom, tableElm.children[i], {
|
| 6786 |
+
'border-width': $_5xkhf2nnjfuw8qrq.addSizeSuffix(data.border),
|
| 6787 |
+
'border-color': data.borderColor,
|
| 6788 |
+
'padding': $_5xkhf2nnjfuw8qrq.addSizeSuffix(data.cellpadding)
|
| 6789 |
+
});
|
| 6790 |
+
}
|
| 6791 |
+
}
|
| 6792 |
+
}
|
| 6793 |
+
if (data.style) {
|
| 6794 |
+
global$2.extend(styles, dom.parseStyle(data.style));
|
| 6795 |
+
} else {
|
| 6796 |
+
styles = global$2.extend({}, dom.parseStyle(dom.getAttrib(tableElm, 'style')), styles);
|
| 6797 |
+
}
|
| 6798 |
+
attrs.style = dom.serializeStyle(styles);
|
| 6799 |
+
dom.setAttribs(tableElm, attrs);
|
| 6800 |
+
};
|
| 6801 |
+
var onSubmitTableForm = function (editor, tableElm, evt) {
|
| 6802 |
+
var dom = editor.dom;
|
| 6803 |
+
var captionElm;
|
| 6804 |
+
var data;
|
| 6805 |
+
$_2fnzp5nxjfuw8qt9.updateStyleField(editor, evt);
|
| 6806 |
+
data = evt.control.rootControl.toJSON();
|
| 6807 |
+
if (data.class === false) {
|
| 6808 |
+
delete data.class;
|
| 6809 |
+
}
|
| 6810 |
+
editor.undoManager.transact(function () {
|
| 6811 |
+
if (!tableElm) {
|
| 6812 |
+
tableElm = $_1mq3b3o1jfuw8qtu.insert(editor, data.cols || 1, data.rows || 1);
|
| 6813 |
+
}
|
| 6814 |
+
applyDataToElement(editor, tableElm, data);
|
| 6815 |
+
captionElm = dom.select('caption', tableElm)[0];
|
| 6816 |
+
if (captionElm && !data.caption) {
|
| 6817 |
+
dom.remove(captionElm);
|
| 6818 |
+
}
|
| 6819 |
+
if (!captionElm && data.caption) {
|
| 6820 |
+
captionElm = dom.create('caption');
|
| 6821 |
+
captionElm.innerHTML = !global$3.ie ? '<br data-mce-bogus="1"/>' : '\xA0';
|
| 6822 |
+
tableElm.insertBefore(captionElm, tableElm.firstChild);
|
| 6823 |
+
}
|
| 6824 |
+
$_ch6rvmnwjfuw8qt7.unApplyAlign(editor, tableElm);
|
| 6825 |
+
if (data.align) {
|
| 6826 |
+
$_ch6rvmnwjfuw8qt7.applyAlign(editor, tableElm, data.align);
|
| 6827 |
+
}
|
| 6828 |
+
editor.focus();
|
| 6829 |
+
editor.addVisual();
|
| 6830 |
+
});
|
| 6831 |
+
};
|
| 6832 |
+
var open$2 = function (editor, isProps) {
|
| 6833 |
+
var dom = editor.dom;
|
| 6834 |
+
var tableElm, colsCtrl, rowsCtrl, classListCtrl, data = {}, generalTableForm;
|
| 6835 |
+
if (isProps === true) {
|
| 6836 |
+
tableElm = dom.getParent(editor.selection.getStart(), 'table');
|
| 6837 |
+
if (tableElm) {
|
| 6838 |
+
data = extractDataFromElement$2(editor, tableElm);
|
| 6839 |
+
}
|
| 6840 |
+
} else {
|
| 6841 |
+
colsCtrl = {
|
| 6842 |
+
label: 'Cols',
|
| 6843 |
+
name: 'cols'
|
| 6844 |
+
};
|
| 6845 |
+
rowsCtrl = {
|
| 6846 |
+
label: 'Rows',
|
| 6847 |
+
name: 'rows'
|
| 6848 |
+
};
|
| 6849 |
+
}
|
| 6850 |
+
if (getTableClassList(editor).length > 0) {
|
| 6851 |
+
if (data.class) {
|
| 6852 |
+
data.class = data.class.replace(/\s*mce\-item\-table\s*/g, '');
|
| 6853 |
+
}
|
| 6854 |
+
classListCtrl = {
|
| 6855 |
+
name: 'class',
|
| 6856 |
+
type: 'listbox',
|
| 6857 |
+
label: 'Class',
|
| 6858 |
+
values: $_2fnzp5nxjfuw8qt9.buildListItems(getTableClassList(editor), function (item) {
|
| 6859 |
+
if (item.value) {
|
| 6860 |
+
item.textStyle = function () {
|
| 6861 |
+
return editor.formatter.getCssText({
|
| 6862 |
+
block: 'table',
|
| 6863 |
+
classes: [item.value]
|
| 6864 |
+
});
|
| 6865 |
+
};
|
| 6866 |
+
}
|
| 6867 |
+
})
|
| 6868 |
+
};
|
| 6869 |
+
}
|
| 6870 |
+
generalTableForm = {
|
| 6871 |
+
type: 'form',
|
| 6872 |
+
layout: 'flex',
|
| 6873 |
+
direction: 'column',
|
| 6874 |
+
labelGapCalc: 'children',
|
| 6875 |
+
padding: 0,
|
| 6876 |
+
items: [
|
| 6877 |
+
{
|
| 6878 |
+
type: 'form',
|
| 6879 |
+
labelGapCalc: false,
|
| 6880 |
+
padding: 0,
|
| 6881 |
+
layout: 'grid',
|
| 6882 |
+
columns: 2,
|
| 6883 |
+
defaults: {
|
| 6884 |
+
type: 'textbox',
|
| 6885 |
+
maxWidth: 50
|
| 6886 |
+
},
|
| 6887 |
+
items: hasAppearanceOptions(editor) ? [
|
| 6888 |
+
colsCtrl,
|
| 6889 |
+
rowsCtrl,
|
| 6890 |
+
{
|
| 6891 |
+
label: 'Width',
|
| 6892 |
+
name: 'width',
|
| 6893 |
+
onchange: $_20nfr6k7jfuw8q4g.curry($_2fnzp5nxjfuw8qt9.updateStyleField, editor)
|
| 6894 |
+
},
|
| 6895 |
+
{
|
| 6896 |
+
label: 'Height',
|
| 6897 |
+
name: 'height',
|
| 6898 |
+
onchange: $_20nfr6k7jfuw8q4g.curry($_2fnzp5nxjfuw8qt9.updateStyleField, editor)
|
| 6899 |
+
},
|
| 6900 |
+
{
|
| 6901 |
+
label: 'Cell spacing',
|
| 6902 |
+
name: 'cellspacing'
|
| 6903 |
+
},
|
| 6904 |
+
{
|
| 6905 |
+
label: 'Cell padding',
|
| 6906 |
+
name: 'cellpadding'
|
| 6907 |
+
},
|
| 6908 |
+
{
|
| 6909 |
+
label: 'Border',
|
| 6910 |
+
name: 'border'
|
| 6911 |
+
},
|
| 6912 |
+
{
|
| 6913 |
+
label: 'Caption',
|
| 6914 |
+
name: 'caption',
|
| 6915 |
+
type: 'checkbox'
|
| 6916 |
+
}
|
| 6917 |
+
] : [
|
| 6918 |
+
colsCtrl,
|
| 6919 |
+
rowsCtrl,
|
| 6920 |
+
{
|
| 6921 |
+
label: 'Width',
|
| 6922 |
+
name: 'width',
|
| 6923 |
+
onchange: $_20nfr6k7jfuw8q4g.curry($_2fnzp5nxjfuw8qt9.updateStyleField, editor)
|
| 6924 |
+
},
|
| 6925 |
+
{
|
| 6926 |
+
label: 'Height',
|
| 6927 |
+
name: 'height',
|
| 6928 |
+
onchange: $_20nfr6k7jfuw8q4g.curry($_2fnzp5nxjfuw8qt9.updateStyleField, editor)
|
| 6929 |
+
}
|
| 6930 |
+
]
|
| 6931 |
+
},
|
| 6932 |
+
{
|
| 6933 |
+
label: 'Alignment',
|
| 6934 |
+
name: 'align',
|
| 6935 |
+
type: 'listbox',
|
| 6936 |
+
text: 'None',
|
| 6937 |
+
values: [
|
| 6938 |
+
{
|
| 6939 |
+
text: 'None',
|
| 6940 |
+
value: ''
|
| 6941 |
+
},
|
| 6942 |
+
{
|
| 6943 |
+
text: 'Left',
|
| 6944 |
+
value: 'left'
|
| 6945 |
+
},
|
| 6946 |
+
{
|
| 6947 |
+
text: 'Center',
|
| 6948 |
+
value: 'center'
|
| 6949 |
+
},
|
| 6950 |
+
{
|
| 6951 |
+
text: 'Right',
|
| 6952 |
+
value: 'right'
|
| 6953 |
+
}
|
| 6954 |
+
]
|
| 6955 |
+
},
|
| 6956 |
+
classListCtrl
|
| 6957 |
+
]
|
| 6958 |
+
};
|
| 6959 |
+
if (hasAdvancedTableTab(editor)) {
|
| 6960 |
+
editor.windowManager.open({
|
| 6961 |
+
title: 'Table properties',
|
| 6962 |
+
data: data,
|
| 6963 |
+
bodyType: 'tabpanel',
|
| 6964 |
+
body: [
|
| 6965 |
+
{
|
| 6966 |
+
title: 'General',
|
| 6967 |
+
type: 'form',
|
| 6968 |
+
items: generalTableForm
|
| 6969 |
+
},
|
| 6970 |
+
$_2fnzp5nxjfuw8qt9.createStyleForm(editor)
|
| 6971 |
+
],
|
| 6972 |
+
onsubmit: $_20nfr6k7jfuw8q4g.curry(onSubmitTableForm, editor, tableElm)
|
| 6973 |
+
});
|
| 6974 |
+
} else {
|
| 6975 |
+
editor.windowManager.open({
|
| 6976 |
+
title: 'Table properties',
|
| 6977 |
+
data: data,
|
| 6978 |
+
body: generalTableForm,
|
| 6979 |
+
onsubmit: $_20nfr6k7jfuw8q4g.curry(onSubmitTableForm, editor, tableElm)
|
| 6980 |
+
});
|
| 6981 |
+
}
|
| 6982 |
+
};
|
| 6983 |
+
var $_ad8brjnzjfuw8qtm = { open: open$2 };
|
| 6984 |
+
|
| 6985 |
+
var each$3 = global$2.each;
|
| 6986 |
+
var registerCommands = function (editor, actions, cellSelection, selections, clipboardRows) {
|
| 6987 |
+
var isRoot = $_5xkhf2nnjfuw8qrq.getIsRoot(editor);
|
| 6988 |
+
var eraseTable = function () {
|
| 6989 |
+
var cell = $_xbeoqkkjfuw8q73.fromDom(editor.dom.getParent(editor.selection.getStart(), 'th,td'));
|
| 6990 |
+
var table = $_aqhz9okhjfuw8q5y.table(cell, isRoot);
|
| 6991 |
+
table.filter($_20nfr6k7jfuw8q4g.not(isRoot)).each(function (table) {
|
| 6992 |
+
var cursor = $_xbeoqkkjfuw8q73.fromText('');
|
| 6993 |
+
$_fatuxylgjfuw8qav.after(table, cursor);
|
| 6994 |
+
$_fl1deelhjfuw8qax.remove(table);
|
| 6995 |
+
var rng = editor.dom.createRng();
|
| 6996 |
+
rng.setStart(cursor.dom(), 0);
|
| 6997 |
+
rng.setEnd(cursor.dom(), 0);
|
| 6998 |
+
editor.selection.setRng(rng);
|
| 6999 |
+
});
|
| 7000 |
+
};
|
| 7001 |
+
var getSelectionStartCell = function () {
|
| 7002 |
+
return $_xbeoqkkjfuw8q73.fromDom(editor.dom.getParent(editor.selection.getStart(), 'th,td'));
|
| 7003 |
+
};
|
| 7004 |
+
var getTableFromCell = function (cell) {
|
| 7005 |
+
return $_aqhz9okhjfuw8q5y.table(cell, isRoot);
|
| 7006 |
+
};
|
| 7007 |
+
var actOnSelection = function (execute) {
|
| 7008 |
+
var cell = getSelectionStartCell();
|
| 7009 |
+
var table = getTableFromCell(cell);
|
| 7010 |
+
table.each(function (table) {
|
| 7011 |
+
var targets = $_5b7h1hlqjfuw8qci.forMenu(selections, table, cell);
|
| 7012 |
+
execute(table, targets).each(function (rng) {
|
| 7013 |
+
editor.selection.setRng(rng);
|
| 7014 |
+
editor.focus();
|
| 7015 |
+
cellSelection.clear(table);
|
| 7016 |
+
});
|
| 7017 |
+
});
|
| 7018 |
+
};
|
| 7019 |
+
var copyRowSelection = function (execute) {
|
| 7020 |
+
var cell = getSelectionStartCell();
|
| 7021 |
+
var table = getTableFromCell(cell);
|
| 7022 |
+
return table.bind(function (table) {
|
| 7023 |
+
var doc = $_xbeoqkkjfuw8q73.fromDom(editor.getDoc());
|
| 7024 |
+
var targets = $_5b7h1hlqjfuw8qci.forMenu(selections, table, cell);
|
| 7025 |
+
var generators = $_5ohg1eljjfuw8qb4.cellOperations($_20nfr6k7jfuw8q4g.noop, doc, Option.none());
|
| 7026 |
+
return $_8a78aqntjfuw8qsp.copyRows(table, targets, generators);
|
| 7027 |
+
});
|
| 7028 |
+
};
|
| 7029 |
+
var pasteOnSelection = function (execute) {
|
| 7030 |
+
clipboardRows.get().each(function (rows) {
|
| 7031 |
+
var clonedRows = $_tyr3yk5jfuw8q47.map(rows, function (row) {
|
| 7032 |
+
return $_ddvp06lkjfuw8qbt.deep(row);
|
| 7033 |
+
});
|
| 7034 |
+
var cell = getSelectionStartCell();
|
| 7035 |
+
var table = getTableFromCell(cell);
|
| 7036 |
+
table.bind(function (table) {
|
| 7037 |
+
var doc = $_xbeoqkkjfuw8q73.fromDom(editor.getDoc());
|
| 7038 |
+
var generators = $_5ohg1eljjfuw8qb4.paste(doc);
|
| 7039 |
+
var targets = $_5b7h1hlqjfuw8qci.pasteRows(selections, table, cell, clonedRows, generators);
|
| 7040 |
+
execute(table, targets).each(function (rng) {
|
| 7041 |
+
editor.selection.setRng(rng);
|
| 7042 |
+
editor.focus();
|
| 7043 |
+
cellSelection.clear(table);
|
| 7044 |
+
});
|
| 7045 |
+
});
|
| 7046 |
+
});
|
| 7047 |
+
};
|
| 7048 |
+
each$3({
|
| 7049 |
+
mceTableSplitCells: function () {
|
| 7050 |
+
actOnSelection(actions.unmergeCells);
|
| 7051 |
+
},
|
| 7052 |
+
mceTableMergeCells: function () {
|
| 7053 |
+
actOnSelection(actions.mergeCells);
|
| 7054 |
+
},
|
| 7055 |
+
mceTableInsertRowBefore: function () {
|
| 7056 |
+
actOnSelection(actions.insertRowsBefore);
|
| 7057 |
+
},
|
| 7058 |
+
mceTableInsertRowAfter: function () {
|
| 7059 |
+
actOnSelection(actions.insertRowsAfter);
|
| 7060 |
+
},
|
| 7061 |
+
mceTableInsertColBefore: function () {
|
| 7062 |
+
actOnSelection(actions.insertColumnsBefore);
|
| 7063 |
+
},
|
| 7064 |
+
mceTableInsertColAfter: function () {
|
| 7065 |
+
actOnSelection(actions.insertColumnsAfter);
|
| 7066 |
+
},
|
| 7067 |
+
mceTableDeleteCol: function () {
|
| 7068 |
+
actOnSelection(actions.deleteColumn);
|
| 7069 |
+
},
|
| 7070 |
+
mceTableDeleteRow: function () {
|
| 7071 |
+
actOnSelection(actions.deleteRow);
|
| 7072 |
+
},
|
| 7073 |
+
mceTableCutRow: function (grid) {
|
| 7074 |
+
clipboardRows.set(copyRowSelection());
|
| 7075 |
+
actOnSelection(actions.deleteRow);
|
| 7076 |
+
},
|
| 7077 |
+
mceTableCopyRow: function (grid) {
|
| 7078 |
+
clipboardRows.set(copyRowSelection());
|
| 7079 |
+
},
|
| 7080 |
+
mceTablePasteRowBefore: function (grid) {
|
| 7081 |
+
pasteOnSelection(actions.pasteRowsBefore);
|
| 7082 |
+
},
|
| 7083 |
+
mceTablePasteRowAfter: function (grid) {
|
| 7084 |
+
pasteOnSelection(actions.pasteRowsAfter);
|
| 7085 |
+
},
|
| 7086 |
+
mceTableDelete: eraseTable
|
| 7087 |
+
}, function (func, name) {
|
| 7088 |
+
editor.addCommand(name, func);
|
| 7089 |
+
});
|
| 7090 |
+
each$3({
|
| 7091 |
+
mceInsertTable: $_20nfr6k7jfuw8q4g.curry($_ad8brjnzjfuw8qtm.open, editor),
|
| 7092 |
+
mceTableProps: $_20nfr6k7jfuw8q4g.curry($_ad8brjnzjfuw8qtm.open, editor, true),
|
| 7093 |
+
mceTableRowProps: $_20nfr6k7jfuw8q4g.curry($_cshv4qnyjfuw8qtf.open, editor),
|
| 7094 |
+
mceTableCellProps: $_20nfr6k7jfuw8q4g.curry($_48j9iinvjfuw8qsu.open, editor)
|
| 7095 |
+
}, function (func, name) {
|
| 7096 |
+
editor.addCommand(name, function (ui, val) {
|
| 7097 |
+
func(val);
|
| 7098 |
+
});
|
| 7099 |
+
});
|
| 7100 |
+
};
|
| 7101 |
+
var $_srry6nsjfuw8qs8 = { registerCommands: registerCommands };
|
| 7102 |
+
|
| 7103 |
+
var only$1 = function (element) {
|
| 7104 |
+
var parent = Option.from(element.dom().documentElement).map($_xbeoqkkjfuw8q73.fromDom).getOr(element);
|
| 7105 |
+
return {
|
| 7106 |
+
parent: $_20nfr6k7jfuw8q4g.constant(parent),
|
| 7107 |
+
view: $_20nfr6k7jfuw8q4g.constant(element),
|
| 7108 |
+
origin: $_20nfr6k7jfuw8q4g.constant(r(0, 0))
|
| 7109 |
+
};
|
| 7110 |
+
};
|
| 7111 |
+
var detached = function (editable, chrome) {
|
| 7112 |
+
var origin = $_20nfr6k7jfuw8q4g.curry($_hsvzlmijfuw8qj4.absolute, chrome);
|
| 7113 |
+
return {
|
| 7114 |
+
parent: $_20nfr6k7jfuw8q4g.constant(chrome),
|
| 7115 |
+
view: $_20nfr6k7jfuw8q4g.constant(editable),
|
| 7116 |
+
origin: origin
|
| 7117 |
+
};
|
| 7118 |
+
};
|
| 7119 |
+
var body$1 = function (editable, chrome) {
|
| 7120 |
+
return {
|
| 7121 |
+
parent: $_20nfr6k7jfuw8q4g.constant(chrome),
|
| 7122 |
+
view: $_20nfr6k7jfuw8q4g.constant(editable),
|
| 7123 |
+
origin: $_20nfr6k7jfuw8q4g.constant(r(0, 0))
|
| 7124 |
+
};
|
| 7125 |
+
};
|
| 7126 |
+
var $_e4gwgeo6jfuw8qvi = {
|
| 7127 |
+
only: only$1,
|
| 7128 |
+
detached: detached,
|
| 7129 |
+
body: body$1
|
| 7130 |
+
};
|
| 7131 |
+
|
| 7132 |
+
function Event (fields) {
|
| 7133 |
+
var struct = $_5now9kbjfuw8q5e.immutable.apply(null, fields);
|
| 7134 |
+
var handlers = [];
|
| 7135 |
+
var bind = function (handler) {
|
| 7136 |
+
if (handler === undefined) {
|
| 7137 |
+
throw 'Event bind error: undefined handler';
|
| 7138 |
+
}
|
| 7139 |
+
handlers.push(handler);
|
| 7140 |
+
};
|
| 7141 |
+
var unbind = function (handler) {
|
| 7142 |
+
handlers = $_tyr3yk5jfuw8q47.filter(handlers, function (h) {
|
| 7143 |
+
return h !== handler;
|
| 7144 |
+
});
|
| 7145 |
+
};
|
| 7146 |
+
var trigger = function () {
|
| 7147 |
+
var event = struct.apply(null, arguments);
|
| 7148 |
+
$_tyr3yk5jfuw8q47.each(handlers, function (handler) {
|
| 7149 |
+
handler(event);
|
| 7150 |
+
});
|
| 7151 |
+
};
|
| 7152 |
+
return {
|
| 7153 |
+
bind: bind,
|
| 7154 |
+
unbind: unbind,
|
| 7155 |
+
trigger: trigger
|
| 7156 |
+
};
|
| 7157 |
+
}
|
| 7158 |
+
|
| 7159 |
+
var create = function (typeDefs) {
|
| 7160 |
+
var registry = $_11yiupkajfuw8q5c.map(typeDefs, function (event) {
|
| 7161 |
+
return {
|
| 7162 |
+
bind: event.bind,
|
| 7163 |
+
unbind: event.unbind
|
| 7164 |
+
};
|
| 7165 |
+
});
|
| 7166 |
+
var trigger = $_11yiupkajfuw8q5c.map(typeDefs, function (event) {
|
| 7167 |
+
return event.trigger;
|
| 7168 |
+
});
|
| 7169 |
+
return {
|
| 7170 |
+
registry: registry,
|
| 7171 |
+
trigger: trigger
|
| 7172 |
+
};
|
| 7173 |
+
};
|
| 7174 |
+
var $_1fbhhho9jfuw8qw4 = { create: create };
|
| 7175 |
+
|
| 7176 |
+
var mode = $_7z97w5mpjfuw8qkk.exactly([
|
| 7177 |
+
'compare',
|
| 7178 |
+
'extract',
|
| 7179 |
+
'mutate',
|
| 7180 |
+
'sink'
|
| 7181 |
+
]);
|
| 7182 |
+
var sink = $_7z97w5mpjfuw8qkk.exactly([
|
| 7183 |
+
'element',
|
| 7184 |
+
'start',
|
| 7185 |
+
'stop',
|
| 7186 |
+
'destroy'
|
| 7187 |
+
]);
|
| 7188 |
+
var api$3 = $_7z97w5mpjfuw8qkk.exactly([
|
| 7189 |
+
'forceDrop',
|
| 7190 |
+
'drop',
|
| 7191 |
+
'move',
|
| 7192 |
+
'delayDrop'
|
| 7193 |
+
]);
|
| 7194 |
+
var $_aqs1mcodjfuw8qxk = {
|
| 7195 |
+
mode: mode,
|
| 7196 |
+
sink: sink,
|
| 7197 |
+
api: api$3
|
| 7198 |
+
};
|
| 7199 |
+
|
| 7200 |
+
var styles$1 = $_63w6atn5jfuw8qot.css('ephox-dragster');
|
| 7201 |
+
var $_41gm3bofjfuw8qxz = { resolve: styles$1.resolve };
|
| 7202 |
+
|
| 7203 |
+
function Blocker (options) {
|
| 7204 |
+
var settings = $_91sgzmujfuw8qm5.merge({ 'layerClass': $_41gm3bofjfuw8qxz.resolve('blocker') }, options);
|
| 7205 |
+
var div = $_xbeoqkkjfuw8q73.fromTag('div');
|
| 7206 |
+
$_3q82t2l5jfuw8q93.set(div, 'role', 'presentation');
|
| 7207 |
+
$_bfod2hlejfuw8qac.setAll(div, {
|
| 7208 |
+
position: 'fixed',
|
| 7209 |
+
left: '0px',
|
| 7210 |
+
top: '0px',
|
| 7211 |
+
width: '100%',
|
| 7212 |
+
height: '100%'
|
| 7213 |
+
});
|
| 7214 |
+
$_fmcseon6jfuw8qou.add(div, $_41gm3bofjfuw8qxz.resolve('blocker'));
|
| 7215 |
+
$_fmcseon6jfuw8qou.add(div, settings.layerClass);
|
| 7216 |
+
var element = function () {
|
| 7217 |
+
return div;
|
| 7218 |
+
};
|
| 7219 |
+
var destroy = function () {
|
| 7220 |
+
$_fl1deelhjfuw8qax.remove(div);
|
| 7221 |
+
};
|
| 7222 |
+
return {
|
| 7223 |
+
element: element,
|
| 7224 |
+
destroy: destroy
|
| 7225 |
+
};
|
| 7226 |
+
}
|
| 7227 |
+
|
| 7228 |
+
var mkEvent = function (target, x, y, stop, prevent, kill, raw) {
|
| 7229 |
+
return {
|
| 7230 |
+
'target': $_20nfr6k7jfuw8q4g.constant(target),
|
| 7231 |
+
'x': $_20nfr6k7jfuw8q4g.constant(x),
|
| 7232 |
+
'y': $_20nfr6k7jfuw8q4g.constant(y),
|
| 7233 |
+
'stop': stop,
|
| 7234 |
+
'prevent': prevent,
|
| 7235 |
+
'kill': kill,
|
| 7236 |
+
'raw': $_20nfr6k7jfuw8q4g.constant(raw)
|
| 7237 |
+
};
|
| 7238 |
+
};
|
| 7239 |
+
var handle = function (filter, handler) {
|
| 7240 |
+
return function (rawEvent) {
|
| 7241 |
+
if (!filter(rawEvent))
|
| 7242 |
+
return;
|
| 7243 |
+
var target = $_xbeoqkkjfuw8q73.fromDom(rawEvent.target);
|
| 7244 |
+
var stop = function () {
|
| 7245 |
+
rawEvent.stopPropagation();
|
| 7246 |
+
};
|
| 7247 |
+
var prevent = function () {
|
| 7248 |
+
rawEvent.preventDefault();
|
| 7249 |
+
};
|
| 7250 |
+
var kill = $_20nfr6k7jfuw8q4g.compose(prevent, stop);
|
| 7251 |
+
var evt = mkEvent(target, rawEvent.clientX, rawEvent.clientY, stop, prevent, kill, rawEvent);
|
| 7252 |
+
handler(evt);
|
| 7253 |
+
};
|
| 7254 |
+
};
|
| 7255 |
+
var binder = function (element, event, filter, handler, useCapture) {
|
| 7256 |
+
var wrapped = handle(filter, handler);
|
| 7257 |
+
element.dom().addEventListener(event, wrapped, useCapture);
|
| 7258 |
+
return { unbind: $_20nfr6k7jfuw8q4g.curry(unbind, element, event, wrapped, useCapture) };
|
| 7259 |
+
};
|
| 7260 |
+
var bind$1 = function (element, event, filter, handler) {
|
| 7261 |
+
return binder(element, event, filter, handler, false);
|
| 7262 |
+
};
|
| 7263 |
+
var capture = function (element, event, filter, handler) {
|
| 7264 |
+
return binder(element, event, filter, handler, true);
|
| 7265 |
+
};
|
| 7266 |
+
var unbind = function (element, event, handler, useCapture) {
|
| 7267 |
+
element.dom().removeEventListener(event, handler, useCapture);
|
| 7268 |
+
};
|
| 7269 |
+
var $_fal932ohjfuw8qy6 = {
|
| 7270 |
+
bind: bind$1,
|
| 7271 |
+
capture: capture
|
| 7272 |
+
};
|
| 7273 |
+
|
| 7274 |
+
var filter$1 = $_20nfr6k7jfuw8q4g.constant(true);
|
| 7275 |
+
var bind$2 = function (element, event, handler) {
|
| 7276 |
+
return $_fal932ohjfuw8qy6.bind(element, event, filter$1, handler);
|
| 7277 |
+
};
|
| 7278 |
+
var capture$1 = function (element, event, handler) {
|
| 7279 |
+
return $_fal932ohjfuw8qy6.capture(element, event, filter$1, handler);
|
| 7280 |
+
};
|
| 7281 |
+
var $_6fxiitogjfuw8qy3 = {
|
| 7282 |
+
bind: bind$2,
|
| 7283 |
+
capture: capture$1
|
| 7284 |
+
};
|
| 7285 |
+
|
| 7286 |
+
var compare = function (old, nu) {
|
| 7287 |
+
return r(nu.left() - old.left(), nu.top() - old.top());
|
| 7288 |
+
};
|
| 7289 |
+
var extract$1 = function (event) {
|
| 7290 |
+
return Option.some(r(event.x(), event.y()));
|
| 7291 |
+
};
|
| 7292 |
+
var mutate$1 = function (mutation, info) {
|
| 7293 |
+
mutation.mutate(info.left(), info.top());
|
| 7294 |
+
};
|
| 7295 |
+
var sink$1 = function (dragApi, settings) {
|
| 7296 |
+
var blocker = Blocker(settings);
|
| 7297 |
+
var mdown = $_6fxiitogjfuw8qy3.bind(blocker.element(), 'mousedown', dragApi.forceDrop);
|
| 7298 |
+
var mup = $_6fxiitogjfuw8qy3.bind(blocker.element(), 'mouseup', dragApi.drop);
|
| 7299 |
+
var mmove = $_6fxiitogjfuw8qy3.bind(blocker.element(), 'mousemove', dragApi.move);
|
| 7300 |
+
var mout = $_6fxiitogjfuw8qy3.bind(blocker.element(), 'mouseout', dragApi.delayDrop);
|
| 7301 |
+
var destroy = function () {
|
| 7302 |
+
blocker.destroy();
|
| 7303 |
+
mup.unbind();
|
| 7304 |
+
mmove.unbind();
|
| 7305 |
+
mout.unbind();
|
| 7306 |
+
mdown.unbind();
|
| 7307 |
+
};
|
| 7308 |
+
var start = function (parent) {
|
| 7309 |
+
$_fatuxylgjfuw8qav.append(parent, blocker.element());
|
| 7310 |
+
};
|
| 7311 |
+
var stop = function () {
|
| 7312 |
+
$_fl1deelhjfuw8qax.remove(blocker.element());
|
| 7313 |
+
};
|
| 7314 |
+
return $_aqs1mcodjfuw8qxk.sink({
|
| 7315 |
+
element: blocker.element,
|
| 7316 |
+
start: start,
|
| 7317 |
+
stop: stop,
|
| 7318 |
+
destroy: destroy
|
| 7319 |
+
});
|
| 7320 |
+
};
|
| 7321 |
+
var MouseDrag = $_aqs1mcodjfuw8qxk.mode({
|
| 7322 |
+
compare: compare,
|
| 7323 |
+
extract: extract$1,
|
| 7324 |
+
sink: sink$1,
|
| 7325 |
+
mutate: mutate$1
|
| 7326 |
+
});
|
| 7327 |
+
|
| 7328 |
+
function InDrag () {
|
| 7329 |
+
var previous = Option.none();
|
| 7330 |
+
var reset = function () {
|
| 7331 |
+
previous = Option.none();
|
| 7332 |
+
};
|
| 7333 |
+
var update = function (mode, nu) {
|
| 7334 |
+
var result = previous.map(function (old) {
|
| 7335 |
+
return mode.compare(old, nu);
|
| 7336 |
+
});
|
| 7337 |
+
previous = Option.some(nu);
|
| 7338 |
+
return result;
|
| 7339 |
+
};
|
| 7340 |
+
var onEvent = function (event, mode) {
|
| 7341 |
+
var dataOption = mode.extract(event);
|
| 7342 |
+
dataOption.each(function (data) {
|
| 7343 |
+
var offset = update(mode, data);
|
| 7344 |
+
offset.each(function (d) {
|
| 7345 |
+
events.trigger.move(d);
|
| 7346 |
+
});
|
| 7347 |
+
});
|
| 7348 |
+
};
|
| 7349 |
+
var events = $_1fbhhho9jfuw8qw4.create({ move: Event(['info']) });
|
| 7350 |
+
return {
|
| 7351 |
+
onEvent: onEvent,
|
| 7352 |
+
reset: reset,
|
| 7353 |
+
events: events.registry
|
| 7354 |
+
};
|
| 7355 |
+
}
|
| 7356 |
+
|
| 7357 |
+
function NoDrag (anchor) {
|
| 7358 |
+
var onEvent = function (event, mode) {
|
| 7359 |
+
};
|
| 7360 |
+
return {
|
| 7361 |
+
onEvent: onEvent,
|
| 7362 |
+
reset: $_20nfr6k7jfuw8q4g.noop
|
| 7363 |
+
};
|
| 7364 |
+
}
|
| 7365 |
+
|
| 7366 |
+
function Movement () {
|
| 7367 |
+
var noDragState = NoDrag();
|
| 7368 |
+
var inDragState = InDrag();
|
| 7369 |
+
var dragState = noDragState;
|
| 7370 |
+
var on = function () {
|
| 7371 |
+
dragState.reset();
|
| 7372 |
+
dragState = inDragState;
|
| 7373 |
+
};
|
| 7374 |
+
var off = function () {
|
| 7375 |
+
dragState.reset();
|
| 7376 |
+
dragState = noDragState;
|
| 7377 |
+
};
|
| 7378 |
+
var onEvent = function (event, mode) {
|
| 7379 |
+
dragState.onEvent(event, mode);
|
| 7380 |
+
};
|
| 7381 |
+
var isOn = function () {
|
| 7382 |
+
return dragState === inDragState;
|
| 7383 |
+
};
|
| 7384 |
+
return {
|
| 7385 |
+
on: on,
|
| 7386 |
+
off: off,
|
| 7387 |
+
isOn: isOn,
|
| 7388 |
+
onEvent: onEvent,
|
| 7389 |
+
events: inDragState.events
|
| 7390 |
+
};
|
| 7391 |
+
}
|
| 7392 |
+
|
| 7393 |
+
var adaptable = function (fn, rate) {
|
| 7394 |
+
var timer = null;
|
| 7395 |
+
var args = null;
|
| 7396 |
+
var cancel = function () {
|
| 7397 |
+
if (timer !== null) {
|
| 7398 |
+
clearTimeout(timer);
|
| 7399 |
+
timer = null;
|
| 7400 |
+
args = null;
|
| 7401 |
+
}
|
| 7402 |
+
};
|
| 7403 |
+
var throttle = function () {
|
| 7404 |
+
args = arguments;
|
| 7405 |
+
if (timer === null) {
|
| 7406 |
+
timer = setTimeout(function () {
|
| 7407 |
+
fn.apply(null, args);
|
| 7408 |
+
timer = null;
|
| 7409 |
+
args = null;
|
| 7410 |
+
}, rate);
|
| 7411 |
+
}
|
| 7412 |
+
};
|
| 7413 |
+
return {
|
| 7414 |
+
cancel: cancel,
|
| 7415 |
+
throttle: throttle
|
| 7416 |
+
};
|
| 7417 |
+
};
|
| 7418 |
+
var first$4 = function (fn, rate) {
|
| 7419 |
+
var timer = null;
|
| 7420 |
+
var cancel = function () {
|
| 7421 |
+
if (timer !== null) {
|
| 7422 |
+
clearTimeout(timer);
|
| 7423 |
+
timer = null;
|
| 7424 |
+
}
|
| 7425 |
+
};
|
| 7426 |
+
var throttle = function () {
|
| 7427 |
+
var args = arguments;
|
| 7428 |
+
if (timer === null) {
|
| 7429 |
+
timer = setTimeout(function () {
|
| 7430 |
+
fn.apply(null, args);
|
| 7431 |
+
timer = null;
|
| 7432 |
+
args = null;
|
| 7433 |
+
}, rate);
|
| 7434 |
+
}
|
| 7435 |
+
};
|
| 7436 |
+
return {
|
| 7437 |
+
cancel: cancel,
|
| 7438 |
+
throttle: throttle
|
| 7439 |
+
};
|
| 7440 |
+
};
|
| 7441 |
+
var last$3 = function (fn, rate) {
|
| 7442 |
+
var timer = null;
|
| 7443 |
+
var cancel = function () {
|
| 7444 |
+
if (timer !== null) {
|
| 7445 |
+
clearTimeout(timer);
|
| 7446 |
+
timer = null;
|
| 7447 |
+
}
|
| 7448 |
+
};
|
| 7449 |
+
var throttle = function () {
|
| 7450 |
+
var args = arguments;
|
| 7451 |
+
if (timer !== null)
|
| 7452 |
+
clearTimeout(timer);
|
| 7453 |
+
timer = setTimeout(function () {
|
| 7454 |
+
fn.apply(null, args);
|
| 7455 |
+
timer = null;
|
| 7456 |
+
args = null;
|
| 7457 |
+
}, rate);
|
| 7458 |
+
};
|
| 7459 |
+
return {
|
| 7460 |
+
cancel: cancel,
|
| 7461 |
+
throttle: throttle
|
| 7462 |
+
};
|
| 7463 |
+
};
|
| 7464 |
+
var $_4fpdigomjfuw8qyv = {
|
| 7465 |
+
adaptable: adaptable,
|
| 7466 |
+
first: first$4,
|
| 7467 |
+
last: last$3
|
| 7468 |
+
};
|
| 7469 |
+
|
| 7470 |
+
var setup = function (mutation, mode, settings) {
|
| 7471 |
+
var active = false;
|
| 7472 |
+
var events = $_1fbhhho9jfuw8qw4.create({
|
| 7473 |
+
start: Event([]),
|
| 7474 |
+
stop: Event([])
|
| 7475 |
+
});
|
| 7476 |
+
var movement = Movement();
|
| 7477 |
+
var drop = function () {
|
| 7478 |
+
sink.stop();
|
| 7479 |
+
if (movement.isOn()) {
|
| 7480 |
+
movement.off();
|
| 7481 |
+
events.trigger.stop();
|
| 7482 |
+
}
|
| 7483 |
+
};
|
| 7484 |
+
var throttledDrop = $_4fpdigomjfuw8qyv.last(drop, 200);
|
| 7485 |
+
var go = function (parent) {
|
| 7486 |
+
sink.start(parent);
|
| 7487 |
+
movement.on();
|
| 7488 |
+
events.trigger.start();
|
| 7489 |
+
};
|
| 7490 |
+
var mousemove = function (event, ui) {
|
| 7491 |
+
throttledDrop.cancel();
|
| 7492 |
+
movement.onEvent(event, mode);
|
| 7493 |
+
};
|
| 7494 |
+
movement.events.move.bind(function (event) {
|
| 7495 |
+
mode.mutate(mutation, event.info());
|
| 7496 |
+
});
|
| 7497 |
+
var on = function () {
|
| 7498 |
+
active = true;
|
| 7499 |
+
};
|
| 7500 |
+
var off = function () {
|
| 7501 |
+
active = false;
|
| 7502 |
+
};
|
| 7503 |
+
var runIfActive = function (f) {
|
| 7504 |
+
return function () {
|
| 7505 |
+
var args = Array.prototype.slice.call(arguments, 0);
|
| 7506 |
+
if (active) {
|
| 7507 |
+
return f.apply(null, args);
|
| 7508 |
+
}
|
| 7509 |
+
};
|
| 7510 |
+
};
|
| 7511 |
+
var sink = mode.sink($_aqs1mcodjfuw8qxk.api({
|
| 7512 |
+
forceDrop: drop,
|
| 7513 |
+
drop: runIfActive(drop),
|
| 7514 |
+
move: runIfActive(mousemove),
|
| 7515 |
+
delayDrop: runIfActive(throttledDrop.throttle)
|
| 7516 |
+
}), settings);
|
| 7517 |
+
var destroy = function () {
|
| 7518 |
+
sink.destroy();
|
| 7519 |
+
};
|
| 7520 |
+
return {
|
| 7521 |
+
element: sink.element,
|
| 7522 |
+
go: go,
|
| 7523 |
+
on: on,
|
| 7524 |
+
off: off,
|
| 7525 |
+
destroy: destroy,
|
| 7526 |
+
events: events.registry
|
| 7527 |
+
};
|
| 7528 |
+
};
|
| 7529 |
+
var $_bv42lfoijfuw8qyb = { setup: setup };
|
| 7530 |
+
|
| 7531 |
+
var transform$1 = function (mutation, options) {
|
| 7532 |
+
var settings = options !== undefined ? options : {};
|
| 7533 |
+
var mode = settings.mode !== undefined ? settings.mode : MouseDrag;
|
| 7534 |
+
return $_bv42lfoijfuw8qyb.setup(mutation, mode, options);
|
| 7535 |
+
};
|
| 7536 |
+
var $_a1giepobjfuw8qx7 = { transform: transform$1 };
|
| 7537 |
+
|
| 7538 |
+
function Mutation () {
|
| 7539 |
+
var events = $_1fbhhho9jfuw8qw4.create({
|
| 7540 |
+
'drag': Event([
|
| 7541 |
+
'xDelta',
|
| 7542 |
+
'yDelta'
|
| 7543 |
+
])
|
| 7544 |
+
});
|
| 7545 |
+
var mutate = function (x, y) {
|
| 7546 |
+
events.trigger.drag(x, y);
|
| 7547 |
+
};
|
| 7548 |
+
return {
|
| 7549 |
+
mutate: mutate,
|
| 7550 |
+
events: events.registry
|
| 7551 |
+
};
|
| 7552 |
+
}
|
| 7553 |
+
|
| 7554 |
+
function BarMutation () {
|
| 7555 |
+
var events = $_1fbhhho9jfuw8qw4.create({
|
| 7556 |
+
drag: Event([
|
| 7557 |
+
'xDelta',
|
| 7558 |
+
'yDelta',
|
| 7559 |
+
'target'
|
| 7560 |
+
])
|
| 7561 |
+
});
|
| 7562 |
+
var target = Option.none();
|
| 7563 |
+
var delegate = Mutation();
|
| 7564 |
+
delegate.events.drag.bind(function (event) {
|
| 7565 |
+
target.each(function (t) {
|
| 7566 |
+
events.trigger.drag(event.xDelta(), event.yDelta(), t);
|
| 7567 |
+
});
|
| 7568 |
+
});
|
| 7569 |
+
var assign = function (t) {
|
| 7570 |
+
target = Option.some(t);
|
| 7571 |
+
};
|
| 7572 |
+
var get = function () {
|
| 7573 |
+
return target;
|
| 7574 |
+
};
|
| 7575 |
+
return {
|
| 7576 |
+
assign: assign,
|
| 7577 |
+
get: get,
|
| 7578 |
+
mutate: delegate.mutate,
|
| 7579 |
+
events: events.registry
|
| 7580 |
+
};
|
| 7581 |
+
}
|
| 7582 |
+
|
| 7583 |
+
var any = function (selector) {
|
| 7584 |
+
return $_8wdrbmlajfuw8q9m.first(selector).isSome();
|
| 7585 |
+
};
|
| 7586 |
+
var ancestor$2 = function (scope, selector, isRoot) {
|
| 7587 |
+
return $_8wdrbmlajfuw8q9m.ancestor(scope, selector, isRoot).isSome();
|
| 7588 |
+
};
|
| 7589 |
+
var sibling$2 = function (scope, selector) {
|
| 7590 |
+
return $_8wdrbmlajfuw8q9m.sibling(scope, selector).isSome();
|
| 7591 |
+
};
|
| 7592 |
+
var child$3 = function (scope, selector) {
|
| 7593 |
+
return $_8wdrbmlajfuw8q9m.child(scope, selector).isSome();
|
| 7594 |
+
};
|
| 7595 |
+
var descendant$2 = function (scope, selector) {
|
| 7596 |
+
return $_8wdrbmlajfuw8q9m.descendant(scope, selector).isSome();
|
| 7597 |
+
};
|
| 7598 |
+
var closest$2 = function (scope, selector, isRoot) {
|
| 7599 |
+
return $_8wdrbmlajfuw8q9m.closest(scope, selector, isRoot).isSome();
|
| 7600 |
+
};
|
| 7601 |
+
var $_44mfk0opjfuw8qze = {
|
| 7602 |
+
any: any,
|
| 7603 |
+
ancestor: ancestor$2,
|
| 7604 |
+
sibling: sibling$2,
|
| 7605 |
+
child: child$3,
|
| 7606 |
+
descendant: descendant$2,
|
| 7607 |
+
closest: closest$2
|
| 7608 |
+
};
|
| 7609 |
+
|
| 7610 |
+
var resizeBarDragging = $_f6r94sn4jfuw8qoq.resolve('resizer-bar-dragging');
|
| 7611 |
+
function BarManager (wire, direction, hdirection) {
|
| 7612 |
+
var mutation = BarMutation();
|
| 7613 |
+
var resizing = $_a1giepobjfuw8qx7.transform(mutation, {});
|
| 7614 |
+
var hoverTable = Option.none();
|
| 7615 |
+
var getResizer = function (element, type) {
|
| 7616 |
+
return Option.from($_3q82t2l5jfuw8q93.get(element, type));
|
| 7617 |
+
};
|
| 7618 |
+
mutation.events.drag.bind(function (event) {
|
| 7619 |
+
getResizer(event.target(), 'data-row').each(function (_dataRow) {
|
| 7620 |
+
var currentRow = $_63qtcvnkjfuw8qqu.getInt(event.target(), 'top');
|
| 7621 |
+
$_bfod2hlejfuw8qac.set(event.target(), 'top', currentRow + event.yDelta() + 'px');
|
| 7622 |
+
});
|
| 7623 |
+
getResizer(event.target(), 'data-column').each(function (_dataCol) {
|
| 7624 |
+
var currentCol = $_63qtcvnkjfuw8qqu.getInt(event.target(), 'left');
|
| 7625 |
+
$_bfod2hlejfuw8qac.set(event.target(), 'left', currentCol + event.xDelta() + 'px');
|
| 7626 |
+
});
|
| 7627 |
+
});
|
| 7628 |
+
var getDelta = function (target, direction) {
|
| 7629 |
+
var newX = $_63qtcvnkjfuw8qqu.getInt(target, direction);
|
| 7630 |
+
var oldX = parseInt($_3q82t2l5jfuw8q93.get(target, 'data-initial-' + direction), 10);
|
| 7631 |
+
return newX - oldX;
|
| 7632 |
+
};
|
| 7633 |
+
resizing.events.stop.bind(function () {
|
| 7634 |
+
mutation.get().each(function (target) {
|
| 7635 |
+
hoverTable.each(function (table) {
|
| 7636 |
+
getResizer(target, 'data-row').each(function (row) {
|
| 7637 |
+
var delta = getDelta(target, 'top');
|
| 7638 |
+
$_3q82t2l5jfuw8q93.remove(target, 'data-initial-top');
|
| 7639 |
+
events.trigger.adjustHeight(table, delta, parseInt(row, 10));
|
| 7640 |
+
});
|
| 7641 |
+
getResizer(target, 'data-column').each(function (column) {
|
| 7642 |
+
var delta = getDelta(target, 'left');
|
| 7643 |
+
$_3q82t2l5jfuw8q93.remove(target, 'data-initial-left');
|
| 7644 |
+
events.trigger.adjustWidth(table, delta, parseInt(column, 10));
|
| 7645 |
+
});
|
| 7646 |
+
$_jc1w5n0jfuw8qng.refresh(wire, table, hdirection, direction);
|
| 7647 |
+
});
|
| 7648 |
+
});
|
| 7649 |
+
});
|
| 7650 |
+
var handler = function (target, direction) {
|
| 7651 |
+
events.trigger.startAdjust();
|
| 7652 |
+
mutation.assign(target);
|
| 7653 |
+
$_3q82t2l5jfuw8q93.set(target, 'data-initial-' + direction, parseInt($_bfod2hlejfuw8qac.get(target, direction), 10));
|
| 7654 |
+
$_fmcseon6jfuw8qou.add(target, resizeBarDragging);
|
| 7655 |
+
$_bfod2hlejfuw8qac.set(target, 'opacity', '0.2');
|
| 7656 |
+
resizing.go(wire.parent());
|
| 7657 |
+
};
|
| 7658 |
+
var mousedown = $_6fxiitogjfuw8qy3.bind(wire.parent(), 'mousedown', function (event) {
|
| 7659 |
+
if ($_jc1w5n0jfuw8qng.isRowBar(event.target()))
|
| 7660 |
+
handler(event.target(), 'top');
|
| 7661 |
+
if ($_jc1w5n0jfuw8qng.isColBar(event.target()))
|
| 7662 |
+
handler(event.target(), 'left');
|
| 7663 |
+
});
|
| 7664 |
+
var isRoot = function (e) {
|
| 7665 |
+
return $_e8rn66kojfuw8q7n.eq(e, wire.view());
|
| 7666 |
+
};
|
| 7667 |
+
var mouseover = $_6fxiitogjfuw8qy3.bind(wire.view(), 'mouseover', function (event) {
|
| 7668 |
+
if ($_a8gk30l6jfuw8q9c.name(event.target()) === 'table' || $_44mfk0opjfuw8qze.closest(event.target(), 'table', isRoot)) {
|
| 7669 |
+
hoverTable = $_a8gk30l6jfuw8q9c.name(event.target()) === 'table' ? Option.some(event.target()) : $_8wdrbmlajfuw8q9m.ancestor(event.target(), 'table', isRoot);
|
| 7670 |
+
hoverTable.each(function (ht) {
|
| 7671 |
+
$_jc1w5n0jfuw8qng.refresh(wire, ht, hdirection, direction);
|
| 7672 |
+
});
|
| 7673 |
+
} else if ($_atd1tul9jfuw8q9i.inBody(event.target())) {
|
| 7674 |
+
$_jc1w5n0jfuw8qng.destroy(wire);
|
| 7675 |
+
}
|
| 7676 |
+
});
|
| 7677 |
+
var destroy = function () {
|
| 7678 |
+
mousedown.unbind();
|
| 7679 |
+
mouseover.unbind();
|
| 7680 |
+
resizing.destroy();
|
| 7681 |
+
$_jc1w5n0jfuw8qng.destroy(wire);
|
| 7682 |
+
};
|
| 7683 |
+
var refresh = function (tbl) {
|
| 7684 |
+
$_jc1w5n0jfuw8qng.refresh(wire, tbl, hdirection, direction);
|
| 7685 |
+
};
|
| 7686 |
+
var events = $_1fbhhho9jfuw8qw4.create({
|
| 7687 |
+
adjustHeight: Event([
|
| 7688 |
+
'table',
|
| 7689 |
+
'delta',
|
| 7690 |
+
'row'
|
| 7691 |
+
]),
|
| 7692 |
+
adjustWidth: Event([
|
| 7693 |
+
'table',
|
| 7694 |
+
'delta',
|
| 7695 |
+
'column'
|
| 7696 |
+
]),
|
| 7697 |
+
startAdjust: Event([])
|
| 7698 |
+
});
|
| 7699 |
+
return {
|
| 7700 |
+
destroy: destroy,
|
| 7701 |
+
refresh: refresh,
|
| 7702 |
+
on: resizing.on,
|
| 7703 |
+
off: resizing.off,
|
| 7704 |
+
hideBars: $_20nfr6k7jfuw8q4g.curry($_jc1w5n0jfuw8qng.hide, wire),
|
| 7705 |
+
showBars: $_20nfr6k7jfuw8q4g.curry($_jc1w5n0jfuw8qng.show, wire),
|
| 7706 |
+
events: events.registry
|
| 7707 |
+
};
|
| 7708 |
+
}
|
| 7709 |
+
|
| 7710 |
+
function TableResize (wire, vdirection) {
|
| 7711 |
+
var hdirection = $_16z2iamhjfuw8qir.height;
|
| 7712 |
+
var manager = BarManager(wire, vdirection, hdirection);
|
| 7713 |
+
var events = $_1fbhhho9jfuw8qw4.create({
|
| 7714 |
+
beforeResize: Event(['table']),
|
| 7715 |
+
afterResize: Event(['table']),
|
| 7716 |
+
startDrag: Event([])
|
| 7717 |
+
});
|
| 7718 |
+
manager.events.adjustHeight.bind(function (event) {
|
| 7719 |
+
events.trigger.beforeResize(event.table());
|
| 7720 |
+
var delta = hdirection.delta(event.delta(), event.table());
|
| 7721 |
+
$_cwciisngjfuw8qq6.adjustHeight(event.table(), delta, event.row(), hdirection);
|
| 7722 |
+
events.trigger.afterResize(event.table());
|
| 7723 |
+
});
|
| 7724 |
+
manager.events.startAdjust.bind(function (event) {
|
| 7725 |
+
events.trigger.startDrag();
|
| 7726 |
+
});
|
| 7727 |
+
manager.events.adjustWidth.bind(function (event) {
|
| 7728 |
+
events.trigger.beforeResize(event.table());
|
| 7729 |
+
var delta = vdirection.delta(event.delta(), event.table());
|
| 7730 |
+
$_cwciisngjfuw8qq6.adjustWidth(event.table(), delta, event.column(), vdirection);
|
| 7731 |
+
events.trigger.afterResize(event.table());
|
| 7732 |
+
});
|
| 7733 |
+
return {
|
| 7734 |
+
on: manager.on,
|
| 7735 |
+
off: manager.off,
|
| 7736 |
+
hideBars: manager.hideBars,
|
| 7737 |
+
showBars: manager.showBars,
|
| 7738 |
+
destroy: manager.destroy,
|
| 7739 |
+
events: events.registry
|
| 7740 |
+
};
|
| 7741 |
+
}
|
| 7742 |
+
|
| 7743 |
+
var createContainer = function () {
|
| 7744 |
+
var container = $_xbeoqkkjfuw8q73.fromTag('div');
|
| 7745 |
+
$_bfod2hlejfuw8qac.setAll(container, {
|
| 7746 |
+
position: 'static',
|
| 7747 |
+
height: '0',
|
| 7748 |
+
width: '0',
|
| 7749 |
+
padding: '0',
|
| 7750 |
+
margin: '0',
|
| 7751 |
+
border: '0'
|
| 7752 |
+
});
|
| 7753 |
+
$_fatuxylgjfuw8qav.append($_atd1tul9jfuw8q9i.body(), container);
|
| 7754 |
+
return container;
|
| 7755 |
+
};
|
| 7756 |
+
var get$8 = function (editor, container) {
|
| 7757 |
+
return editor.inline ? $_e4gwgeo6jfuw8qvi.body($_5xkhf2nnjfuw8qrq.getBody(editor), createContainer()) : $_e4gwgeo6jfuw8qvi.only($_xbeoqkkjfuw8q73.fromDom(editor.getDoc()));
|
| 7758 |
+
};
|
| 7759 |
+
var remove$6 = function (editor, wire) {
|
| 7760 |
+
if (editor.inline) {
|
| 7761 |
+
$_fl1deelhjfuw8qax.remove(wire.parent());
|
| 7762 |
+
}
|
| 7763 |
+
};
|
| 7764 |
+
var $_fdmzdaoqjfuw8qzh = {
|
| 7765 |
+
get: get$8,
|
| 7766 |
+
remove: remove$6
|
| 7767 |
+
};
|
| 7768 |
+
|
| 7769 |
+
var ResizeHandler = function (editor) {
|
| 7770 |
+
var selectionRng = Option.none();
|
| 7771 |
+
var resize = Option.none();
|
| 7772 |
+
var wire = Option.none();
|
| 7773 |
+
var percentageBasedSizeRegex = /(\d+(\.\d+)?)%/;
|
| 7774 |
+
var startW, startRawW;
|
| 7775 |
+
var isTable = function (elm) {
|
| 7776 |
+
return elm.nodeName === 'TABLE';
|
| 7777 |
+
};
|
| 7778 |
+
var getRawWidth = function (elm) {
|
| 7779 |
+
return editor.dom.getStyle(elm, 'width') || editor.dom.getAttrib(elm, 'width');
|
| 7780 |
+
};
|
| 7781 |
+
var lazyResize = function () {
|
| 7782 |
+
return resize;
|
| 7783 |
+
};
|
| 7784 |
+
var lazyWire = function () {
|
| 7785 |
+
return wire.getOr($_e4gwgeo6jfuw8qvi.only($_xbeoqkkjfuw8q73.fromDom(editor.getBody())));
|
| 7786 |
+
};
|
| 7787 |
+
var destroy = function () {
|
| 7788 |
+
resize.each(function (sz) {
|
| 7789 |
+
sz.destroy();
|
| 7790 |
+
});
|
| 7791 |
+
wire.each(function (w) {
|
| 7792 |
+
$_fdmzdaoqjfuw8qzh.remove(editor, w);
|
| 7793 |
+
});
|
| 7794 |
+
};
|
| 7795 |
+
editor.on('init', function () {
|
| 7796 |
+
var direction = TableDirection($_4xd1udnojfuw8qrw.directionAt);
|
| 7797 |
+
var rawWire = $_fdmzdaoqjfuw8qzh.get(editor);
|
| 7798 |
+
wire = Option.some(rawWire);
|
| 7799 |
+
if (hasObjectResizing(editor) && hasTableResizeBars(editor)) {
|
| 7800 |
+
var sz = TableResize(rawWire, direction);
|
| 7801 |
+
sz.on();
|
| 7802 |
+
sz.events.startDrag.bind(function (event) {
|
| 7803 |
+
selectionRng = Option.some(editor.selection.getRng());
|
| 7804 |
+
});
|
| 7805 |
+
sz.events.afterResize.bind(function (event) {
|
| 7806 |
+
var table = event.table();
|
| 7807 |
+
var dataStyleCells = $_6c9d0hl7jfuw8q9d.descendants(table, 'td[data-mce-style],th[data-mce-style]');
|
| 7808 |
+
$_tyr3yk5jfuw8q47.each(dataStyleCells, function (cell) {
|
| 7809 |
+
$_3q82t2l5jfuw8q93.remove(cell, 'data-mce-style');
|
| 7810 |
+
});
|
| 7811 |
+
selectionRng.each(function (rng) {
|
| 7812 |
+
editor.selection.setRng(rng);
|
| 7813 |
+
editor.focus();
|
| 7814 |
+
});
|
| 7815 |
+
editor.undoManager.add();
|
| 7816 |
+
});
|
| 7817 |
+
resize = Option.some(sz);
|
| 7818 |
+
}
|
| 7819 |
+
});
|
| 7820 |
+
editor.on('ObjectResizeStart', function (e) {
|
| 7821 |
+
var targetElm = e.target;
|
| 7822 |
+
if (isTable(targetElm)) {
|
| 7823 |
+
startW = e.width;
|
| 7824 |
+
startRawW = getRawWidth(targetElm);
|
| 7825 |
+
}
|
| 7826 |
+
});
|
| 7827 |
+
editor.on('ObjectResized', function (e) {
|
| 7828 |
+
var targetElm = e.target;
|
| 7829 |
+
if (isTable(targetElm)) {
|
| 7830 |
+
var table = targetElm;
|
| 7831 |
+
if (percentageBasedSizeRegex.test(startRawW)) {
|
| 7832 |
+
var percentW = parseFloat(percentageBasedSizeRegex.exec(startRawW)[1]);
|
| 7833 |
+
var targetPercentW = e.width * percentW / startW;
|
| 7834 |
+
editor.dom.setStyle(table, 'width', targetPercentW + '%');
|
| 7835 |
+
} else {
|
| 7836 |
+
var newCellSizes_1 = [];
|
| 7837 |
+
global$2.each(table.rows, function (row) {
|
| 7838 |
+
global$2.each(row.cells, function (cell) {
|
| 7839 |
+
var width = editor.dom.getStyle(cell, 'width', true);
|
| 7840 |
+
newCellSizes_1.push({
|
| 7841 |
+
cell: cell,
|
| 7842 |
+
width: width
|
| 7843 |
+
});
|
| 7844 |
+
});
|
| 7845 |
+
});
|
| 7846 |
+
global$2.each(newCellSizes_1, function (newCellSize) {
|
| 7847 |
+
editor.dom.setStyle(newCellSize.cell, 'width', newCellSize.width);
|
| 7848 |
+
editor.dom.setAttrib(newCellSize.cell, 'width', null);
|
| 7849 |
+
});
|
| 7850 |
+
}
|
| 7851 |
+
}
|
| 7852 |
+
});
|
| 7853 |
+
return {
|
| 7854 |
+
lazyResize: lazyResize,
|
| 7855 |
+
lazyWire: lazyWire,
|
| 7856 |
+
destroy: destroy
|
| 7857 |
+
};
|
| 7858 |
+
};
|
| 7859 |
+
|
| 7860 |
+
var none$2 = function (current) {
|
| 7861 |
+
return folder$1(function (n, f, m, l) {
|
| 7862 |
+
return n(current);
|
| 7863 |
+
});
|
| 7864 |
+
};
|
| 7865 |
+
var first$5 = function (current) {
|
| 7866 |
+
return folder$1(function (n, f, m, l) {
|
| 7867 |
+
return f(current);
|
| 7868 |
+
});
|
| 7869 |
+
};
|
| 7870 |
+
var middle$1 = function (current, target) {
|
| 7871 |
+
return folder$1(function (n, f, m, l) {
|
| 7872 |
+
return m(current, target);
|
| 7873 |
+
});
|
| 7874 |
+
};
|
| 7875 |
+
var last$4 = function (current) {
|
| 7876 |
+
return folder$1(function (n, f, m, l) {
|
| 7877 |
+
return l(current);
|
| 7878 |
+
});
|
| 7879 |
+
};
|
| 7880 |
+
var folder$1 = function (fold) {
|
| 7881 |
+
return { fold: fold };
|
| 7882 |
+
};
|
| 7883 |
+
var $_wsunjotjfuw8r0k = {
|
| 7884 |
+
none: none$2,
|
| 7885 |
+
first: first$5,
|
| 7886 |
+
middle: middle$1,
|
| 7887 |
+
last: last$4
|
| 7888 |
+
};
|
| 7889 |
+
|
| 7890 |
+
var detect$4 = function (current, isRoot) {
|
| 7891 |
+
return $_aqhz9okhjfuw8q5y.table(current, isRoot).bind(function (table) {
|
| 7892 |
+
var all = $_aqhz9okhjfuw8q5y.cells(table);
|
| 7893 |
+
var index = $_tyr3yk5jfuw8q47.findIndex(all, function (x) {
|
| 7894 |
+
return $_e8rn66kojfuw8q7n.eq(current, x);
|
| 7895 |
+
});
|
| 7896 |
+
return index.map(function (ind) {
|
| 7897 |
+
return {
|
| 7898 |
+
index: $_20nfr6k7jfuw8q4g.constant(ind),
|
| 7899 |
+
all: $_20nfr6k7jfuw8q4g.constant(all)
|
| 7900 |
+
};
|
| 7901 |
+
});
|
| 7902 |
+
});
|
| 7903 |
+
};
|
| 7904 |
+
var next = function (current, isRoot) {
|
| 7905 |
+
var detection = detect$4(current, isRoot);
|
| 7906 |
+
return detection.fold(function () {
|
| 7907 |
+
return $_wsunjotjfuw8r0k.none(current);
|
| 7908 |
+
}, function (info) {
|
| 7909 |
+
return info.index() + 1 < info.all().length ? $_wsunjotjfuw8r0k.middle(current, info.all()[info.index() + 1]) : $_wsunjotjfuw8r0k.last(current);
|
| 7910 |
+
});
|
| 7911 |
+
};
|
| 7912 |
+
var prev = function (current, isRoot) {
|
| 7913 |
+
var detection = detect$4(current, isRoot);
|
| 7914 |
+
return detection.fold(function () {
|
| 7915 |
+
return $_wsunjotjfuw8r0k.none();
|
| 7916 |
+
}, function (info) {
|
| 7917 |
+
return info.index() - 1 >= 0 ? $_wsunjotjfuw8r0k.middle(current, info.all()[info.index() - 1]) : $_wsunjotjfuw8r0k.first(current);
|
| 7918 |
+
});
|
| 7919 |
+
};
|
| 7920 |
+
var $_947ovkosjfuw8r0c = {
|
| 7921 |
+
next: next,
|
| 7922 |
+
prev: prev
|
| 7923 |
+
};
|
| 7924 |
+
|
| 7925 |
+
var adt = $_7sbzam7jfuw8qgu.generate([
|
| 7926 |
+
{ 'before': ['element'] },
|
| 7927 |
+
{
|
| 7928 |
+
'on': [
|
| 7929 |
+
'element',
|
| 7930 |
+
'offset'
|
| 7931 |
+
]
|
| 7932 |
+
},
|
| 7933 |
+
{ after: ['element'] }
|
| 7934 |
+
]);
|
| 7935 |
+
var cata$1 = function (subject, onBefore, onOn, onAfter) {
|
| 7936 |
+
return subject.fold(onBefore, onOn, onAfter);
|
| 7937 |
+
};
|
| 7938 |
+
var getStart = function (situ) {
|
| 7939 |
+
return situ.fold($_20nfr6k7jfuw8q4g.identity, $_20nfr6k7jfuw8q4g.identity, $_20nfr6k7jfuw8q4g.identity);
|
| 7940 |
+
};
|
| 7941 |
+
var $_cuk0n0ovjfuw8r0r = {
|
| 7942 |
+
before: adt.before,
|
| 7943 |
+
on: adt.on,
|
| 7944 |
+
after: adt.after,
|
| 7945 |
+
cata: cata$1,
|
| 7946 |
+
getStart: getStart
|
| 7947 |
+
};
|
| 7948 |
+
|
| 7949 |
+
var type$2 = $_7sbzam7jfuw8qgu.generate([
|
| 7950 |
+
{ domRange: ['rng'] },
|
| 7951 |
+
{
|
| 7952 |
+
relative: [
|
| 7953 |
+
'startSitu',
|
| 7954 |
+
'finishSitu'
|
| 7955 |
+
]
|
| 7956 |
+
},
|
| 7957 |
+
{
|
| 7958 |
+
exact: [
|
| 7959 |
+
'start',
|
| 7960 |
+
'soffset',
|
| 7961 |
+
'finish',
|
| 7962 |
+
'foffset'
|
| 7963 |
+
]
|
| 7964 |
+
}
|
| 7965 |
+
]);
|
| 7966 |
+
var range$2 = $_5now9kbjfuw8q5e.immutable('start', 'soffset', 'finish', 'foffset');
|
| 7967 |
+
var exactFromRange = function (simRange) {
|
| 7968 |
+
return type$2.exact(simRange.start(), simRange.soffset(), simRange.finish(), simRange.foffset());
|
| 7969 |
+
};
|
| 7970 |
+
var getStart$1 = function (selection) {
|
| 7971 |
+
return selection.match({
|
| 7972 |
+
domRange: function (rng) {
|
| 7973 |
+
return $_xbeoqkkjfuw8q73.fromDom(rng.startContainer);
|
| 7974 |
+
},
|
| 7975 |
+
relative: function (startSitu, finishSitu) {
|
| 7976 |
+
return $_cuk0n0ovjfuw8r0r.getStart(startSitu);
|
| 7977 |
+
},
|
| 7978 |
+
exact: function (start, soffset, finish, foffset) {
|
| 7979 |
+
return start;
|
| 7980 |
+
}
|
| 7981 |
+
});
|
| 7982 |
+
};
|
| 7983 |
+
var getWin = function (selection) {
|
| 7984 |
+
var start = getStart$1(selection);
|
| 7985 |
+
return $_s8scrkmjfuw8q7a.defaultView(start);
|
| 7986 |
+
};
|
| 7987 |
+
var $_bv1jwpoujfuw8r0m = {
|
| 7988 |
+
domRange: type$2.domRange,
|
| 7989 |
+
relative: type$2.relative,
|
| 7990 |
+
exact: type$2.exact,
|
| 7991 |
+
exactFromRange: exactFromRange,
|
| 7992 |
+
range: range$2,
|
| 7993 |
+
getWin: getWin
|
| 7994 |
+
};
|
| 7995 |
+
|
| 7996 |
+
var makeRange = function (start, soffset, finish, foffset) {
|
| 7997 |
+
var doc = $_s8scrkmjfuw8q7a.owner(start);
|
| 7998 |
+
var rng = doc.dom().createRange();
|
| 7999 |
+
rng.setStart(start.dom(), soffset);
|
| 8000 |
+
rng.setEnd(finish.dom(), foffset);
|
| 8001 |
+
return rng;
|
| 8002 |
+
};
|
| 8003 |
+
var commonAncestorContainer = function (start, soffset, finish, foffset) {
|
| 8004 |
+
var r = makeRange(start, soffset, finish, foffset);
|
| 8005 |
+
return $_xbeoqkkjfuw8q73.fromDom(r.commonAncestorContainer);
|
| 8006 |
+
};
|
| 8007 |
+
var after$2 = function (start, soffset, finish, foffset) {
|
| 8008 |
+
var r = makeRange(start, soffset, finish, foffset);
|
| 8009 |
+
var same = $_e8rn66kojfuw8q7n.eq(start, finish) && soffset === foffset;
|
| 8010 |
+
return r.collapsed && !same;
|
| 8011 |
+
};
|
| 8012 |
+
var $_5xef0moxjfuw8r17 = {
|
| 8013 |
+
after: after$2,
|
| 8014 |
+
commonAncestorContainer: commonAncestorContainer
|
| 8015 |
+
};
|
| 8016 |
+
|
| 8017 |
+
var fromElements = function (elements, scope) {
|
| 8018 |
+
var doc = scope || document;
|
| 8019 |
+
var fragment = doc.createDocumentFragment();
|
| 8020 |
+
$_tyr3yk5jfuw8q47.each(elements, function (element) {
|
| 8021 |
+
fragment.appendChild(element.dom());
|
| 8022 |
+
});
|
| 8023 |
+
return $_xbeoqkkjfuw8q73.fromDom(fragment);
|
| 8024 |
+
};
|
| 8025 |
+
var $_8a834noyjfuw8r19 = { fromElements: fromElements };
|
| 8026 |
+
|
| 8027 |
+
var selectNodeContents = function (win, element) {
|
| 8028 |
+
var rng = win.document.createRange();
|
| 8029 |
+
selectNodeContentsUsing(rng, element);
|
| 8030 |
+
return rng;
|
| 8031 |
+
};
|
| 8032 |
+
var selectNodeContentsUsing = function (rng, element) {
|
| 8033 |
+
rng.selectNodeContents(element.dom());
|
| 8034 |
+
};
|
| 8035 |
+
var isWithin$1 = function (outerRange, innerRange) {
|
| 8036 |
+
return innerRange.compareBoundaryPoints(outerRange.END_TO_START, outerRange) < 1 && innerRange.compareBoundaryPoints(outerRange.START_TO_END, outerRange) > -1;
|
| 8037 |
+
};
|
| 8038 |
+
var create$1 = function (win) {
|
| 8039 |
+
return win.document.createRange();
|
| 8040 |
+
};
|
| 8041 |
+
var setStart = function (rng, situ) {
|
| 8042 |
+
situ.fold(function (e) {
|
| 8043 |
+
rng.setStartBefore(e.dom());
|
| 8044 |
+
}, function (e, o) {
|
| 8045 |
+
rng.setStart(e.dom(), o);
|
| 8046 |
+
}, function (e) {
|
| 8047 |
+
rng.setStartAfter(e.dom());
|
| 8048 |
+
});
|
| 8049 |
+
};
|
| 8050 |
+
var setFinish = function (rng, situ) {
|
| 8051 |
+
situ.fold(function (e) {
|
| 8052 |
+
rng.setEndBefore(e.dom());
|
| 8053 |
+
}, function (e, o) {
|
| 8054 |
+
rng.setEnd(e.dom(), o);
|
| 8055 |
+
}, function (e) {
|
| 8056 |
+
rng.setEndAfter(e.dom());
|
| 8057 |
+
});
|
| 8058 |
+
};
|
| 8059 |
+
var replaceWith = function (rng, fragment) {
|
| 8060 |
+
deleteContents(rng);
|
| 8061 |
+
rng.insertNode(fragment.dom());
|
| 8062 |
+
};
|
| 8063 |
+
var relativeToNative = function (win, startSitu, finishSitu) {
|
| 8064 |
+
var range = win.document.createRange();
|
| 8065 |
+
setStart(range, startSitu);
|
| 8066 |
+
setFinish(range, finishSitu);
|
| 8067 |
+
return range;
|
| 8068 |
+
};
|
| 8069 |
+
var exactToNative = function (win, start, soffset, finish, foffset) {
|
| 8070 |
+
var rng = win.document.createRange();
|
| 8071 |
+
rng.setStart(start.dom(), soffset);
|
| 8072 |
+
rng.setEnd(finish.dom(), foffset);
|
| 8073 |
+
return rng;
|
| 8074 |
+
};
|
| 8075 |
+
var deleteContents = function (rng) {
|
| 8076 |
+
rng.deleteContents();
|
| 8077 |
+
};
|
| 8078 |
+
var cloneFragment = function (rng) {
|
| 8079 |
+
var fragment = rng.cloneContents();
|
| 8080 |
+
return $_xbeoqkkjfuw8q73.fromDom(fragment);
|
| 8081 |
+
};
|
| 8082 |
+
var toRect = function (rect) {
|
| 8083 |
+
return {
|
| 8084 |
+
left: $_20nfr6k7jfuw8q4g.constant(rect.left),
|
| 8085 |
+
top: $_20nfr6k7jfuw8q4g.constant(rect.top),
|
| 8086 |
+
right: $_20nfr6k7jfuw8q4g.constant(rect.right),
|
| 8087 |
+
bottom: $_20nfr6k7jfuw8q4g.constant(rect.bottom),
|
| 8088 |
+
width: $_20nfr6k7jfuw8q4g.constant(rect.width),
|
| 8089 |
+
height: $_20nfr6k7jfuw8q4g.constant(rect.height)
|
| 8090 |
+
};
|
| 8091 |
+
};
|
| 8092 |
+
var getFirstRect = function (rng) {
|
| 8093 |
+
var rects = rng.getClientRects();
|
| 8094 |
+
var rect = rects.length > 0 ? rects[0] : rng.getBoundingClientRect();
|
| 8095 |
+
return rect.width > 0 || rect.height > 0 ? Option.some(rect).map(toRect) : Option.none();
|
| 8096 |
+
};
|
| 8097 |
+
var getBounds$1 = function (rng) {
|
| 8098 |
+
var rect = rng.getBoundingClientRect();
|
| 8099 |
+
return rect.width > 0 || rect.height > 0 ? Option.some(rect).map(toRect) : Option.none();
|
| 8100 |
+
};
|
| 8101 |
+
var toString = function (rng) {
|
| 8102 |
+
return rng.toString();
|
| 8103 |
+
};
|
| 8104 |
+
var $_dkhwcmozjfuw8r1d = {
|
| 8105 |
+
create: create$1,
|
| 8106 |
+
replaceWith: replaceWith,
|
| 8107 |
+
selectNodeContents: selectNodeContents,
|
| 8108 |
+
selectNodeContentsUsing: selectNodeContentsUsing,
|
| 8109 |
+
relativeToNative: relativeToNative,
|
| 8110 |
+
exactToNative: exactToNative,
|
| 8111 |
+
deleteContents: deleteContents,
|
| 8112 |
+
cloneFragment: cloneFragment,
|
| 8113 |
+
getFirstRect: getFirstRect,
|
| 8114 |
+
getBounds: getBounds$1,
|
| 8115 |
+
isWithin: isWithin$1,
|
| 8116 |
+
toString: toString
|
| 8117 |
+
};
|
| 8118 |
+
|
| 8119 |
+
var adt$1 = $_7sbzam7jfuw8qgu.generate([
|
| 8120 |
+
{
|
| 8121 |
+
ltr: [
|
| 8122 |
+
'start',
|
| 8123 |
+
'soffset',
|
| 8124 |
+
'finish',
|
| 8125 |
+
'foffset'
|
| 8126 |
+
]
|
| 8127 |
+
},
|
| 8128 |
+
{
|
| 8129 |
+
rtl: [
|
| 8130 |
+
'start',
|
| 8131 |
+
'soffset',
|
| 8132 |
+
'finish',
|
| 8133 |
+
'foffset'
|
| 8134 |
+
]
|
| 8135 |
+
}
|
| 8136 |
+
]);
|
| 8137 |
+
var fromRange = function (win, type, range) {
|
| 8138 |
+
return type($_xbeoqkkjfuw8q73.fromDom(range.startContainer), range.startOffset, $_xbeoqkkjfuw8q73.fromDom(range.endContainer), range.endOffset);
|
| 8139 |
+
};
|
| 8140 |
+
var getRanges = function (win, selection) {
|
| 8141 |
+
return selection.match({
|
| 8142 |
+
domRange: function (rng) {
|
| 8143 |
+
return {
|
| 8144 |
+
ltr: $_20nfr6k7jfuw8q4g.constant(rng),
|
| 8145 |
+
rtl: Option.none
|
| 8146 |
+
};
|
| 8147 |
+
},
|
| 8148 |
+
relative: function (startSitu, finishSitu) {
|
| 8149 |
+
return {
|
| 8150 |
+
ltr: $_cfqymdkujfuw8q85.cached(function () {
|
| 8151 |
+
return $_dkhwcmozjfuw8r1d.relativeToNative(win, startSitu, finishSitu);
|
| 8152 |
+
}),
|
| 8153 |
+
rtl: $_cfqymdkujfuw8q85.cached(function () {
|
| 8154 |
+
return Option.some($_dkhwcmozjfuw8r1d.relativeToNative(win, finishSitu, startSitu));
|
| 8155 |
+
})
|
| 8156 |
+
};
|
| 8157 |
+
},
|
| 8158 |
+
exact: function (start, soffset, finish, foffset) {
|
| 8159 |
+
return {
|
| 8160 |
+
ltr: $_cfqymdkujfuw8q85.cached(function () {
|
| 8161 |
+
return $_dkhwcmozjfuw8r1d.exactToNative(win, start, soffset, finish, foffset);
|
| 8162 |
+
}),
|
| 8163 |
+
rtl: $_cfqymdkujfuw8q85.cached(function () {
|
| 8164 |
+
return Option.some($_dkhwcmozjfuw8r1d.exactToNative(win, finish, foffset, start, soffset));
|
| 8165 |
+
})
|
| 8166 |
+
};
|
| 8167 |
+
}
|
| 8168 |
+
});
|
| 8169 |
+
};
|
| 8170 |
+
var doDiagnose = function (win, ranges) {
|
| 8171 |
+
var rng = ranges.ltr();
|
| 8172 |
+
if (rng.collapsed) {
|
| 8173 |
+
var reversed = ranges.rtl().filter(function (rev) {
|
| 8174 |
+
return rev.collapsed === false;
|
| 8175 |
+
});
|
| 8176 |
+
return reversed.map(function (rev) {
|
| 8177 |
+
return adt$1.rtl($_xbeoqkkjfuw8q73.fromDom(rev.endContainer), rev.endOffset, $_xbeoqkkjfuw8q73.fromDom(rev.startContainer), rev.startOffset);
|
| 8178 |
+
}).getOrThunk(function () {
|
| 8179 |
+
return fromRange(win, adt$1.ltr, rng);
|
| 8180 |
+
});
|
| 8181 |
+
} else {
|
| 8182 |
+
return fromRange(win, adt$1.ltr, rng);
|
| 8183 |
+
}
|
| 8184 |
+
};
|
| 8185 |
+
var diagnose = function (win, selection) {
|
| 8186 |
+
var ranges = getRanges(win, selection);
|
| 8187 |
+
return doDiagnose(win, ranges);
|
| 8188 |
+
};
|
| 8189 |
+
var asLtrRange = function (win, selection) {
|
| 8190 |
+
var diagnosis = diagnose(win, selection);
|
| 8191 |
+
return diagnosis.match({
|
| 8192 |
+
ltr: function (start, soffset, finish, foffset) {
|
| 8193 |
+
var rng = win.document.createRange();
|
| 8194 |
+
rng.setStart(start.dom(), soffset);
|
| 8195 |
+
rng.setEnd(finish.dom(), foffset);
|
| 8196 |
+
return rng;
|
| 8197 |
+
},
|
| 8198 |
+
rtl: function (start, soffset, finish, foffset) {
|
| 8199 |
+
var rng = win.document.createRange();
|
| 8200 |
+
rng.setStart(finish.dom(), foffset);
|
| 8201 |
+
rng.setEnd(start.dom(), soffset);
|
| 8202 |
+
return rng;
|
| 8203 |
+
}
|
| 8204 |
+
});
|
| 8205 |
+
};
|
| 8206 |
+
var $_c9xxrpp0jfuw8r1k = {
|
| 8207 |
+
ltr: adt$1.ltr,
|
| 8208 |
+
rtl: adt$1.rtl,
|
| 8209 |
+
diagnose: diagnose,
|
| 8210 |
+
asLtrRange: asLtrRange
|
| 8211 |
+
};
|
| 8212 |
+
|
| 8213 |
+
var searchForPoint = function (rectForOffset, x, y, maxX, length) {
|
| 8214 |
+
if (length === 0)
|
| 8215 |
+
return 0;
|
| 8216 |
+
else if (x === maxX)
|
| 8217 |
+
return length - 1;
|
| 8218 |
+
var xDelta = maxX;
|
| 8219 |
+
for (var i = 1; i < length; i++) {
|
| 8220 |
+
var rect = rectForOffset(i);
|
| 8221 |
+
var curDeltaX = Math.abs(x - rect.left);
|
| 8222 |
+
if (y > rect.bottom) {
|
| 8223 |
+
} else if (y < rect.top || curDeltaX > xDelta) {
|
| 8224 |
+
return i - 1;
|
| 8225 |
+
} else {
|
| 8226 |
+
xDelta = curDeltaX;
|
| 8227 |
+
}
|
| 8228 |
+
}
|
| 8229 |
+
return 0;
|
| 8230 |
+
};
|
| 8231 |
+
var inRect = function (rect, x, y) {
|
| 8232 |
+
return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;
|
| 8233 |
+
};
|
| 8234 |
+
var $_4j2zpup3jfuw8r2b = {
|
| 8235 |
+
inRect: inRect,
|
| 8236 |
+
searchForPoint: searchForPoint
|
| 8237 |
+
};
|
| 8238 |
+
|
| 8239 |
+
var locateOffset = function (doc, textnode, x, y, rect) {
|
| 8240 |
+
var rangeForOffset = function (offset) {
|
| 8241 |
+
var r = doc.dom().createRange();
|
| 8242 |
+
r.setStart(textnode.dom(), offset);
|
| 8243 |
+
r.collapse(true);
|
| 8244 |
+
return r;
|
| 8245 |
+
};
|
| 8246 |
+
var rectForOffset = function (offset) {
|
| 8247 |
+
var r = rangeForOffset(offset);
|
| 8248 |
+
return r.getBoundingClientRect();
|
| 8249 |
+
};
|
| 8250 |
+
var length = $_6j8y7blnjfuw8qc3.get(textnode).length;
|
| 8251 |
+
var offset = $_4j2zpup3jfuw8r2b.searchForPoint(rectForOffset, x, y, rect.right, length);
|
| 8252 |
+
return rangeForOffset(offset);
|
| 8253 |
+
};
|
| 8254 |
+
var locate = function (doc, node, x, y) {
|
| 8255 |
+
var r = doc.dom().createRange();
|
| 8256 |
+
r.selectNode(node.dom());
|
| 8257 |
+
var rects = r.getClientRects();
|
| 8258 |
+
var foundRect = $_cul8qomvjfuw8qm7.findMap(rects, function (rect) {
|
| 8259 |
+
return $_4j2zpup3jfuw8r2b.inRect(rect, x, y) ? Option.some(rect) : Option.none();
|
| 8260 |
+
});
|
| 8261 |
+
return foundRect.map(function (rect) {
|
| 8262 |
+
return locateOffset(doc, node, x, y, rect);
|
| 8263 |
+
});
|
| 8264 |
+
};
|
| 8265 |
+
var $_11d3zhp4jfuw8r2c = { locate: locate };
|
| 8266 |
+
|
| 8267 |
+
var searchInChildren = function (doc, node, x, y) {
|
| 8268 |
+
var r = doc.dom().createRange();
|
| 8269 |
+
var nodes = $_s8scrkmjfuw8q7a.children(node);
|
| 8270 |
+
return $_cul8qomvjfuw8qm7.findMap(nodes, function (n) {
|
| 8271 |
+
r.selectNode(n.dom());
|
| 8272 |
+
return $_4j2zpup3jfuw8r2b.inRect(r.getBoundingClientRect(), x, y) ? locateNode(doc, n, x, y) : Option.none();
|
| 8273 |
+
});
|
| 8274 |
+
};
|
| 8275 |
+
var locateNode = function (doc, node, x, y) {
|
| 8276 |
+
var locator = $_a8gk30l6jfuw8q9c.isText(node) ? $_11d3zhp4jfuw8r2c.locate : searchInChildren;
|
| 8277 |
+
return locator(doc, node, x, y);
|
| 8278 |
+
};
|
| 8279 |
+
var locate$1 = function (doc, node, x, y) {
|
| 8280 |
+
var r = doc.dom().createRange();
|
| 8281 |
+
r.selectNode(node.dom());
|
| 8282 |
+
var rect = r.getBoundingClientRect();
|
| 8283 |
+
var boundedX = Math.max(rect.left, Math.min(rect.right, x));
|
| 8284 |
+
var boundedY = Math.max(rect.top, Math.min(rect.bottom, y));
|
| 8285 |
+
return locateNode(doc, node, boundedX, boundedY);
|
| 8286 |
+
};
|
| 8287 |
+
var $_6f632yp2jfuw8r25 = { locate: locate$1 };
|
| 8288 |
+
|
| 8289 |
+
var COLLAPSE_TO_LEFT = true;
|
| 8290 |
+
var COLLAPSE_TO_RIGHT = false;
|
| 8291 |
+
var getCollapseDirection = function (rect, x) {
|
| 8292 |
+
return x - rect.left < rect.right - x ? COLLAPSE_TO_LEFT : COLLAPSE_TO_RIGHT;
|
| 8293 |
+
};
|
| 8294 |
+
var createCollapsedNode = function (doc, target, collapseDirection) {
|
| 8295 |
+
var r = doc.dom().createRange();
|
| 8296 |
+
r.selectNode(target.dom());
|
| 8297 |
+
r.collapse(collapseDirection);
|
| 8298 |
+
return r;
|
| 8299 |
+
};
|
| 8300 |
+
var locateInElement = function (doc, node, x) {
|
| 8301 |
+
var cursorRange = doc.dom().createRange();
|
| 8302 |
+
cursorRange.selectNode(node.dom());
|
| 8303 |
+
var rect = cursorRange.getBoundingClientRect();
|
| 8304 |
+
var collapseDirection = getCollapseDirection(rect, x);
|
| 8305 |
+
var f = collapseDirection === COLLAPSE_TO_LEFT ? $_ejrzj4lljfuw8qbw.first : $_ejrzj4lljfuw8qbw.last;
|
| 8306 |
+
return f(node).map(function (target) {
|
| 8307 |
+
return createCollapsedNode(doc, target, collapseDirection);
|
| 8308 |
+
});
|
| 8309 |
+
};
|
| 8310 |
+
var locateInEmpty = function (doc, node, x) {
|
| 8311 |
+
var rect = node.dom().getBoundingClientRect();
|
| 8312 |
+
var collapseDirection = getCollapseDirection(rect, x);
|
| 8313 |
+
return Option.some(createCollapsedNode(doc, node, collapseDirection));
|
| 8314 |
+
};
|
| 8315 |
+
var search = function (doc, node, x) {
|
| 8316 |
+
var f = $_s8scrkmjfuw8q7a.children(node).length === 0 ? locateInEmpty : locateInElement;
|
| 8317 |
+
return f(doc, node, x);
|
| 8318 |
+
};
|
| 8319 |
+
var $_azsqu2p5jfuw8r2i = { search: search };
|
| 8320 |
+
|
| 8321 |
+
var caretPositionFromPoint = function (doc, x, y) {
|
| 8322 |
+
return Option.from(doc.dom().caretPositionFromPoint(x, y)).bind(function (pos) {
|
| 8323 |
+
if (pos.offsetNode === null)
|
| 8324 |
+
return Option.none();
|
| 8325 |
+
var r = doc.dom().createRange();
|
| 8326 |
+
r.setStart(pos.offsetNode, pos.offset);
|
| 8327 |
+
r.collapse();
|
| 8328 |
+
return Option.some(r);
|
| 8329 |
+
});
|
| 8330 |
+
};
|
| 8331 |
+
var caretRangeFromPoint = function (doc, x, y) {
|
| 8332 |
+
return Option.from(doc.dom().caretRangeFromPoint(x, y));
|
| 8333 |
+
};
|
| 8334 |
+
var searchTextNodes = function (doc, node, x, y) {
|
| 8335 |
+
var r = doc.dom().createRange();
|
| 8336 |
+
r.selectNode(node.dom());
|
| 8337 |
+
var rect = r.getBoundingClientRect();
|
| 8338 |
+
var boundedX = Math.max(rect.left, Math.min(rect.right, x));
|
| 8339 |
+
var boundedY = Math.max(rect.top, Math.min(rect.bottom, y));
|
| 8340 |
+
return $_6f632yp2jfuw8r25.locate(doc, node, boundedX, boundedY);
|
| 8341 |
+
};
|
| 8342 |
+
var searchFromPoint = function (doc, x, y) {
|
| 8343 |
+
return $_xbeoqkkjfuw8q73.fromPoint(doc, x, y).bind(function (elem) {
|
| 8344 |
+
var fallback = function () {
|
| 8345 |
+
return $_azsqu2p5jfuw8r2i.search(doc, elem, x);
|
| 8346 |
+
};
|
| 8347 |
+
return $_s8scrkmjfuw8q7a.children(elem).length === 0 ? fallback() : searchTextNodes(doc, elem, x, y).orThunk(fallback);
|
| 8348 |
+
});
|
| 8349 |
+
};
|
| 8350 |
+
var availableSearch = document.caretPositionFromPoint ? caretPositionFromPoint : document.caretRangeFromPoint ? caretRangeFromPoint : searchFromPoint;
|
| 8351 |
+
var fromPoint$1 = function (win, x, y) {
|
| 8352 |
+
var doc = $_xbeoqkkjfuw8q73.fromDom(win.document);
|
| 8353 |
+
return availableSearch(doc, x, y).map(function (rng) {
|
| 8354 |
+
return $_bv1jwpoujfuw8r0m.range($_xbeoqkkjfuw8q73.fromDom(rng.startContainer), rng.startOffset, $_xbeoqkkjfuw8q73.fromDom(rng.endContainer), rng.endOffset);
|
| 8355 |
+
});
|
| 8356 |
+
};
|
| 8357 |
+
var $_lw04hp1jfuw8r1v = { fromPoint: fromPoint$1 };
|
| 8358 |
+
|
| 8359 |
+
var withinContainer = function (win, ancestor, outerRange, selector) {
|
| 8360 |
+
var innerRange = $_dkhwcmozjfuw8r1d.create(win);
|
| 8361 |
+
var self = $_enn9uikjjfuw8q6w.is(ancestor, selector) ? [ancestor] : [];
|
| 8362 |
+
var elements = self.concat($_6c9d0hl7jfuw8q9d.descendants(ancestor, selector));
|
| 8363 |
+
return $_tyr3yk5jfuw8q47.filter(elements, function (elem) {
|
| 8364 |
+
$_dkhwcmozjfuw8r1d.selectNodeContentsUsing(innerRange, elem);
|
| 8365 |
+
return $_dkhwcmozjfuw8r1d.isWithin(outerRange, innerRange);
|
| 8366 |
+
});
|
| 8367 |
+
};
|
| 8368 |
+
var find$3 = function (win, selection, selector) {
|
| 8369 |
+
var outerRange = $_c9xxrpp0jfuw8r1k.asLtrRange(win, selection);
|
| 8370 |
+
var ancestor = $_xbeoqkkjfuw8q73.fromDom(outerRange.commonAncestorContainer);
|
| 8371 |
+
return $_a8gk30l6jfuw8q9c.isElement(ancestor) ? withinContainer(win, ancestor, outerRange, selector) : [];
|
| 8372 |
+
};
|
| 8373 |
+
var $_7efy22p6jfuw8r2m = { find: find$3 };
|
| 8374 |
+
|
| 8375 |
+
var beforeSpecial = function (element, offset) {
|
| 8376 |
+
var name = $_a8gk30l6jfuw8q9c.name(element);
|
| 8377 |
+
if ('input' === name)
|
| 8378 |
+
return $_cuk0n0ovjfuw8r0r.after(element);
|
| 8379 |
+
else if (!$_tyr3yk5jfuw8q47.contains([
|
| 8380 |
+
'br',
|
| 8381 |
+
'img'
|
| 8382 |
+
], name))
|
| 8383 |
+
return $_cuk0n0ovjfuw8r0r.on(element, offset);
|
| 8384 |
+
else
|
| 8385 |
+
return offset === 0 ? $_cuk0n0ovjfuw8r0r.before(element) : $_cuk0n0ovjfuw8r0r.after(element);
|
| 8386 |
+
};
|
| 8387 |
+
var preprocessRelative = function (startSitu, finishSitu) {
|
| 8388 |
+
var start = startSitu.fold($_cuk0n0ovjfuw8r0r.before, beforeSpecial, $_cuk0n0ovjfuw8r0r.after);
|
| 8389 |
+
var finish = finishSitu.fold($_cuk0n0ovjfuw8r0r.before, beforeSpecial, $_cuk0n0ovjfuw8r0r.after);
|
| 8390 |
+
return $_bv1jwpoujfuw8r0m.relative(start, finish);
|
| 8391 |
+
};
|
| 8392 |
+
var preprocessExact = function (start, soffset, finish, foffset) {
|
| 8393 |
+
var startSitu = beforeSpecial(start, soffset);
|
| 8394 |
+
var finishSitu = beforeSpecial(finish, foffset);
|
| 8395 |
+
return $_bv1jwpoujfuw8r0m.relative(startSitu, finishSitu);
|
| 8396 |
+
};
|
| 8397 |
+
var preprocess = function (selection) {
|
| 8398 |
+
return selection.match({
|
| 8399 |
+
domRange: function (rng) {
|
| 8400 |
+
var start = $_xbeoqkkjfuw8q73.fromDom(rng.startContainer);
|
| 8401 |
+
var finish = $_xbeoqkkjfuw8q73.fromDom(rng.endContainer);
|
| 8402 |
+
return preprocessExact(start, rng.startOffset, finish, rng.endOffset);
|
| 8403 |
+
},
|
| 8404 |
+
relative: preprocessRelative,
|
| 8405 |
+
exact: preprocessExact
|
| 8406 |
+
});
|
| 8407 |
+
};
|
| 8408 |
+
var $_cjts8ap7jfuw8r2q = {
|
| 8409 |
+
beforeSpecial: beforeSpecial,
|
| 8410 |
+
preprocess: preprocess,
|
| 8411 |
+
preprocessRelative: preprocessRelative,
|
| 8412 |
+
preprocessExact: preprocessExact
|
| 8413 |
+
};
|
| 8414 |
+
|
| 8415 |
+
var doSetNativeRange = function (win, rng) {
|
| 8416 |
+
Option.from(win.getSelection()).each(function (selection) {
|
| 8417 |
+
selection.removeAllRanges();
|
| 8418 |
+
selection.addRange(rng);
|
| 8419 |
+
});
|
| 8420 |
+
};
|
| 8421 |
+
var doSetRange = function (win, start, soffset, finish, foffset) {
|
| 8422 |
+
var rng = $_dkhwcmozjfuw8r1d.exactToNative(win, start, soffset, finish, foffset);
|
| 8423 |
+
doSetNativeRange(win, rng);
|
| 8424 |
+
};
|
| 8425 |
+
var findWithin = function (win, selection, selector) {
|
| 8426 |
+
return $_7efy22p6jfuw8r2m.find(win, selection, selector);
|
| 8427 |
+
};
|
| 8428 |
+
var setRangeFromRelative = function (win, relative) {
|
| 8429 |
+
return $_c9xxrpp0jfuw8r1k.diagnose(win, relative).match({
|
| 8430 |
+
ltr: function (start, soffset, finish, foffset) {
|
| 8431 |
+
doSetRange(win, start, soffset, finish, foffset);
|
| 8432 |
+
},
|
| 8433 |
+
rtl: function (start, soffset, finish, foffset) {
|
| 8434 |
+
var selection = win.getSelection();
|
| 8435 |
+
if (selection.setBaseAndExtent) {
|
| 8436 |
+
selection.setBaseAndExtent(start.dom(), soffset, finish.dom(), foffset);
|
| 8437 |
+
} else if (selection.extend) {
|
| 8438 |
+
selection.collapse(start.dom(), soffset);
|
| 8439 |
+
selection.extend(finish.dom(), foffset);
|
| 8440 |
+
} else {
|
| 8441 |
+
doSetRange(win, finish, foffset, start, soffset);
|
| 8442 |
+
}
|
| 8443 |
+
}
|
| 8444 |
+
});
|
| 8445 |
+
};
|
| 8446 |
+
var setExact = function (win, start, soffset, finish, foffset) {
|
| 8447 |
+
var relative = $_cjts8ap7jfuw8r2q.preprocessExact(start, soffset, finish, foffset);
|
| 8448 |
+
setRangeFromRelative(win, relative);
|
| 8449 |
+
};
|
| 8450 |
+
var setRelative = function (win, startSitu, finishSitu) {
|
| 8451 |
+
var relative = $_cjts8ap7jfuw8r2q.preprocessRelative(startSitu, finishSitu);
|
| 8452 |
+
setRangeFromRelative(win, relative);
|
| 8453 |
+
};
|
| 8454 |
+
var toNative = function (selection) {
|
| 8455 |
+
var win = $_bv1jwpoujfuw8r0m.getWin(selection).dom();
|
| 8456 |
+
var getDomRange = function (start, soffset, finish, foffset) {
|
| 8457 |
+
return $_dkhwcmozjfuw8r1d.exactToNative(win, start, soffset, finish, foffset);
|
| 8458 |
+
};
|
| 8459 |
+
var filtered = $_cjts8ap7jfuw8r2q.preprocess(selection);
|
| 8460 |
+
return $_c9xxrpp0jfuw8r1k.diagnose(win, filtered).match({
|
| 8461 |
+
ltr: getDomRange,
|
| 8462 |
+
rtl: getDomRange
|
| 8463 |
+
});
|
| 8464 |
+
};
|
| 8465 |
+
var readRange = function (selection) {
|
| 8466 |
+
if (selection.rangeCount > 0) {
|
| 8467 |
+
var firstRng = selection.getRangeAt(0);
|
| 8468 |
+
var lastRng = selection.getRangeAt(selection.rangeCount - 1);
|
| 8469 |
+
return Option.some($_bv1jwpoujfuw8r0m.range($_xbeoqkkjfuw8q73.fromDom(firstRng.startContainer), firstRng.startOffset, $_xbeoqkkjfuw8q73.fromDom(lastRng.endContainer), lastRng.endOffset));
|
| 8470 |
+
} else {
|
| 8471 |
+
return Option.none();
|
| 8472 |
+
}
|
| 8473 |
+
};
|
| 8474 |
+
var doGetExact = function (selection) {
|
| 8475 |
+
var anchorNode = $_xbeoqkkjfuw8q73.fromDom(selection.anchorNode);
|
| 8476 |
+
var focusNode = $_xbeoqkkjfuw8q73.fromDom(selection.focusNode);
|
| 8477 |
+
return $_5xef0moxjfuw8r17.after(anchorNode, selection.anchorOffset, focusNode, selection.focusOffset) ? Option.some($_bv1jwpoujfuw8r0m.range($_xbeoqkkjfuw8q73.fromDom(selection.anchorNode), selection.anchorOffset, $_xbeoqkkjfuw8q73.fromDom(selection.focusNode), selection.focusOffset)) : readRange(selection);
|
| 8478 |
+
};
|
| 8479 |
+
var setToElement = function (win, element) {
|
| 8480 |
+
var rng = $_dkhwcmozjfuw8r1d.selectNodeContents(win, element);
|
| 8481 |
+
doSetNativeRange(win, rng);
|
| 8482 |
+
};
|
| 8483 |
+
var forElement = function (win, element) {
|
| 8484 |
+
var rng = $_dkhwcmozjfuw8r1d.selectNodeContents(win, element);
|
| 8485 |
+
return $_bv1jwpoujfuw8r0m.range($_xbeoqkkjfuw8q73.fromDom(rng.startContainer), rng.startOffset, $_xbeoqkkjfuw8q73.fromDom(rng.endContainer), rng.endOffset);
|
| 8486 |
+
};
|
| 8487 |
+
var getExact = function (win) {
|
| 8488 |
+
var selection = win.getSelection();
|
| 8489 |
+
return selection.rangeCount > 0 ? doGetExact(selection) : Option.none();
|
| 8490 |
+
};
|
| 8491 |
+
var get$9 = function (win) {
|
| 8492 |
+
return getExact(win).map(function (range) {
|
| 8493 |
+
return $_bv1jwpoujfuw8r0m.exact(range.start(), range.soffset(), range.finish(), range.foffset());
|
| 8494 |
+
});
|
| 8495 |
+
};
|
| 8496 |
+
var getFirstRect$1 = function (win, selection) {
|
| 8497 |
+
var rng = $_c9xxrpp0jfuw8r1k.asLtrRange(win, selection);
|
| 8498 |
+
return $_dkhwcmozjfuw8r1d.getFirstRect(rng);
|
| 8499 |
+
};
|
| 8500 |
+
var getBounds$2 = function (win, selection) {
|
| 8501 |
+
var rng = $_c9xxrpp0jfuw8r1k.asLtrRange(win, selection);
|
| 8502 |
+
return $_dkhwcmozjfuw8r1d.getBounds(rng);
|
| 8503 |
+
};
|
| 8504 |
+
var getAtPoint = function (win, x, y) {
|
| 8505 |
+
return $_lw04hp1jfuw8r1v.fromPoint(win, x, y);
|
| 8506 |
+
};
|
| 8507 |
+
var getAsString = function (win, selection) {
|
| 8508 |
+
var rng = $_c9xxrpp0jfuw8r1k.asLtrRange(win, selection);
|
| 8509 |
+
return $_dkhwcmozjfuw8r1d.toString(rng);
|
| 8510 |
+
};
|
| 8511 |
+
var clear$1 = function (win) {
|
| 8512 |
+
var selection = win.getSelection();
|
| 8513 |
+
selection.removeAllRanges();
|
| 8514 |
+
};
|
| 8515 |
+
var clone$2 = function (win, selection) {
|
| 8516 |
+
var rng = $_c9xxrpp0jfuw8r1k.asLtrRange(win, selection);
|
| 8517 |
+
return $_dkhwcmozjfuw8r1d.cloneFragment(rng);
|
| 8518 |
+
};
|
| 8519 |
+
var replace$1 = function (win, selection, elements) {
|
| 8520 |
+
var rng = $_c9xxrpp0jfuw8r1k.asLtrRange(win, selection);
|
| 8521 |
+
var fragment = $_8a834noyjfuw8r19.fromElements(elements, win.document);
|
| 8522 |
+
$_dkhwcmozjfuw8r1d.replaceWith(rng, fragment);
|
| 8523 |
+
};
|
| 8524 |
+
var deleteAt = function (win, selection) {
|
| 8525 |
+
var rng = $_c9xxrpp0jfuw8r1k.asLtrRange(win, selection);
|
| 8526 |
+
$_dkhwcmozjfuw8r1d.deleteContents(rng);
|
| 8527 |
+
};
|
| 8528 |
+
var isCollapsed = function (start, soffset, finish, foffset) {
|
| 8529 |
+
return $_e8rn66kojfuw8q7n.eq(start, finish) && soffset === foffset;
|
| 8530 |
+
};
|
| 8531 |
+
var $_3gcdhqowjfuw8r11 = {
|
| 8532 |
+
setExact: setExact,
|
| 8533 |
+
getExact: getExact,
|
| 8534 |
+
get: get$9,
|
| 8535 |
+
setRelative: setRelative,
|
| 8536 |
+
toNative: toNative,
|
| 8537 |
+
setToElement: setToElement,
|
| 8538 |
+
clear: clear$1,
|
| 8539 |
+
clone: clone$2,
|
| 8540 |
+
replace: replace$1,
|
| 8541 |
+
deleteAt: deleteAt,
|
| 8542 |
+
forElement: forElement,
|
| 8543 |
+
getFirstRect: getFirstRect$1,
|
| 8544 |
+
getBounds: getBounds$2,
|
| 8545 |
+
getAtPoint: getAtPoint,
|
| 8546 |
+
findWithin: findWithin,
|
| 8547 |
+
getAsString: getAsString,
|
| 8548 |
+
isCollapsed: isCollapsed
|
| 8549 |
+
};
|
| 8550 |
+
|
| 8551 |
+
var global$4 = tinymce.util.Tools.resolve('tinymce.util.VK');
|
| 8552 |
+
|
| 8553 |
+
var forward = function (editor, isRoot, cell, lazyWire) {
|
| 8554 |
+
return go(editor, isRoot, $_947ovkosjfuw8r0c.next(cell), lazyWire);
|
| 8555 |
+
};
|
| 8556 |
+
var backward = function (editor, isRoot, cell, lazyWire) {
|
| 8557 |
+
return go(editor, isRoot, $_947ovkosjfuw8r0c.prev(cell), lazyWire);
|
| 8558 |
+
};
|
| 8559 |
+
var getCellFirstCursorPosition = function (editor, cell) {
|
| 8560 |
+
var selection = $_bv1jwpoujfuw8r0m.exact(cell, 0, cell, 0);
|
| 8561 |
+
return $_3gcdhqowjfuw8r11.toNative(selection);
|
| 8562 |
+
};
|
| 8563 |
+
var getNewRowCursorPosition = function (editor, table) {
|
| 8564 |
+
var rows = $_6c9d0hl7jfuw8q9d.descendants(table, 'tr');
|
| 8565 |
+
return $_tyr3yk5jfuw8q47.last(rows).bind(function (last) {
|
| 8566 |
+
return $_8wdrbmlajfuw8q9m.descendant(last, 'td,th').map(function (first) {
|
| 8567 |
+
return getCellFirstCursorPosition(editor, first);
|
| 8568 |
+
});
|
| 8569 |
+
});
|
| 8570 |
+
};
|
| 8571 |
+
var go = function (editor, isRoot, cell, actions, lazyWire) {
|
| 8572 |
+
return cell.fold(Option.none, Option.none, function (current, next) {
|
| 8573 |
+
return $_ejrzj4lljfuw8qbw.first(next).map(function (cell) {
|
| 8574 |
+
return getCellFirstCursorPosition(editor, cell);
|
| 8575 |
+
});
|
| 8576 |
+
}, function (current) {
|
| 8577 |
+
return $_aqhz9okhjfuw8q5y.table(current, isRoot).bind(function (table) {
|
| 8578 |
+
var targets = $_5b7h1hlqjfuw8qci.noMenu(current);
|
| 8579 |
+
editor.undoManager.transact(function () {
|
| 8580 |
+
actions.insertRowsAfter(table, targets);
|
| 8581 |
+
});
|
| 8582 |
+
return getNewRowCursorPosition(editor, table);
|
| 8583 |
+
});
|
| 8584 |
+
});
|
| 8585 |
+
};
|
| 8586 |
+
var rootElements = [
|
| 8587 |
+
'table',
|
| 8588 |
+
'li',
|
| 8589 |
+
'dl'
|
| 8590 |
+
];
|
| 8591 |
+
var handle$1 = function (event, editor, actions, lazyWire) {
|
| 8592 |
+
if (event.keyCode === global$4.TAB) {
|
| 8593 |
+
var body_1 = $_5xkhf2nnjfuw8qrq.getBody(editor);
|
| 8594 |
+
var isRoot_1 = function (element) {
|
| 8595 |
+
var name = $_a8gk30l6jfuw8q9c.name(element);
|
| 8596 |
+
return $_e8rn66kojfuw8q7n.eq(element, body_1) || $_tyr3yk5jfuw8q47.contains(rootElements, name);
|
| 8597 |
+
};
|
| 8598 |
+
var rng = editor.selection.getRng();
|
| 8599 |
+
if (rng.collapsed) {
|
| 8600 |
+
var start = $_xbeoqkkjfuw8q73.fromDom(rng.startContainer);
|
| 8601 |
+
$_aqhz9okhjfuw8q5y.cell(start, isRoot_1).each(function (cell) {
|
| 8602 |
+
event.preventDefault();
|
| 8603 |
+
var navigation = event.shiftKey ? backward : forward;
|
| 8604 |
+
var rng = navigation(editor, isRoot_1, cell, actions, lazyWire);
|
| 8605 |
+
rng.each(function (range) {
|
| 8606 |
+
editor.selection.setRng(range);
|
| 8607 |
+
});
|
| 8608 |
+
});
|
| 8609 |
+
}
|
| 8610 |
+
}
|
| 8611 |
+
};
|
| 8612 |
+
var $_djb8ceorjfuw8qzt = { handle: handle$1 };
|
| 8613 |
+
|
| 8614 |
+
var response = $_5now9kbjfuw8q5e.immutable('selection', 'kill');
|
| 8615 |
+
var $_b7ap4hpbjfuw8r3x = { response: response };
|
| 8616 |
+
|
| 8617 |
+
var isKey = function (key) {
|
| 8618 |
+
return function (keycode) {
|
| 8619 |
+
return keycode === key;
|
| 8620 |
+
};
|
| 8621 |
+
};
|
| 8622 |
+
var isUp = isKey(38);
|
| 8623 |
+
var isDown = isKey(40);
|
| 8624 |
+
var isNavigation = function (keycode) {
|
| 8625 |
+
return keycode >= 37 && keycode <= 40;
|
| 8626 |
+
};
|
| 8627 |
+
var $_9n04otpcjfuw8r40 = {
|
| 8628 |
+
ltr: {
|
| 8629 |
+
isBackward: isKey(37),
|
| 8630 |
+
isForward: isKey(39)
|
| 8631 |
+
},
|
| 8632 |
+
rtl: {
|
| 8633 |
+
isBackward: isKey(39),
|
| 8634 |
+
isForward: isKey(37)
|
| 8635 |
+
},
|
| 8636 |
+
isUp: isUp,
|
| 8637 |
+
isDown: isDown,
|
| 8638 |
+
isNavigation: isNavigation
|
| 8639 |
+
};
|
| 8640 |
+
|
| 8641 |
+
var convertToRange = function (win, selection) {
|
| 8642 |
+
var rng = $_c9xxrpp0jfuw8r1k.asLtrRange(win, selection);
|
| 8643 |
+
return {
|
| 8644 |
+
start: $_20nfr6k7jfuw8q4g.constant($_xbeoqkkjfuw8q73.fromDom(rng.startContainer)),
|
| 8645 |
+
soffset: $_20nfr6k7jfuw8q4g.constant(rng.startOffset),
|
| 8646 |
+
finish: $_20nfr6k7jfuw8q4g.constant($_xbeoqkkjfuw8q73.fromDom(rng.endContainer)),
|
| 8647 |
+
foffset: $_20nfr6k7jfuw8q4g.constant(rng.endOffset)
|
| 8648 |
+
};
|
| 8649 |
+
};
|
| 8650 |
+
var makeSitus = function (start, soffset, finish, foffset) {
|
| 8651 |
+
return {
|
| 8652 |
+
start: $_20nfr6k7jfuw8q4g.constant($_cuk0n0ovjfuw8r0r.on(start, soffset)),
|
| 8653 |
+
finish: $_20nfr6k7jfuw8q4g.constant($_cuk0n0ovjfuw8r0r.on(finish, foffset))
|
| 8654 |
+
};
|
| 8655 |
+
};
|
| 8656 |
+
var $_81eh29pejfuw8r4k = {
|
| 8657 |
+
convertToRange: convertToRange,
|
| 8658 |
+
makeSitus: makeSitus
|
| 8659 |
+
};
|
| 8660 |
+
|
| 8661 |
+
var isSafari = $_fqgee0ktjfuw8q83.detect().browser.isSafari();
|
| 8662 |
+
var get$10 = function (_doc) {
|
| 8663 |
+
var doc = _doc !== undefined ? _doc.dom() : document;
|
| 8664 |
+
var x = doc.body.scrollLeft || doc.documentElement.scrollLeft;
|
| 8665 |
+
var y = doc.body.scrollTop || doc.documentElement.scrollTop;
|
| 8666 |
+
return r(x, y);
|
| 8667 |
+
};
|
| 8668 |
+
var to = function (x, y, _doc) {
|
| 8669 |
+
var doc = _doc !== undefined ? _doc.dom() : document;
|
| 8670 |
+
var win = doc.defaultView;
|
| 8671 |
+
win.scrollTo(x, y);
|
| 8672 |
+
};
|
| 8673 |
+
var by = function (x, y, _doc) {
|
| 8674 |
+
var doc = _doc !== undefined ? _doc.dom() : document;
|
| 8675 |
+
var win = doc.defaultView;
|
| 8676 |
+
win.scrollBy(x, y);
|
| 8677 |
+
};
|
| 8678 |
+
var setToElement$1 = function (win, element) {
|
| 8679 |
+
var pos = $_hsvzlmijfuw8qj4.absolute(element);
|
| 8680 |
+
var doc = $_xbeoqkkjfuw8q73.fromDom(win.document);
|
| 8681 |
+
to(pos.left(), pos.top(), doc);
|
| 8682 |
+
};
|
| 8683 |
+
var preserve$1 = function (doc, f) {
|
| 8684 |
+
var before = get$10(doc);
|
| 8685 |
+
f();
|
| 8686 |
+
var after = get$10(doc);
|
| 8687 |
+
if (before.top() !== after.top() || before.left() !== after.left()) {
|
| 8688 |
+
to(before.left(), before.top(), doc);
|
| 8689 |
+
}
|
| 8690 |
+
};
|
| 8691 |
+
var capture$2 = function (doc) {
|
| 8692 |
+
var previous = Option.none();
|
| 8693 |
+
var save = function () {
|
| 8694 |
+
previous = Option.some(get$10(doc));
|
| 8695 |
+
};
|
| 8696 |
+
var restore = function () {
|
| 8697 |
+
previous.each(function (p) {
|
| 8698 |
+
to(p.left(), p.top(), doc);
|
| 8699 |
+
});
|
| 8700 |
+
};
|
| 8701 |
+
save();
|
| 8702 |
+
return {
|
| 8703 |
+
save: save,
|
| 8704 |
+
restore: restore
|
| 8705 |
+
};
|
| 8706 |
+
};
|
| 8707 |
+
var intoView = function (element, alignToTop) {
|
| 8708 |
+
if (isSafari && $_g6mvnrk8jfuw8q4k.isFunction(element.dom().scrollIntoViewIfNeeded)) {
|
| 8709 |
+
element.dom().scrollIntoViewIfNeeded(false);
|
| 8710 |
+
} else {
|
| 8711 |
+
element.dom().scrollIntoView(alignToTop);
|
| 8712 |
+
}
|
| 8713 |
+
};
|
| 8714 |
+
var intoViewIfNeeded = function (element, container) {
|
| 8715 |
+
var containerBox = container.dom().getBoundingClientRect();
|
| 8716 |
+
var elementBox = element.dom().getBoundingClientRect();
|
| 8717 |
+
if (elementBox.top < containerBox.top) {
|
| 8718 |
+
intoView(element, true);
|
| 8719 |
+
} else if (elementBox.bottom > containerBox.bottom) {
|
| 8720 |
+
intoView(element, false);
|
| 8721 |
+
}
|
| 8722 |
+
};
|
| 8723 |
+
var scrollBarWidth = function () {
|
| 8724 |
+
var scrollDiv = $_xbeoqkkjfuw8q73.fromHtml('<div style="width: 100px; height: 100px; overflow: scroll; position: absolute; top: -9999px;"></div>');
|
| 8725 |
+
$_fatuxylgjfuw8qav.after($_atd1tul9jfuw8q9i.body(), scrollDiv);
|
| 8726 |
+
var w = scrollDiv.dom().offsetWidth - scrollDiv.dom().clientWidth;
|
| 8727 |
+
$_fl1deelhjfuw8qax.remove(scrollDiv);
|
| 8728 |
+
return w;
|
| 8729 |
+
};
|
| 8730 |
+
var $_xvhf9pfjfuw8r51 = {
|
| 8731 |
+
get: get$10,
|
| 8732 |
+
to: to,
|
| 8733 |
+
by: by,
|
| 8734 |
+
preserve: preserve$1,
|
| 8735 |
+
capture: capture$2,
|
| 8736 |
+
intoView: intoView,
|
| 8737 |
+
intoViewIfNeeded: intoViewIfNeeded,
|
| 8738 |
+
setToElement: setToElement$1,
|
| 8739 |
+
scrollBarWidth: scrollBarWidth
|
| 8740 |
+
};
|
| 8741 |
+
|
| 8742 |
+
function WindowBridge (win) {
|
| 8743 |
+
var elementFromPoint = function (x, y) {
|
| 8744 |
+
return Option.from(win.document.elementFromPoint(x, y)).map($_xbeoqkkjfuw8q73.fromDom);
|
| 8745 |
+
};
|
| 8746 |
+
var getRect = function (element) {
|
| 8747 |
+
return element.dom().getBoundingClientRect();
|
| 8748 |
+
};
|
| 8749 |
+
var getRangedRect = function (start, soffset, finish, foffset) {
|
| 8750 |
+
var sel = $_bv1jwpoujfuw8r0m.exact(start, soffset, finish, foffset);
|
| 8751 |
+
return $_3gcdhqowjfuw8r11.getFirstRect(win, sel).map(function (structRect) {
|
| 8752 |
+
return $_11yiupkajfuw8q5c.map(structRect, $_20nfr6k7jfuw8q4g.apply);
|
| 8753 |
+
});
|
| 8754 |
+
};
|
| 8755 |
+
var getSelection = function () {
|
| 8756 |
+
return $_3gcdhqowjfuw8r11.get(win).map(function (exactAdt) {
|
| 8757 |
+
return $_81eh29pejfuw8r4k.convertToRange(win, exactAdt);
|
| 8758 |
+
});
|
| 8759 |
+
};
|
| 8760 |
+
var fromSitus = function (situs) {
|
| 8761 |
+
var relative = $_bv1jwpoujfuw8r0m.relative(situs.start(), situs.finish());
|
| 8762 |
+
return $_81eh29pejfuw8r4k.convertToRange(win, relative);
|
| 8763 |
+
};
|
| 8764 |
+
var situsFromPoint = function (x, y) {
|
| 8765 |
+
return $_3gcdhqowjfuw8r11.getAtPoint(win, x, y).map(function (exact) {
|
| 8766 |
+
return {
|
| 8767 |
+
start: $_20nfr6k7jfuw8q4g.constant($_cuk0n0ovjfuw8r0r.on(exact.start(), exact.soffset())),
|
| 8768 |
+
finish: $_20nfr6k7jfuw8q4g.constant($_cuk0n0ovjfuw8r0r.on(exact.finish(), exact.foffset()))
|
| 8769 |
+
};
|
| 8770 |
+
});
|
| 8771 |
+
};
|
| 8772 |
+
var clearSelection = function () {
|
| 8773 |
+
$_3gcdhqowjfuw8r11.clear(win);
|
| 8774 |
+
};
|
| 8775 |
+
var selectContents = function (element) {
|
| 8776 |
+
$_3gcdhqowjfuw8r11.setToElement(win, element);
|
| 8777 |
+
};
|
| 8778 |
+
var setSelection = function (sel) {
|
| 8779 |
+
$_3gcdhqowjfuw8r11.setExact(win, sel.start(), sel.soffset(), sel.finish(), sel.foffset());
|
| 8780 |
+
};
|
| 8781 |
+
var setRelativeSelection = function (start, finish) {
|
| 8782 |
+
$_3gcdhqowjfuw8r11.setRelative(win, start, finish);
|
| 8783 |
+
};
|
| 8784 |
+
var getInnerHeight = function () {
|
| 8785 |
+
return win.innerHeight;
|
| 8786 |
+
};
|
| 8787 |
+
var getScrollY = function () {
|
| 8788 |
+
var pos = $_xvhf9pfjfuw8r51.get($_xbeoqkkjfuw8q73.fromDom(win.document));
|
| 8789 |
+
return pos.top();
|
| 8790 |
+
};
|
| 8791 |
+
var scrollBy = function (x, y) {
|
| 8792 |
+
$_xvhf9pfjfuw8r51.by(x, y, $_xbeoqkkjfuw8q73.fromDom(win.document));
|
| 8793 |
+
};
|
| 8794 |
+
return {
|
| 8795 |
+
elementFromPoint: elementFromPoint,
|
| 8796 |
+
getRect: getRect,
|
| 8797 |
+
getRangedRect: getRangedRect,
|
| 8798 |
+
getSelection: getSelection,
|
| 8799 |
+
fromSitus: fromSitus,
|
| 8800 |
+
situsFromPoint: situsFromPoint,
|
| 8801 |
+
clearSelection: clearSelection,
|
| 8802 |
+
setSelection: setSelection,
|
| 8803 |
+
setRelativeSelection: setRelativeSelection,
|
| 8804 |
+
selectContents: selectContents,
|
| 8805 |
+
getInnerHeight: getInnerHeight,
|
| 8806 |
+
getScrollY: getScrollY,
|
| 8807 |
+
scrollBy: scrollBy
|
| 8808 |
+
};
|
| 8809 |
+
}
|
| 8810 |
+
|
| 8811 |
+
var sync = function (container, isRoot, start, soffset, finish, foffset, selectRange) {
|
| 8812 |
+
if (!($_e8rn66kojfuw8q7n.eq(start, finish) && soffset === foffset)) {
|
| 8813 |
+
return $_8wdrbmlajfuw8q9m.closest(start, 'td,th', isRoot).bind(function (s) {
|
| 8814 |
+
return $_8wdrbmlajfuw8q9m.closest(finish, 'td,th', isRoot).bind(function (f) {
|
| 8815 |
+
return detect$5(container, isRoot, s, f, selectRange);
|
| 8816 |
+
});
|
| 8817 |
+
});
|
| 8818 |
+
} else {
|
| 8819 |
+
return Option.none();
|
| 8820 |
+
}
|
| 8821 |
+
};
|
| 8822 |
+
var detect$5 = function (container, isRoot, start, finish, selectRange) {
|
| 8823 |
+
if (!$_e8rn66kojfuw8q7n.eq(start, finish)) {
|
| 8824 |
+
return $_dpd405ltjfuw8qd8.identify(start, finish, isRoot).bind(function (cellSel) {
|
| 8825 |
+
var boxes = cellSel.boxes().getOr([]);
|
| 8826 |
+
if (boxes.length > 0) {
|
| 8827 |
+
selectRange(container, boxes, cellSel.start(), cellSel.finish());
|
| 8828 |
+
return Option.some($_b7ap4hpbjfuw8r3x.response(Option.some($_81eh29pejfuw8r4k.makeSitus(start, 0, start, $_6vfowrlmjfuw8qbz.getEnd(start))), true));
|
| 8829 |
+
} else {
|
| 8830 |
+
return Option.none();
|
| 8831 |
+
}
|
| 8832 |
+
});
|
| 8833 |
+
} else {
|
| 8834 |
+
return Option.none();
|
| 8835 |
+
}
|
| 8836 |
+
};
|
| 8837 |
+
var update = function (rows, columns, container, selected, annotations) {
|
| 8838 |
+
var updateSelection = function (newSels) {
|
| 8839 |
+
annotations.clear(container);
|
| 8840 |
+
annotations.selectRange(container, newSels.boxes(), newSels.start(), newSels.finish());
|
| 8841 |
+
return newSels.boxes();
|
| 8842 |
+
};
|
| 8843 |
+
return $_dpd405ltjfuw8qd8.shiftSelection(selected, rows, columns, annotations.firstSelectedSelector(), annotations.lastSelectedSelector()).map(updateSelection);
|
| 8844 |
+
};
|
| 8845 |
+
var $_7ulhzpgjfuw8r5b = {
|
| 8846 |
+
sync: sync,
|
| 8847 |
+
detect: detect$5,
|
| 8848 |
+
update: update
|
| 8849 |
+
};
|
| 8850 |
+
|
| 8851 |
+
var nu$3 = $_5now9kbjfuw8q5e.immutableBag([
|
| 8852 |
+
'left',
|
| 8853 |
+
'top',
|
| 8854 |
+
'right',
|
| 8855 |
+
'bottom'
|
| 8856 |
+
], []);
|
| 8857 |
+
var moveDown = function (caret, amount) {
|
| 8858 |
+
return nu$3({
|
| 8859 |
+
left: caret.left(),
|
| 8860 |
+
top: caret.top() + amount,
|
| 8861 |
+
right: caret.right(),
|
| 8862 |
+
bottom: caret.bottom() + amount
|
| 8863 |
+
});
|
| 8864 |
+
};
|
| 8865 |
+
var moveUp = function (caret, amount) {
|
| 8866 |
+
return nu$3({
|
| 8867 |
+
left: caret.left(),
|
| 8868 |
+
top: caret.top() - amount,
|
| 8869 |
+
right: caret.right(),
|
| 8870 |
+
bottom: caret.bottom() - amount
|
| 8871 |
+
});
|
| 8872 |
+
};
|
| 8873 |
+
var moveBottomTo = function (caret, bottom) {
|
| 8874 |
+
var height = caret.bottom() - caret.top();
|
| 8875 |
+
return nu$3({
|
| 8876 |
+
left: caret.left(),
|
| 8877 |
+
top: bottom - height,
|
| 8878 |
+
right: caret.right(),
|
| 8879 |
+
bottom: bottom
|
| 8880 |
+
});
|
| 8881 |
+
};
|
| 8882 |
+
var moveTopTo = function (caret, top) {
|
| 8883 |
+
var height = caret.bottom() - caret.top();
|
| 8884 |
+
return nu$3({
|
| 8885 |
+
left: caret.left(),
|
| 8886 |
+
top: top,
|
| 8887 |
+
right: caret.right(),
|
| 8888 |
+
bottom: top + height
|
| 8889 |
+
});
|
| 8890 |
+
};
|
| 8891 |
+
var translate = function (caret, xDelta, yDelta) {
|
| 8892 |
+
return nu$3({
|
| 8893 |
+
left: caret.left() + xDelta,
|
| 8894 |
+
top: caret.top() + yDelta,
|
| 8895 |
+
right: caret.right() + xDelta,
|
| 8896 |
+
bottom: caret.bottom() + yDelta
|
| 8897 |
+
});
|
| 8898 |
+
};
|
| 8899 |
+
var getTop$1 = function (caret) {
|
| 8900 |
+
return caret.top();
|
| 8901 |
+
};
|
| 8902 |
+
var getBottom = function (caret) {
|
| 8903 |
+
return caret.bottom();
|
| 8904 |
+
};
|
| 8905 |
+
var toString$1 = function (caret) {
|
| 8906 |
+
return '(' + caret.left() + ', ' + caret.top() + ') -> (' + caret.right() + ', ' + caret.bottom() + ')';
|
| 8907 |
+
};
|
| 8908 |
+
var $_37xezepjjfuw8r6q = {
|
| 8909 |
+
nu: nu$3,
|
| 8910 |
+
moveUp: moveUp,
|
| 8911 |
+
moveDown: moveDown,
|
| 8912 |
+
moveBottomTo: moveBottomTo,
|
| 8913 |
+
moveTopTo: moveTopTo,
|
| 8914 |
+
getTop: getTop$1,
|
| 8915 |
+
getBottom: getBottom,
|
| 8916 |
+
translate: translate,
|
| 8917 |
+
toString: toString$1
|
| 8918 |
+
};
|
| 8919 |
+
|
| 8920 |
+
var getPartialBox = function (bridge, element, offset) {
|
| 8921 |
+
if (offset >= 0 && offset < $_6vfowrlmjfuw8qbz.getEnd(element))
|
| 8922 |
+
return bridge.getRangedRect(element, offset, element, offset + 1);
|
| 8923 |
+
else if (offset > 0)
|
| 8924 |
+
return bridge.getRangedRect(element, offset - 1, element, offset);
|
| 8925 |
+
return Option.none();
|
| 8926 |
+
};
|
| 8927 |
+
var toCaret = function (rect) {
|
| 8928 |
+
return $_37xezepjjfuw8r6q.nu({
|
| 8929 |
+
left: rect.left,
|
| 8930 |
+
top: rect.top,
|
| 8931 |
+
right: rect.right,
|
| 8932 |
+
bottom: rect.bottom
|
| 8933 |
+
});
|
| 8934 |
+
};
|
| 8935 |
+
var getElemBox = function (bridge, element) {
|
| 8936 |
+
return Option.some(bridge.getRect(element));
|
| 8937 |
+
};
|
| 8938 |
+
var getBoxAt = function (bridge, element, offset) {
|
| 8939 |
+
if ($_a8gk30l6jfuw8q9c.isElement(element))
|
| 8940 |
+
return getElemBox(bridge, element).map(toCaret);
|
| 8941 |
+
else if ($_a8gk30l6jfuw8q9c.isText(element))
|
| 8942 |
+
return getPartialBox(bridge, element, offset).map(toCaret);
|
| 8943 |
+
else
|
| 8944 |
+
return Option.none();
|
| 8945 |
+
};
|
| 8946 |
+
var getEntireBox = function (bridge, element) {
|
| 8947 |
+
if ($_a8gk30l6jfuw8q9c.isElement(element))
|
| 8948 |
+
return getElemBox(bridge, element).map(toCaret);
|
| 8949 |
+
else if ($_a8gk30l6jfuw8q9c.isText(element))
|
| 8950 |
+
return bridge.getRangedRect(element, 0, element, $_6vfowrlmjfuw8qbz.getEnd(element)).map(toCaret);
|
| 8951 |
+
else
|
| 8952 |
+
return Option.none();
|
| 8953 |
+
};
|
| 8954 |
+
var $_8xl6tpkjfuw8r6u = {
|
| 8955 |
+
getBoxAt: getBoxAt,
|
| 8956 |
+
getEntireBox: getEntireBox
|
| 8957 |
+
};
|
| 8958 |
+
|
| 8959 |
+
var traverse = $_5now9kbjfuw8q5e.immutable('item', 'mode');
|
| 8960 |
+
var backtrack = function (universe, item, direction, _transition) {
|
| 8961 |
+
var transition = _transition !== undefined ? _transition : sidestep;
|
| 8962 |
+
return universe.property().parent(item).map(function (p) {
|
| 8963 |
+
return traverse(p, transition);
|
| 8964 |
+
});
|
| 8965 |
+
};
|
| 8966 |
+
var sidestep = function (universe, item, direction, _transition) {
|
| 8967 |
+
var transition = _transition !== undefined ? _transition : advance;
|
| 8968 |
+
return direction.sibling(universe, item).map(function (p) {
|
| 8969 |
+
return traverse(p, transition);
|
| 8970 |
+
});
|
| 8971 |
+
};
|
| 8972 |
+
var advance = function (universe, item, direction, _transition) {
|
| 8973 |
+
var transition = _transition !== undefined ? _transition : advance;
|
| 8974 |
+
var children = universe.property().children(item);
|
| 8975 |
+
var result = direction.first(children);
|
| 8976 |
+
return result.map(function (r) {
|
| 8977 |
+
return traverse(r, transition);
|
| 8978 |
+
});
|
| 8979 |
+
};
|
| 8980 |
+
var successors = [
|
| 8981 |
+
{
|
| 8982 |
+
current: backtrack,
|
| 8983 |
+
next: sidestep,
|
| 8984 |
+
fallback: Option.none()
|
| 8985 |
+
},
|
| 8986 |
+
{
|
| 8987 |
+
current: sidestep,
|
| 8988 |
+
next: advance,
|
| 8989 |
+
fallback: Option.some(backtrack)
|
| 8990 |
+
},
|
| 8991 |
+
{
|
| 8992 |
+
current: advance,
|
| 8993 |
+
next: advance,
|
| 8994 |
+
fallback: Option.some(sidestep)
|
| 8995 |
+
}
|
| 8996 |
+
];
|
| 8997 |
+
var go$1 = function (universe, item, mode, direction, rules) {
|
| 8998 |
+
var rules = rules !== undefined ? rules : successors;
|
| 8999 |
+
var ruleOpt = $_tyr3yk5jfuw8q47.find(rules, function (succ) {
|
| 9000 |
+
return succ.current === mode;
|
| 9001 |
+
});
|
| 9002 |
+
return ruleOpt.bind(function (rule) {
|
| 9003 |
+
return rule.current(universe, item, direction, rule.next).orThunk(function () {
|
| 9004 |
+
return rule.fallback.bind(function (fb) {
|
| 9005 |
+
return go$1(universe, item, fb, direction);
|
| 9006 |
+
});
|
| 9007 |
+
});
|
| 9008 |
+
});
|
| 9009 |
+
};
|
| 9010 |
+
var $_12nww3ppjfuw8r7x = {
|
| 9011 |
+
backtrack: backtrack,
|
| 9012 |
+
sidestep: sidestep,
|
| 9013 |
+
advance: advance,
|
| 9014 |
+
go: go$1
|
| 9015 |
+
};
|
| 9016 |
+
|
| 9017 |
+
var left$1 = function () {
|
| 9018 |
+
var sibling = function (universe, item) {
|
| 9019 |
+
return universe.query().prevSibling(item);
|
| 9020 |
+
};
|
| 9021 |
+
var first = function (children) {
|
| 9022 |
+
return children.length > 0 ? Option.some(children[children.length - 1]) : Option.none();
|
| 9023 |
+
};
|
| 9024 |
+
return {
|
| 9025 |
+
sibling: sibling,
|
| 9026 |
+
first: first
|
| 9027 |
+
};
|
| 9028 |
+
};
|
| 9029 |
+
var right$1 = function () {
|
| 9030 |
+
var sibling = function (universe, item) {
|
| 9031 |
+
return universe.query().nextSibling(item);
|
| 9032 |
+
};
|
| 9033 |
+
var first = function (children) {
|
| 9034 |
+
return children.length > 0 ? Option.some(children[0]) : Option.none();
|
| 9035 |
+
};
|
| 9036 |
+
return {
|
| 9037 |
+
sibling: sibling,
|
| 9038 |
+
first: first
|
| 9039 |
+
};
|
| 9040 |
+
};
|
| 9041 |
+
var $_135xakpqjfuw8r85 = {
|
| 9042 |
+
left: left$1,
|
| 9043 |
+
right: right$1
|
| 9044 |
+
};
|
| 9045 |
+
|
| 9046 |
+
var hone = function (universe, item, predicate, mode, direction, isRoot) {
|
| 9047 |
+
var next = $_12nww3ppjfuw8r7x.go(universe, item, mode, direction);
|
| 9048 |
+
return next.bind(function (n) {
|
| 9049 |
+
if (isRoot(n.item()))
|
| 9050 |
+
return Option.none();
|
| 9051 |
+
else
|
| 9052 |
+
return predicate(n.item()) ? Option.some(n.item()) : hone(universe, n.item(), predicate, n.mode(), direction, isRoot);
|
| 9053 |
+
});
|
| 9054 |
+
};
|
| 9055 |
+
var left$2 = function (universe, item, predicate, isRoot) {
|
| 9056 |
+
return hone(universe, item, predicate, $_12nww3ppjfuw8r7x.sidestep, $_135xakpqjfuw8r85.left(), isRoot);
|
| 9057 |
+
};
|
| 9058 |
+
var right$2 = function (universe, item, predicate, isRoot) {
|
| 9059 |
+
return hone(universe, item, predicate, $_12nww3ppjfuw8r7x.sidestep, $_135xakpqjfuw8r85.right(), isRoot);
|
| 9060 |
+
};
|
| 9061 |
+
var $_6b0zg3pojfuw8r7t = {
|
| 9062 |
+
left: left$2,
|
| 9063 |
+
right: right$2
|
| 9064 |
+
};
|
| 9065 |
+
|
| 9066 |
+
var isLeaf = function (universe, element) {
|
| 9067 |
+
return universe.property().children(element).length === 0;
|
| 9068 |
+
};
|
| 9069 |
+
var before$2 = function (universe, item, isRoot) {
|
| 9070 |
+
return seekLeft(universe, item, $_20nfr6k7jfuw8q4g.curry(isLeaf, universe), isRoot);
|
| 9071 |
+
};
|
| 9072 |
+
var after$3 = function (universe, item, isRoot) {
|
| 9073 |
+
return seekRight(universe, item, $_20nfr6k7jfuw8q4g.curry(isLeaf, universe), isRoot);
|
| 9074 |
+
};
|
| 9075 |
+
var seekLeft = function (universe, item, predicate, isRoot) {
|
| 9076 |
+
return $_6b0zg3pojfuw8r7t.left(universe, item, predicate, isRoot);
|
| 9077 |
+
};
|
| 9078 |
+
var seekRight = function (universe, item, predicate, isRoot) {
|
| 9079 |
+
return $_6b0zg3pojfuw8r7t.right(universe, item, predicate, isRoot);
|
| 9080 |
+
};
|
| 9081 |
+
var walkers = function () {
|
| 9082 |
+
return {
|
| 9083 |
+
left: $_135xakpqjfuw8r85.left,
|
| 9084 |
+
right: $_135xakpqjfuw8r85.right
|
| 9085 |
+
};
|
| 9086 |
+
};
|
| 9087 |
+
var walk = function (universe, item, mode, direction, _rules) {
|
| 9088 |
+
return $_12nww3ppjfuw8r7x.go(universe, item, mode, direction, _rules);
|
| 9089 |
+
};
|
| 9090 |
+
var $_fivsmpnjfuw8r7p = {
|
| 9091 |
+
before: before$2,
|
| 9092 |
+
after: after$3,
|
| 9093 |
+
seekLeft: seekLeft,
|
| 9094 |
+
seekRight: seekRight,
|
| 9095 |
+
walkers: walkers,
|
| 9096 |
+
walk: walk,
|
| 9097 |
+
backtrack: $_12nww3ppjfuw8r7x.backtrack,
|
| 9098 |
+
sidestep: $_12nww3ppjfuw8r7x.sidestep,
|
| 9099 |
+
advance: $_12nww3ppjfuw8r7x.advance
|
| 9100 |
+
};
|
| 9101 |
+
|
| 9102 |
+
var universe$2 = DomUniverse();
|
| 9103 |
+
var gather = function (element, prune, transform) {
|
| 9104 |
+
return $_fivsmpnjfuw8r7p.gather(universe$2, element, prune, transform);
|
| 9105 |
+
};
|
| 9106 |
+
var before$3 = function (element, isRoot) {
|
| 9107 |
+
return $_fivsmpnjfuw8r7p.before(universe$2, element, isRoot);
|
| 9108 |
+
};
|
| 9109 |
+
var after$4 = function (element, isRoot) {
|
| 9110 |
+
return $_fivsmpnjfuw8r7p.after(universe$2, element, isRoot);
|
| 9111 |
+
};
|
| 9112 |
+
var seekLeft$1 = function (element, predicate, isRoot) {
|
| 9113 |
+
return $_fivsmpnjfuw8r7p.seekLeft(universe$2, element, predicate, isRoot);
|
| 9114 |
+
};
|
| 9115 |
+
var seekRight$1 = function (element, predicate, isRoot) {
|
| 9116 |
+
return $_fivsmpnjfuw8r7p.seekRight(universe$2, element, predicate, isRoot);
|
| 9117 |
+
};
|
| 9118 |
+
var walkers$1 = function () {
|
| 9119 |
+
return $_fivsmpnjfuw8r7p.walkers();
|
| 9120 |
+
};
|
| 9121 |
+
var walk$1 = function (item, mode, direction, _rules) {
|
| 9122 |
+
return $_fivsmpnjfuw8r7p.walk(universe$2, item, mode, direction, _rules);
|
| 9123 |
+
};
|
| 9124 |
+
var $_fgafb6pmjfuw8r7l = {
|
| 9125 |
+
gather: gather,
|
| 9126 |
+
before: before$3,
|
| 9127 |
+
after: after$4,
|
| 9128 |
+
seekLeft: seekLeft$1,
|
| 9129 |
+
seekRight: seekRight$1,
|
| 9130 |
+
walkers: walkers$1,
|
| 9131 |
+
walk: walk$1
|
| 9132 |
+
};
|
| 9133 |
+
|
| 9134 |
+
var JUMP_SIZE = 5;
|
| 9135 |
+
var NUM_RETRIES = 100;
|
| 9136 |
+
var adt$2 = $_7sbzam7jfuw8qgu.generate([
|
| 9137 |
+
{ 'none': [] },
|
| 9138 |
+
{ 'retry': ['caret'] }
|
| 9139 |
+
]);
|
| 9140 |
+
var isOutside = function (caret, box) {
|
| 9141 |
+
return caret.left() < box.left() || Math.abs(box.right() - caret.left()) < 1 || caret.left() > box.right();
|
| 9142 |
+
};
|
| 9143 |
+
var inOutsideBlock = function (bridge, element, caret) {
|
| 9144 |
+
return $_11ympzlbjfuw8q9n.closest(element, $_d9tdqtmrjfuw8ql9.isBlock).fold($_20nfr6k7jfuw8q4g.constant(false), function (cell) {
|
| 9145 |
+
return $_8xl6tpkjfuw8r6u.getEntireBox(bridge, cell).exists(function (box) {
|
| 9146 |
+
return isOutside(caret, box);
|
| 9147 |
+
});
|
| 9148 |
+
});
|
| 9149 |
+
};
|
| 9150 |
+
var adjustDown = function (bridge, element, guessBox, original, caret) {
|
| 9151 |
+
var lowerCaret = $_37xezepjjfuw8r6q.moveDown(caret, JUMP_SIZE);
|
| 9152 |
+
if (Math.abs(guessBox.bottom() - original.bottom()) < 1)
|
| 9153 |
+
return adt$2.retry(lowerCaret);
|
| 9154 |
+
else if (guessBox.top() > caret.bottom())
|
| 9155 |
+
return adt$2.retry(lowerCaret);
|
| 9156 |
+
else if (guessBox.top() === caret.bottom())
|
| 9157 |
+
return adt$2.retry($_37xezepjjfuw8r6q.moveDown(caret, 1));
|
| 9158 |
+
else
|
| 9159 |
+
return inOutsideBlock(bridge, element, caret) ? adt$2.retry($_37xezepjjfuw8r6q.translate(lowerCaret, JUMP_SIZE, 0)) : adt$2.none();
|
| 9160 |
+
};
|
| 9161 |
+
var adjustUp = function (bridge, element, guessBox, original, caret) {
|
| 9162 |
+
var higherCaret = $_37xezepjjfuw8r6q.moveUp(caret, JUMP_SIZE);
|
| 9163 |
+
if (Math.abs(guessBox.top() - original.top()) < 1)
|
| 9164 |
+
return adt$2.retry(higherCaret);
|
| 9165 |
+
else if (guessBox.bottom() < caret.top())
|
| 9166 |
+
return adt$2.retry(higherCaret);
|
| 9167 |
+
else if (guessBox.bottom() === caret.top())
|
| 9168 |
+
return adt$2.retry($_37xezepjjfuw8r6q.moveUp(caret, 1));
|
| 9169 |
+
else
|
| 9170 |
+
return inOutsideBlock(bridge, element, caret) ? adt$2.retry($_37xezepjjfuw8r6q.translate(higherCaret, JUMP_SIZE, 0)) : adt$2.none();
|
| 9171 |
+
};
|
| 9172 |
+
var upMovement = {
|
| 9173 |
+
point: $_37xezepjjfuw8r6q.getTop,
|
| 9174 |
+
adjuster: adjustUp,
|
| 9175 |
+
move: $_37xezepjjfuw8r6q.moveUp,
|
| 9176 |
+
gather: $_fgafb6pmjfuw8r7l.before
|
| 9177 |
+
};
|
| 9178 |
+
var downMovement = {
|
| 9179 |
+
point: $_37xezepjjfuw8r6q.getBottom,
|
| 9180 |
+
adjuster: adjustDown,
|
| 9181 |
+
move: $_37xezepjjfuw8r6q.moveDown,
|
| 9182 |
+
gather: $_fgafb6pmjfuw8r7l.after
|
| 9183 |
+
};
|
| 9184 |
+
var isAtTable = function (bridge, x, y) {
|
| 9185 |
+
return bridge.elementFromPoint(x, y).filter(function (elm) {
|
| 9186 |
+
return $_a8gk30l6jfuw8q9c.name(elm) === 'table';
|
| 9187 |
+
}).isSome();
|
| 9188 |
+
};
|
| 9189 |
+
var adjustForTable = function (bridge, movement, original, caret, numRetries) {
|
| 9190 |
+
return adjustTil(bridge, movement, original, movement.move(caret, JUMP_SIZE), numRetries);
|
| 9191 |
+
};
|
| 9192 |
+
var adjustTil = function (bridge, movement, original, caret, numRetries) {
|
| 9193 |
+
if (numRetries === 0)
|
| 9194 |
+
return Option.some(caret);
|
| 9195 |
+
if (isAtTable(bridge, caret.left(), movement.point(caret)))
|
| 9196 |
+
return adjustForTable(bridge, movement, original, caret, numRetries - 1);
|
| 9197 |
+
return bridge.situsFromPoint(caret.left(), movement.point(caret)).bind(function (guess) {
|
| 9198 |
+
return guess.start().fold(Option.none, function (element, offset) {
|
| 9199 |
+
return $_8xl6tpkjfuw8r6u.getEntireBox(bridge, element, offset).bind(function (guessBox) {
|
| 9200 |
+
return movement.adjuster(bridge, element, guessBox, original, caret).fold(Option.none, function (newCaret) {
|
| 9201 |
+
return adjustTil(bridge, movement, original, newCaret, numRetries - 1);
|
| 9202 |
+
});
|
| 9203 |
+
}).orThunk(function () {
|
| 9204 |
+
return Option.some(caret);
|
| 9205 |
+
});
|
| 9206 |
+
}, Option.none);
|
| 9207 |
+
});
|
| 9208 |
+
};
|
| 9209 |
+
var ieTryDown = function (bridge, caret) {
|
| 9210 |
+
return bridge.situsFromPoint(caret.left(), caret.bottom() + JUMP_SIZE);
|
| 9211 |
+
};
|
| 9212 |
+
var ieTryUp = function (bridge, caret) {
|
| 9213 |
+
return bridge.situsFromPoint(caret.left(), caret.top() - JUMP_SIZE);
|
| 9214 |
+
};
|
| 9215 |
+
var checkScroll = function (movement, adjusted, bridge) {
|
| 9216 |
+
if (movement.point(adjusted) > bridge.getInnerHeight())
|
| 9217 |
+
return Option.some(movement.point(adjusted) - bridge.getInnerHeight());
|
| 9218 |
+
else if (movement.point(adjusted) < 0)
|
| 9219 |
+
return Option.some(-movement.point(adjusted));
|
| 9220 |
+
else
|
| 9221 |
+
return Option.none();
|
| 9222 |
+
};
|
| 9223 |
+
var retry = function (movement, bridge, caret) {
|
| 9224 |
+
var moved = movement.move(caret, JUMP_SIZE);
|
| 9225 |
+
var adjusted = adjustTil(bridge, movement, caret, moved, NUM_RETRIES).getOr(moved);
|
| 9226 |
+
return checkScroll(movement, adjusted, bridge).fold(function () {
|
| 9227 |
+
return bridge.situsFromPoint(adjusted.left(), movement.point(adjusted));
|
| 9228 |
+
}, function (delta) {
|
| 9229 |
+
bridge.scrollBy(0, delta);
|
| 9230 |
+
return bridge.situsFromPoint(adjusted.left(), movement.point(adjusted) - delta);
|
| 9231 |
+
});
|
| 9232 |
+
};
|
| 9233 |
+
var $_efciv1pljfuw8r73 = {
|
| 9234 |
+
tryUp: $_20nfr6k7jfuw8q4g.curry(retry, upMovement),
|
| 9235 |
+
tryDown: $_20nfr6k7jfuw8q4g.curry(retry, downMovement),
|
| 9236 |
+
ieTryUp: ieTryUp,
|
| 9237 |
+
ieTryDown: ieTryDown,
|
| 9238 |
+
getJumpSize: $_20nfr6k7jfuw8q4g.constant(JUMP_SIZE)
|
| 9239 |
+
};
|
| 9240 |
+
|
| 9241 |
+
var adt$3 = $_7sbzam7jfuw8qgu.generate([
|
| 9242 |
+
{ 'none': ['message'] },
|
| 9243 |
+
{ 'success': [] },
|
| 9244 |
+
{ 'failedUp': ['cell'] },
|
| 9245 |
+
{ 'failedDown': ['cell'] }
|
| 9246 |
+
]);
|
| 9247 |
+
var isOverlapping = function (bridge, before, after) {
|
| 9248 |
+
var beforeBounds = bridge.getRect(before);
|
| 9249 |
+
var afterBounds = bridge.getRect(after);
|
| 9250 |
+
return afterBounds.right > beforeBounds.left && afterBounds.left < beforeBounds.right;
|
| 9251 |
+
};
|
| 9252 |
+
var verify = function (bridge, before, beforeOffset, after, afterOffset, failure, isRoot) {
|
| 9253 |
+
return $_8wdrbmlajfuw8q9m.closest(after, 'td,th', isRoot).bind(function (afterCell) {
|
| 9254 |
+
return $_8wdrbmlajfuw8q9m.closest(before, 'td,th', isRoot).map(function (beforeCell) {
|
| 9255 |
+
if (!$_e8rn66kojfuw8q7n.eq(afterCell, beforeCell)) {
|
| 9256 |
+
return $_583a2nlujfuw8qdw.sharedOne(isRow, [
|
| 9257 |
+
afterCell,
|
| 9258 |
+
beforeCell
|
| 9259 |
+
]).fold(function () {
|
| 9260 |
+
return isOverlapping(bridge, beforeCell, afterCell) ? adt$3.success() : failure(beforeCell);
|
| 9261 |
+
}, function (sharedRow) {
|
| 9262 |
+
return failure(beforeCell);
|
| 9263 |
+
});
|
| 9264 |
+
} else {
|
| 9265 |
+
return $_e8rn66kojfuw8q7n.eq(after, afterCell) && $_6vfowrlmjfuw8qbz.getEnd(afterCell) === afterOffset ? failure(beforeCell) : adt$3.none('in same cell');
|
| 9266 |
+
}
|
| 9267 |
+
});
|
| 9268 |
+
}).getOr(adt$3.none('default'));
|
| 9269 |
+
};
|
| 9270 |
+
var isRow = function (elem) {
|
| 9271 |
+
return $_8wdrbmlajfuw8q9m.closest(elem, 'tr');
|
| 9272 |
+
};
|
| 9273 |
+
var cata$2 = function (subject, onNone, onSuccess, onFailedUp, onFailedDown) {
|
| 9274 |
+
return subject.fold(onNone, onSuccess, onFailedUp, onFailedDown);
|
| 9275 |
+
};
|
| 9276 |
+
var $_25fydhprjfuw8r89 = {
|
| 9277 |
+
verify: verify,
|
| 9278 |
+
cata: cata$2,
|
| 9279 |
+
adt: adt$3
|
| 9280 |
+
};
|
| 9281 |
+
|
| 9282 |
+
var point = $_5now9kbjfuw8q5e.immutable('element', 'offset');
|
| 9283 |
+
var delta = $_5now9kbjfuw8q5e.immutable('element', 'deltaOffset');
|
| 9284 |
+
var range$3 = $_5now9kbjfuw8q5e.immutable('element', 'start', 'finish');
|
| 9285 |
+
var points = $_5now9kbjfuw8q5e.immutable('begin', 'end');
|
| 9286 |
+
var text = $_5now9kbjfuw8q5e.immutable('element', 'text');
|
| 9287 |
+
var $_1kct4uptjfuw8r98 = {
|
| 9288 |
+
point: point,
|
| 9289 |
+
delta: delta,
|
| 9290 |
+
range: range$3,
|
| 9291 |
+
points: points,
|
| 9292 |
+
text: text
|
| 9293 |
+
};
|
| 9294 |
+
|
| 9295 |
+
var inAncestor = $_5now9kbjfuw8q5e.immutable('ancestor', 'descendants', 'element', 'index');
|
| 9296 |
+
var inParent = $_5now9kbjfuw8q5e.immutable('parent', 'children', 'element', 'index');
|
| 9297 |
+
var childOf = function (element, ancestor) {
|
| 9298 |
+
return $_11ympzlbjfuw8q9n.closest(element, function (elem) {
|
| 9299 |
+
return $_s8scrkmjfuw8q7a.parent(elem).exists(function (parent) {
|
| 9300 |
+
return $_e8rn66kojfuw8q7n.eq(parent, ancestor);
|
| 9301 |
+
});
|
| 9302 |
+
});
|
| 9303 |
+
};
|
| 9304 |
+
var indexInParent = function (element) {
|
| 9305 |
+
return $_s8scrkmjfuw8q7a.parent(element).bind(function (parent) {
|
| 9306 |
+
var children = $_s8scrkmjfuw8q7a.children(parent);
|
| 9307 |
+
return indexOf$1(children, element).map(function (index) {
|
| 9308 |
+
return inParent(parent, children, element, index);
|
| 9309 |
+
});
|
| 9310 |
+
});
|
| 9311 |
+
};
|
| 9312 |
+
var indexOf$1 = function (elements, element) {
|
| 9313 |
+
return $_tyr3yk5jfuw8q47.findIndex(elements, $_20nfr6k7jfuw8q4g.curry($_e8rn66kojfuw8q7n.eq, element));
|
| 9314 |
+
};
|
| 9315 |
+
var selectorsInParent = function (element, selector) {
|
| 9316 |
+
return $_s8scrkmjfuw8q7a.parent(element).bind(function (parent) {
|
| 9317 |
+
var children = $_6c9d0hl7jfuw8q9d.children(parent, selector);
|
| 9318 |
+
return indexOf$1(children, element).map(function (index) {
|
| 9319 |
+
return inParent(parent, children, element, index);
|
| 9320 |
+
});
|
| 9321 |
+
});
|
| 9322 |
+
};
|
| 9323 |
+
var descendantsInAncestor = function (element, ancestorSelector, descendantSelector) {
|
| 9324 |
+
return $_8wdrbmlajfuw8q9m.closest(element, ancestorSelector).bind(function (ancestor) {
|
| 9325 |
+
var descendants = $_6c9d0hl7jfuw8q9d.descendants(ancestor, descendantSelector);
|
| 9326 |
+
return indexOf$1(descendants, element).map(function (index) {
|
| 9327 |
+
return inAncestor(ancestor, descendants, element, index);
|
| 9328 |
+
});
|
| 9329 |
+
});
|
| 9330 |
+
};
|
| 9331 |
+
var $_cz3gbvpujfuw8r9c = {
|
| 9332 |
+
childOf: childOf,
|
| 9333 |
+
indexOf: indexOf$1,
|
| 9334 |
+
indexInParent: indexInParent,
|
| 9335 |
+
selectorsInParent: selectorsInParent,
|
| 9336 |
+
descendantsInAncestor: descendantsInAncestor
|
| 9337 |
+
};
|
| 9338 |
+
|
| 9339 |
+
var isBr = function (elem) {
|
| 9340 |
+
return $_a8gk30l6jfuw8q9c.name(elem) === 'br';
|
| 9341 |
+
};
|
| 9342 |
+
var gatherer = function (cand, gather, isRoot) {
|
| 9343 |
+
return gather(cand, isRoot).bind(function (target) {
|
| 9344 |
+
return $_a8gk30l6jfuw8q9c.isText(target) && $_6j8y7blnjfuw8qc3.get(target).trim().length === 0 ? gatherer(target, gather, isRoot) : Option.some(target);
|
| 9345 |
+
});
|
| 9346 |
+
};
|
| 9347 |
+
var handleBr = function (isRoot, element, direction) {
|
| 9348 |
+
return direction.traverse(element).orThunk(function () {
|
| 9349 |
+
return gatherer(element, direction.gather, isRoot);
|
| 9350 |
+
}).map(direction.relative);
|
| 9351 |
+
};
|
| 9352 |
+
var findBr = function (element, offset) {
|
| 9353 |
+
return $_s8scrkmjfuw8q7a.child(element, offset).filter(isBr).orThunk(function () {
|
| 9354 |
+
return $_s8scrkmjfuw8q7a.child(element, offset - 1).filter(isBr);
|
| 9355 |
+
});
|
| 9356 |
+
};
|
| 9357 |
+
var handleParent = function (isRoot, element, offset, direction) {
|
| 9358 |
+
return findBr(element, offset).bind(function (br) {
|
| 9359 |
+
return direction.traverse(br).fold(function () {
|
| 9360 |
+
return gatherer(br, direction.gather, isRoot).map(direction.relative);
|
| 9361 |
+
}, function (adjacent) {
|
| 9362 |
+
return $_cz3gbvpujfuw8r9c.indexInParent(adjacent).map(function (info) {
|
| 9363 |
+
return $_cuk0n0ovjfuw8r0r.on(info.parent(), info.index());
|
| 9364 |
+
});
|
| 9365 |
+
});
|
| 9366 |
+
});
|
| 9367 |
+
};
|
| 9368 |
+
var tryBr = function (isRoot, element, offset, direction) {
|
| 9369 |
+
var target = isBr(element) ? handleBr(isRoot, element, direction) : handleParent(isRoot, element, offset, direction);
|
| 9370 |
+
return target.map(function (tgt) {
|
| 9371 |
+
return {
|
| 9372 |
+
start: $_20nfr6k7jfuw8q4g.constant(tgt),
|
| 9373 |
+
finish: $_20nfr6k7jfuw8q4g.constant(tgt)
|
| 9374 |
+
};
|
| 9375 |
+
});
|
| 9376 |
+
};
|
| 9377 |
+
var process = function (analysis) {
|
| 9378 |
+
return $_25fydhprjfuw8r89.cata(analysis, function (message) {
|
| 9379 |
+
return Option.none();
|
| 9380 |
+
}, function () {
|
| 9381 |
+
return Option.none();
|
| 9382 |
+
}, function (cell) {
|
| 9383 |
+
return Option.some($_1kct4uptjfuw8r98.point(cell, 0));
|
| 9384 |
+
}, function (cell) {
|
| 9385 |
+
return Option.some($_1kct4uptjfuw8r98.point(cell, $_6vfowrlmjfuw8qbz.getEnd(cell)));
|
| 9386 |
+
});
|
| 9387 |
+
};
|
| 9388 |
+
var $_62az2spsjfuw8r8p = {
|
| 9389 |
+
tryBr: tryBr,
|
| 9390 |
+
process: process
|
| 9391 |
+
};
|
| 9392 |
+
|
| 9393 |
+
var MAX_RETRIES = 20;
|
| 9394 |
+
var platform$1 = $_fqgee0ktjfuw8q83.detect();
|
| 9395 |
+
var findSpot = function (bridge, isRoot, direction) {
|
| 9396 |
+
return bridge.getSelection().bind(function (sel) {
|
| 9397 |
+
return $_62az2spsjfuw8r8p.tryBr(isRoot, sel.finish(), sel.foffset(), direction).fold(function () {
|
| 9398 |
+
return Option.some($_1kct4uptjfuw8r98.point(sel.finish(), sel.foffset()));
|
| 9399 |
+
}, function (brNeighbour) {
|
| 9400 |
+
var range = bridge.fromSitus(brNeighbour);
|
| 9401 |
+
var analysis = $_25fydhprjfuw8r89.verify(bridge, sel.finish(), sel.foffset(), range.finish(), range.foffset(), direction.failure, isRoot);
|
| 9402 |
+
return $_62az2spsjfuw8r8p.process(analysis);
|
| 9403 |
+
});
|
| 9404 |
+
});
|
| 9405 |
+
};
|
| 9406 |
+
var scan = function (bridge, isRoot, element, offset, direction, numRetries) {
|
| 9407 |
+
if (numRetries === 0)
|
| 9408 |
+
return Option.none();
|
| 9409 |
+
return tryCursor(bridge, isRoot, element, offset, direction).bind(function (situs) {
|
| 9410 |
+
var range = bridge.fromSitus(situs);
|
| 9411 |
+
var analysis = $_25fydhprjfuw8r89.verify(bridge, element, offset, range.finish(), range.foffset(), direction.failure, isRoot);
|
| 9412 |
+
return $_25fydhprjfuw8r89.cata(analysis, function () {
|
| 9413 |
+
return Option.none();
|
| 9414 |
+
}, function () {
|
| 9415 |
+
return Option.some(situs);
|
| 9416 |
+
}, function (cell) {
|
| 9417 |
+
if ($_e8rn66kojfuw8q7n.eq(element, cell) && offset === 0)
|
| 9418 |
+
return tryAgain(bridge, element, offset, $_37xezepjjfuw8r6q.moveUp, direction);
|
| 9419 |
+
else
|
| 9420 |
+
return scan(bridge, isRoot, cell, 0, direction, numRetries - 1);
|
| 9421 |
+
}, function (cell) {
|
| 9422 |
+
if ($_e8rn66kojfuw8q7n.eq(element, cell) && offset === $_6vfowrlmjfuw8qbz.getEnd(cell))
|
| 9423 |
+
return tryAgain(bridge, element, offset, $_37xezepjjfuw8r6q.moveDown, direction);
|
| 9424 |
+
else
|
| 9425 |
+
return scan(bridge, isRoot, cell, $_6vfowrlmjfuw8qbz.getEnd(cell), direction, numRetries - 1);
|
| 9426 |
+
});
|
| 9427 |
+
});
|
| 9428 |
+
};
|
| 9429 |
+
var tryAgain = function (bridge, element, offset, move, direction) {
|
| 9430 |
+
return $_8xl6tpkjfuw8r6u.getBoxAt(bridge, element, offset).bind(function (box) {
|
| 9431 |
+
return tryAt(bridge, direction, move(box, $_efciv1pljfuw8r73.getJumpSize()));
|
| 9432 |
+
});
|
| 9433 |
+
};
|
| 9434 |
+
var tryAt = function (bridge, direction, box) {
|
| 9435 |
+
if (platform$1.browser.isChrome() || platform$1.browser.isSafari() || platform$1.browser.isFirefox() || platform$1.browser.isEdge())
|
| 9436 |
+
return direction.otherRetry(bridge, box);
|
| 9437 |
+
else if (platform$1.browser.isIE())
|
| 9438 |
+
return direction.ieRetry(bridge, box);
|
| 9439 |
+
else
|
| 9440 |
+
return Option.none();
|
| 9441 |
+
};
|
| 9442 |
+
var tryCursor = function (bridge, isRoot, element, offset, direction) {
|
| 9443 |
+
return $_8xl6tpkjfuw8r6u.getBoxAt(bridge, element, offset).bind(function (box) {
|
| 9444 |
+
return tryAt(bridge, direction, box);
|
| 9445 |
+
});
|
| 9446 |
+
};
|
| 9447 |
+
var handle$2 = function (bridge, isRoot, direction) {
|
| 9448 |
+
return findSpot(bridge, isRoot, direction).bind(function (spot) {
|
| 9449 |
+
return scan(bridge, isRoot, spot.element(), spot.offset(), direction, MAX_RETRIES).map(bridge.fromSitus);
|
| 9450 |
+
});
|
| 9451 |
+
};
|
| 9452 |
+
var $_fxzqelpijfuw8r6a = { handle: handle$2 };
|
| 9453 |
+
|
| 9454 |
+
var any$1 = function (predicate) {
|
| 9455 |
+
return $_11ympzlbjfuw8q9n.first(predicate).isSome();
|
| 9456 |
+
};
|
| 9457 |
+
var ancestor$3 = function (scope, predicate, isRoot) {
|
| 9458 |
+
return $_11ympzlbjfuw8q9n.ancestor(scope, predicate, isRoot).isSome();
|
| 9459 |
+
};
|
| 9460 |
+
var closest$3 = function (scope, predicate, isRoot) {
|
| 9461 |
+
return $_11ympzlbjfuw8q9n.closest(scope, predicate, isRoot).isSome();
|
| 9462 |
+
};
|
| 9463 |
+
var sibling$3 = function (scope, predicate) {
|
| 9464 |
+
return $_11ympzlbjfuw8q9n.sibling(scope, predicate).isSome();
|
| 9465 |
+
};
|
| 9466 |
+
var child$4 = function (scope, predicate) {
|
| 9467 |
+
return $_11ympzlbjfuw8q9n.child(scope, predicate).isSome();
|
| 9468 |
+
};
|
| 9469 |
+
var descendant$3 = function (scope, predicate) {
|
| 9470 |
+
return $_11ympzlbjfuw8q9n.descendant(scope, predicate).isSome();
|
| 9471 |
+
};
|
| 9472 |
+
var $_cs6t5xpvjfuw8r9l = {
|
| 9473 |
+
any: any$1,
|
| 9474 |
+
ancestor: ancestor$3,
|
| 9475 |
+
closest: closest$3,
|
| 9476 |
+
sibling: sibling$3,
|
| 9477 |
+
child: child$4,
|
| 9478 |
+
descendant: descendant$3
|
| 9479 |
+
};
|
| 9480 |
+
|
| 9481 |
+
var detection = $_fqgee0ktjfuw8q83.detect();
|
| 9482 |
+
var inSameTable = function (elem, table) {
|
| 9483 |
+
return $_cs6t5xpvjfuw8r9l.ancestor(elem, function (e) {
|
| 9484 |
+
return $_s8scrkmjfuw8q7a.parent(e).exists(function (p) {
|
| 9485 |
+
return $_e8rn66kojfuw8q7n.eq(p, table);
|
| 9486 |
+
});
|
| 9487 |
+
});
|
| 9488 |
+
};
|
| 9489 |
+
var simulate = function (bridge, isRoot, direction, initial, anchor) {
|
| 9490 |
+
return $_8wdrbmlajfuw8q9m.closest(initial, 'td,th', isRoot).bind(function (start) {
|
| 9491 |
+
return $_8wdrbmlajfuw8q9m.closest(start, 'table', isRoot).bind(function (table) {
|
| 9492 |
+
if (!inSameTable(anchor, table))
|
| 9493 |
+
return Option.none();
|
| 9494 |
+
return $_fxzqelpijfuw8r6a.handle(bridge, isRoot, direction).bind(function (range) {
|
| 9495 |
+
return $_8wdrbmlajfuw8q9m.closest(range.finish(), 'td,th', isRoot).map(function (finish) {
|
| 9496 |
+
return {
|
| 9497 |
+
start: $_20nfr6k7jfuw8q4g.constant(start),
|
| 9498 |
+
finish: $_20nfr6k7jfuw8q4g.constant(finish),
|
| 9499 |
+
range: $_20nfr6k7jfuw8q4g.constant(range)
|
| 9500 |
+
};
|
| 9501 |
+
});
|
| 9502 |
+
});
|
| 9503 |
+
});
|
| 9504 |
+
});
|
| 9505 |
+
};
|
| 9506 |
+
var navigate = function (bridge, isRoot, direction, initial, anchor, precheck) {
|
| 9507 |
+
if (detection.browser.isIE()) {
|
| 9508 |
+
return Option.none();
|
| 9509 |
+
} else {
|
| 9510 |
+
return precheck(initial, isRoot).orThunk(function () {
|
| 9511 |
+
return simulate(bridge, isRoot, direction, initial, anchor).map(function (info) {
|
| 9512 |
+
var range = info.range();
|
| 9513 |
+
return $_b7ap4hpbjfuw8r3x.response(Option.some($_81eh29pejfuw8r4k.makeSitus(range.start(), range.soffset(), range.finish(), range.foffset())), true);
|
| 9514 |
+
});
|
| 9515 |
+
});
|
| 9516 |
+
}
|
| 9517 |
+
};
|
| 9518 |
+
var firstUpCheck = function (initial, isRoot) {
|
| 9519 |
+
return $_8wdrbmlajfuw8q9m.closest(initial, 'tr', isRoot).bind(function (startRow) {
|
| 9520 |
+
return $_8wdrbmlajfuw8q9m.closest(startRow, 'table', isRoot).bind(function (table) {
|
| 9521 |
+
var rows = $_6c9d0hl7jfuw8q9d.descendants(table, 'tr');
|
| 9522 |
+
if ($_e8rn66kojfuw8q7n.eq(startRow, rows[0])) {
|
| 9523 |
+
return $_fgafb6pmjfuw8r7l.seekLeft(table, function (element) {
|
| 9524 |
+
return $_ejrzj4lljfuw8qbw.last(element).isSome();
|
| 9525 |
+
}, isRoot).map(function (last) {
|
| 9526 |
+
var lastOffset = $_6vfowrlmjfuw8qbz.getEnd(last);
|
| 9527 |
+
return $_b7ap4hpbjfuw8r3x.response(Option.some($_81eh29pejfuw8r4k.makeSitus(last, lastOffset, last, lastOffset)), true);
|
| 9528 |
+
});
|
| 9529 |
+
} else {
|
| 9530 |
+
return Option.none();
|
| 9531 |
+
}
|
| 9532 |
+
});
|
| 9533 |
+
});
|
| 9534 |
+
};
|
| 9535 |
+
var lastDownCheck = function (initial, isRoot) {
|
| 9536 |
+
return $_8wdrbmlajfuw8q9m.closest(initial, 'tr', isRoot).bind(function (startRow) {
|
| 9537 |
+
return $_8wdrbmlajfuw8q9m.closest(startRow, 'table', isRoot).bind(function (table) {
|
| 9538 |
+
var rows = $_6c9d0hl7jfuw8q9d.descendants(table, 'tr');
|
| 9539 |
+
if ($_e8rn66kojfuw8q7n.eq(startRow, rows[rows.length - 1])) {
|
| 9540 |
+
return $_fgafb6pmjfuw8r7l.seekRight(table, function (element) {
|
| 9541 |
+
return $_ejrzj4lljfuw8qbw.first(element).isSome();
|
| 9542 |
+
}, isRoot).map(function (first) {
|
| 9543 |
+
return $_b7ap4hpbjfuw8r3x.response(Option.some($_81eh29pejfuw8r4k.makeSitus(first, 0, first, 0)), true);
|
| 9544 |
+
});
|
| 9545 |
+
} else {
|
| 9546 |
+
return Option.none();
|
| 9547 |
+
}
|
| 9548 |
+
});
|
| 9549 |
+
});
|
| 9550 |
+
};
|
| 9551 |
+
var select = function (bridge, container, isRoot, direction, initial, anchor, selectRange) {
|
| 9552 |
+
return simulate(bridge, isRoot, direction, initial, anchor).bind(function (info) {
|
| 9553 |
+
return $_7ulhzpgjfuw8r5b.detect(container, isRoot, info.start(), info.finish(), selectRange);
|
| 9554 |
+
});
|
| 9555 |
+
};
|
| 9556 |
+
var $_4f08xvphjfuw8r5l = {
|
| 9557 |
+
navigate: navigate,
|
| 9558 |
+
select: select,
|
| 9559 |
+
firstUpCheck: firstUpCheck,
|
| 9560 |
+
lastDownCheck: lastDownCheck
|
| 9561 |
+
};
|
| 9562 |
+
|
| 9563 |
+
var findCell = function (target, isRoot) {
|
| 9564 |
+
return $_8wdrbmlajfuw8q9m.closest(target, 'td,th', isRoot);
|
| 9565 |
+
};
|
| 9566 |
+
function MouseSelection (bridge, container, isRoot, annotations) {
|
| 9567 |
+
var cursor = Option.none();
|
| 9568 |
+
var clearState = function () {
|
| 9569 |
+
cursor = Option.none();
|
| 9570 |
+
};
|
| 9571 |
+
var mousedown = function (event) {
|
| 9572 |
+
annotations.clear(container);
|
| 9573 |
+
cursor = findCell(event.target(), isRoot);
|
| 9574 |
+
};
|
| 9575 |
+
var mouseover = function (event) {
|
| 9576 |
+
cursor.each(function (start) {
|
| 9577 |
+
annotations.clear(container);
|
| 9578 |
+
findCell(event.target(), isRoot).each(function (finish) {
|
| 9579 |
+
$_dpd405ltjfuw8qd8.identify(start, finish, isRoot).each(function (cellSel) {
|
| 9580 |
+
var boxes = cellSel.boxes().getOr([]);
|
| 9581 |
+
if (boxes.length > 1 || boxes.length === 1 && !$_e8rn66kojfuw8q7n.eq(start, finish)) {
|
| 9582 |
+
annotations.selectRange(container, boxes, cellSel.start(), cellSel.finish());
|
| 9583 |
+
bridge.selectContents(finish);
|
| 9584 |
+
}
|
| 9585 |
+
});
|
| 9586 |
+
});
|
| 9587 |
+
});
|
| 9588 |
+
};
|
| 9589 |
+
var mouseup = function () {
|
| 9590 |
+
cursor.each(clearState);
|
| 9591 |
+
};
|
| 9592 |
+
return {
|
| 9593 |
+
mousedown: mousedown,
|
| 9594 |
+
mouseover: mouseover,
|
| 9595 |
+
mouseup: mouseup
|
| 9596 |
+
};
|
| 9597 |
+
}
|
| 9598 |
+
|
| 9599 |
+
var $_9alrp8pxjfuw8r9w = {
|
| 9600 |
+
down: {
|
| 9601 |
+
traverse: $_s8scrkmjfuw8q7a.nextSibling,
|
| 9602 |
+
gather: $_fgafb6pmjfuw8r7l.after,
|
| 9603 |
+
relative: $_cuk0n0ovjfuw8r0r.before,
|
| 9604 |
+
otherRetry: $_efciv1pljfuw8r73.tryDown,
|
| 9605 |
+
ieRetry: $_efciv1pljfuw8r73.ieTryDown,
|
| 9606 |
+
failure: $_25fydhprjfuw8r89.adt.failedDown
|
| 9607 |
+
},
|
| 9608 |
+
up: {
|
| 9609 |
+
traverse: $_s8scrkmjfuw8q7a.prevSibling,
|
| 9610 |
+
gather: $_fgafb6pmjfuw8r7l.before,
|
| 9611 |
+
relative: $_cuk0n0ovjfuw8r0r.before,
|
| 9612 |
+
otherRetry: $_efciv1pljfuw8r73.tryUp,
|
| 9613 |
+
ieRetry: $_efciv1pljfuw8r73.ieTryUp,
|
| 9614 |
+
failure: $_25fydhprjfuw8r89.adt.failedUp
|
| 9615 |
+
}
|
| 9616 |
+
};
|
| 9617 |
+
|
| 9618 |
+
var rc = $_5now9kbjfuw8q5e.immutable('rows', 'cols');
|
| 9619 |
+
var mouse = function (win, container, isRoot, annotations) {
|
| 9620 |
+
var bridge = WindowBridge(win);
|
| 9621 |
+
var handlers = MouseSelection(bridge, container, isRoot, annotations);
|
| 9622 |
+
return {
|
| 9623 |
+
mousedown: handlers.mousedown,
|
| 9624 |
+
mouseover: handlers.mouseover,
|
| 9625 |
+
mouseup: handlers.mouseup
|
| 9626 |
+
};
|
| 9627 |
+
};
|
| 9628 |
+
var keyboard = function (win, container, isRoot, annotations) {
|
| 9629 |
+
var bridge = WindowBridge(win);
|
| 9630 |
+
var clearToNavigate = function () {
|
| 9631 |
+
annotations.clear(container);
|
| 9632 |
+
return Option.none();
|
| 9633 |
+
};
|
| 9634 |
+
var keydown = function (event, start, soffset, finish, foffset, direction) {
|
| 9635 |
+
var keycode = event.raw().which;
|
| 9636 |
+
var shiftKey = event.raw().shiftKey === true;
|
| 9637 |
+
var handler = $_dpd405ltjfuw8qd8.retrieve(container, annotations.selectedSelector()).fold(function () {
|
| 9638 |
+
if ($_9n04otpcjfuw8r40.isDown(keycode) && shiftKey) {
|
| 9639 |
+
return $_20nfr6k7jfuw8q4g.curry($_4f08xvphjfuw8r5l.select, bridge, container, isRoot, $_9alrp8pxjfuw8r9w.down, finish, start, annotations.selectRange);
|
| 9640 |
+
} else if ($_9n04otpcjfuw8r40.isUp(keycode) && shiftKey) {
|
| 9641 |
+
return $_20nfr6k7jfuw8q4g.curry($_4f08xvphjfuw8r5l.select, bridge, container, isRoot, $_9alrp8pxjfuw8r9w.up, finish, start, annotations.selectRange);
|
| 9642 |
+
} else if ($_9n04otpcjfuw8r40.isDown(keycode)) {
|
| 9643 |
+
return $_20nfr6k7jfuw8q4g.curry($_4f08xvphjfuw8r5l.navigate, bridge, isRoot, $_9alrp8pxjfuw8r9w.down, finish, start, $_4f08xvphjfuw8r5l.lastDownCheck);
|
| 9644 |
+
} else if ($_9n04otpcjfuw8r40.isUp(keycode)) {
|
| 9645 |
+
return $_20nfr6k7jfuw8q4g.curry($_4f08xvphjfuw8r5l.navigate, bridge, isRoot, $_9alrp8pxjfuw8r9w.up, finish, start, $_4f08xvphjfuw8r5l.firstUpCheck);
|
| 9646 |
+
} else {
|
| 9647 |
+
return Option.none;
|
| 9648 |
+
}
|
| 9649 |
+
}, function (selected) {
|
| 9650 |
+
var update = function (attempts) {
|
| 9651 |
+
return function () {
|
| 9652 |
+
var navigation = $_cul8qomvjfuw8qm7.findMap(attempts, function (delta) {
|
| 9653 |
+
return $_7ulhzpgjfuw8r5b.update(delta.rows(), delta.cols(), container, selected, annotations);
|
| 9654 |
+
});
|
| 9655 |
+
return navigation.fold(function () {
|
| 9656 |
+
return $_dpd405ltjfuw8qd8.getEdges(container, annotations.firstSelectedSelector(), annotations.lastSelectedSelector()).map(function (edges) {
|
| 9657 |
+
var relative = $_9n04otpcjfuw8r40.isDown(keycode) || direction.isForward(keycode) ? $_cuk0n0ovjfuw8r0r.after : $_cuk0n0ovjfuw8r0r.before;
|
| 9658 |
+
bridge.setRelativeSelection($_cuk0n0ovjfuw8r0r.on(edges.first(), 0), relative(edges.table()));
|
| 9659 |
+
annotations.clear(container);
|
| 9660 |
+
return $_b7ap4hpbjfuw8r3x.response(Option.none(), true);
|
| 9661 |
+
});
|
| 9662 |
+
}, function (_) {
|
| 9663 |
+
return Option.some($_b7ap4hpbjfuw8r3x.response(Option.none(), true));
|
| 9664 |
+
});
|
| 9665 |
+
};
|
| 9666 |
+
};
|
| 9667 |
+
if ($_9n04otpcjfuw8r40.isDown(keycode) && shiftKey)
|
| 9668 |
+
return update([rc(+1, 0)]);
|
| 9669 |
+
else if ($_9n04otpcjfuw8r40.isUp(keycode) && shiftKey)
|
| 9670 |
+
return update([rc(-1, 0)]);
|
| 9671 |
+
else if (direction.isBackward(keycode) && shiftKey)
|
| 9672 |
+
return update([
|
| 9673 |
+
rc(0, -1),
|
| 9674 |
+
rc(-1, 0)
|
| 9675 |
+
]);
|
| 9676 |
+
else if (direction.isForward(keycode) && shiftKey)
|
| 9677 |
+
return update([
|
| 9678 |
+
rc(0, +1),
|
| 9679 |
+
rc(+1, 0)
|
| 9680 |
+
]);
|
| 9681 |
+
else if ($_9n04otpcjfuw8r40.isNavigation(keycode) && shiftKey === false)
|
| 9682 |
+
return clearToNavigate;
|
| 9683 |
+
else
|
| 9684 |
+
return Option.none;
|
| 9685 |
+
});
|
| 9686 |
+
return handler();
|
| 9687 |
+
};
|
| 9688 |
+
var keyup = function (event, start, soffset, finish, foffset) {
|
| 9689 |
+
return $_dpd405ltjfuw8qd8.retrieve(container, annotations.selectedSelector()).fold(function () {
|
| 9690 |
+
var keycode = event.raw().which;
|
| 9691 |
+
var shiftKey = event.raw().shiftKey === true;
|
| 9692 |
+
if (shiftKey === false)
|
| 9693 |
+
return Option.none();
|
| 9694 |
+
if ($_9n04otpcjfuw8r40.isNavigation(keycode))
|
| 9695 |
+
return $_7ulhzpgjfuw8r5b.sync(container, isRoot, start, soffset, finish, foffset, annotations.selectRange);
|
| 9696 |
+
else
|
| 9697 |
+
return Option.none();
|
| 9698 |
+
}, Option.none);
|
| 9699 |
+
};
|
| 9700 |
+
return {
|
| 9701 |
+
keydown: keydown,
|
| 9702 |
+
keyup: keyup
|
| 9703 |
+
};
|
| 9704 |
+
};
|
| 9705 |
+
var $_ev8thhpajfuw8r3k = {
|
| 9706 |
+
mouse: mouse,
|
| 9707 |
+
keyboard: keyboard
|
| 9708 |
+
};
|
| 9709 |
+
|
| 9710 |
+
var add$3 = function (element, classes) {
|
| 9711 |
+
$_tyr3yk5jfuw8q47.each(classes, function (x) {
|
| 9712 |
+
$_fmcseon6jfuw8qou.add(element, x);
|
| 9713 |
+
});
|
| 9714 |
+
};
|
| 9715 |
+
var remove$7 = function (element, classes) {
|
| 9716 |
+
$_tyr3yk5jfuw8q47.each(classes, function (x) {
|
| 9717 |
+
$_fmcseon6jfuw8qou.remove(element, x);
|
| 9718 |
+
});
|
| 9719 |
+
};
|
| 9720 |
+
var toggle$2 = function (element, classes) {
|
| 9721 |
+
$_tyr3yk5jfuw8q47.each(classes, function (x) {
|
| 9722 |
+
$_fmcseon6jfuw8qou.toggle(element, x);
|
| 9723 |
+
});
|
| 9724 |
+
};
|
| 9725 |
+
var hasAll = function (element, classes) {
|
| 9726 |
+
return $_tyr3yk5jfuw8q47.forall(classes, function (clazz) {
|
| 9727 |
+
return $_fmcseon6jfuw8qou.has(element, clazz);
|
| 9728 |
+
});
|
| 9729 |
+
};
|
| 9730 |
+
var hasAny = function (element, classes) {
|
| 9731 |
+
return $_tyr3yk5jfuw8q47.exists(classes, function (clazz) {
|
| 9732 |
+
return $_fmcseon6jfuw8qou.has(element, clazz);
|
| 9733 |
+
});
|
| 9734 |
+
};
|
| 9735 |
+
var getNative = function (element) {
|
| 9736 |
+
var classList = element.dom().classList;
|
| 9737 |
+
var r = new Array(classList.length);
|
| 9738 |
+
for (var i = 0; i < classList.length; i++) {
|
| 9739 |
+
r[i] = classList.item(i);
|
| 9740 |
+
}
|
| 9741 |
+
return r;
|
| 9742 |
+
};
|
| 9743 |
+
var get$11 = function (element) {
|
| 9744 |
+
return $_f4rpvun8jfuw8qox.supports(element) ? getNative(element) : $_f4rpvun8jfuw8qox.get(element);
|
| 9745 |
+
};
|
| 9746 |
+
var $_6cu9bpq0jfuw8ram = {
|
| 9747 |
+
add: add$3,
|
| 9748 |
+
remove: remove$7,
|
| 9749 |
+
toggle: toggle$2,
|
| 9750 |
+
hasAll: hasAll,
|
| 9751 |
+
hasAny: hasAny,
|
| 9752 |
+
get: get$11
|
| 9753 |
+
};
|
| 9754 |
+
|
| 9755 |
+
var addClass = function (clazz) {
|
| 9756 |
+
return function (element) {
|
| 9757 |
+
$_fmcseon6jfuw8qou.add(element, clazz);
|
| 9758 |
+
};
|
| 9759 |
+
};
|
| 9760 |
+
var removeClass = function (clazz) {
|
| 9761 |
+
return function (element) {
|
| 9762 |
+
$_fmcseon6jfuw8qou.remove(element, clazz);
|
| 9763 |
+
};
|
| 9764 |
+
};
|
| 9765 |
+
var removeClasses = function (classes) {
|
| 9766 |
+
return function (element) {
|
| 9767 |
+
$_6cu9bpq0jfuw8ram.remove(element, classes);
|
| 9768 |
+
};
|
| 9769 |
+
};
|
| 9770 |
+
var hasClass = function (clazz) {
|
| 9771 |
+
return function (element) {
|
| 9772 |
+
return $_fmcseon6jfuw8qou.has(element, clazz);
|
| 9773 |
+
};
|
| 9774 |
+
};
|
| 9775 |
+
var $_5za372pzjfuw8rak = {
|
| 9776 |
+
addClass: addClass,
|
| 9777 |
+
removeClass: removeClass,
|
| 9778 |
+
removeClasses: removeClasses,
|
| 9779 |
+
hasClass: hasClass
|
| 9780 |
+
};
|
| 9781 |
+
|
| 9782 |
+
var byClass = function (ephemera) {
|
| 9783 |
+
var addSelectionClass = $_5za372pzjfuw8rak.addClass(ephemera.selected());
|
| 9784 |
+
var removeSelectionClasses = $_5za372pzjfuw8rak.removeClasses([
|
| 9785 |
+
ephemera.selected(),
|
| 9786 |
+
ephemera.lastSelected(),
|
| 9787 |
+
ephemera.firstSelected()
|
| 9788 |
+
]);
|
| 9789 |
+
var clear = function (container) {
|
| 9790 |
+
var sels = $_6c9d0hl7jfuw8q9d.descendants(container, ephemera.selectedSelector());
|
| 9791 |
+
$_tyr3yk5jfuw8q47.each(sels, removeSelectionClasses);
|
| 9792 |
+
};
|
| 9793 |
+
var selectRange = function (container, cells, start, finish) {
|
| 9794 |
+
clear(container);
|
| 9795 |
+
$_tyr3yk5jfuw8q47.each(cells, addSelectionClass);
|
| 9796 |
+
$_fmcseon6jfuw8qou.add(start, ephemera.firstSelected());
|
| 9797 |
+
$_fmcseon6jfuw8qou.add(finish, ephemera.lastSelected());
|
| 9798 |
+
};
|
| 9799 |
+
return {
|
| 9800 |
+
clear: clear,
|
| 9801 |
+
selectRange: selectRange,
|
| 9802 |
+
selectedSelector: ephemera.selectedSelector,
|
| 9803 |
+
firstSelectedSelector: ephemera.firstSelectedSelector,
|
| 9804 |
+
lastSelectedSelector: ephemera.lastSelectedSelector
|
| 9805 |
+
};
|
| 9806 |
+
};
|
| 9807 |
+
var byAttr = function (ephemera) {
|
| 9808 |
+
var removeSelectionAttributes = function (element) {
|
| 9809 |
+
$_3q82t2l5jfuw8q93.remove(element, ephemera.selected());
|
| 9810 |
+
$_3q82t2l5jfuw8q93.remove(element, ephemera.firstSelected());
|
| 9811 |
+
$_3q82t2l5jfuw8q93.remove(element, ephemera.lastSelected());
|
| 9812 |
+
};
|
| 9813 |
+
var addSelectionAttribute = function (element) {
|
| 9814 |
+
$_3q82t2l5jfuw8q93.set(element, ephemera.selected(), '1');
|
| 9815 |
+
};
|
| 9816 |
+
var clear = function (container) {
|
| 9817 |
+
var sels = $_6c9d0hl7jfuw8q9d.descendants(container, ephemera.selectedSelector());
|
| 9818 |
+
$_tyr3yk5jfuw8q47.each(sels, removeSelectionAttributes);
|
| 9819 |
+
};
|
| 9820 |
+
var selectRange = function (container, cells, start, finish) {
|
| 9821 |
+
clear(container);
|
| 9822 |
+
$_tyr3yk5jfuw8q47.each(cells, addSelectionAttribute);
|
| 9823 |
+
$_3q82t2l5jfuw8q93.set(start, ephemera.firstSelected(), '1');
|
| 9824 |
+
$_3q82t2l5jfuw8q93.set(finish, ephemera.lastSelected(), '1');
|
| 9825 |
+
};
|
| 9826 |
+
return {
|
| 9827 |
+
clear: clear,
|
| 9828 |
+
selectRange: selectRange,
|
| 9829 |
+
selectedSelector: ephemera.selectedSelector,
|
| 9830 |
+
firstSelectedSelector: ephemera.firstSelectedSelector,
|
| 9831 |
+
lastSelectedSelector: ephemera.lastSelectedSelector
|
| 9832 |
+
};
|
| 9833 |
+
};
|
| 9834 |
+
var $_21uhbjpyjfuw8ra4 = {
|
| 9835 |
+
byClass: byClass,
|
| 9836 |
+
byAttr: byAttr
|
| 9837 |
+
};
|
| 9838 |
+
|
| 9839 |
+
function CellSelection$1 (editor, lazyResize) {
|
| 9840 |
+
var handlerStruct = $_5now9kbjfuw8q5e.immutableBag([
|
| 9841 |
+
'mousedown',
|
| 9842 |
+
'mouseover',
|
| 9843 |
+
'mouseup',
|
| 9844 |
+
'keyup',
|
| 9845 |
+
'keydown'
|
| 9846 |
+
], []);
|
| 9847 |
+
var handlers = Option.none();
|
| 9848 |
+
var annotations = $_21uhbjpyjfuw8ra4.byAttr($_f8tr2nm5jfuw8qgp);
|
| 9849 |
+
editor.on('init', function (e) {
|
| 9850 |
+
var win = editor.getWin();
|
| 9851 |
+
var body = $_5xkhf2nnjfuw8qrq.getBody(editor);
|
| 9852 |
+
var isRoot = $_5xkhf2nnjfuw8qrq.getIsRoot(editor);
|
| 9853 |
+
var syncSelection = function () {
|
| 9854 |
+
var sel = editor.selection;
|
| 9855 |
+
var start = $_xbeoqkkjfuw8q73.fromDom(sel.getStart());
|
| 9856 |
+
var end = $_xbeoqkkjfuw8q73.fromDom(sel.getEnd());
|
| 9857 |
+
var startTable = $_aqhz9okhjfuw8q5y.table(start);
|
| 9858 |
+
var endTable = $_aqhz9okhjfuw8q5y.table(end);
|
| 9859 |
+
var sameTable = startTable.bind(function (tableStart) {
|
| 9860 |
+
return endTable.bind(function (tableEnd) {
|
| 9861 |
+
return $_e8rn66kojfuw8q7n.eq(tableStart, tableEnd) ? Option.some(true) : Option.none();
|
| 9862 |
+
});
|
| 9863 |
+
});
|
| 9864 |
+
sameTable.fold(function () {
|
| 9865 |
+
annotations.clear(body);
|
| 9866 |
+
}, $_20nfr6k7jfuw8q4g.noop);
|
| 9867 |
+
};
|
| 9868 |
+
var mouseHandlers = $_ev8thhpajfuw8r3k.mouse(win, body, isRoot, annotations);
|
| 9869 |
+
var keyHandlers = $_ev8thhpajfuw8r3k.keyboard(win, body, isRoot, annotations);
|
| 9870 |
+
var hasShiftKey = function (event) {
|
| 9871 |
+
return event.raw().shiftKey === true;
|
| 9872 |
+
};
|
| 9873 |
+
var handleResponse = function (event, response) {
|
| 9874 |
+
if (!hasShiftKey(event)) {
|
| 9875 |
+
return;
|
| 9876 |
+
}
|
| 9877 |
+
if (response.kill()) {
|
| 9878 |
+
event.kill();
|
| 9879 |
+
}
|
| 9880 |
+
response.selection().each(function (ns) {
|
| 9881 |
+
var relative = $_bv1jwpoujfuw8r0m.relative(ns.start(), ns.finish());
|
| 9882 |
+
var rng = $_c9xxrpp0jfuw8r1k.asLtrRange(win, relative);
|
| 9883 |
+
editor.selection.setRng(rng);
|
| 9884 |
+
});
|
| 9885 |
+
};
|
| 9886 |
+
var keyup = function (event) {
|
| 9887 |
+
var wrappedEvent = wrapEvent(event);
|
| 9888 |
+
if (wrappedEvent.raw().shiftKey && $_9n04otpcjfuw8r40.isNavigation(wrappedEvent.raw().which)) {
|
| 9889 |
+
var rng = editor.selection.getRng();
|
| 9890 |
+
var start = $_xbeoqkkjfuw8q73.fromDom(rng.startContainer);
|
| 9891 |
+
var end = $_xbeoqkkjfuw8q73.fromDom(rng.endContainer);
|
| 9892 |
+
keyHandlers.keyup(wrappedEvent, start, rng.startOffset, end, rng.endOffset).each(function (response) {
|
| 9893 |
+
handleResponse(wrappedEvent, response);
|
| 9894 |
+
});
|
| 9895 |
+
}
|
| 9896 |
+
};
|
| 9897 |
+
var keydown = function (event) {
|
| 9898 |
+
var wrappedEvent = wrapEvent(event);
|
| 9899 |
+
lazyResize().each(function (resize) {
|
| 9900 |
+
resize.hideBars();
|
| 9901 |
+
});
|
| 9902 |
+
var rng = editor.selection.getRng();
|
| 9903 |
+
var startContainer = $_xbeoqkkjfuw8q73.fromDom(editor.selection.getStart());
|
| 9904 |
+
var start = $_xbeoqkkjfuw8q73.fromDom(rng.startContainer);
|
| 9905 |
+
var end = $_xbeoqkkjfuw8q73.fromDom(rng.endContainer);
|
| 9906 |
+
var direction = $_4xd1udnojfuw8qrw.directionAt(startContainer).isRtl() ? $_9n04otpcjfuw8r40.rtl : $_9n04otpcjfuw8r40.ltr;
|
| 9907 |
+
keyHandlers.keydown(wrappedEvent, start, rng.startOffset, end, rng.endOffset, direction).each(function (response) {
|
| 9908 |
+
handleResponse(wrappedEvent, response);
|
| 9909 |
+
});
|
| 9910 |
+
lazyResize().each(function (resize) {
|
| 9911 |
+
resize.showBars();
|
| 9912 |
+
});
|
| 9913 |
+
};
|
| 9914 |
+
var isMouseEvent = function (event) {
|
| 9915 |
+
return event.hasOwnProperty('x') && event.hasOwnProperty('y');
|
| 9916 |
+
};
|
| 9917 |
+
var wrapEvent = function (event) {
|
| 9918 |
+
var target = $_xbeoqkkjfuw8q73.fromDom(event.target);
|
| 9919 |
+
var stop = function () {
|
| 9920 |
+
event.stopPropagation();
|
| 9921 |
+
};
|
| 9922 |
+
var prevent = function () {
|
| 9923 |
+
event.preventDefault();
|
| 9924 |
+
};
|
| 9925 |
+
var kill = $_20nfr6k7jfuw8q4g.compose(prevent, stop);
|
| 9926 |
+
return {
|
| 9927 |
+
target: $_20nfr6k7jfuw8q4g.constant(target),
|
| 9928 |
+
x: $_20nfr6k7jfuw8q4g.constant(isMouseEvent(event) ? event.x : null),
|
| 9929 |
+
y: $_20nfr6k7jfuw8q4g.constant(isMouseEvent(event) ? event.y : null),
|
| 9930 |
+
stop: stop,
|
| 9931 |
+
prevent: prevent,
|
| 9932 |
+
kill: kill,
|
| 9933 |
+
raw: $_20nfr6k7jfuw8q4g.constant(event)
|
| 9934 |
+
};
|
| 9935 |
+
};
|
| 9936 |
+
var isLeftMouse = function (raw) {
|
| 9937 |
+
return raw.button === 0;
|
| 9938 |
+
};
|
| 9939 |
+
var isLeftButtonPressed = function (raw) {
|
| 9940 |
+
if (raw.buttons === undefined) {
|
| 9941 |
+
return true;
|
| 9942 |
+
}
|
| 9943 |
+
return (raw.buttons & 1) !== 0;
|
| 9944 |
+
};
|
| 9945 |
+
var mouseDown = function (e) {
|
| 9946 |
+
if (isLeftMouse(e)) {
|
| 9947 |
+
mouseHandlers.mousedown(wrapEvent(e));
|
| 9948 |
+
}
|
| 9949 |
+
};
|
| 9950 |
+
var mouseOver = function (e) {
|
| 9951 |
+
if (isLeftButtonPressed(e)) {
|
| 9952 |
+
mouseHandlers.mouseover(wrapEvent(e));
|
| 9953 |
+
}
|
| 9954 |
+
};
|
| 9955 |
+
var mouseUp = function (e) {
|
| 9956 |
+
if (isLeftMouse(e)) {
|
| 9957 |
+
mouseHandlers.mouseup(wrapEvent(e));
|
| 9958 |
+
}
|
| 9959 |
+
};
|
| 9960 |
+
editor.on('mousedown', mouseDown);
|
| 9961 |
+
editor.on('mouseover', mouseOver);
|
| 9962 |
+
editor.on('mouseup', mouseUp);
|
| 9963 |
+
editor.on('keyup', keyup);
|
| 9964 |
+
editor.on('keydown', keydown);
|
| 9965 |
+
editor.on('nodechange', syncSelection);
|
| 9966 |
+
handlers = Option.some(handlerStruct({
|
| 9967 |
+
mousedown: mouseDown,
|
| 9968 |
+
mouseover: mouseOver,
|
| 9969 |
+
mouseup: mouseUp,
|
| 9970 |
+
keyup: keyup,
|
| 9971 |
+
keydown: keydown
|
| 9972 |
+
}));
|
| 9973 |
+
});
|
| 9974 |
+
var destroy = function () {
|
| 9975 |
+
handlers.each(function (handlers) {
|
| 9976 |
+
});
|
| 9977 |
+
};
|
| 9978 |
+
return {
|
| 9979 |
+
clear: annotations.clear,
|
| 9980 |
+
destroy: destroy
|
| 9981 |
+
};
|
| 9982 |
+
}
|
| 9983 |
+
|
| 9984 |
+
var Selections = function (editor) {
|
| 9985 |
+
var get = function () {
|
| 9986 |
+
var body = $_5xkhf2nnjfuw8qrq.getBody(editor);
|
| 9987 |
+
return $_1mynollsjfuw8qcy.retrieve(body, $_f8tr2nm5jfuw8qgp.selectedSelector()).fold(function () {
|
| 9988 |
+
if (editor.selection.getStart() === undefined) {
|
| 9989 |
+
return $_cx0pwam6jfuw8qgr.none();
|
| 9990 |
+
} else {
|
| 9991 |
+
return $_cx0pwam6jfuw8qgr.single(editor.selection);
|
| 9992 |
+
}
|
| 9993 |
+
}, function (cells) {
|
| 9994 |
+
return $_cx0pwam6jfuw8qgr.multiple(cells);
|
| 9995 |
+
});
|
| 9996 |
+
};
|
| 9997 |
+
return { get: get };
|
| 9998 |
+
};
|
| 9999 |
+
|
| 10000 |
+
var each$4 = global$2.each;
|
| 10001 |
+
var addButtons = function (editor) {
|
| 10002 |
+
var menuItems = [];
|
| 10003 |
+
each$4('inserttable tableprops deletetable | cell row column'.split(' '), function (name) {
|
| 10004 |
+
if (name === '|') {
|
| 10005 |
+
menuItems.push({ text: '-' });
|
| 10006 |
+
} else {
|
| 10007 |
+
menuItems.push(editor.menuItems[name]);
|
| 10008 |
+
}
|
| 10009 |
+
});
|
| 10010 |
+
editor.addButton('table', {
|
| 10011 |
+
type: 'menubutton',
|
| 10012 |
+
title: 'Table',
|
| 10013 |
+
menu: menuItems
|
| 10014 |
+
});
|
| 10015 |
+
function cmd(command) {
|
| 10016 |
+
return function () {
|
| 10017 |
+
editor.execCommand(command);
|
| 10018 |
+
};
|
| 10019 |
+
}
|
| 10020 |
+
editor.addButton('tableprops', {
|
| 10021 |
+
title: 'Table properties',
|
| 10022 |
+
onclick: $_20nfr6k7jfuw8q4g.curry($_ad8brjnzjfuw8qtm.open, editor, true),
|
| 10023 |
+
icon: 'table'
|
| 10024 |
+
});
|
| 10025 |
+
editor.addButton('tabledelete', {
|
| 10026 |
+
title: 'Delete table',
|
| 10027 |
+
onclick: cmd('mceTableDelete')
|
| 10028 |
+
});
|
| 10029 |
+
editor.addButton('tablecellprops', {
|
| 10030 |
+
title: 'Cell properties',
|
| 10031 |
+
onclick: cmd('mceTableCellProps')
|
| 10032 |
+
});
|
| 10033 |
+
editor.addButton('tablemergecells', {
|
| 10034 |
+
title: 'Merge cells',
|
| 10035 |
+
onclick: cmd('mceTableMergeCells')
|
| 10036 |
+
});
|
| 10037 |
+
editor.addButton('tablesplitcells', {
|
| 10038 |
+
title: 'Split cell',
|
| 10039 |
+
onclick: cmd('mceTableSplitCells')
|
| 10040 |
+
});
|
| 10041 |
+
editor.addButton('tableinsertrowbefore', {
|
| 10042 |
+
title: 'Insert row before',
|
| 10043 |
+
onclick: cmd('mceTableInsertRowBefore')
|
| 10044 |
+
});
|
| 10045 |
+
editor.addButton('tableinsertrowafter', {
|
| 10046 |
+
title: 'Insert row after',
|
| 10047 |
+
onclick: cmd('mceTableInsertRowAfter')
|
| 10048 |
+
});
|
| 10049 |
+
editor.addButton('tabledeleterow', {
|
| 10050 |
+
title: 'Delete row',
|
| 10051 |
+
onclick: cmd('mceTableDeleteRow')
|
| 10052 |
+
});
|
| 10053 |
+
editor.addButton('tablerowprops', {
|
| 10054 |
+
title: 'Row properties',
|
| 10055 |
+
onclick: cmd('mceTableRowProps')
|
| 10056 |
+
});
|
| 10057 |
+
editor.addButton('tablecutrow', {
|
| 10058 |
+
title: 'Cut row',
|
| 10059 |
+
onclick: cmd('mceTableCutRow')
|
| 10060 |
+
});
|
| 10061 |
+
editor.addButton('tablecopyrow', {
|
| 10062 |
+
title: 'Copy row',
|
| 10063 |
+
onclick: cmd('mceTableCopyRow')
|
| 10064 |
+
});
|
| 10065 |
+
editor.addButton('tablepasterowbefore', {
|
| 10066 |
+
title: 'Paste row before',
|
| 10067 |
+
onclick: cmd('mceTablePasteRowBefore')
|
| 10068 |
+
});
|
| 10069 |
+
editor.addButton('tablepasterowafter', {
|
| 10070 |
+
title: 'Paste row after',
|
| 10071 |
+
onclick: cmd('mceTablePasteRowAfter')
|
| 10072 |
+
});
|
| 10073 |
+
editor.addButton('tableinsertcolbefore', {
|
| 10074 |
+
title: 'Insert column before',
|
| 10075 |
+
onclick: cmd('mceTableInsertColBefore')
|
| 10076 |
+
});
|
| 10077 |
+
editor.addButton('tableinsertcolafter', {
|
| 10078 |
+
title: 'Insert column after',
|
| 10079 |
+
onclick: cmd('mceTableInsertColAfter')
|
| 10080 |
+
});
|
| 10081 |
+
editor.addButton('tabledeletecol', {
|
| 10082 |
+
title: 'Delete column',
|
| 10083 |
+
onclick: cmd('mceTableDeleteCol')
|
| 10084 |
+
});
|
| 10085 |
+
};
|
| 10086 |
+
var addToolbars = function (editor) {
|
| 10087 |
+
var isTable = function (table) {
|
| 10088 |
+
var selectorMatched = editor.dom.is(table, 'table') && editor.getBody().contains(table);
|
| 10089 |
+
return selectorMatched;
|
| 10090 |
+
};
|
| 10091 |
+
var toolbar = getToolbar(editor);
|
| 10092 |
+
if (toolbar.length > 0) {
|
| 10093 |
+
editor.addContextToolbar(isTable, toolbar.join(' '));
|
| 10094 |
+
}
|
| 10095 |
+
};
|
| 10096 |
+
var $_ga9kj7q2jfuw8rau = {
|
| 10097 |
+
addButtons: addButtons,
|
| 10098 |
+
addToolbars: addToolbars
|
| 10099 |
+
};
|
| 10100 |
+
|
| 10101 |
+
var addMenuItems = function (editor, selections) {
|
| 10102 |
+
var targets = Option.none();
|
| 10103 |
+
var tableCtrls = [];
|
| 10104 |
+
var cellCtrls = [];
|
| 10105 |
+
var mergeCtrls = [];
|
| 10106 |
+
var unmergeCtrls = [];
|
| 10107 |
+
var noTargetDisable = function (ctrl) {
|
| 10108 |
+
ctrl.disabled(true);
|
| 10109 |
+
};
|
| 10110 |
+
var ctrlEnable = function (ctrl) {
|
| 10111 |
+
ctrl.disabled(false);
|
| 10112 |
+
};
|
| 10113 |
+
var pushTable = function () {
|
| 10114 |
+
var self = this;
|
| 10115 |
+
tableCtrls.push(self);
|
| 10116 |
+
targets.fold(function () {
|
| 10117 |
+
noTargetDisable(self);
|
| 10118 |
+
}, function (targets) {
|
| 10119 |
+
ctrlEnable(self);
|
| 10120 |
+
});
|
| 10121 |
+
};
|
| 10122 |
+
var pushCell = function () {
|
| 10123 |
+
var self = this;
|
| 10124 |
+
cellCtrls.push(self);
|
| 10125 |
+
targets.fold(function () {
|
| 10126 |
+
noTargetDisable(self);
|
| 10127 |
+
}, function (targets) {
|
| 10128 |
+
ctrlEnable(self);
|
| 10129 |
+
});
|
| 10130 |
+
};
|
| 10131 |
+
var pushMerge = function () {
|
| 10132 |
+
var self = this;
|
| 10133 |
+
mergeCtrls.push(self);
|
| 10134 |
+
targets.fold(function () {
|
| 10135 |
+
noTargetDisable(self);
|
| 10136 |
+
}, function (targets) {
|
| 10137 |
+
self.disabled(targets.mergable().isNone());
|
| 10138 |
+
});
|
| 10139 |
+
};
|
| 10140 |
+
var pushUnmerge = function () {
|
| 10141 |
+
var self = this;
|
| 10142 |
+
unmergeCtrls.push(self);
|
| 10143 |
+
targets.fold(function () {
|
| 10144 |
+
noTargetDisable(self);
|
| 10145 |
+
}, function (targets) {
|
| 10146 |
+
self.disabled(targets.unmergable().isNone());
|
| 10147 |
+
});
|
| 10148 |
+
};
|
| 10149 |
+
var setDisabledCtrls = function () {
|
| 10150 |
+
targets.fold(function () {
|
| 10151 |
+
$_tyr3yk5jfuw8q47.each(tableCtrls, noTargetDisable);
|
| 10152 |
+
$_tyr3yk5jfuw8q47.each(cellCtrls, noTargetDisable);
|
| 10153 |
+
$_tyr3yk5jfuw8q47.each(mergeCtrls, noTargetDisable);
|
| 10154 |
+
$_tyr3yk5jfuw8q47.each(unmergeCtrls, noTargetDisable);
|
| 10155 |
+
}, function (targets) {
|
| 10156 |
+
$_tyr3yk5jfuw8q47.each(tableCtrls, ctrlEnable);
|
| 10157 |
+
$_tyr3yk5jfuw8q47.each(cellCtrls, ctrlEnable);
|
| 10158 |
+
$_tyr3yk5jfuw8q47.each(mergeCtrls, function (mergeCtrl) {
|
| 10159 |
+
mergeCtrl.disabled(targets.mergable().isNone());
|
| 10160 |
+
});
|
| 10161 |
+
$_tyr3yk5jfuw8q47.each(unmergeCtrls, function (unmergeCtrl) {
|
| 10162 |
+
unmergeCtrl.disabled(targets.unmergable().isNone());
|
| 10163 |
+
});
|
| 10164 |
+
});
|
| 10165 |
+
};
|
| 10166 |
+
editor.on('init', function () {
|
| 10167 |
+
editor.on('nodechange', function (e) {
|
| 10168 |
+
var cellOpt = Option.from(editor.dom.getParent(editor.selection.getStart(), 'th,td'));
|
| 10169 |
+
targets = cellOpt.bind(function (cellDom) {
|
| 10170 |
+
var cell = $_xbeoqkkjfuw8q73.fromDom(cellDom);
|
| 10171 |
+
var table = $_aqhz9okhjfuw8q5y.table(cell);
|
| 10172 |
+
return table.map(function (table) {
|
| 10173 |
+
return $_5b7h1hlqjfuw8qci.forMenu(selections, table, cell);
|
| 10174 |
+
});
|
| 10175 |
+
});
|
| 10176 |
+
setDisabledCtrls();
|
| 10177 |
+
});
|
| 10178 |
+
});
|
| 10179 |
+
var generateTableGrid = function () {
|
| 10180 |
+
var html = '';
|
| 10181 |
+
html = '<table role="grid" class="mce-grid mce-grid-border" aria-readonly="true">';
|
| 10182 |
+
for (var y = 0; y < 10; y++) {
|
| 10183 |
+
html += '<tr>';
|
| 10184 |
+
for (var x = 0; x < 10; x++) {
|
| 10185 |
+
html += '<td role="gridcell" tabindex="-1"><a id="mcegrid' + (y * 10 + x) + '" href="#" ' + 'data-mce-x="' + x + '" data-mce-y="' + y + '"></a></td>';
|
| 10186 |
+
}
|
| 10187 |
+
html += '</tr>';
|
| 10188 |
+
}
|
| 10189 |
+
html += '</table>';
|
| 10190 |
+
html += '<div class="mce-text-center" role="presentation">1 x 1</div>';
|
| 10191 |
+
return html;
|
| 10192 |
+
};
|
| 10193 |
+
var selectGrid = function (editor, tx, ty, control) {
|
| 10194 |
+
var table = control.getEl().getElementsByTagName('table')[0];
|
| 10195 |
+
var x, y, focusCell, cell, active;
|
| 10196 |
+
var rtl = control.isRtl() || control.parent().rel === 'tl-tr';
|
| 10197 |
+
table.nextSibling.innerHTML = tx + 1 + ' x ' + (ty + 1);
|
| 10198 |
+
if (rtl) {
|
| 10199 |
+
tx = 9 - tx;
|
| 10200 |
+
}
|
| 10201 |
+
for (y = 0; y < 10; y++) {
|
| 10202 |
+
for (x = 0; x < 10; x++) {
|
| 10203 |
+
cell = table.rows[y].childNodes[x].firstChild;
|
| 10204 |
+
active = (rtl ? x >= tx : x <= tx) && y <= ty;
|
| 10205 |
+
editor.dom.toggleClass(cell, 'mce-active', active);
|
| 10206 |
+
if (active) {
|
| 10207 |
+
focusCell = cell;
|
| 10208 |
+
}
|
| 10209 |
+
}
|
| 10210 |
+
}
|
| 10211 |
+
return focusCell.parentNode;
|
| 10212 |
+
};
|
| 10213 |
+
var insertTable = hasTableGrid(editor) === false ? {
|
| 10214 |
+
text: 'Table',
|
| 10215 |
+
icon: 'table',
|
| 10216 |
+
context: 'table',
|
| 10217 |
+
onclick: $_20nfr6k7jfuw8q4g.curry($_ad8brjnzjfuw8qtm.open, editor)
|
| 10218 |
+
} : {
|
| 10219 |
+
text: 'Table',
|
| 10220 |
+
icon: 'table',
|
| 10221 |
+
context: 'table',
|
| 10222 |
+
ariaHideMenu: true,
|
| 10223 |
+
onclick: function (e) {
|
| 10224 |
+
if (e.aria) {
|
| 10225 |
+
this.parent().hideAll();
|
| 10226 |
+
e.stopImmediatePropagation();
|
| 10227 |
+
$_ad8brjnzjfuw8qtm.open(editor);
|
| 10228 |
+
}
|
| 10229 |
+
},
|
| 10230 |
+
onshow: function () {
|
| 10231 |
+
selectGrid(editor, 0, 0, this.menu.items()[0]);
|
| 10232 |
+
},
|
| 10233 |
+
onhide: function () {
|
| 10234 |
+
var elements = this.menu.items()[0].getEl().getElementsByTagName('a');
|
| 10235 |
+
editor.dom.removeClass(elements, 'mce-active');
|
| 10236 |
+
editor.dom.addClass(elements[0], 'mce-active');
|
| 10237 |
+
},
|
| 10238 |
+
menu: [{
|
| 10239 |
+
type: 'container',
|
| 10240 |
+
html: generateTableGrid(),
|
| 10241 |
+
onPostRender: function () {
|
| 10242 |
+
this.lastX = this.lastY = 0;
|
| 10243 |
+
},
|
| 10244 |
+
onmousemove: function (e) {
|
| 10245 |
+
var target = e.target;
|
| 10246 |
+
var x, y;
|
| 10247 |
+
if (target.tagName.toUpperCase() === 'A') {
|
| 10248 |
+
x = parseInt(target.getAttribute('data-mce-x'), 10);
|
| 10249 |
+
y = parseInt(target.getAttribute('data-mce-y'), 10);
|
| 10250 |
+
if (this.isRtl() || this.parent().rel === 'tl-tr') {
|
| 10251 |
+
x = 9 - x;
|
| 10252 |
+
}
|
| 10253 |
+
if (x !== this.lastX || y !== this.lastY) {
|
| 10254 |
+
selectGrid(editor, x, y, e.control);
|
| 10255 |
+
this.lastX = x;
|
| 10256 |
+
this.lastY = y;
|
| 10257 |
+
}
|
| 10258 |
+
}
|
| 10259 |
+
},
|
| 10260 |
+
onclick: function (e) {
|
| 10261 |
+
var self = this;
|
| 10262 |
+
if (e.target.tagName.toUpperCase() === 'A') {
|
| 10263 |
+
e.preventDefault();
|
| 10264 |
+
e.stopPropagation();
|
| 10265 |
+
self.parent().cancel();
|
| 10266 |
+
editor.undoManager.transact(function () {
|
| 10267 |
+
$_1mq3b3o1jfuw8qtu.insert(editor, self.lastX + 1, self.lastY + 1);
|
| 10268 |
+
});
|
| 10269 |
+
editor.addVisual();
|
| 10270 |
+
}
|
| 10271 |
+
}
|
| 10272 |
+
}]
|
| 10273 |
+
};
|
| 10274 |
+
function cmd(command) {
|
| 10275 |
+
return function () {
|
| 10276 |
+
editor.execCommand(command);
|
| 10277 |
+
};
|
| 10278 |
+
}
|
| 10279 |
+
var tableProperties = {
|
| 10280 |
+
text: 'Table properties',
|
| 10281 |
+
context: 'table',
|
| 10282 |
+
onPostRender: pushTable,
|
| 10283 |
+
onclick: $_20nfr6k7jfuw8q4g.curry($_ad8brjnzjfuw8qtm.open, editor, true)
|
| 10284 |
+
};
|
| 10285 |
+
var deleteTable = {
|
| 10286 |
+
text: 'Delete table',
|
| 10287 |
+
context: 'table',
|
| 10288 |
+
onPostRender: pushTable,
|
| 10289 |
+
cmd: 'mceTableDelete'
|
| 10290 |
+
};
|
| 10291 |
+
var row = {
|
| 10292 |
+
text: 'Row',
|
| 10293 |
+
context: 'table',
|
| 10294 |
+
menu: [
|
| 10295 |
+
{
|
| 10296 |
+
text: 'Insert row before',
|
| 10297 |
+
onclick: cmd('mceTableInsertRowBefore'),
|
| 10298 |
+
onPostRender: pushCell
|
| 10299 |
+
},
|
| 10300 |
+
{
|
| 10301 |
+
text: 'Insert row after',
|
| 10302 |
+
onclick: cmd('mceTableInsertRowAfter'),
|
| 10303 |
+
onPostRender: pushCell
|
| 10304 |
+
},
|
| 10305 |
+
{
|
| 10306 |
+
text: 'Delete row',
|
| 10307 |
+
onclick: cmd('mceTableDeleteRow'),
|
| 10308 |
+
onPostRender: pushCell
|
| 10309 |
+
},
|
| 10310 |
+
{
|
| 10311 |
+
text: 'Row properties',
|
| 10312 |
+
onclick: cmd('mceTableRowProps'),
|
| 10313 |
+
onPostRender: pushCell
|
| 10314 |
+
},
|
| 10315 |
+
{ text: '-' },
|
| 10316 |
+
{
|
| 10317 |
+
text: 'Cut row',
|
| 10318 |
+
onclick: cmd('mceTableCutRow'),
|
| 10319 |
+
onPostRender: pushCell
|
| 10320 |
+
},
|
| 10321 |
+
{
|
| 10322 |
+
text: 'Copy row',
|
| 10323 |
+
onclick: cmd('mceTableCopyRow'),
|
| 10324 |
+
onPostRender: pushCell
|
| 10325 |
+
},
|
| 10326 |
+
{
|
| 10327 |
+
text: 'Paste row before',
|
| 10328 |
+
onclick: cmd('mceTablePasteRowBefore'),
|
| 10329 |
+
onPostRender: pushCell
|
| 10330 |
+
},
|
| 10331 |
+
{
|
| 10332 |
+
text: 'Paste row after',
|
| 10333 |
+
onclick: cmd('mceTablePasteRowAfter'),
|
| 10334 |
+
onPostRender: pushCell
|
| 10335 |
+
}
|
| 10336 |
+
]
|
| 10337 |
+
};
|
| 10338 |
+
var column = {
|
| 10339 |
+
text: 'Column',
|
| 10340 |
+
context: 'table',
|
| 10341 |
+
menu: [
|
| 10342 |
+
{
|
| 10343 |
+
text: 'Insert column before',
|
| 10344 |
+
onclick: cmd('mceTableInsertColBefore'),
|
| 10345 |
+
onPostRender: pushCell
|
| 10346 |
+
},
|
| 10347 |
+
{
|
| 10348 |
+
text: 'Insert column after',
|
| 10349 |
+
onclick: cmd('mceTableInsertColAfter'),
|
| 10350 |
+
onPostRender: pushCell
|
| 10351 |
+
},
|
| 10352 |
+
{
|
| 10353 |
+
text: 'Delete column',
|
| 10354 |
+
onclick: cmd('mceTableDeleteCol'),
|
| 10355 |
+
onPostRender: pushCell
|
| 10356 |
+
}
|
| 10357 |
+
]
|
| 10358 |
+
};
|
| 10359 |
+
var cell = {
|
| 10360 |
+
separator: 'before',
|
| 10361 |
+
text: 'Cell',
|
| 10362 |
+
context: 'table',
|
| 10363 |
+
menu: [
|
| 10364 |
+
{
|
| 10365 |
+
text: 'Cell properties',
|
| 10366 |
+
onclick: cmd('mceTableCellProps'),
|
| 10367 |
+
onPostRender: pushCell
|
| 10368 |
+
},
|
| 10369 |
+
{
|
| 10370 |
+
text: 'Merge cells',
|
| 10371 |
+
onclick: cmd('mceTableMergeCells'),
|
| 10372 |
+
onPostRender: pushMerge
|
| 10373 |
+
},
|
| 10374 |
+
{
|
| 10375 |
+
text: 'Split cell',
|
| 10376 |
+
onclick: cmd('mceTableSplitCells'),
|
| 10377 |
+
onPostRender: pushUnmerge
|
| 10378 |
+
}
|
| 10379 |
+
]
|
| 10380 |
+
};
|
| 10381 |
+
editor.addMenuItem('inserttable', insertTable);
|
| 10382 |
+
editor.addMenuItem('tableprops', tableProperties);
|
| 10383 |
+
editor.addMenuItem('deletetable', deleteTable);
|
| 10384 |
+
editor.addMenuItem('row', row);
|
| 10385 |
+
editor.addMenuItem('column', column);
|
| 10386 |
+
editor.addMenuItem('cell', cell);
|
| 10387 |
+
};
|
| 10388 |
+
var $_e80bn7q3jfuw8raz = { addMenuItems: addMenuItems };
|
| 10389 |
+
|
| 10390 |
+
var getClipboardRows = function (clipboardRows) {
|
| 10391 |
+
return clipboardRows.get().fold(function () {
|
| 10392 |
+
return;
|
| 10393 |
+
}, function (rows) {
|
| 10394 |
+
return $_tyr3yk5jfuw8q47.map(rows, function (row) {
|
| 10395 |
+
return row.dom();
|
| 10396 |
+
});
|
| 10397 |
+
});
|
| 10398 |
+
};
|
| 10399 |
+
var setClipboardRows = function (rows, clipboardRows) {
|
| 10400 |
+
var sugarRows = $_tyr3yk5jfuw8q47.map(rows, $_xbeoqkkjfuw8q73.fromDom);
|
| 10401 |
+
clipboardRows.set(Option.from(sugarRows));
|
| 10402 |
+
};
|
| 10403 |
+
var getApi = function (editor, clipboardRows) {
|
| 10404 |
+
return {
|
| 10405 |
+
insertTable: function (columns, rows) {
|
| 10406 |
+
return $_1mq3b3o1jfuw8qtu.insert(editor, columns, rows);
|
| 10407 |
+
},
|
| 10408 |
+
setClipboardRows: function (rows) {
|
| 10409 |
+
return setClipboardRows(rows, clipboardRows);
|
| 10410 |
+
},
|
| 10411 |
+
getClipboardRows: function () {
|
| 10412 |
+
return getClipboardRows(clipboardRows);
|
| 10413 |
+
}
|
| 10414 |
+
};
|
| 10415 |
+
};
|
| 10416 |
+
|
| 10417 |
+
function Plugin(editor) {
|
| 10418 |
+
var resizeHandler = ResizeHandler(editor);
|
| 10419 |
+
var cellSelection = CellSelection$1(editor, resizeHandler.lazyResize);
|
| 10420 |
+
var actions = TableActions(editor, resizeHandler.lazyWire);
|
| 10421 |
+
var selections = Selections(editor);
|
| 10422 |
+
var clipboardRows = Cell(Option.none());
|
| 10423 |
+
$_srry6nsjfuw8qs8.registerCommands(editor, actions, cellSelection, selections, clipboardRows);
|
| 10424 |
+
$_3y1hv8k4jfuw8q3l.registerEvents(editor, selections, actions, cellSelection);
|
| 10425 |
+
$_e80bn7q3jfuw8raz.addMenuItems(editor, selections);
|
| 10426 |
+
$_ga9kj7q2jfuw8rau.addButtons(editor);
|
| 10427 |
+
$_ga9kj7q2jfuw8rau.addToolbars(editor);
|
| 10428 |
+
editor.on('PreInit', function () {
|
| 10429 |
+
editor.serializer.addTempAttr($_f8tr2nm5jfuw8qgp.firstSelected());
|
| 10430 |
+
editor.serializer.addTempAttr($_f8tr2nm5jfuw8qgp.lastSelected());
|
| 10431 |
+
});
|
| 10432 |
+
if (hasTabNavigation(editor)) {
|
| 10433 |
+
editor.on('keydown', function (e) {
|
| 10434 |
+
$_djb8ceorjfuw8qzt.handle(e, editor, actions, resizeHandler.lazyWire);
|
| 10435 |
+
});
|
| 10436 |
+
}
|
| 10437 |
+
editor.on('remove', function () {
|
| 10438 |
+
resizeHandler.destroy();
|
| 10439 |
+
cellSelection.destroy();
|
| 10440 |
+
});
|
| 10441 |
+
return getApi(editor, clipboardRows);
|
| 10442 |
+
}
|
| 10443 |
+
global.add('table', Plugin);
|
| 10444 |
+
function Plugin$1 () {
|
| 10445 |
+
}
|
| 10446 |
+
|
| 10447 |
+
return Plugin$1;
|
| 10448 |
+
|
| 10449 |
+
}());
|
| 10450 |
+
})();
|
tinymce47-table/plugin.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
| 1 |
+
!function(){"use strict";var e,t,n,r,o,i,u=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=function(e){return function(){return e}},y={noop:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t]},noarg:function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n()}},compose:function(n,r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n(r.apply(null,arguments))}},constant:a,identity:function(e){return e},tripleEquals:function(e,t){return e===t},curry:function(i){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var u=new Array(arguments.length-1),n=1;n<arguments.length;n++)u[n-1]=arguments[n];return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];var o=u.concat(n);return i.apply(null,o)}},not:function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return!n.apply(null,arguments)}},die:function(e){return function(){throw new Error(e)}},apply:function(e){return e()},call:function(e){e()},never:a(!1),always:a(!0)},c=y.never,l=y.always,s=function(){return f},f=(r={fold:function(e,t){return e()},is:c,isSome:c,isNone:l,getOr:n=function(e){return e},getOrThunk:t=function(e){return e()},getOrDie:function(e){throw new Error(e||"error: getOrDie called on none.")},or:n,orThunk:t,map:s,ap:s,each:function(){},bind:s,flatten:s,exists:c,forall:l,filter:s,equals:e=function(e){return e.isNone()},equals_:e,toArray:function(){return[]},toString:y.constant("none()")},Object.freeze&&Object.freeze(r),r),d=function(n){var e=function(){return n},t=function(){return o},r=function(e){return e(n)},o={fold:function(e,t){return t(n)},is:function(e){return n===e},isSome:l,isNone:c,getOr:e,getOrThunk:e,getOrDie:e,or:t,orThunk:t,map:function(e){return d(e(n))},ap:function(e){return e.fold(s,function(e){return d(e(n))})},each:function(e){e(n)},bind:r,flatten:e,exists:r,forall:r,filter:function(e){return e(n)?o:f},equals:function(e){return e.is(n)},equals_:function(e,t){return e.fold(c,function(e){return t(n,e)})},toArray:function(){return[n]},toString:function(){return"some("+n+")"}};return o},x={some:d,none:s,from:function(e){return null===e||e===undefined?f:d(e)}},m=function(t){return function(e){return function(e){if(null===e)return"null";var t=typeof e;return"object"===t&&Array.prototype.isPrototypeOf(e)?"array":"object"===t&&String.prototype.isPrototypeOf(e)?"string":t}(e)===t}},g={isString:m("string"),isObject:m("object"),isArray:m("array"),isNull:m("null"),isBoolean:m("boolean"),isUndefined:m("undefined"),isFunction:m("function"),isNumber:m("number")},p=(o=Array.prototype.indexOf)===undefined?function(e,t){return R(e,t)}:function(e,t){return o.call(e,t)},h=function(e,t){return-1<p(e,t)},v=function(e,t){for(var n=e.length,r=new Array(n),o=0;o<n;o++){var i=e[o];r[o]=t(i,o,e)}return r},b=function(e,t){for(var n=0,r=e.length;n<r;n++)t(e[n],n,e)},w=function(e,t){for(var n=e.length-1;0<=n;n--)t(e[n],n,e)},S=function(e,t){for(var n=[],r=0,o=e.length;r<o;r++){var i=e[r];t(i,r,e)&&n.push(i)}return n},C=function(e,t){for(var n=0,r=e.length;n<r;n++)if(t(e[n],n,e))return x.some(n);return x.none()},R=function(e,t){for(var n=0,r=e.length;n<r;++n)if(e[n]===t)return n;return-1},T=Array.prototype.push,A=function(e){for(var t=[],n=0,r=e.length;n<r;++n){if(!Array.prototype.isPrototypeOf(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);T.apply(t,e[n])}return t},D=function(e,t){for(var n=0,r=e.length;n<r;++n)if(!0!==t(e[n],n,e))return!1;return!0},k=Array.prototype.slice,N=g.isFunction(Array.from)?Array.from:function(e){return k.call(e)},E={map:v,each:b,eachr:w,partition:function(e,t){for(var n=[],r=[],o=0,i=e.length;o<i;o++){var u=e[o];(t(u,o,e)?n:r).push(u)}return{pass:n,fail:r}},filter:S,groupBy:function(e,t){if(0===e.length)return[];for(var n=t(e[0]),r=[],o=[],i=0,u=e.length;i<u;i++){var a=e[i],c=t(a);c!==n&&(r.push(o),o=[]),n=c,o.push(a)}return 0!==o.length&&r.push(o),r},indexOf:function(e,t){var n=p(e,t);return-1===n?x.none():x.some(n)},foldr:function(e,t,n){return w(e,function(e){n=t(n,e)}),n},foldl:function(e,t,n){return b(e,function(e){n=t(n,e)}),n},find:function(e,t){for(var n=0,r=e.length;n<r;n++){var o=e[n];if(t(o,n,e))return x.some(o)}return x.none()},findIndex:C,flatten:A,bind:function(e,t){var n=v(e,t);return A(n)},forall:D,exists:function(e,t){return C(e,t).isSome()},contains:h,equal:function(e,n){return e.length===n.length&&D(e,function(e,t){return e===n[t]})},reverse:function(e){var t=k.call(e,0);return t.reverse(),t},chunk:function(e,t){for(var n=[],r=0;r<e.length;r+=t){var o=e.slice(r,r+t);n.push(o)}return n},difference:function(e,t){return S(e,function(e){return!h(t,e)})},mapToObject:function(e,t){for(var n={},r=0,o=e.length;r<o;r++){var i=e[r];n[String(i)]=t(i,r)}return n},pure:function(e){return[e]},sort:function(e,t){var n=k.call(e,0);return n.sort(t),n},range:function(e,t){for(var n=[],r=0;r<e;r++)n.push(t(r));return n},head:function(e){return 0===e.length?x.none():x.some(e[0])},last:function(e){return 0===e.length?x.none():x.some(e[e.length-1])},from:N},O=(i=Object.keys)===undefined?function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t}:i,B=function(e,t){for(var n=O(e),r=0,o=n.length;r<o;r++){var i=n[r];t(e[i],i,e)}},P=function(r,o){var i={};return B(r,function(e,t){var n=o(e,t,r);i[n.k]=n.v}),i},I=function(e,n){var r=[];return B(e,function(e,t){r.push(n(e,t))}),r},W=function(e){return I(e,function(e){return e})},M={bifilter:function(e,n){var r={},o={};return B(e,function(e,t){(n(e,t)?r:o)[t]=e}),{t:r,f:o}},each:B,map:function(e,r){return P(e,function(e,t,n){return{k:t,v:r(e,t,n)}})},mapToArray:I,tupleMap:P,find:function(e,t){for(var n=O(e),r=0,o=n.length;r<o;r++){var i=n[r],u=e[i];if(t(u,i,e))return x.some(u)}return x.none()},keys:O,values:W,size:function(e){return W(e).length}},L=function(e){return e.slice(0).sort()},q={sort:L,reqMessage:function(e,t){throw new Error("All required keys ("+L(e).join(", ")+") were not specified. Specified keys were: "+L(t).join(", ")+".")},unsuppMessage:function(e){throw new Error("Unsupported keys for object: "+L(e).join(", "))},validateStrArr:function(t,e){if(!g.isArray(e))throw new Error("The "+t+" fields must be an array. Was: "+e+".");E.each(e,function(e){if(!g.isString(e))throw new Error("The value "+e+" in the "+t+" fields was not a string.")})},invalidTypeMessage:function(e,t){throw new Error("All values need to be of type: "+t+". Keys ("+L(e).join(", ")+") were not.")},checkDupes:function(e){var n=L(e);E.find(n,function(e,t){return t<n.length-1&&e===n[t+1]}).each(function(e){throw new Error("The field: "+e+" occurs more than once in the combined fields: ["+n.join(", ")+"].")})}},F={immutable:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(t.length!==n.length)throw new Error('Wrong number of arguments to struct. Expected "['+t.length+']", got '+n.length+" arguments");var r={};return E.each(t,function(e,t){r[e]=y.constant(n[t])}),r}},immutableBag:function(o,i){var u=o.concat(i);if(0===u.length)throw new Error("You must specify at least one required or optional field.");return q.validateStrArr("required",o),q.validateStrArr("optional",i),q.checkDupes(u),function(t){var n=M.keys(t);E.forall(o,function(e){return E.contains(n,e)})||q.reqMessage(o,n);var e=E.filter(n,function(e){return!E.contains(u,e)});0<e.length&&q.unsuppMessage(e);var r={};return E.each(o,function(e){r[e]=y.constant(t[e])}),E.each(i,function(e){r[e]=y.constant(Object.prototype.hasOwnProperty.call(t,e)?x.some(t[e]):x.none())}),r}}},j=F.immutable("width","height"),z=F.immutable("rows","columns"),_=F.immutable("row","column"),H=F.immutable("x","y"),V=F.immutable("element","rowspan","colspan"),U=F.immutable("element","rowspan","colspan","isNew"),G={dimensions:j,grid:z,address:_,coords:H,extended:F.immutable("element","rowspan","colspan","row","column"),detail:V,detailnew:U,rowdata:F.immutable("element","cells","section"),elementnew:F.immutable("element","isNew"),rowdatanew:F.immutable("element","cells","section","isNew"),rowcells:F.immutable("cells","section"),rowdetails:F.immutable("details","section"),bounds:F.immutable("startRow","startCol","finishRow","finishCol")},X=function(e){if(null===e||e===undefined)throw new Error("Node cannot be null or undefined");return{dom:y.constant(e)}},Y={fromHtml:function(e,t){var n=(t||document).createElement("div");if(n.innerHTML=e,!n.hasChildNodes()||1<n.childNodes.length)throw console.error("HTML does not have a single root node",e),"HTML must have a single root node";return X(n.childNodes[0])},fromTag:function(e,t){var n=(t||document).createElement(e);return X(n)},fromText:function(e,t){var n=(t||document).createTextNode(e);return X(n)},fromDom:X,fromPoint:function(e,t,n){return x.from(e.dom().elementFromPoint(t,n)).map(X)}},K=8,$=9,J=1,Q=3,Z=J,ee=$,te=function(e){return e.nodeType!==Z&&e.nodeType!==ee||0===e.childElementCount},ne={all:function(e,t){var n=t===undefined?document:t.dom();return te(n)?[]:E.map(n.querySelectorAll(e),Y.fromDom)},is:function(e,t){var n=e.dom();if(n.nodeType!==Z)return!1;if(n.matches!==undefined)return n.matches(t);if(n.msMatchesSelector!==undefined)return n.msMatchesSelector(t);if(n.webkitMatchesSelector!==undefined)return n.webkitMatchesSelector(t);if(n.mozMatchesSelector!==undefined)return n.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")},one:function(e,t){var n=t===undefined?document:t.dom();return te(n)?x.none():x.from(n.querySelector(e)).map(Y.fromDom)}},re=function(e,t){for(var n=[],r=function(e){return n.push(e),t(e)},o=t(e);(o=o.bind(r)).isSome(););return n},oe="undefined"!=typeof window?window:Function("return this;")(),ie=function(e,t){for(var n=t!==undefined&&null!==t?t:oe,r=0;r<e.length&&n!==undefined&&null!==n;++r)n=n[e[r]];return n},ue=function(e,t){var n=e.split(".");return ie(n,t)},ae=function(e,t){var n=ue(e,t);if(n===undefined||null===n)throw e+" not available on this browser";return n},ce=function(){return ae("Node")},le=function(e,t,n){return 0!=(e.compareDocumentPosition(t)&n)},se=function(e,t){return le(e,t,ce().DOCUMENT_POSITION_CONTAINED_BY)},fe=function(e){var t,n=!1;return function(){return n||(n=!0,t=e.apply(null,arguments)),t}},de=function(e,t){var n=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(r.test(t))return r}return undefined}(e,t);if(!n)return{major:0,minor:0};var r=function(e){return Number(t.replace(n,"$"+e))};return ge(r(1),r(2))},me=function(){return ge(0,0)},ge=function(e,t){return{major:e,minor:t}},pe={nu:ge,detect:function(e,t){var n=String(t).toLowerCase();return 0===e.length?me():de(e,n)},unknown:me},he="Firefox",ve=function(e,t){return function(){return t===e}},be=function(e){var t=e.current;return{current:t,version:e.version,isEdge:ve("Edge",t),isChrome:ve("Chrome",t),isIE:ve("IE",t),isOpera:ve("Opera",t),isFirefox:ve(he,t),isSafari:ve("Safari",t)}},we={unknown:function(){return be({current:undefined,version:pe.unknown()})},nu:be,edge:y.constant("Edge"),chrome:y.constant("Chrome"),ie:y.constant("IE"),opera:y.constant("Opera"),firefox:y.constant(he),safari:y.constant("Safari")},ye="Windows",xe="Android",Se="Solaris",Ce="FreeBSD",Re=function(e,t){return function(){return t===e}},Te=function(e){var t=e.current;return{current:t,version:e.version,isWindows:Re(ye,t),isiOS:Re("iOS",t),isAndroid:Re(xe,t),isOSX:Re("OSX",t),isLinux:Re("Linux",t),isSolaris:Re(Se,t),isFreeBSD:Re(Ce,t)}},Ae={unknown:function(){return Te({current:undefined,version:pe.unknown()})},nu:Te,windows:y.constant(ye),ios:y.constant("iOS"),android:y.constant(xe),linux:y.constant("Linux"),osx:y.constant("OSX"),solaris:y.constant(Se),freebsd:y.constant(Ce)},De=function(e,t){var n=String(t).toLowerCase();return E.find(e,function(e){return e.search(n)})},ke=function(e,n){return De(e,n).map(function(e){var t=pe.detect(e.versionRegexes,n);return{current:e.name,version:t}})},Ne=function(e,n){return De(e,n).map(function(e){var t=pe.detect(e.versionRegexes,n);return{current:e.name,version:t}})},Ee=function(e,t){return t+e},Oe=function(e,t){return e+t},Be=function(e,t){return e.substring(t)},Pe=function(e,t){return e.substring(0,e.length-t)},Ie=function(e){return""===e?x.none():x.some(e.substr(0,1))},We=function(e){return""===e?x.none():x.some(e.substring(1))},Me=function(e,t,n){return""===t||!(e.length<t.length)&&e.substr(n,n+t.length)===t},Le=function(e,t){return Me(e,t,0)},qe=function(e,t){return Me(e,t,e.length-t.length)},Fe={supplant:function(e,o){return e.replace(/\${([^{}]*)}/g,function(e,t){var n,r=o[t];return"string"==(n=typeof r)||"number"===n?r:e})},startsWith:Le,removeLeading:function(e,t){return Le(e,t)?Be(e,t.length):e},removeTrailing:function(e,t){return qe(e,t)?Pe(e,t.length):e},ensureLeading:function(e,t){return Le(e,t)?e:Ee(e,t)},ensureTrailing:function(e,t){return qe(e,t)?e:Oe(e,t)},endsWith:qe,contains:function(e,t){return-1!==e.indexOf(t)},trim:function(e){return e.replace(/^\s+|\s+$/g,"")},lTrim:function(e){return e.replace(/^\s+/g,"")},rTrim:function(e){return e.replace(/\s+$/g,"")},capitalize:function(e){return Ie(e).bind(function(t){return We(e).map(function(e){return t.toUpperCase()+e})}).getOr(e)}},je=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,ze=function(t){return function(e){return Fe.contains(e,t)}},_e=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(e){return Fe.contains(e,"edge/")&&Fe.contains(e,"chrome")&&Fe.contains(e,"safari")&&Fe.contains(e,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,je],search:function(e){return Fe.contains(e,"chrome")&&!Fe.contains(e,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(e){return Fe.contains(e,"msie")||Fe.contains(e,"trident")}},{name:"Opera",versionRegexes:[je,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:ze("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:ze("firefox")},{name:"Safari",versionRegexes:[je,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(e){return(Fe.contains(e,"safari")||Fe.contains(e,"mobile/"))&&Fe.contains(e,"applewebkit")}}],He=[{name:"Windows",search:ze("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(e){return Fe.contains(e,"iphone")||Fe.contains(e,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:ze("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:ze("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:ze("linux"),versionRegexes:[]},{name:"Solaris",search:ze("sunos"),versionRegexes:[]},{name:"FreeBSD",search:ze("freebsd"),versionRegexes:[]}],Ve={browsers:y.constant(_e),oses:y.constant(He)},Ue=function(e){var t,n,r,o,i,u,a,c,l,s,f,d=Ve.browsers(),m=Ve.oses(),g=ke(d,e).fold(we.unknown,we.nu),p=Ne(m,e).fold(Ae.unknown,Ae.nu);return{browser:g,os:p,deviceType:(n=g,r=e,o=(t=p).isiOS()&&!0===/ipad/i.test(r),i=t.isiOS()&&!o,u=t.isAndroid()&&3===t.version.major,a=t.isAndroid()&&4===t.version.major,c=o||u||a&&!0===/mobile/i.test(r),l=t.isiOS()||t.isAndroid(),s=l&&!c,f=n.isSafari()&&t.isiOS()&&!1===/safari/i.test(r),{isiPad:y.constant(o),isiPhone:y.constant(i),isTablet:y.constant(c),isPhone:y.constant(s),isTouch:y.constant(l),isAndroid:t.isAndroid,isiOS:t.isiOS,isWebView:y.constant(f)})}},Ge={detect:fe(function(){var e=navigator.userAgent;return Ue(e)})},Xe=function(e,t){return e.dom()===t.dom()},Ye=Ge.detect().browser.isIE()?function(e,t){return se(e.dom(),t.dom())}:function(e,t){var n=e.dom(),r=t.dom();return n!==r&&n.contains(r)},Ke={eq:Xe,isEqualNode:function(e,t){return e.dom().isEqualNode(t.dom())},member:function(e,t){return E.exists(t,y.curry(Xe,e))},contains:Ye,is:ne.is},$e=function(e){return Y.fromDom(e.dom().ownerDocument)},Je=function(e){var t=e.dom();return x.from(t.parentNode).map(Y.fromDom)},Qe=function(e){var t=e.dom();return x.from(t.previousSibling).map(Y.fromDom)},Ze=function(e){var t=e.dom();return x.from(t.nextSibling).map(Y.fromDom)},et=function(e){var t=e.dom();return E.map(t.childNodes,Y.fromDom)},tt=function(e,t){var n=e.dom().childNodes;return x.from(n[t]).map(Y.fromDom)},nt=F.immutable("element","offset"),rt={owner:$e,defaultView:function(e){var t=e.dom().ownerDocument.defaultView;return Y.fromDom(t)},documentElement:function(e){var t=$e(e);return Y.fromDom(t.dom().documentElement)},parent:Je,findIndex:function(n){return Je(n).bind(function(e){var t=et(e);return E.findIndex(t,function(e){return Ke.eq(n,e)})})},parents:function(e,t){for(var n=g.isFunction(t)?t:y.constant(!1),r=e.dom(),o=[];null!==r.parentNode&&r.parentNode!==undefined;){var i=r.parentNode,u=Y.fromDom(i);if(o.push(u),!0===n(u))break;r=i}return o},siblings:function(t){return Je(t).map(et).map(function(e){return E.filter(e,function(e){return!Ke.eq(t,e)})}).getOr([])},prevSibling:Qe,offsetParent:function(e){var t=e.dom();return x.from(t.offsetParent).map(Y.fromDom)},prevSiblings:function(e){return E.reverse(re(e,Qe))},nextSibling:Ze,nextSiblings:function(e){return re(e,Ze)},children:et,child:tt,firstChild:function(e){return tt(e,0)},lastChild:function(e){return tt(e,e.dom().childNodes.length-1)},childNodesCount:function(e){return e.dom().childNodes.length},hasChildNodes:function(e){return e.dom().hasChildNodes()},leaf:function(e,t){var n=et(e);return 0<n.length&&t<n.length?nt(n[t],0):nt(e,t)}},ot=function(e,t,n){return E.bind(rt.children(e),function(e){return ne.is(e,t)?n(e)?[e]:[]:ot(e,t,n)})},it={firstLayer:function(e,t){return ot(e,t,y.constant(!0))},filterFirstLayer:ot},ut=function(e){return e.dom().nodeName.toLowerCase()},at=function(e){return e.dom().nodeType},ct=function(t){return function(e){return at(e)===t}},lt=ct(J),st=ct(Q),ft=ct($),dt={name:ut,type:at,value:function(e){return e.dom().nodeValue},isElement:lt,isText:st,isDocument:ft,isComment:function(e){return at(e)===K||"#comment"===ut(e)}},mt=function(e,t,n){if(!(g.isString(n)||g.isBoolean(n)||g.isNumber(n)))throw console.error("Invalid call to Attr.set. Key ",t,":: Value ",n,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,n+"")},gt=function(e,t,n){mt(e.dom(),t,n)},pt=function(e,t){var n=e.dom().getAttribute(t);return null===n?undefined:n},ht=function(e,t){var n=e.dom();return!(!n||!n.hasAttribute)&&n.hasAttribute(t)},vt={clone:function(e){return E.foldl(e.dom().attributes,function(e,t){return e[t.name]=t.value,e},{})},set:gt,setAll:function(e,t){var n=e.dom();M.each(t,function(e,t){mt(n,t,e)})},get:pt,has:ht,remove:function(e,t){e.dom().removeAttribute(t)},hasNone:function(e){var t=e.dom().attributes;return t===undefined||null===t||0===t.length},transfer:function(o,i,e){dt.isElement(o)&&dt.isElement(i)&&E.each(e,function(e){var t,n,r;n=i,ht(t=o,r=e)&&!ht(n,r)&>(n,r,pt(t,r))})}},bt=fe(function(){return wt(Y.fromDom(document))}),wt=function(e){var t=e.dom().body;if(null===t||t===undefined)throw"Body is not available yet";return Y.fromDom(t)},yt={body:bt,getBody:wt,inBody:function(e){var t=dt.isText(e)?e.dom().parentNode:e.dom();return t!==undefined&&null!==t&&t.ownerDocument.body.contains(t)}},xt=function(e,t){var n=[];return E.each(rt.children(e),function(e){t(e)&&(n=n.concat([e])),n=n.concat(xt(e,t))}),n},St={all:function(e){return xt(yt.body(),e)},ancestors:function(e,t,n){return E.filter(rt.parents(e,n),t)},siblings:function(e,t){return E.filter(rt.siblings(e),t)},children:function(e,t){return E.filter(rt.children(e),t)},descendants:xt},Ct={all:function(e){return ne.all(e)},ancestors:function(e,t,n){return St.ancestors(e,function(e){return ne.is(e,t)},n)},siblings:function(e,t){return St.siblings(e,function(e){return ne.is(e,t)})},children:function(e,t){return St.children(e,function(e){return ne.is(e,t)})},descendants:function(e,t){return ne.all(t,e)}};function Rt(e,t,n,r,o){return e(n,r)?x.some(n):g.isFunction(o)&&o(n)?x.none():t(n,r,o)}var Tt,At,Dt,kt,Nt,Et=function(e,t,n){for(var r=e.dom(),o=g.isFunction(n)?n:y.constant(!1);r.parentNode;){r=r.parentNode;var i=Y.fromDom(r);if(t(i))return x.some(i);if(o(i))break}return x.none()},Ot=function(e,t){return E.find(e.dom().childNodes,y.compose(t,Y.fromDom)).map(Y.fromDom)},Bt=function(e,r){var o=function(e){for(var t=0;t<e.childNodes.length;t++){if(r(Y.fromDom(e.childNodes[t])))return x.some(Y.fromDom(e.childNodes[t]));var n=o(e.childNodes[t]);if(n.isSome())return n}return x.none()};return o(e.dom())},Pt={first:function(e){return Bt(yt.body(),e)},ancestor:Et,closest:function(e,t,n){return Rt(function(e){return t(e)},Et,e,t,n)},sibling:function(t,n){var e=t.dom();return e.parentNode?Ot(Y.fromDom(e.parentNode),function(e){return!Ke.eq(t,e)&&n(e)}):x.none()},child:Ot,descendant:Bt},It=function(e,t,n){return Pt.ancestor(e,function(e){return ne.is(e,t)},n)},Wt={first:function(e){return ne.one(e)},ancestor:It,sibling:function(e,t){return Pt.sibling(e,function(e){return ne.is(e,t)})},child:function(e,t){return Pt.child(e,function(e){return ne.is(e,t)})},descendant:function(e,t){return ne.one(t,e)},closest:function(e,t,n){return Rt(ne.is,It,e,t,n)}},Mt=function(e,t,n){var r=n!==undefined?n:y.constant(!1);return r(t)?x.none():E.contains(e,dt.name(t))?x.some(t):Wt.ancestor(t,e.join(","),function(e){return ne.is(e,"table")||r(e)})},Lt=function(t,e){return rt.parent(e).map(function(e){return Ct.children(e,t)})},qt=y.curry(Lt,"th,td"),Ft=y.curry(Lt,"tr"),jt=function(e,t){return parseInt(vt.get(e,t),10)},zt={cell:function(e,t){return Mt(["td","th"],e,t)},firstCell:function(e){return Wt.descendant(e,"th,td")},cells:function(e){return it.firstLayer(e,"th,td")},neighbourCells:qt,table:function(e,t){return Wt.closest(e,"table",t)},row:function(e,t){return Mt(["tr"],e,t)},rows:function(e){return it.firstLayer(e,"tr")},notCell:function(e,t){return Mt(["caption","tr","tbody","tfoot","thead"],e,t)},neighbourRows:Ft,attr:jt,grid:function(e,t,n){var r=jt(e,t),o=jt(e,n);return G.grid(r,o)}},_t=function(e){var t=zt.rows(e);return E.map(t,function(e){var t=e,n=rt.parent(t).bind(function(e){var t=dt.name(e);return"tfoot"===t||"thead"===t||"tbody"===t?t:"tbody"}),r=E.map(zt.cells(e),function(e){var t=vt.has(e,"rowspan")?parseInt(vt.get(e,"rowspan"),10):1,n=vt.has(e,"colspan")?parseInt(vt.get(e,"colspan"),10):1;return G.detail(e,t,n)});return G.rowdata(t,r,n)})},Ht=function(e,n){return E.map(e,function(e){var t=E.map(zt.cells(e),function(e){var t=vt.has(e,"rowspan")?parseInt(vt.get(e,"rowspan"),10):1,n=vt.has(e,"colspan")?parseInt(vt.get(e,"colspan"),10):1;return G.detail(e,t,n)});return G.rowdata(e,t,n.section())})},Vt=function(e,t){return e+","+t},Ut=function(e,t){var n=E.bind(e.all(),function(e){return e.cells()});return E.filter(n,t)},Gt={generate:function(e){var s={},t=[],n=e.length,f=0;E.each(e,function(e,c){var l=[];E.each(e.cells(),function(e,t){for(var n=0;s[Vt(c,n)]!==undefined;)n++;for(var r=G.extended(e.element(),e.rowspan(),e.colspan(),c,n),o=0;o<e.colspan();o++)for(var i=0;i<e.rowspan();i++){var u=n+o,a=Vt(c+i,u);s[a]=r,f=Math.max(f,u+1)}l.push(r)}),t.push(G.rowdata(e.element(),l,e.section()))});var r=G.grid(n,f);return{grid:y.constant(r),access:y.constant(s),all:y.constant(t)}},getAt:function(e,t,n){var r=e.access()[Vt(t,n)];return r!==undefined?x.some(r):x.none()},findItem:function(e,t,n){var r=Ut(e,function(e){return n(t,e.element())});return 0<r.length?x.some(r[0]):x.none()},filterItems:Ut,justCells:function(e){var t=E.map(e.all(),function(e){return e.cells()});return E.flatten(t)}},Xt={isSupported:function(e){return e.style!==undefined}},Yt=function(e,t,n){if(!g.isString(n))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",n,":: Element ",e),new Error("CSS value must be a string: "+n);Xt.isSupported(e)&&e.style.setProperty(t,n)},Kt=function(e,t){Xt.isSupported(e)&&e.style.removeProperty(t)},$t=function(e,t,n){var r=e.dom();Yt(r,t,n)},Jt=function(e,t){return Xt.isSupported(e)?e.style.getPropertyValue(t):""},Qt=function(e,t){var n=e.dom(),r=Jt(n,t);return x.from(r).filter(function(e){return 0<e.length})},Zt={copy:function(e,t){var n=e.dom(),r=t.dom();Xt.isSupported(n)&&Xt.isSupported(r)&&(r.style.cssText=n.style.cssText)},set:$t,preserve:function(e,t){var n=vt.get(e,"style"),r=t(e);return(n===undefined?vt.remove:vt.set)(e,"style",n),r},setAll:function(e,t){var n=e.dom();M.each(t,function(e,t){Yt(n,t,e)})},setOptions:function(e,t){var n=e.dom();M.each(t,function(e,t){e.fold(function(){Kt(n,t)},function(e){Yt(n,t,e)})})},remove:function(e,t){var n=e.dom();Kt(n,t),vt.has(e,"style")&&""===Fe.trim(vt.get(e,"style"))&&vt.remove(e,"style")},get:function(e,t){var n=e.dom(),r=window.getComputedStyle(n).getPropertyValue(t),o=""!==r||yt.inBody(e)?r:Jt(n,t);return null===o?undefined:o},getRaw:Qt,getAllRaw:function(e){var t={},n=e.dom();if(Xt.isSupported(n))for(var r=0;r<n.style.length;r++){var o=n.style.item(r);t[o]=n.style[o]}return t},isValidValue:function(e,t,n){var r=Y.fromTag(e);return $t(r,t,n),Qt(r,t).isSome()},reflow:function(e){return e.dom().offsetWidth},transfer:function(r,o,e){dt.isElement(r)&&dt.isElement(o)&&E.each(e,function(e){var t,n;t=o,Qt(r,n=e).each(function(e){Qt(t,n).isNone()&&$t(t,n,e)})})}},en=function(t,n){rt.parent(t).each(function(e){e.dom().insertBefore(n.dom(),t.dom())})},tn=function(e,t){e.dom().appendChild(t.dom())},nn={before:en,after:function(e,t){rt.nextSibling(e).fold(function(){rt.parent(e).each(function(e){tn(e,t)})},function(e){en(e,t)})},prepend:function(t,n){rt.firstChild(t).fold(function(){tn(t,n)},function(e){t.dom().insertBefore(n.dom(),e.dom())})},append:tn,appendAt:function(e,t,n){rt.child(e,n).fold(function(){tn(e,t)},function(e){en(e,t)})},wrap:function(e,t){en(e,t),tn(t,e)}},rn={before:function(t,e){E.each(e,function(e){nn.before(t,e)})},after:function(r,o){E.each(o,function(e,t){var n=0===t?r:o[t-1];nn.after(n,e)})},prepend:function(t,e){E.each(e.slice().reverse(),function(e){nn.prepend(t,e)})},append:function(t,e){E.each(e,function(e){nn.append(t,e)})}},on=function(e){var t=e.dom();null!==t.parentNode&&t.parentNode.removeChild(t)},un={empty:function(e){e.dom().textContent="",E.each(rt.children(e),function(e){on(e)})},remove:on,unwrap:function(e){var t=rt.children(e);0<t.length&&rn.before(e,t),on(e)}},an=F.immutable("minRow","minCol","maxRow","maxCol"),cn=function(e,t){var n,i,r,u,a,c,l,o,s,f,d=function(e){return ne.is(e.element(),t)},m=_t(e),g=Gt.generate(m),p=(i=d,r=(n=g).grid().columns(),u=n.grid().rows(),a=r,l=c=0,M.each(n.access(),function(e){if(i(e)){var t=e.row(),n=t+e.rowspan()-1,r=e.column(),o=r+e.colspan()-1;t<u?u=t:c<n&&(c=n),r<a?a=r:l<o&&(l=o)}}),an(u,a,c,l)),h="th:not("+t+"),td:not("+t+")",v=it.filterFirstLayer(e,"th,td",function(e){return ne.is(e,h)});return E.each(v,un.remove),function(e,t,n,r){for(var o,i,u,a=t.grid().columns(),c=t.grid().rows(),l=0;l<c;l++)for(var s=!1,f=0;f<a;f++)l<n.minRow()||l>n.maxRow()||f<n.minCol()||f>n.maxCol()||(Gt.getAt(t,l,f).filter(r).isNone()?(o=s,i=e[l].element(),u=Y.fromTag("td"),nn.append(u,Y.fromTag("br")),(o?nn.append:nn.prepend)(i,u)):s=!0)}(m,g,p,d),o=e,s=p,f=E.filter(it.firstLayer(o,"tr"),function(e){return 0===e.dom().childElementCount}),E.each(f,un.remove),s.minCol()!==s.maxCol()&&s.minRow()!==s.maxRow()||E.each(it.firstLayer(o,"th,td"),function(e){vt.remove(e,"rowspan"),vt.remove(e,"colspan")}),vt.remove(o,"width"),vt.remove(o,"height"),Zt.remove(o,"width"),Zt.remove(o,"height"),e},ln=function(e,t){return Y.fromDom(e.dom().cloneNode(t))},sn=function(e){return ln(e,!0)},fn=function(e,t){var n=Y.fromTag(t),r=vt.clone(e);return vt.setAll(n,r),n},dn=function(e){return ln(e,!1)},mn=sn,gn=function(e,t){var n=fn(e,t),r=rt.children(sn(e));return rn.append(n,r),n},pn=(Tt=dt.isText,At="text",Dt=function(e){return Tt(e)?x.from(e.dom().nodeValue):x.none()},kt=Ge.detect().browser,{get:function(e){if(!Tt(e))throw new Error("Can only get "+At+" value of a "+At+" node");return Nt(e).getOr("")},getOption:Nt=kt.isIE()&&10===kt.version.major?function(e){try{return Dt(e)}catch(t){return x.none()}}:Dt,set:function(e,t){if(!Tt(e))throw new Error("Can only set raw "+At+" value of a "+At+" node");e.dom().nodeValue=t}}),hn={get:function(e){return pn.get(e)},getOption:function(e){return pn.getOption(e)},set:function(e,t){pn.set(e,t)}},vn=function(e){return"img"===dt.name(e)?1:hn.getOption(e).fold(function(){return rt.children(e).length},function(e){return e.length})},bn=["img","br"],wn=vn,yn=function(e){var t;return t=e,hn.getOption(t).filter(function(e){return 0!==e.trim().length||-1<e.indexOf("\xa0")}).isSome()||E.contains(bn,dt.name(e))},xn=function(e,i){var u=function(e){for(var t=rt.children(e),n=t.length-1;0<=n;n--){var r=t[n];if(i(r))return x.some(r);var o=u(r);if(o.isSome())return o}return x.none()};return u(e)},Sn={first:function(e){return Pt.descendant(e,yn)},last:function(e){return xn(e,yn)}},Cn=function(){var e=Y.fromTag("td");return nn.append(e,Y.fromTag("br")),e},Rn=function(e,t,n){var r=gn(e,t);return M.each(n,function(e,t){null===e?vt.remove(r,t):vt.set(r,t,e)}),r},Tn=function(e){return e},An=function(e){return function(){return Y.fromTag("tr",e.dom())}},Dn=function(c,e,l){return{row:An(e),cell:function(e){var r,o,i,t=rt.owner(e.element()),n=Y.fromTag(dt.name(e.element()),t.dom()),u=l.getOr(["strong","em","b","i","span","font","h1","h2","h3","h4","h5","h6","p","div"]),a=0<u.length?(r=e.element(),o=n,i=u,Sn.first(r).map(function(e){var t=i.join(","),n=Ct.ancestors(e,t,function(e){return Ke.eq(e,r)});return E.foldr(n,function(e,t){var n=dn(t);return nn.append(e,n),n},o)}).getOr(o)):n;return nn.append(a,Y.fromTag("br")),Zt.copy(e.element(),n),Zt.remove(n,"height"),1!==e.colspan()&&Zt.remove(e.element(),"width"),c(e.element(),n),n},replace:Rn,gap:Cn}},kn=function(e){return{row:An(e),cell:Cn,replace:Tn,gap:Cn}},Nn=function(e,t){var n=(t||document).createElement("div");return n.innerHTML=e,rt.children(Y.fromDom(n))},En=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","li","table","thead","tbody","tfoot","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"];function On(){return{up:y.constant({selector:Wt.ancestor,closest:Wt.closest,predicate:Pt.ancestor,all:rt.parents}),down:y.constant({selector:Ct.descendants,predicate:St.descendants}),styles:y.constant({get:Zt.get,getRaw:Zt.getRaw,set:Zt.set,remove:Zt.remove}),attrs:y.constant({get:vt.get,set:vt.set,remove:vt.remove,copyTo:function(e,t){var n=vt.clone(e);vt.setAll(t,n)}}),insert:y.constant({before:nn.before,after:nn.after,afterAll:rn.after,append:nn.append,appendAll:rn.append,prepend:nn.prepend,wrap:nn.wrap}),remove:y.constant({unwrap:un.unwrap,remove:un.remove}),create:y.constant({nu:Y.fromTag,clone:function(e){return Y.fromDom(e.dom().cloneNode(!1))},text:Y.fromText}),query:y.constant({comparePosition:function(e,t){return e.dom().compareDocumentPosition(t.dom())},prevSibling:rt.prevSibling,nextSibling:rt.nextSibling}),property:y.constant({children:rt.children,name:dt.name,parent:rt.parent,isText:dt.isText,isComment:dt.isComment,isElement:dt.isElement,getText:hn.get,setText:hn.set,isBoundary:function(e){return!!dt.isElement(e)&&("body"===dt.name(e)||E.contains(En,dt.name(e)))},isEmptyTag:function(e){return!!dt.isElement(e)&&E.contains(["br","img","hr","input"],dt.name(e))}}),eq:Ke.eq,is:Ke.is}}F.immutable("left","right");var Bn=function(r,o,e,t){var n=o(r,e);return E.foldr(t,function(e,t){var n=o(r,t);return Pn(r,e,n)},n)},Pn=function(t,e,n){return e.bind(function(e){return n.filter(y.curry(t.eq,e))})},In=function(e,t,n){return 0<n.length?Bn(e,t,(r=n)[0],r.slice(1)):x.none();var r},Wn=function(e,t){return y.curry(e.eq,t)},Mn=function(t,e,n,r){var o=r!==undefined?r:y.constant(!1),i=[e].concat(t.up().all(e)),u=[n].concat(t.up().all(n)),a=function(t){return E.findIndex(t,o).fold(function(){return t},function(e){return t.slice(0,e+1)})},c=a(i),l=a(u),s=E.find(c,function(e){return E.exists(l,Wn(t,e))});return{firstpath:y.constant(c),secondpath:y.constant(l),shared:y.constant(s)}},Ln=Mn,qn=function(e,t,n){return In(e,t,n)},Fn=function(e,t,n,r){return Ln(e,t,n,r)},jn=On(),zn=function(n,e){return qn(jn,function(e,t){return n(t)},e)},_n=function(e,t,n){return Fn(jn,e,t,n)},Hn=function(e,t){return t.column()>=e.startCol()&&t.column()+t.colspan()-1<=e.finishCol()&&t.row()>=e.startRow()&&t.row()+t.rowspan()-1<=e.finishRow()},Vn=function(e,t){var n=t.column(),r=t.column()+t.colspan()-1,o=t.row(),i=t.row()+t.rowspan()-1;return n<=e.finishCol()&&r>=e.startCol()&&o<=e.finishRow()&&i>=e.startRow()},Un=function(e,t){for(var n=!0,r=y.curry(Hn,t),o=t.startRow();o<=t.finishRow();o++)for(var i=t.startCol();i<=t.finishCol();i++)n=n&&Gt.getAt(e,o,i).exists(r);return n?x.some(t):x.none()},Gn=function(e,t,n){var r=Gt.findItem(e,t,Ke.eq),o=Gt.findItem(e,n,Ke.eq);return r.bind(function(r){return o.map(function(e){return t=r,n=e,G.bounds(Math.min(t.row(),n.row()),Math.min(t.column(),n.column()),Math.max(t.row()+t.rowspan()-1,n.row()+n.rowspan()-1),Math.max(t.column()+t.colspan()-1,n.column()+n.colspan()-1));var t,n})})},Xn=Gn,Yn=function(t,e,n){return Gn(t,e,n).bind(function(e){return Un(t,e)})},Kn=function(r,e,o,i){return Gt.findItem(r,e,Ke.eq).bind(function(e){var t=0<o?e.row()+e.rowspan()-1:e.row(),n=0<i?e.column()+e.colspan()-1:e.column();return Gt.getAt(r,t+o,n+i).map(function(e){return e.element()})})},$n=function(n,e,t){return Xn(n,e,t).map(function(e){var t=Gt.filterItems(n,y.curry(Vn,e));return E.map(t,function(e){return e.element()})})},Jn=function(e,t){return Gt.findItem(e,t,function(e,t){return Ke.contains(t,e)}).bind(function(e){return e.element()})},Qn=function(e){var t=_t(e);return Gt.generate(t)},Zn=function(n,r,o){return zt.table(n).bind(function(e){var t=Qn(e);return Kn(t,n,r,o)})},er=function(e,t,n){var r=Qn(e);return $n(r,t,n)},tr=function(e,t,n,r,o){var i=Qn(e),u=Ke.eq(e,n)?t:Jn(i,t),a=Ke.eq(e,o)?r:Jn(i,r);return $n(i,u,a)},nr=function(e,t,n){var r=Qn(e);return Yn(r,t,n)},rr=function(e,t){return Wt.ancestor(e,"table")},or=F.immutableBag(["boxes","start","finish"],[]),ir=function(a,c,r){var l=function(t){return function(e){return r(e)||Ke.eq(e,t)}};return Ke.eq(a,c)?x.some(or({boxes:x.some([a]),start:a,finish:c})):rr(a).bind(function(u){return rr(c).bind(function(i){if(Ke.eq(u,i))return x.some(or({boxes:er(u,a,c),start:a,finish:c}));if(Ke.contains(u,i)){var e=0<(t=Ct.ancestors(c,"td,th",l(u))).length?t[t.length-1]:c;return x.some(or({boxes:tr(u,a,u,c,i),start:a,finish:e}))}if(Ke.contains(i,u)){var t,n=0<(t=Ct.ancestors(a,"td,th",l(i))).length?t[t.length-1]:a;return x.some(or({boxes:tr(i,a,u,c,i),start:a,finish:n}))}return _n(a,c).shared().bind(function(e){return Wt.closest(e,"table",r).bind(function(e){var t=Ct.ancestors(c,"td,th",l(e)),n=0<t.length?t[t.length-1]:c,r=Ct.ancestors(a,"td,th",l(e)),o=0<r.length?r[r.length-1]:a;return x.some(or({boxes:tr(e,a,u,c,i),start:o,finish:n}))})})})})},ur={identify:ir,retrieve:function(e,t){var n=Ct.descendants(e,t);return 0<n.length?x.some(n):x.none()},shiftSelection:function(e,t,n,r,o){return(i=e,u=o,E.find(i,function(e){return ne.is(e,u)})).bind(function(e){return Zn(e,t,n).bind(function(e){return t=e,n=r,Wt.ancestor(t,"table").bind(function(e){return Wt.descendant(e,n).bind(function(e){return ir(e,t).bind(function(t){return t.boxes().map(function(e){return{boxes:y.constant(e),start:y.constant(t.start()),finish:y.constant(t.finish())}})})})});var t,n})});var i,u},getEdges:function(e,t,r){return Wt.descendant(e,t).bind(function(n){return Wt.descendant(e,r).bind(function(t){return zn(rr,[n,t]).map(function(e){return{first:y.constant(n),last:y.constant(t),table:y.constant(e)}})})})}},ar=function(e,t){return ur.retrieve(e,t)},cr=function(o,e,t){return ur.getEdges(o,e,t).bind(function(n){var e=function(e){return Ke.eq(o,e)},t=Wt.ancestor(n.first(),"thead,tfoot,tbody,table",e),r=Wt.ancestor(n.last(),"thead,tfoot,tbody,table",e);return t.bind(function(t){return r.bind(function(e){return Ke.eq(t,e)?nr(n.table(),n.first(),n.last()):x.none()})})})},lr="data-mce-selected",sr="data-mce-first-selected",fr="data-mce-last-selected",dr={selected:y.constant(lr),selectedSelector:y.constant("td[data-mce-selected],th[data-mce-selected]"),attributeSelector:y.constant("[data-mce-selected]"),firstSelected:y.constant(sr),firstSelectedSelector:y.constant("td[data-mce-first-selected],th[data-mce-first-selected]"),lastSelected:y.constant(fr),lastSelectedSelector:y.constant("td[data-mce-last-selected],th[data-mce-last-selected]")},mr=function(u){if(!g.isArray(u))throw new Error("cases must be an array");if(0===u.length)throw new Error("there must be at least one case");var a=[],n={};return E.each(u,function(e,r){var t=M.keys(e);if(1!==t.length)throw new Error("one and only one name per case");var o=t[0],i=e[o];if(n[o]!==undefined)throw new Error("duplicate key detected:"+o);if("cata"===o)throw new Error("cannot have a case named cata (sorry)");if(!g.isArray(i))throw new Error("case arguments must be an array");a.push(o),n[o]=function(){var e=arguments.length;if(e!==i.length)throw new Error("Wrong number of arguments to case "+o+". Expected "+i.length+" ("+i+"), got "+e);for(var n=new Array(e),t=0;t<n.length;t++)n[t]=arguments[t];return{fold:function(){if(arguments.length!==u.length)throw new Error("Wrong number of arguments to fold. Expected "+u.length+", got "+arguments.length);return arguments[r].apply(null,n)},match:function(e){var t=M.keys(e);if(a.length!==t.length)throw new Error("Wrong number of arguments to match. Expected: "+a.join(",")+"\nActual: "+t.join(","));if(!E.forall(a,function(e){return E.contains(t,e)}))throw new Error("Not all branches were specified when using match. Specified: "+t.join(", ")+"\nRequired: "+a.join(", "));return e[o].apply(null,n)},log:function(e){console.log(e,{constructors:a,constructor:o,params:n})}}}}),n},gr=mr([{none:[]},{multiple:["elements"]},{single:["selection"]}]),pr={cata:function(e,t,n,r){return e.fold(t,n,r)},none:gr.none,multiple:gr.multiple,single:gr.single},hr=function(e,t){return pr.cata(t.get(),y.constant([]),y.identity,y.constant([e]))},vr=function(n,e){return pr.cata(e.get(),x.none,function(t,e){return 0===t.length?x.none():cr(n,dr.firstSelectedSelector(),dr.lastSelectedSelector()).bind(function(e){return 1<t.length?x.some({bounds:y.constant(e),cells:y.constant(t)}):x.none()})},x.none)},br=function(e,t){var n=hr(e,t);return 0<n.length&&E.forall(n,function(e){return vt.has(e,"rowspan")&&1<parseInt(vt.get(e,"rowspan"),10)||vt.has(e,"colspan")&&1<parseInt(vt.get(e,"colspan"),10)})?x.some(n):x.none()},wr=hr,yr=function(e){return{element:y.constant(e),mergable:x.none,unmergable:x.none,selection:y.constant([e])}},xr=F.immutable("element","clipboard","generators"),Sr={noMenu:yr,forMenu:function(e,t,n){return{element:y.constant(n),mergable:y.constant(vr(t,e)),unmergable:y.constant(br(n,e)),selection:y.constant(wr(n,e))}},notCell:function(e){return yr(e)},paste:xr,pasteRows:function(e,t,n,r,o){return{element:y.constant(n),mergable:x.none,unmergable:x.none,selection:y.constant(wr(n,e)),clipboard:y.constant(r),generators:y.constant(o)}}},Cr={registerEvents:function(a,e,c,l){a.on("BeforeGetContent",function(n){!0===n.selection&&pr.cata(e.get(),y.noop,function(e){var t;n.preventDefault(),(t=e,zt.table(t[0]).map(mn).map(function(e){return[cn(e,dr.attributeSelector())]})).each(function(e){n.content=E.map(e,function(e){return t=e,a.selection.serializer.serialize(t.dom(),{});var t}).join("")})},y.noop)}),a.on("BeforeSetContent",function(u){!0===u.selection&&!0===u.paste&&x.from(a.dom.getParent(a.selection.getStart(),"th,td")).each(function(e){var i=Y.fromDom(e);zt.table(i).bind(function(t){var e=E.filter(Nn(u.content),function(e){return"meta"!==dt.name(e)});if(1===e.length&&"table"===dt.name(e[0])){u.preventDefault();var n=Y.fromDom(a.getDoc()),r=kn(n),o=Sr.paste(i,e[0],r);c.pasteCells(t,o).each(function(e){a.selection.setRng(e),a.focus(),l.clear(t)})}})})})}};function Rr(r,o){var e=function(e){var t=o(e);if(t<=0||null===t){var n=Zt.get(e,r);return parseFloat(n)||0}return t},i=function(o,e){return E.foldl(e,function(e,t){var n=Zt.get(o,t),r=n===undefined?0:parseInt(n,10);return isNaN(r)?e:e+r},0)};return{set:function(e,t){if(!g.isNumber(t)&&!t.match(/^[0-9]+$/))throw r+".set accepts only positive integer values. Value was "+t;var n=e.dom();Xt.isSupported(n)&&(n.style[r]=t+"px")},get:e,getOuter:e,aggregate:i,max:function(e,t,n){var r=i(e,n);return r<t?t-r:0}}}var Tr=Rr("height",function(e){return yt.inBody(e)?e.dom().getBoundingClientRect().height:e.dom().offsetHeight}),Ar=function(e){return Tr.get(e)},Dr=function(e){return Tr.getOuter(e)},kr=Rr("width",function(e){return e.dom().offsetWidth}),Nr=function(e){return kr.get(e)},Er=function(e){return kr.getOuter(e)},Or=Ge.detect(),Br=function(e,t,n){return r=Zt.get(e,t),o=n,i=parseFloat(r),isNaN(i)?o:i;var r,o,i},Pr=function(e){return Or.browser.isIE()||Or.browser.isEdge()?(n=Br(t=e,"padding-top",0),r=Br(t,"padding-bottom",0),o=Br(t,"border-top-width",0),i=Br(t,"border-bottom-width",0),u=t.dom().getBoundingClientRect().height,"border-box"===Zt.get(t,"box-sizing")?u:u-n-r-(o+i)):Br(e,"height",Ar(e));var t,n,r,o,i,u},Ir=/(\d+(\.\d+)?)(\w|%)*/,Wr=/(\d+(\.\d+)?)%/,Mr=/(\d+(\.\d+)?)px|em/,Lr=function(e,t){Zt.set(e,"height",t+"px")},qr=function(e,t,n,r){var o,i,u,a,c,l=parseInt(e,10);return Fe.endsWith(e,"%")&&"table"!==dt.name(t)?(o=t,i=l,u=n,a=r,c=zt.table(o).map(function(e){var t=u(e);return Math.floor(i/100*t)}).getOr(i),a(o,c),c):l},Fr=function(e){var t,n=(t=e,Zt.getRaw(t,"height").getOrThunk(function(){return Pr(t)+"px"}));return n?qr(n,e,Ar,Lr):Ar(e)},jr=function(e,t){return vt.has(e,t)?parseInt(vt.get(e,t),10):1},zr=function(e){return Zt.getRaw(e,"width").fold(function(){return x.from(vt.get(e,"width"))},function(e){return x.some(e)})},_r=function(e,t){return e/t.pixelWidth()*100},Hr={percentageBasedSizeRegex:y.constant(Wr),pixelBasedSizeRegex:y.constant(Mr),setPixelWidth:function(e,t){Zt.set(e,"width",t+"px")},setPercentageWidth:function(e,t){Zt.set(e,"width",t+"%")},setHeight:Lr,getPixelWidth:function(t,n){return zr(t).fold(function(){var e=Nr(t);return parseInt(e,10)},function(e){return function(e,t,n){if(Mr.test(t)){var r=Mr.exec(t);return parseInt(r[1],10)}if(Wr.test(t)){var o=Wr.exec(t),i=parseFloat(o[1]);return i/100*n.pixelWidth()}var u=Nr(e);return parseInt(u,10)}(t,e,n)})},getPercentageWidth:function(n,r){return zr(n).fold(function(){var e=Nr(n),t=parseInt(e,10);return _r(t,r)},function(e){return function(e,t,n){if(Wr.test(t)){var r=Wr.exec(t);return parseFloat(r[1])}var o=Nr(e),i=parseInt(o,10);return _r(i,n)}(n,e,r)})},getGenericWidth:function(e){return zr(e).bind(function(e){if(Ir.test(e)){var t=Ir.exec(e);return x.some({width:y.constant(t[1]),unit:y.constant(t[3])})}return x.none()})},setGenericWidth:function(e,t,n){Zt.set(e,"width",t+n)},getHeight:function(e){return n="rowspan",Fr(t=e)/jr(t,n);var t,n},getRawWidth:zr},Vr=function(n,r){Hr.getGenericWidth(n).each(function(e){var t=e.width()/2;Hr.setGenericWidth(n,t,e.unit()),Hr.setGenericWidth(r,t,e.unit())})},Ur=function(e,t){var n=t||Y.fromDom(document.documentElement);return Pt.ancestor(e,y.curry(Ke.eq,n)).isSome()},Gr=function(e){var t=e.dom();return t===t.window?e:dt.isDocument(e)?t.defaultView||t.parentWindow:null},Xr=function(n,r){return{left:y.constant(n),top:y.constant(r),translate:function(e,t){return Xr(n+e,r+t)}}},Yr=function(e,t){return e!==undefined?e:t!==undefined?t:0},Kr=function(e){var t,n=e.dom(),r=n.ownerDocument,o=r.body,i=Y.fromDom(r.documentElement);return o===n?Xr(o.offsetLeft,o.offsetTop):Ur(e,i)?(t=n.getBoundingClientRect(),Xr(t.left,t.top)):Xr(0,0)},$r=function(e){var t=e.dom().ownerDocument,n=t.body,r=Gr(Y.fromDom(t)),o=t.documentElement,i=Yr(r.pageYOffset,o.scrollTop),u=Yr(r.pageXOffset,o.scrollLeft),a=Yr(o.clientTop,n.clientTop),c=Yr(o.clientLeft,n.clientLeft);return Kr(e).translate(u-c,i-a)},Jr=F.immutable("row","y"),Qr=F.immutable("col","x"),Zr=function(e){return $r(e).left()+Er(e)},eo=function(e){return $r(e).left()},to=function(e,t){return Qr(e,eo(t))},no=function(e,t){return Qr(e,Zr(t))},ro=function(e){return $r(e).top()},oo=function(n,t,r){if(0===r.length)return[];var e=E.map(r.slice(1),function(e,t){return e.map(function(e){return n(t,e)})}),o=r[r.length-1].map(function(e){return t(r.length-1,e)});return e.concat([o])},io={delta:y.identity,positions:y.curry(oo,function(e,t){return Jr(e,ro(t))},function(e,t){return Jr(e,ro(t)+Dr(t))}),edge:ro},uo={delta:y.identity,edge:eo,positions:y.curry(oo,to,no)},ao={height:io,rtl:{delta:function(e,t){return-e},edge:Zr,positions:y.curry(oo,no,to)},ltr:uo},co={ltr:ao.ltr,rtl:ao.rtl};function lo(t){var n=function(e){return t(e).isRtl()?co.rtl:co.ltr};return{delta:function(e,t){return n(t).delta(e,t)},edge:function(e){return n(e).edge(e)},positions:function(e,t){return n(t).positions(e,t)}}}var so=function(e){var t=_t(e);return Gt.generate(t).grid()},fo=function(e){var t=e,n=function(){return t};return{get:n,set:function(e){t=e},clone:function(){return fo(n())}}},mo=function(e,t){return go(e,t,{validate:g.isFunction,label:"function"})},go=function(r,o,i){if(0===o.length)throw new Error("You must specify at least one required field.");return q.validateStrArr("required",o),q.checkDupes(o),function(t){var n=M.keys(t);E.forall(o,function(e){return E.contains(n,e)})||q.reqMessage(o,n),r(o,n);var e=E.filter(o,function(e){return!i.validate(t[e],e)});return 0<e.length&&q.invalidTypeMessage(e,i.label),t}},po=y.noop,ho={exactly:y.curry(mo,function(t,e){var n=E.filter(e,function(e){return!E.contains(t,e)});0<n.length&&q.unsuppMessage(n)}),ensure:y.curry(mo,po),ensureWith:y.curry(go,po)},vo=function(e){var t=vt.has(e,"colspan")?parseInt(vt.get(e,"colspan"),10):1,n=vt.has(e,"rowspan")?parseInt(vt.get(e,"rowspan"),10):1;return{element:y.constant(e),colspan:y.constant(t),rowspan:y.constant(n)}},bo=ho.exactly(["cell","row","replace","gap"]),wo=function(r,e){bo(r);var n=fo(x.none()),o=e!==undefined?e:vo,i=function(e){var t,n=o(e);return t=n,r.cell(t)},u=function(e){var t=i(e);return n.get().isNone()&&n.set(x.some(t)),a=x.some({item:e,replacement:t}),t},a=x.none();return{getOrInit:function(t,n){return a.fold(function(){return u(t)},function(e){return n(t,e.item)?e.replacement:u(t)})},cursor:n.get}},yo=function(o,a){return function(n){var r=fo(x.none());bo(n);var i=[],u=function(e){var t=n.replace(e,a,{scope:o});return i.push({item:e,sub:t}),r.get().isNone()&&r.set(x.some(t)),t};return{replaceOrInit:function(t,n){return(r=t,o=n,E.find(i,function(e){return o(e.item,r)})).fold(function(){return u(t)},function(e){return n(t,e.item)?e.sub:u(t)});var r,o},cursor:r.get}}},xo=function(n){bo(n);var e=fo(x.none());return{combine:function(t){return e.get().isNone()&&e.set(x.some(t)),function(){var e=n.cell({element:y.constant(t),colspan:y.constant(1),rowspan:y.constant(1)});return Zt.remove(e,"width"),Zt.remove(t,"width"),e}},cursor:e.get}},So=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","table","thead","tfoot","tbody","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"],Co=function(e,t){var n=e.property().name(t);return E.contains(So,n)},Ro=function(e,t){return E.contains(["br","img","hr","input"],e.property().name(t))},To=Co,Ao=function(e,t){var n=e.property().name(t);return E.contains(["ol","ul"],n)},Do=Ro,ko=On(),No=function(e){return To(ko,e)},Eo=function(e){return Ao(ko,e)},Oo=function(e){return Do(ko,e)},Bo=function(e){var t,i=function(e){return"br"===dt.name(e)},r=function(o){return Sn.last(o).bind(function(n){var e,r=(e=n,rt.nextSibling(e).map(function(e){return!!No(e)||(Oo(e)?"img"!==dt.name(e):void 0)}).getOr(!1));return rt.parent(n).map(function(e){return!0===r||(t=e,"li"===dt.name(t)||Pt.ancestor(t,Eo).isSome())||i(n)||No(e)&&!Ke.eq(o,e)?[]:[Y.fromTag("br")];var t})}).getOr([])},n=0===(t=E.bind(e,function(e){var t,n=rt.children(e);return t=n,E.forall(t,function(e){return i(e)||dt.isText(e)&&0===hn.get(e).trim().length})?[]:n.concat(r(e))})).length?[Y.fromTag("br")]:t;un.empty(e[0]),rn.append(e[0],n)},Po=function(u){return function(){for(var e=new Array(arguments.length),t=0;t<e.length;t++)e[t]=arguments[t];if(0===e.length)throw new Error("Can't merge zero objects");for(var n={},r=0;r<e.length;r++){var o=e[r];for(var i in o)o.hasOwnProperty(i)&&(n[i]=u(n[i],o[i]))}return n}},Io=Po(function(e,t){return g.isObject(e)&&g.isObject(t)?Io(e,t):t}),Wo=Po(function(e,t){return t}),Mo={deepMerge:Io,merge:Wo},Lo=function(e){for(var t=[],n=function(e){t.push(e)},r=0;r<e.length;r++)e[r].each(n);return t},qo=function(e,t){for(var n=0;n<e.length;n++){var r=t(e[n],n);if(r.isSome())return r}return x.none()},Fo=function(e,t){return G.rowcells(t,e.section())},jo=function(e,t){return e.cells()[t]},zo={addCell:function(e,t,n){var r=e.cells(),o=r.slice(0,t),i=r.slice(t),u=o.concat([n]).concat(i);return Fo(e,u)},setCells:Fo,mutateCell:function(e,t,n){e.cells()[t]=n},getCell:jo,getCellElement:function(e,t){return jo(e,t).element()},mapCells:function(e,t){var n=e.cells(),r=E.map(n,t);return G.rowcells(r,e.section())},cellLength:function(e){return e.cells().length}},_o=function(e,t){if(0===e.length)return 0;var n=e[0];return E.findIndex(e,function(e){return!t(n.element(),e.element())}).fold(function(){return e.length},function(e){return e})},Ho=function(e,t,n,r){var o,i,u,a,c=(o=e,i=t,o[i]).cells().slice(n),l=_o(c,r),s=(u=e,a=n,E.map(u,function(e){return zo.getCell(e,a)})).slice(t),f=_o(s,r);return{colspan:y.constant(l),rowspan:y.constant(f)}},Vo=function(o,i){var u=E.map(o,function(e,t){return E.map(e.cells(),function(e,t){return!1})});return E.map(o,function(e,r){var t=E.bind(e.cells(),function(e,t){if(!1===u[r][t]){var n=Ho(o,r,t,i);return function(e,t,n,r){for(var o=e;o<e+n;o++)for(var i=t;i<t+r;i++)u[o][i]=!0}(r,t,n.rowspan(),n.colspan()),[G.detailnew(e.element(),n.rowspan(),n.colspan(),e.isNew())]}return[]});return G.rowdetails(t,e.section())})},Uo=function(e,t,n){for(var r=[],o=0;o<e.grid().rows();o++){for(var i=[],u=0;u<e.grid().columns();u++){var a=Gt.getAt(e,o,u).map(function(e){return G.elementnew(e.element(),n)}).getOrThunk(function(){return G.elementnew(t.gap(),!0)});i.push(a)}var c=G.rowcells(i,e.all()[o].section());r.push(c)}return r},Go=function(e,t,n,r){n===r?vt.remove(e,t):vt.set(e,t,n)},Xo=function(o,e){var i=[],u=[],t=function(e,t){var n;0<e.length?function(e,t){var n=Wt.child(o,t).getOrThunk(function(){var e=Y.fromTag(t,rt.owner(o).dom());return nn.append(o,e),e});un.empty(n);var r=E.map(e,function(e){e.isNew()&&i.push(e.element());var t=e.element();return un.empty(t),E.each(e.cells(),function(e){e.isNew()&&u.push(e.element()),Go(e.element(),"colspan",e.colspan(),1),Go(e.element(),"rowspan",e.rowspan(),1),nn.append(t,e.element())}),t});rn.append(n,r)}(e,t):(n=t,Wt.child(o,n).bind(un.remove))},n=[],r=[],a=[];return E.each(e,function(e){switch(e.section()){case"thead":n.push(e);break;case"tbody":r.push(e);break;case"tfoot":a.push(e)}}),t(n,"thead"),t(r,"tbody"),t(a,"tfoot"),{newRows:y.constant(i),newCells:y.constant(u)}},Yo=function(e){return E.map(e,function(e){var n=dn(e.element());return E.each(e.cells(),function(e){var t=mn(e.element());Go(t,"colspan",e.colspan(),1),Go(t,"rowspan",e.rowspan(),1),nn.append(n,t)}),n})},Ko=function(e,t){for(var n=[],r=0;r<e;r++)n.push(t(r));return n},$o=function(e,t){for(var n=[],r=e;r<t;r++)n.push(r);return n},Jo=function(t,n){if(n<0||n>=t.length-1)return x.none();var e=t[n].fold(function(){var e=E.reverse(t.slice(0,n));return qo(e,function(e,t){return e.map(function(e){return{value:e,delta:t+1}})})},function(e){return x.some({value:e,delta:0})}),r=t[n+1].fold(function(){var e=t.slice(n+1);return qo(e,function(e,t){return e.map(function(e){return{value:e,delta:t+1}})})},function(e){return x.some({value:e,delta:1})});return e.bind(function(n){return r.map(function(e){var t=e.delta+n.delta;return Math.abs(e.value-n.value)/t})})},Qo=function(e,t,n){var r=e();return E.find(r,t).orThunk(function(){return x.from(r[0]).orThunk(n)}).map(function(e){return e.element()})},Zo=function(n){var e=n.grid(),t=$o(0,e.columns()),r=$o(0,e.rows());return E.map(t,function(t){return Qo(function(){return E.bind(r,function(e){return Gt.getAt(n,e,t).filter(function(e){return e.column()===t}).fold(y.constant([]),function(e){return[e]})})},function(e){return 1===e.colspan()},function(){return Gt.getAt(n,0,t)})})},ei=function(n){var e=n.grid(),t=$o(0,e.rows()),r=$o(0,e.columns());return E.map(t,function(t){return Qo(function(){return E.bind(r,function(e){return Gt.getAt(n,t,e).filter(function(e){return e.row()===t}).fold(y.constant([]),function(e){return[e]})})},function(e){return 1===e.rowspan()},function(){return Gt.getAt(n,t,0)})})},ti=function(e,t,n,r,o){var i=Y.fromTag("div");return Zt.setAll(i,{position:"absolute",left:t-r/2+"px",top:n+"px",height:o+"px",width:r+"px"}),vt.setAll(i,{"data-column":e,role:"presentation"}),i},ni=function(e,t,n,r,o){var i=Y.fromTag("div");return Zt.setAll(i,{position:"absolute",left:t+"px",top:n-o/2+"px",height:o+"px",width:r+"px"}),vt.setAll(i,{"data-row":e,role:"presentation"}),i},ri=function(e){var t=e.replace(/\./g,"-");return{resolve:function(e){return t+"-"+e}}},oi={resolve:ri("ephox-snooker").resolve},ii=function(e,t){var n=vt.get(e,t);return n===undefined||""===n?[]:n.split(" ")},ui=ii,ai=function(e,t,n){var r=ii(e,t).concat([n]);vt.set(e,t,r.join(" "))},ci=function(e,t,n){var r=E.filter(ii(e,t),function(e){return e!==n});0<r.length?vt.set(e,t,r.join(" ")):vt.remove(e,t)},li=function(e){return ui(e,"class")},si=function(e,t){return ai(e,"class",t)},fi=function(e,t){return ci(e,"class",t)},di=li,mi=si,gi=fi,pi=function(e,t){E.contains(li(e),t)?fi(e,t):si(e,t)},hi=function(e){return e.dom().classList!==undefined},vi=function(e,t){return hi(e)&&e.dom().classList.contains(t)},bi={add:function(e,t){hi(e)?e.dom().classList.add(t):mi(e,t)},remove:function(e,t){var n;hi(e)?e.dom().classList.remove(t):gi(e,t),0===(hi(n=e)?n.dom().classList:di(n)).length&&vt.remove(n,"class")},toggle:function(e,t){return hi(e)?e.dom().classList.toggle(t):pi(e,t)},toggler:function(e,t){var n,r,o,i,u,a,c=hi(e),l=e.dom().classList;return n=function(){c?l.remove(t):gi(e,t)},r=function(){c?l.add(t):mi(e,t)},o=vi(e,t),i=o||!1,{on:u=function(){r(),i=!0},off:a=function(){n(),i=!1},toggle:function(){(i?a:u)()},isOn:function(){return i}}},has:vi},wi=oi.resolve("resizer-bar"),yi=oi.resolve("resizer-rows"),xi=oi.resolve("resizer-cols"),Si=function(e){var t=Ct.descendants(e.parent(),"."+wi);E.each(t,un.remove)},Ci=function(n,e,r){var o=n.origin();E.each(e,function(e,t){e.each(function(e){var t=r(o,e);bi.add(t,wi),nn.append(n.parent(),t)})})},Ri=function(e,t,n,r,o,i){var u,a,c,l,s=$r(t),f=0<n.length?o.positions(n,t):[];u=e,a=f,c=s,l=Er(t),Ci(u,a,function(e,t){var n=ni(t.row(),c.left()-e.left(),t.y()-e.top(),l,7);return bi.add(n,yi),n});var d,m,g,p,h=0<r.length?i.positions(r,t):[];d=e,m=h,g=s,p=Dr(t),Ci(d,m,function(e,t){var n=ti(t.col(),t.x()-e.left(),g.top()-e.top(),7,p);return bi.add(n,xi),n})},Ti=function(e,t){var n=Ct.descendants(e.parent(),"."+wi);E.each(n,t)},Ai={refresh:function(e,t,n,r){Si(e);var o=_t(t),i=Gt.generate(o),u=ei(i),a=Zo(i);Ri(e,t,u,a,n,r)},hide:function(e){Ti(e,function(e){Zt.set(e,"display","none")})},show:function(e){Ti(e,function(e){Zt.set(e,"display","block")})},destroy:Si,isRowBar:function(e){return bi.has(e,yi)},isColBar:function(e){return bi.has(e,xi)}},Di=function(e,r){return E.map(e,function(e){var t,n=(t=e.details(),qo(t,function(e){return rt.parent(e.element()).map(function(e){var t=rt.parent(e).isNone();return G.elementnew(e,t)})}).getOrThunk(function(){return G.elementnew(r.row(),!0)}));return G.rowdatanew(n.element(),e.details(),e.section(),n.isNew())})},ki=function(e,t){var n=Vo(e,Ke.eq);return Di(n,t)},Ni=function(e,t){var n=E.flatten(E.map(e.all(),function(e){return e.cells()}));return E.find(n,function(e){return Ke.eq(t,e.element())})},Ei=function(a,c,l,s,f){return function(n,r,e,o,i){var t=_t(r),u=Gt.generate(t);return c(u,e).map(function(e){var t=Uo(u,o,!1),n=a(t,e,Ke.eq,f(o)),r=ki(n.grid(),o);return{grid:y.constant(r),cursor:n.cursor}}).fold(function(){return x.none()},function(e){var t=Xo(r,e.grid());return l(r,e.grid(),i),s(r),Ai.refresh(n,r,ao.height,i),x.some({cursor:e.cursor,newRows:t.newRows,newCells:t.newCells})})}},Oi=ki,Bi=function(t,e){return zt.cell(e.element()).bind(function(e){return Ni(t,e)})},Pi=function(t,e){var n=E.map(e.selection(),function(e){return zt.cell(e).bind(function(e){return Ni(t,e)})}),r=Lo(n);return 0<r.length?x.some(r):x.none()},Ii=function(t,n){return zt.cell(n.element()).bind(function(e){return Ni(t,e).map(function(e){return Mo.merge(e,{generators:n.generators,clipboard:n.clipboard})})})},Wi=function(t,e){var n=E.map(e.selection(),function(e){return zt.cell(e).bind(function(e){return Ni(t,e)})}),r=Lo(n);return 0<r.length?x.some(Mo.merge({cells:r},{generators:e.generators,clipboard:e.clipboard})):x.none()},Mi=function(e,t){return t.mergable()},Li=function(e,t){return t.unmergable()},qi=function(n){return{is:function(e){return n===e},isValue:y.always,isError:y.never,getOr:y.constant(n),getOrThunk:y.constant(n),getOrDie:y.constant(n),or:function(e){return qi(n)},orThunk:function(e){return qi(n)},fold:function(e,t){return t(n)},map:function(e){return qi(e(n))},each:function(e){e(n)},bind:function(e){return e(n)},exists:function(e){return e(n)},forall:function(e){return e(n)},toOption:function(){return x.some(n)}}},Fi=function(n){return{is:y.never,isValue:y.never,isError:y.always,getOr:y.identity,getOrThunk:function(e){return e()},getOrDie:function(){return y.die(String(n))()},or:function(e){return e},orThunk:function(e){return e()},fold:function(e,t){return e(n)},map:function(e){return Fi(n)},each:y.noop,bind:function(e){return Fi(n)},exists:y.never,forall:y.always,toOption:x.none}},ji={value:qi,error:Fi},zi=function(e,t){return E.map(e,function(){return G.elementnew(t.cell(),!0)})},_i=function(t,e,n){return t.concat(Ko(e,function(e){return zo.setCells(t[t.length-1],zi(t[t.length-1].cells(),n))}))},Hi=function(e,t,n){return E.map(e,function(e){return zo.setCells(e,e.cells().concat(zi($o(0,t),n)))})},Vi=function(e,t,n){if(e.row()>=t.length||e.column()>zo.cellLength(t[0]))return ji.error("invalid start address out of table bounds, row: "+e.row()+", column: "+e.column());var r=t.slice(e.row()),o=r[0].cells().slice(e.column()),i=zo.cellLength(n[0]),u=n.length;return ji.value({rowDelta:y.constant(r.length-u),colDelta:y.constant(o.length-i)})},Ui=function(e,t){var n=zo.cellLength(e[0]),r=zo.cellLength(t[0]);return{rowDelta:y.constant(0),colDelta:y.constant(n-r)}},Gi=function(e,t,n){var r=t.colDelta()<0?Hi:y.identity;return(t.rowDelta()<0?_i:y.identity)(r(e,Math.abs(t.colDelta()),n),Math.abs(t.rowDelta()),n)},Xi=function(e,t,n,r){if(0===e.length)return e;for(var o=t.startRow();o<=t.finishRow();o++)for(var i=t.startCol();i<=t.finishCol();i++)zo.mutateCell(e[o],i,G.elementnew(r(),!1));return e},Yi=function(e,t,n,r){for(var o=!0,i=0;i<e.length;i++)for(var u=0;u<zo.cellLength(e[0]);u++){var a=n(zo.getCellElement(e[i],u),t);!0===a&&!1===o?zo.mutateCell(e[i],u,G.elementnew(r(),!0)):!0===a&&(o=!1)}return e},Ki=function(i,u,a,c){if(0<u&&u<i.length){var e=i[u-1].cells(),t=(n=e,r=a,E.foldl(n,function(e,t){return E.exists(e,function(e){return r(e.element(),t.element())})?e:e.concat([t])},[]));E.each(t,function(e){for(var t=x.none(),n=u;n<i.length;n++)for(var r=0;r<zo.cellLength(i[0]);r++){var o=i[n].cells()[r];a(o.element(),e.element())&&(t.isNone()&&(t=x.some(c())),t.each(function(e){zo.mutateCell(i[n],r,G.elementnew(e,!0))}))}})}var n,r;return i},$i=function(n,r,o,i,u){return Vi(n,r,o).map(function(e){var t=Gi(r,e,i);return function(e,t,n,r,o){for(var i,u,a,c,l,s,f,d=e.row(),m=e.column(),g=d+n.length,p=m+zo.cellLength(n[0]),h=d;h<g;h++)for(var v=m;v<p;v++){i=t,u=h,a=v,c=o,s=l=void 0,l=zo.getCell(i[u],a),s=y.curry(c,l.element()),f=i[u],1<i.length&&1<zo.cellLength(f)&&(0<a&&s(zo.getCellElement(f,a-1))||a<f.length-1&&s(zo.getCellElement(f,a+1))||0<u&&s(zo.getCellElement(i[u-1],a))||u<i.length-1&&s(zo.getCellElement(i[u+1],a)))&&Yi(t,zo.getCellElement(t[h],v),o,r.cell);var b=zo.getCellElement(n[h-d],v-m),w=r.replace(b);zo.mutateCell(t[h],v,G.elementnew(w,!0))}return t}(n,t,o,i,u)})},Ji=function(e,t,n,r,o){Ki(t,e,o,r.cell);var i=Ui(n,t),u=Gi(n,i,r),a=Ui(t,u),c=Gi(t,a,r);return c.slice(0,e).concat(u).concat(c.slice(e,c.length))},Qi=function(n,r,e,o,i){var t=n.slice(0,r),u=n.slice(r),a=zo.mapCells(n[e],function(e,t){return 0<r&&r<n.length&&o(zo.getCellElement(n[r-1],t),zo.getCellElement(n[r],t))?zo.getCell(n[r],t):G.elementnew(i(e.element(),o),!0)});return t.concat([a]).concat(u)},Zi=function(e,n,r,o,i){return E.map(e,function(e){var t=0<n&&n<zo.cellLength(e)&&o(zo.getCellElement(e,n-1),zo.getCellElement(e,n))?zo.getCell(e,n):G.elementnew(i(zo.getCellElement(e,r),o),!0);return zo.addCell(e,n,t)})},eu=function(e,r,o,i,u){var a=o+1;return E.map(e,function(e,t){var n=t===r?G.elementnew(u(zo.getCellElement(e,o),i),!0):zo.getCell(e,o);return zo.addCell(e,a,n)})},tu=function(e,t,n,r,o){var i=t+1,u=e.slice(0,i),a=e.slice(i),c=zo.mapCells(e[t],function(e,t){return t===n?G.elementnew(o(e.element(),r),!0):e});return u.concat([c]).concat(a)},nu=function(e,t,n){return e.slice(0,t).concat(e.slice(n+1))},ru=function(e,n,r){var t=E.map(e,function(e){var t=e.cells().slice(0,n).concat(e.cells().slice(r+1));return G.rowcells(t,e.section())});return E.filter(t,function(e){return 0<e.cells().length})},ou=function(e,n,r,o){return E.map(e,function(e){return zo.mapCells(e,function(e){return t=e,E.exists(n,function(e){return r(t.element(),e.element())})?G.elementnew(o(e.element(),r),!0):e;var t})})},iu=function(e,t,n,r){return zo.getCellElement(e[t],n)!==undefined&&0<t&&r(zo.getCellElement(e[t-1],n),zo.getCellElement(e[t],n))},uu=function(e,t,n){return 0<t&&n(zo.getCellElement(e,t-1),zo.getCellElement(e,t))},au=function(n,r,o,e){var t=E.bind(n,function(e,t){return iu(n,t,r,o)||uu(e,r,o)?[]:[zo.getCell(e,r)]});return ou(n,t,o,e)},cu=function(n,r,o,e){var i=n[r],t=E.bind(i.cells(),function(e,t){return iu(n,r,t,o)||uu(i,t,o)?[]:[e]});return ou(n,t,o,e)},lu=function(e){return{fold:e}},su=function(){return lu(function(e,t,n,r,o){return e()})},fu=function(i){return lu(function(e,t,n,r,o){return t(i)})},du=function(i,u){return lu(function(e,t,n,r,o){return n(i,u)})},mu=function(i,u,a){return lu(function(e,t,n,r,o){return r(i,u,a)})},gu=function(i,u){return lu(function(e,t,n,r,o){return o(i,u)})},pu=function(e,t,i,u){var n,r,a=e.slice(0),o=(r=t,0===(n=e).length?su():1===n.length?fu(0):0===r?du(0,1):r===n.length-1?gu(r-1,r):0<r&&r<n.length-1?mu(r-1,r,r+1):su()),c=function(e){return E.map(e,y.constant(0))},l=y.constant(c(a)),s=function(e,t){if(0<=i){var n=Math.max(u.minCellWidth(),a[t]-i);return c(a.slice(0,e)).concat([i,n-a[t]]).concat(c(a.slice(t+1)))}var r=Math.max(u.minCellWidth(),a[e]+i),o=a[e]-r;return c(a.slice(0,e)).concat([r-a[e],o]).concat(c(a.slice(t+1)))},f=s;return o.fold(l,function(e){return u.singleColumnWidth(a[e],i)},f,function(e,t,n){return s(t,n)},function(e,t){if(0<=i)return c(a.slice(0,t)).concat([i]);var n=Math.max(u.minCellWidth(),a[t]+i);return c(a.slice(0,t)).concat([n-a[t]])})},hu=function(e,t){return vt.has(e,t)&&1<parseInt(vt.get(e,t),10)},vu={hasColspan:function(e){return hu(e,"colspan")},hasRowspan:function(e){return hu(e,"rowspan")},minWidth:y.constant(10),minHeight:y.constant(10),getInt:function(e,t){return parseInt(Zt.get(e,t),10)}},bu=function(e,t,n){return Zt.getRaw(e,t).fold(function(){return n(e)+"px"},function(e){return e})},wu=function(e){return bu(e,"width",Hr.getPixelWidth)},yu=function(e){return bu(e,"height",Hr.getHeight)},xu=function(e,t,n,r,o){var i=Zo(e),u=E.map(i,function(e){return e.map(t.edge)});return E.map(i,function(e,t){return e.filter(y.not(vu.hasColspan)).fold(function(){var e=Jo(u,t);return r(e)},function(e){return n(e,o)})})},Su=function(e){return e.map(function(e){return e+"px"}).getOr("")},Cu=function(e,t,n,r){var o=ei(e),i=E.map(o,function(e){return e.map(t.edge)});return E.map(o,function(e,t){return e.filter(y.not(vu.hasRowspan)).fold(function(){var e=Jo(i,t);return r(e)},function(e){return n(e)})})},Ru={getRawWidths:function(e,t){return xu(e,t,wu,Su)},getPixelWidths:function(e,t,n){return xu(e,t,Hr.getPixelWidth,function(e){return e.getOrThunk(n.minCellWidth)},n)},getPercentageWidths:function(e,t,n){return xu(e,t,Hr.getPercentageWidth,function(e){return e.fold(function(){return n.minCellWidth()},function(e){return e/n.pixelWidth()*100})},n)},getPixelHeights:function(e,t){return Cu(e,t,Hr.getHeight,function(e){return e.getOrThunk(vu.minHeight)})},getRawHeights:function(e,t){return Cu(e,t,yu,Su)}},Tu=function(e,t,n){for(var r=0,o=e;o<t;o++)r+=n[o]!==undefined?n[o]:0;return r},Au=function(e,n){var t=Gt.justCells(e);return E.map(t,function(e){var t=Tu(e.column(),e.column()+e.colspan(),n);return{element:e.element,width:y.constant(t),colspan:e.colspan}})},Du=function(e,n){var t=Gt.justCells(e);return E.map(t,function(e){var t=Tu(e.row(),e.row()+e.rowspan(),n);return{element:e.element,height:y.constant(t),rowspan:e.rowspan}})},ku=function(e,n){return E.map(e.all(),function(e,t){return{element:e.element,height:y.constant(n[t])}})},Nu=function(e){var t=parseInt(e,10),n=y.identity;return{width:y.constant(t),pixelWidth:y.constant(t),getWidths:Ru.getPixelWidths,getCellDelta:n,singleColumnWidth:function(e,t){return[Math.max(vu.minWidth(),e+t)-e]},minCellWidth:vu.minWidth,setElementWidth:Hr.setPixelWidth,setTableWidth:function(e,t,n){var r=E.foldr(t,function(e,t){return e+t},0);Hr.setPixelWidth(e,r)}}},Eu=function(e,t){if(Hr.percentageBasedSizeRegex().test(t)){var n=Hr.percentageBasedSizeRegex().exec(t);return o=n[1],i=e,u=parseFloat(o),a=Nr(i),{width:y.constant(u),pixelWidth:y.constant(a),getWidths:Ru.getPercentageWidths,getCellDelta:function(e){return e/a*100},singleColumnWidth:function(e,t){return[100-e]},minCellWidth:function(){return vu.minWidth()/a*100},setElementWidth:Hr.setPercentageWidth,setTableWidth:function(e,t,n){var r=u+n;Hr.setPercentageWidth(e,r)}}}if(Hr.pixelBasedSizeRegex().test(t)){var r=Hr.pixelBasedSizeRegex().exec(t);return Nu(r[1])}var o,i,u,a,c=Nr(e);return Nu(c)},Ou=function(t){return Hr.getRawWidth(t).fold(function(){var e=Nr(t);return Nu(e)},function(e){return Eu(t,e)})},Bu=function(e){return Gt.generate(e)},Pu=function(e){var t=_t(e);return Bu(t)},Iu={adjustWidth:function(e,t,n,r){var o=Ou(e),i=o.getCellDelta(t),u=Pu(e),a=o.getWidths(u,r,o),c=pu(a,n,i,o),l=E.map(c,function(e,t){return e+a[t]}),s=Au(u,l);E.each(s,function(e){o.setElementWidth(e.element(),e.width())}),n===u.grid().columns()-1&&o.setTableWidth(e,l,i)},adjustHeight:function(e,n,r,t){var o=Pu(e),i=Ru.getPixelHeights(o,t),u=E.map(i,function(e,t){return r===t?Math.max(n+e,vu.minHeight()):e}),a=Du(o,u),c=ku(o,u);E.each(c,function(e){Hr.setHeight(e.element(),e.height())}),E.each(a,function(e){Hr.setHeight(e.element(),e.height())});var l,s=(l=u,E.foldr(l,function(e,t){return e+t},0));Hr.setHeight(e,s)},adjustWidthTo:function(e,t,n){var r=Ou(e),o=Bu(t),i=r.getWidths(o,n,r),u=Au(o,i);E.each(u,function(e){r.setElementWidth(e.element(),e.width())});var a=E.foldr(i,function(e,t){return t+e},0);0<u.length&&r.setElementWidth(e,a)}},Wu=function(e){0===zt.cells(e).length&&un.remove(e)},Mu=F.immutable("grid","cursor"),Lu=function(e,t,n){return qu(e,t,n).orThunk(function(){return qu(e,0,0)})},qu=function(e,t,n){return x.from(e[t]).bind(function(e){return x.from(e.cells()[n]).bind(function(e){return x.from(e.element())})})},Fu=function(e,t,n){return Mu(e,qu(e,t,n))},ju=function(e){return E.foldl(e,function(e,t){return E.exists(e,function(e){return e.row()===t.row()})?e:e.concat([t])},[]).sort(function(e,t){return e.row()-t.row()})},zu=function(e){return E.foldl(e,function(e,t){return E.exists(e,function(e){return e.column()===t.column()})?e:e.concat([t])},[]).sort(function(e,t){return e.column()-t.column()})},_u=function(e,t,n){var r=Ht(e,n),o=Gt.generate(r);return Uo(o,t,!0)},Hu=Iu.adjustWidthTo,Vu={insertRowBefore:Ei(function(e,t,n,r){var o=t.row(),i=t.row(),u=Qi(e,i,o,n,r.getOrInit);return Fu(u,i,t.column())},Bi,y.noop,y.noop,wo),insertRowsBefore:Ei(function(e,t,n,r){var o=t[0].row(),i=t[0].row(),u=ju(t),a=E.foldl(u,function(e,t){return Qi(e,i,o,n,r.getOrInit)},e);return Fu(a,i,t[0].column())},Pi,y.noop,y.noop,wo),insertRowAfter:Ei(function(e,t,n,r){var o=t.row(),i=t.row()+t.rowspan(),u=Qi(e,i,o,n,r.getOrInit);return Fu(u,i,t.column())},Bi,y.noop,y.noop,wo),insertRowsAfter:Ei(function(e,t,n,r){var o=ju(t),i=o[o.length-1].row(),u=o[o.length-1].row()+o[o.length-1].rowspan(),a=E.foldl(o,function(e,t){return Qi(e,u,i,n,r.getOrInit)},e);return Fu(a,u,t[0].column())},Pi,y.noop,y.noop,wo),insertColumnBefore:Ei(function(e,t,n,r){var o=t.column(),i=t.column(),u=Zi(e,i,o,n,r.getOrInit);return Fu(u,t.row(),i)},Bi,Hu,y.noop,wo),insertColumnsBefore:Ei(function(e,t,n,r){var o=zu(t),i=o[0].column(),u=o[0].column(),a=E.foldl(o,function(e,t){return Zi(e,u,i,n,r.getOrInit)},e);return Fu(a,t[0].row(),u)},Pi,Hu,y.noop,wo),insertColumnAfter:Ei(function(e,t,n,r){var o=t.column(),i=t.column()+t.colspan(),u=Zi(e,i,o,n,r.getOrInit);return Fu(u,t.row(),i)},Bi,Hu,y.noop,wo),insertColumnsAfter:Ei(function(e,t,n,r){var o=t[t.length-1].column(),i=t[t.length-1].column()+t[t.length-1].colspan(),u=zu(t),a=E.foldl(u,function(e,t){return Zi(e,i,o,n,r.getOrInit)},e);return Fu(a,t[0].row(),i)},Pi,Hu,y.noop,wo),splitCellIntoColumns:Ei(function(e,t,n,r){var o=eu(e,t.row(),t.column(),n,r.getOrInit);return Fu(o,t.row(),t.column())},Bi,Hu,y.noop,wo),splitCellIntoRows:Ei(function(e,t,n,r){var o=tu(e,t.row(),t.column(),n,r.getOrInit);return Fu(o,t.row(),t.column())},Bi,y.noop,y.noop,wo),eraseColumns:Ei(function(e,t,n,r){var o=zu(t),i=ru(e,o[0].column(),o[o.length-1].column()),u=Lu(i,t[0].row(),t[0].column());return Mu(i,u)},Pi,Hu,Wu,wo),eraseRows:Ei(function(e,t,n,r){var o=ju(t),i=nu(e,o[0].row(),o[o.length-1].row()),u=Lu(i,t[0].row(),t[0].column());return Mu(i,u)},Pi,y.noop,Wu,wo),makeColumnHeader:Ei(function(e,t,n,r){var o=au(e,t.column(),n,r.replaceOrInit);return Fu(o,t.row(),t.column())},Bi,y.noop,y.noop,yo("row","th")),unmakeColumnHeader:Ei(function(e,t,n,r){var o=au(e,t.column(),n,r.replaceOrInit);return Fu(o,t.row(),t.column())},Bi,y.noop,y.noop,yo(null,"td")),makeRowHeader:Ei(function(e,t,n,r){var o=cu(e,t.row(),n,r.replaceOrInit);return Fu(o,t.row(),t.column())},Bi,y.noop,y.noop,yo("col","th")),unmakeRowHeader:Ei(function(e,t,n,r){var o=cu(e,t.row(),n,r.replaceOrInit);return Fu(o,t.row(),t.column())},Bi,y.noop,y.noop,yo(null,"td")),mergeCells:Ei(function(e,t,n,r){var o=t.cells();Bo(o);var i=Xi(e,t.bounds(),n,y.constant(o[0]));return Mu(i,x.from(o[0]))},Mi,y.noop,y.noop,xo),unmergeCells:Ei(function(e,t,n,r){var o=E.foldr(t,function(e,t){return Yi(e,t,n,r.combine(t))},e);return Mu(o,x.from(t[0]))},Li,Hu,y.noop,xo),pasteCells:Ei(function(e,n,t,r){var o,i,u,a,c=(o=n.clipboard(),i=n.generators(),u=_t(o),a=Gt.generate(u),Uo(a,i,!0)),l=G.address(n.row(),n.column());return $i(l,e,c,n.generators(),t).fold(function(){return Mu(e,x.some(n.element()))},function(e){var t=Lu(e,n.row(),n.column());return Mu(e,t)})},Ii,Hu,y.noop,wo),pasteRowsBefore:Ei(function(e,t,n,r){var o=e[t.cells[0].row()],i=t.cells[0].row(),u=_u(t.clipboard(),t.generators(),o),a=Ji(i,e,u,t.generators(),n),c=Lu(a,t.cells[0].row(),t.cells[0].column());return Mu(a,c)},Wi,y.noop,y.noop,wo),pasteRowsAfter:Ei(function(e,t,n,r){var o=e[t.cells[0].row()],i=t.cells[t.cells.length-1].row()+t.cells[t.cells.length-1].rowspan(),u=_u(t.clipboard(),t.generators(),o),a=Ji(i,e,u,t.generators(),n),c=Lu(a,t.cells[0].row(),t.cells[0].column());return Mu(a,c)},Wi,y.noop,y.noop,wo)},Uu=function(e){return Y.fromDom(e.getBody())},Gu={getBody:Uu,getIsRoot:function(t){return function(e){return Ke.eq(e,Uu(t))}},addSizeSuffix:function(e){return/^[0-9]+$/.test(e)&&(e+="px"),e},removePxSuffix:function(e){return e?e.replace(/px$/,""):""}},Xu=function(e){return"rtl"===Zt.get(e,"direction")?"rtl":"ltr"},Yu={onDirection:function(t,n){return function(e){return"rtl"===Xu(e)?n:t}},getDirection:Xu},Ku={isRtl:y.constant(!1)},$u={isRtl:y.constant(!0)},Ju={directionAt:function(e){return"rtl"===Yu.getDirection(e)?$u:Ku}},Qu=["tableprops","tabledelete","|","tableinsertrowbefore","tableinsertrowafter","tabledeleterow","|","tableinsertcolbefore","tableinsertcolafter","tabledeletecol"],Zu={"border-collapse":"collapse",width:"100%"},ea={border:"1"},ta=function(e){return e.getParam("table_tab_navigation",!0,"boolean")},na=function(e){return e.getParam("table_cell_advtab",!0,"boolean")},ra=function(e){return e.getParam("table_row_advtab",!0,"boolean")},oa=function(e){return e.getParam("table_advtab",!0,"boolean")},ia=function(e){return e.getParam("table_style_by_css",!1,"boolean")},ua=function(e){return e.getParam("table_cell_class_list",[],"array")},aa=function(e){return e.getParam("table_row_class_list",[],"array")},ca=function(e){return e.getParam("table_class_list",[],"array")},la=function(e){return!1===e.getParam("table_responsive_width")},sa=function(e,t){return e.fire("newrow",{node:t})},fa=function(e,t){return e.fire("newcell",{node:t})},da=function(f,e){var t,n=function(e){return"table"===dt.name(Gu.getBody(e))},d=(t=f.getParam("table_clone_elements"),g.isString(t)?x.some(t.split(/[ ,]/)):Array.isArray(t)?x.some(t):x.none()),r=function(a,c,l,s){return function(e,t){var n=Ct.descendants(e,"td[data-mce-style],th[data-mce-style]");E.each(n,function(e){vt.remove(e,"data-mce-style")});var r=s(),o=Y.fromDom(f.getDoc()),i=lo(Ju.directionAt),u=Dn(l,o,d);return c(e)?a(r,e,t,u,i).bind(function(e){return E.each(e.newRows(),function(e){sa(f,e.dom())}),E.each(e.newCells(),function(e){fa(f,e.dom())}),e.cursor().map(function(e){var t=f.dom.createRng();return t.setStart(e.dom(),0),t.setEnd(e.dom(),0),t})}):x.none()}};return{deleteRow:r(Vu.eraseRows,function(e){var t=so(e);return!1===n(f)||1<t.rows()},y.noop,e),deleteColumn:r(Vu.eraseColumns,function(e){var t=so(e);return!1===n(f)||1<t.columns()},y.noop,e),insertRowsBefore:r(Vu.insertRowsBefore,y.always,y.noop,e),insertRowsAfter:r(Vu.insertRowsAfter,y.always,y.noop,e),insertColumnsBefore:r(Vu.insertColumnsBefore,y.always,Vr,e),insertColumnsAfter:r(Vu.insertColumnsAfter,y.always,Vr,e),mergeCells:r(Vu.mergeCells,y.always,y.noop,e),unmergeCells:r(Vu.unmergeCells,y.always,y.noop,e),pasteRowsBefore:r(Vu.pasteRowsBefore,y.always,y.noop,e),pasteRowsAfter:r(Vu.pasteRowsAfter,y.always,y.noop,e),pasteCells:r(Vu.pasteCells,y.always,y.noop,e)}},ma=function(e,t,r){var n=_t(e),o=Gt.generate(n);return Pi(o,t).map(function(e){var t=Uo(o,r,!1).slice(e[0].row(),e[e.length-1].row()+e[e.length-1].rowspan()),n=Oi(t,r);return Yo(n)})},ga=tinymce.util.Tools.resolve("tinymce.util.Tools"),pa={applyAlign:function(e,t,n){n&&e.formatter.apply("align"+n,{},t)},applyVAlign:function(e,t,n){n&&e.formatter.apply("valign"+n,{},t)},unApplyAlign:function(t,n){ga.each("left center right".split(" "),function(e){t.formatter.remove("align"+e,{},n)})},unApplyVAlign:function(t,n){ga.each("top middle bottom".split(" "),function(e){t.formatter.remove("valign"+e,{},n)})},getTDTHOverallStyle:function(o,e,i){var t;return t=function(e,t){for(var n=0;n<t.length;n++){var r=o.getStyle(t[n],i);if(void 0===e&&(e=r),e!==r)return""}return e}(t,o.select("td,th",e))}},ha=function(e,t){var n=e.dom,r=t.control.rootControl,o=r.toJSON(),i=n.parseStyle(o.style);"style"===t.control.name()?(r.find("#borderStyle").value(i["border-style"]||"")[0].fire("select"),r.find("#borderColor").value(i["border-color"]||"")[0].fire("change"),r.find("#backgroundColor").value(i["background-color"]||"")[0].fire("change"),r.find("#width").value(i.width||"").fire("change"),r.find("#height").value(i.height||"").fire("change")):(i["border-style"]=o.borderStyle,i["border-color"]=o.borderColor,i["background-color"]=o.backgroundColor,i.width=o.width?Gu.addSizeSuffix(o.width):"",i.height=o.height?Gu.addSizeSuffix(o.height):""),r.find("#style").value(n.serializeStyle(n.parseStyle(n.serializeStyle(i))))},va={createStyleForm:function(n){var e=function(){var e=n.getParam("color_picker_callback");if(e)return function(t){return e.call(n,function(e){t.control.value(e).fire("change")},t.control.value())}};return{title:"Advanced",type:"form",defaults:{onchange:y.curry(ha,n)},items:[{label:"Style",name:"style",type:"textbox"},{type:"form",padding:0,formItemDefaults:{layout:"grid",alignH:["start","right"]},defaults:{size:7},items:[{label:"Border style",type:"listbox",name:"borderStyle",width:90,onselect:y.curry(ha,n),values:[{text:"Select...",value:""},{text:"Solid",value:"solid"},{text:"Dotted",value:"dotted"},{text:"Dashed",value:"dashed"},{text:"Double",value:"double"},{text:"Groove",value:"groove"},{text:"Ridge",value:"ridge"},{text:"Inset",value:"inset"},{text:"Outset",value:"outset"},{text:"None",value:"none"},{text:"Hidden",value:"hidden"}]},{label:"Border color",type:"colorbox",name:"borderColor",onaction:e()},{label:"Background color",type:"colorbox",name:"backgroundColor",onaction:e()}]}]}},buildListItems:function(e,r,t){var o=function(e,n){return n=n||[],ga.each(e,function(e){var t={text:e.text||e.title};e.menu?t.menu=o(e.menu):(t.value=e.value,r&&r(t)),n.push(t)}),n};return o(e,t||[])},updateStyleField:ha,extractAdvancedStyles:function(e,t){var n=e.parseStyle(e.getAttrib(t,"style")),r={};return n["border-style"]&&(r.borderStyle=n["border-style"]),n["border-color"]&&(r.borderColor=n["border-color"]),n["background-color"]&&(r.backgroundColor=n["background-color"]),r.style=e.serializeStyle(n),r}},ba=function(r,o,e){var i,u=r.dom;function a(e,t,n){n&&u.setAttrib(e,t,n)}function c(e,t,n){n&&u.setStyle(e,t,n)}va.updateStyleField(r,e),i=e.control.rootControl.toJSON(),r.undoManager.transact(function(){ga.each(o,function(e){var t,n;a(e,"scope",i.scope),1===o.length?a(e,"style",i.style):(t=e,n=i.style,delete t.dataset.mceStyle,t.style.cssText+=";"+n),a(e,"class",i["class"]),c(e,"width",Gu.addSizeSuffix(i.width)),c(e,"height",Gu.addSizeSuffix(i.height)),i.type&&e.nodeName.toLowerCase()!==i.type&&(e=u.rename(e,i.type)),1===o.length&&(pa.unApplyAlign(r,e),pa.unApplyVAlign(r,e)),i.align&&pa.applyAlign(r,e,i.align),i.valign&&pa.applyVAlign(r,e,i.valign)}),r.focus()})},wa=function(t){var e,n,r,o=[];if(o=t.dom.select("td[data-mce-selected],th[data-mce-selected]"),e=t.dom.getParent(t.selection.getStart(),"td,th"),!o.length&&e&&o.push(e),e=e||o[0]){var i,u,a,c;1<o.length?n={width:"",height:"",scope:"","class":"",align:"",valign:"",style:"",type:e.nodeName.toLowerCase()}:(u=e,a=(i=t).dom,c={width:a.getStyle(u,"width")||a.getAttrib(u,"width"),height:a.getStyle(u,"height")||a.getAttrib(u,"height"),scope:a.getAttrib(u,"scope"),"class":a.getAttrib(u,"class"),type:u.nodeName.toLowerCase(),style:"",align:"",valign:""},ga.each("left center right".split(" "),function(e){i.formatter.matchNode(u,"align"+e)&&(c.align=e)}),ga.each("top middle bottom".split(" "),function(e){i.formatter.matchNode(u,"valign"+e)&&(c.valign=e)}),na(i)&&ga.extend(c,va.extractAdvancedStyles(a,u)),n=c),0<ua(t).length&&(r={name:"class",type:"listbox",label:"Class",values:va.buildListItems(ua(t),function(e){e.value&&(e.textStyle=function(){return t.formatter.getCssText({block:"td",classes:[e.value]})})})});var l={type:"form",layout:"flex",direction:"column",labelGapCalc:"children",padding:0,items:[{type:"form",layout:"grid",columns:2,labelGapCalc:!1,padding:0,defaults:{type:"textbox",maxWidth:50},items:[{label:"Width",name:"width",onchange:y.curry(va.updateStyleField,t)},{label:"Height",name:"height",onchange:y.curry(va.updateStyleField,t)},{label:"Cell type",name:"type",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"Cell",value:"td"},{text:"Header cell",value:"th"}]},{label:"Scope",name:"scope",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Row",value:"row"},{text:"Column",value:"col"},{text:"Row group",value:"rowgroup"},{text:"Column group",value:"colgroup"}]},{label:"H Align",name:"align",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"V Align",name:"valign",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Top",value:"top"},{text:"Middle",value:"middle"},{text:"Bottom",value:"bottom"}]}]},r]};na(t)?t.windowManager.open({title:"Cell properties",bodyType:"tabpanel",data:n,body:[{title:"General",type:"form",items:l},va.createStyleForm(t)],onsubmit:y.curry(ba,t,o)}):t.windowManager.open({title:"Cell properties",data:n,body:l,onsubmit:y.curry(ba,t,o)})}},ya=function(e,t,n){var r=e.getParent(t,"table"),o=t.parentNode,i=e.select(n,r)[0];i||(i=e.create(n),r.firstChild?"CAPTION"===r.firstChild.nodeName?e.insertAfter(i,r.firstChild):r.insertBefore(i,r.firstChild):r.appendChild(i)),i.appendChild(t),o.hasChildNodes()||e.remove(o)};function xa(o,e,i,t){var u=o.dom;function a(e,t,n){n&&u.setAttrib(e,t,n)}va.updateStyleField(o,t);var c=t.control.rootControl.toJSON();o.undoManager.transact(function(){ga.each(e,function(e){var t,n,r;a(e,"scope",c.scope),a(e,"style",c.style),a(e,"class",c["class"]),t=e,n="height",(r=Gu.addSizeSuffix(c.height))&&u.setStyle(t,n,r),c.type!==e.parentNode.nodeName.toLowerCase()&&ya(o.dom,e,c.type),c.align!==i.align&&(pa.unApplyAlign(o,e),pa.applyAlign(o,e,c.align))}),o.focus()})}var Sa=function(t){var e,n,r,o,i,u,a,c,l,s,f=t.dom,d=[];e=f.getParent(t.selection.getStart(),"table"),n=f.getParent(t.selection.getStart(),"td,th"),ga.each(e.rows,function(t){ga.each(t.cells,function(e){if(f.getAttrib(e,"data-mce-selected")||e===n)return d.push(t),!1})}),(r=d[0])&&(1<d.length?i={height:"",scope:"",style:"","class":"",align:"",type:r.parentNode.nodeName.toLowerCase()}:(c=r,l=(a=t).dom,s={height:l.getStyle(c,"height")||l.getAttrib(c,"height"),scope:l.getAttrib(c,"scope"),"class":l.getAttrib(c,"class"),align:"",style:"",type:c.parentNode.nodeName.toLowerCase()},ga.each("left center right".split(" "),function(e){a.formatter.matchNode(c,"align"+e)&&(s.align=e)}),ra(a)&&ga.extend(s,va.extractAdvancedStyles(l,c)),i=s),0<aa(t).length&&(o={name:"class",type:"listbox",label:"Class",values:va.buildListItems(aa(t),function(e){e.value&&(e.textStyle=function(){return t.formatter.getCssText({block:"tr",classes:[e.value]})})})}),u={type:"form",columns:2,padding:0,defaults:{type:"textbox"},items:[{type:"listbox",name:"type",label:"Row type",text:"Header",maxWidth:null,values:[{text:"Header",value:"thead"},{text:"Body",value:"tbody"},{text:"Footer",value:"tfoot"}]},{type:"listbox",name:"align",label:"Alignment",text:"None",maxWidth:null,values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"Height",name:"height"},o]},ra(t)?t.windowManager.open({title:"Row properties",data:i,bodyType:"tabpanel",body:[{title:"General",type:"form",items:u},va.createStyleForm(t)],onsubmit:y.curry(xa,t,d,i)}):t.windowManager.open({title:"Row properties",data:i,body:u,onsubmit:y.curry(xa,t,d,i)}))},Ca=tinymce.util.Tools.resolve("tinymce.Env"),Ra={styles:{"border-collapse":"collapse",width:"100%"},attributes:{border:"1"},percentages:!0},Ta=function(e,t,n,r,o){void 0===o&&(o=Ra);var i=Y.fromTag("table");Zt.setAll(i,o.styles),vt.setAll(i,o.attributes);var u=Y.fromTag("tbody");nn.append(i,u);for(var a=[],c=0;c<e;c++){for(var l=Y.fromTag("tr"),s=0;s<t;s++){var f=c<n||s<r?Y.fromTag("th"):Y.fromTag("td");s<r&&vt.set(f,"scope","row"),c<n&&vt.set(f,"scope","col"),nn.append(f,Y.fromTag("br")),o.percentages&&Zt.set(f,"width",100/t+"%"),nn.append(l,f)}a.push(l)}return rn.append(u,a),i},Aa=function(e){return e.dom().innerHTML},Da=function(e){var t=Y.fromTag("div"),n=Y.fromDom(e.dom().cloneNode(!0));return nn.append(t,n),Aa(t)},ka=function(e,t){e.selection.select(t.dom(),!0),e.selection.collapse(!0)},Na=function(i,e,t){var n,r,o=i.getParam("table_default_styles",Zu,"object"),u={styles:o,attributes:(r=i,r.getParam("table_default_attributes",ea,"object")),percentages:(n=o.width,g.isString(n)&&-1!==n.indexOf("%")&&!la(i))},a=Ta(t,e,0,0,u);vt.set(a,"data-mce-id","__mce");var c=Da(a);return i.insertContent(c),Wt.descendant(Gu.getBody(i),'table[data-mce-id="__mce"]').map(function(e){var t,n,r,o;return la(i)&&Zt.set(e,"width",Zt.get(e,"width")),vt.remove(e,"data-mce-id"),t=i,n=e,E.each(Ct.descendants(n,"tr"),function(e){sa(t,e.dom()),E.each(Ct.descendants(e,"th,td"),function(e){fa(t,e.dom())})}),r=i,o=e,Wt.descendant(o,"td,th").each(y.curry(ka,r)),e.dom()}).getOr(null)};function Ea(e,t,n,r){if("TD"===t.tagName||"TH"===t.tagName)e.setStyle(t,n,r);else if(t.children)for(var o=0;o<t.children.length;o++)Ea(e,t.children[o],n,r)}var Oa=function(e,t,n){var r,o,i=e.dom;va.updateStyleField(e,n),!1===(o=n.control.rootControl.toJSON())["class"]&&delete o["class"],e.undoManager.transact(function(){t||(t=Na(e,o.cols||1,o.rows||1)),function(e,t,n){var r=e.dom,o={},i={};if(o["class"]=n["class"],i.height=Gu.addSizeSuffix(n.height),r.getAttrib(t,"width")&&!ia(e)?o.width=Gu.removePxSuffix(n.width):i.width=Gu.addSizeSuffix(n.width),ia(e)?(i["border-width"]=Gu.addSizeSuffix(n.border),i["border-spacing"]=Gu.addSizeSuffix(n.cellspacing),ga.extend(o,{"data-mce-border-color":n.borderColor,"data-mce-cell-padding":n.cellpadding,"data-mce-border":n.border})):ga.extend(o,{border:n.border,cellpadding:n.cellpadding,cellspacing:n.cellspacing}),ia(e)&&t.children)for(var u=0;u<t.children.length;u++)Ea(r,t.children[u],{"border-width":Gu.addSizeSuffix(n.border),"border-color":n.borderColor,padding:Gu.addSizeSuffix(n.cellpadding)});n.style?ga.extend(i,r.parseStyle(n.style)):i=ga.extend({},r.parseStyle(r.getAttrib(t,"style")),i),o.style=r.serializeStyle(i),r.setAttribs(t,o)}(e,t,o),(r=i.select("caption",t)[0])&&!o.caption&&i.remove(r),!r&&o.caption&&((r=i.create("caption")).innerHTML=Ca.ie?"\xa0":'<br data-mce-bogus="1"/>',t.insertBefore(r,t.firstChild)),pa.unApplyAlign(e,t),o.align&&pa.applyAlign(e,t,o.align),e.focus(),e.addVisual()})},Ba=function(t,e){var n,r,o,i,u,a,c,l,s,f,d=t.dom,m={};!0===e?(n=d.getParent(t.selection.getStart(),"table"))&&(c=n,l=(a=t).dom,s={width:l.getStyle(c,"width")||l.getAttrib(c,"width"),height:l.getStyle(c,"height")||l.getAttrib(c,"height"),cellspacing:l.getStyle(c,"border-spacing")||l.getAttrib(c,"cellspacing"),cellpadding:l.getAttrib(c,"data-mce-cell-padding")||l.getAttrib(c,"cellpadding")||pa.getTDTHOverallStyle(a.dom,c,"padding"),border:l.getAttrib(c,"data-mce-border")||l.getAttrib(c,"border")||pa.getTDTHOverallStyle(a.dom,c,"border"),borderColor:l.getAttrib(c,"data-mce-border-color"),caption:!!l.select("caption",c)[0],"class":l.getAttrib(c,"class")},ga.each("left center right".split(" "),function(e){a.formatter.matchNode(c,"align"+e)&&(s.align=e)}),oa(a)&&ga.extend(s,va.extractAdvancedStyles(l,c)),m=s):(r={label:"Cols",name:"cols"},o={label:"Rows",name:"rows"}),0<ca(t).length&&(m["class"]&&(m["class"]=m["class"].replace(/\s*mce\-item\-table\s*/g,"")),i={name:"class",type:"listbox",label:"Class",values:va.buildListItems(ca(t),function(e){e.value&&(e.textStyle=function(){return t.formatter.getCssText({block:"table",classes:[e.value]})})})}),u={type:"form",layout:"flex",direction:"column",labelGapCalc:"children",padding:0,items:[{type:"form",labelGapCalc:!1,padding:0,layout:"grid",columns:2,defaults:{type:"textbox",maxWidth:50},items:(f=t,f.getParam("table_appearance_options",!0,"boolean")?[r,o,{label:"Width",name:"width",onchange:y.curry(va.updateStyleField,t)},{label:"Height",name:"height",onchange:y.curry(va.updateStyleField,t)},{label:"Cell spacing",name:"cellspacing"},{label:"Cell padding",name:"cellpadding"},{label:"Border",name:"border"},{label:"Caption",name:"caption",type:"checkbox"}]:[r,o,{label:"Width",name:"width",onchange:y.curry(va.updateStyleField,t)},{label:"Height",name:"height",onchange:y.curry(va.updateStyleField,t)}])},{label:"Alignment",name:"align",type:"listbox",text:"None",values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},i]},oa(t)?t.windowManager.open({title:"Table properties",data:m,bodyType:"tabpanel",body:[{title:"General",type:"form",items:u},va.createStyleForm(t)],onsubmit:y.curry(Oa,t,n)}):t.windowManager.open({title:"Table properties",data:m,body:u,onsubmit:y.curry(Oa,t,n)})},Pa=ga.each,Ia={registerCommands:function(a,t,c,l,n){var r=Gu.getIsRoot(a),s=function(){return Y.fromDom(a.dom.getParent(a.selection.getStart(),"th,td"))},f=function(e){return zt.table(e,r)},o=function(n){var r=s();f(r).each(function(t){var e=Sr.forMenu(l,t,r);n(t,e).each(function(e){a.selection.setRng(e),a.focus(),c.clear(t)})})},i=function(e){var o=s();return f(o).bind(function(e){var t=Y.fromDom(a.getDoc()),n=Sr.forMenu(l,e,o),r=Dn(y.noop,t,x.none());return ma(e,n,r)})},u=function(u){n.get().each(function(e){var o=E.map(e,function(e){return mn(e)}),i=s();f(i).bind(function(t){var e=Y.fromDom(a.getDoc()),n=kn(e),r=Sr.pasteRows(l,t,i,o,n);u(t,r).each(function(e){a.selection.setRng(e),a.focus(),c.clear(t)})})})};Pa({mceTableSplitCells:function(){o(t.unmergeCells)},mceTableMergeCells:function(){o(t.mergeCells)},mceTableInsertRowBefore:function(){o(t.insertRowsBefore)},mceTableInsertRowAfter:function(){o(t.insertRowsAfter)},mceTableInsertColBefore:function(){o(t.insertColumnsBefore)},mceTableInsertColAfter:function(){o(t.insertColumnsAfter)},mceTableDeleteCol:function(){o(t.deleteColumn)},mceTableDeleteRow:function(){o(t.deleteRow)},mceTableCutRow:function(e){n.set(i()),o(t.deleteRow)},mceTableCopyRow:function(e){n.set(i())},mceTablePasteRowBefore:function(e){u(t.pasteRowsBefore)},mceTablePasteRowAfter:function(e){u(t.pasteRowsAfter)},mceTableDelete:function(){var e=Y.fromDom(a.dom.getParent(a.selection.getStart(),"th,td"));zt.table(e,r).filter(y.not(r)).each(function(e){var t=Y.fromText("");nn.after(e,t),un.remove(e);var n=a.dom.createRng();n.setStart(t.dom(),0),n.setEnd(t.dom(),0),a.selection.setRng(n)})}},function(e,t){a.addCommand(t,e)}),Pa({mceInsertTable:y.curry(Ba,a),mceTableProps:y.curry(Ba,a,!0),mceTableRowProps:y.curry(Sa,a),mceTableCellProps:y.curry(wa,a)},function(n,e){a.addCommand(e,function(e,t){n(t)})})}},Wa=function(e){var t=x.from(e.dom().documentElement).map(Y.fromDom).getOr(e);return{parent:y.constant(t),view:y.constant(e),origin:y.constant(Xr(0,0))}},Ma=function(e,t){return{parent:y.constant(t),view:y.constant(e),origin:y.constant(Xr(0,0))}};function La(e){var n=F.immutable.apply(null,e),r=[];return{bind:function(e){if(e===undefined)throw"Event bind error: undefined handler";r.push(e)},unbind:function(t){r=E.filter(r,function(e){return e!==t})},trigger:function(){var t=n.apply(null,arguments);E.each(r,function(e){e(t)})}}}var qa={create:function(e){return{registry:M.map(e,function(e){return{bind:e.bind,unbind:e.unbind}}),trigger:M.map(e,function(e){return e.trigger})}}},Fa={mode:ho.exactly(["compare","extract","mutate","sink"]),sink:ho.exactly(["element","start","stop","destroy"]),api:ho.exactly(["forceDrop","drop","move","delayDrop"])},ja={resolve:ri("ephox-dragster").resolve},za=function(m,g){return function(e){if(m(e)){var t,n,r,o,i,u,a,c=Y.fromDom(e.target),l=function(){e.stopPropagation()},s=function(){e.preventDefault()},f=y.compose(s,l),d=(t=c,n=e.clientX,r=e.clientY,o=l,i=s,u=f,a=e,{target:y.constant(t),x:y.constant(n),y:y.constant(r),stop:o,prevent:i,kill:u,raw:y.constant(a)});g(d)}}},_a=function(e,t,n,r,o){var i=za(n,r);return e.dom().addEventListener(t,i,o),{unbind:y.curry(Ha,e,t,i,o)}},Ha=function(e,t,n,r){e.dom().removeEventListener(t,n,r)},Va=function(e,t,n,r){return _a(e,t,n,r,!1)},Ua=function(e,t,n,r){return _a(e,t,n,r,!0)},Ga=y.constant(!0),Xa={bind:function(e,t,n){return Va(e,t,Ga,n)},capture:function(e,t,n){return Ua(e,t,Ga,n)}},Ya=Fa.mode({compare:function(e,t){return Xr(t.left()-e.left(),t.top()-e.top())},extract:function(e){return x.some(Xr(e.x(),e.y()))},sink:function(e,t){var n,r,o,i=(n=t,r=Mo.merge({layerClass:ja.resolve("blocker")},n),o=Y.fromTag("div"),vt.set(o,"role","presentation"),Zt.setAll(o,{position:"fixed",left:"0px",top:"0px",width:"100%",height:"100%"}),bi.add(o,ja.resolve("blocker")),bi.add(o,r.layerClass),{element:function(){return o},destroy:function(){un.remove(o)}}),u=Xa.bind(i.element(),"mousedown",e.forceDrop),a=Xa.bind(i.element(),"mouseup",e.drop),c=Xa.bind(i.element(),"mousemove",e.move),l=Xa.bind(i.element(),"mouseout",e.delayDrop);return Fa.sink({element:i.element,start:function(e){nn.append(e,i.element())},stop:function(){un.remove(i.element())},destroy:function(){i.destroy(),a.unbind(),c.unbind(),l.unbind(),u.unbind()}})},mutate:function(e,t){e.mutate(t.left(),t.top())}});function Ka(){var i=x.none(),u=qa.create({move:La(["info"])});return{onEvent:function(e,o){o.extract(e).each(function(e){var t,n,r;(t=o,n=e,r=i.map(function(e){return t.compare(e,n)}),i=x.some(n),r).each(function(e){u.trigger.move(e)})})},reset:function(){i=x.none()},events:u.registry}}function $a(){var e={onEvent:function(e,t){},reset:y.noop},t=Ka(),n=e;return{on:function(){n.reset(),n=t},off:function(){n.reset(),n=e},isOn:function(){return n===t},onEvent:function(e,t){n.onEvent(e,t)},events:t.events}}var Ja=function(t,n){var r=null;return{cancel:function(){null!==r&&(clearTimeout(r),r=null)},throttle:function(){var e=arguments;null!==r&&clearTimeout(r),r=setTimeout(function(){t.apply(null,e),e=r=null},n)}}},Qa=function(t,n,e){var r=!1,o=qa.create({start:La([]),stop:La([])}),i=$a(),u=function(){l.stop(),i.isOn()&&(i.off(),o.trigger.stop())},a=Ja(u,200);i.events.move.bind(function(e){n.mutate(t,e.info())});var c=function(t){return function(){var e=Array.prototype.slice.call(arguments,0);if(r)return t.apply(null,e)}},l=n.sink(Fa.api({forceDrop:u,drop:c(u),move:c(function(e,t){a.cancel(),i.onEvent(e,n)}),delayDrop:c(a.throttle)}),e);return{element:l.element,go:function(e){l.start(e),i.on(),o.trigger.start()},on:function(){r=!0},off:function(){r=!1},destroy:function(){l.destroy()},events:o.registry}},Za={transform:function(e,t){var n=t!==undefined?t:{},r=n.mode!==undefined?n.mode:Ya;return Qa(e,r,t)}};function ec(){var n,r=qa.create({drag:La(["xDelta","yDelta","target"])}),o=x.none(),e={mutate:function(e,t){n.trigger.drag(e,t)},events:(n=qa.create({drag:La(["xDelta","yDelta"])})).registry};return e.events.drag.bind(function(t){o.each(function(e){r.trigger.drag(t.xDelta(),t.yDelta(),e)})}),{assign:function(e){o=x.some(e)},get:function(){return o},mutate:e.mutate,events:r.registry}}var tc={any:function(e){return Wt.first(e).isSome()},ancestor:function(e,t,n){return Wt.ancestor(e,t,n).isSome()},sibling:function(e,t){return Wt.sibling(e,t).isSome()},child:function(e,t){return Wt.child(e,t).isSome()},descendant:function(e,t){return Wt.descendant(e,t).isSome()},closest:function(e,t,n){return Wt.closest(e,t,n).isSome()}},nc=oi.resolve("resizer-bar-dragging");function rc(e,n){var r=ao.height,t=function(o,t,i){var n=ec(),r=Za.transform(n,{}),u=x.none(),e=function(e,t){return x.from(vt.get(e,t))};n.events.drag.bind(function(n){e(n.target(),"data-row").each(function(e){var t=vu.getInt(n.target(),"top");Zt.set(n.target(),"top",t+n.yDelta()+"px")}),e(n.target(),"data-column").each(function(e){var t=vu.getInt(n.target(),"left");Zt.set(n.target(),"left",t+n.xDelta()+"px")})});var a=function(e,t){return vu.getInt(e,t)-parseInt(vt.get(e,"data-initial-"+t),10)};r.events.stop.bind(function(){n.get().each(function(r){u.each(function(n){e(r,"data-row").each(function(e){var t=a(r,"top");vt.remove(r,"data-initial-top"),d.trigger.adjustHeight(n,t,parseInt(e,10))}),e(r,"data-column").each(function(e){var t=a(r,"left");vt.remove(r,"data-initial-left"),d.trigger.adjustWidth(n,t,parseInt(e,10))}),Ai.refresh(o,n,i,t)})})});var c=function(e,t){d.trigger.startAdjust(),n.assign(e),vt.set(e,"data-initial-"+t,parseInt(Zt.get(e,t),10)),bi.add(e,nc),Zt.set(e,"opacity","0.2"),r.go(o.parent())},l=Xa.bind(o.parent(),"mousedown",function(e){Ai.isRowBar(e.target())&&c(e.target(),"top"),Ai.isColBar(e.target())&&c(e.target(),"left")}),s=function(e){return Ke.eq(e,o.view())},f=Xa.bind(o.view(),"mouseover",function(e){"table"===dt.name(e.target())||tc.closest(e.target(),"table",s)?(u="table"===dt.name(e.target())?x.some(e.target()):Wt.ancestor(e.target(),"table",s)).each(function(e){Ai.refresh(o,e,i,t)}):yt.inBody(e.target())&&Ai.destroy(o)}),d=qa.create({adjustHeight:La(["table","delta","row"]),adjustWidth:La(["table","delta","column"]),startAdjust:La([])});return{destroy:function(){l.unbind(),f.unbind(),r.destroy(),Ai.destroy(o)},refresh:function(e){Ai.refresh(o,e,i,t)},on:r.on,off:r.off,hideBars:y.curry(Ai.hide,o),showBars:y.curry(Ai.show,o),events:d.registry}}(e,n,r),o=qa.create({beforeResize:La(["table"]),afterResize:La(["table"]),startDrag:La([])});return t.events.adjustHeight.bind(function(e){o.trigger.beforeResize(e.table());var t=r.delta(e.delta(),e.table());Iu.adjustHeight(e.table(),t,e.row(),r),o.trigger.afterResize(e.table())}),t.events.startAdjust.bind(function(e){o.trigger.startDrag()}),t.events.adjustWidth.bind(function(e){o.trigger.beforeResize(e.table());var t=n.delta(e.delta(),e.table());Iu.adjustWidth(e.table(),t,e.column(),n),o.trigger.afterResize(e.table())}),{on:t.on,off:t.off,hideBars:t.hideBars,showBars:t.showBars,destroy:t.destroy,events:o.registry}}var oc=function(e,t){return e.inline?Ma(Gu.getBody(e),(n=Y.fromTag("div"),Zt.setAll(n,{position:"static",height:"0",width:"0",padding:"0",margin:"0",border:"0"}),nn.append(yt.body(),n),n)):Wa(Y.fromDom(e.getDoc()));var n},ic=function(e,t){e.inline&&un.remove(t.parent())},uc=function(u){var a,c,o=x.none(),i=x.none(),l=x.none(),s=/(\d+(\.\d+)?)%/,f=function(e){return"TABLE"===e.nodeName};return u.on("init",function(){var e,t=lo(Ju.directionAt),n=oc(u);if(l=x.some(n),("table"===(e=u.getParam("object_resizing",!0))||e)&&u.getParam("table_resize_bars",!0,"boolean")){var r=rc(n,t);r.on(),r.events.startDrag.bind(function(e){o=x.some(u.selection.getRng())}),r.events.afterResize.bind(function(e){var t=e.table(),n=Ct.descendants(t,"td[data-mce-style],th[data-mce-style]");E.each(n,function(e){vt.remove(e,"data-mce-style")}),o.each(function(e){u.selection.setRng(e),u.focus()}),u.undoManager.add()}),i=x.some(r)}}),u.on("ObjectResizeStart",function(e){var t,n=e.target;f(n)&&(a=e.width,t=n,c=u.dom.getStyle(t,"width")||u.dom.getAttrib(t,"width"))}),u.on("ObjectResized",function(e){var t=e.target;if(f(t)){var n=t;if(s.test(c)){var r=parseFloat(s.exec(c)[1]),o=e.width*r/a;u.dom.setStyle(n,"width",o+"%")}else{var i=[];ga.each(n.rows,function(e){ga.each(e.cells,function(e){var t=u.dom.getStyle(e,"width",!0);i.push({cell:e,width:t})})}),ga.each(i,function(e){u.dom.setStyle(e.cell,"width",e.width),u.dom.setAttrib(e.cell,"width",null)})}}}),{lazyResize:function(){return i},lazyWire:function(){return l.getOr(Wa(Y.fromDom(u.getBody())))},destroy:function(){i.each(function(e){e.destroy()}),l.each(function(e){ic(u,e)})}}},ac=function(e){return{fold:e}},cc=function(o){return ac(function(e,t,n,r){return e(o)})},lc=function(o){return ac(function(e,t,n,r){return t(o)})},sc=function(o,i){return ac(function(e,t,n,r){return n(o,i)})},fc=function(o){return ac(function(e,t,n,r){return r(o)})},dc=function(n,e){return zt.table(n,e).bind(function(e){var t=zt.cells(e);return E.findIndex(t,function(e){return Ke.eq(n,e)}).map(function(e){return{index:y.constant(e),all:y.constant(t)}})})},mc=function(t,e){return dc(t,e).fold(function(){return cc(t)},function(e){return e.index()+1<e.all().length?sc(t,e.all()[e.index()+1]):fc(t)})},gc=function(t,e){return dc(t,e).fold(function(){return cc()},function(e){return 0<=e.index()-1?sc(t,e.all()[e.index()-1]):lc(t)})},pc=mr([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),hc={before:pc.before,on:pc.on,after:pc.after,cata:function(e,t,n,r){return e.fold(t,n,r)},getStart:function(e){return e.fold(y.identity,y.identity,y.identity)}},vc=mr([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),bc=F.immutable("start","soffset","finish","foffset"),wc={domRange:vc.domRange,relative:vc.relative,exact:vc.exact,exactFromRange:function(e){return vc.exact(e.start(),e.soffset(),e.finish(),e.foffset())},range:bc,getWin:function(e){var t=e.match({domRange:function(e){return Y.fromDom(e.startContainer)},relative:function(e,t){return hc.getStart(e)},exact:function(e,t,n,r){return e}});return rt.defaultView(t)}},yc=function(e,t,n,r){var o=rt.owner(e).dom().createRange();return o.setStart(e.dom(),t),o.setEnd(n.dom(),r),o},xc=function(e,t,n,r){var o=yc(e,t,n,r),i=Ke.eq(e,n)&&t===r;return o.collapsed&&!i},Sc=function(e,t){var n=(t||document).createDocumentFragment();return E.each(e,function(e){n.appendChild(e.dom())}),Y.fromDom(n)},Cc=function(e,t){e.selectNodeContents(t.dom())},Rc=function(e){e.deleteContents()},Tc=function(e){return{left:y.constant(e.left),top:y.constant(e.top),right:y.constant(e.right),bottom:y.constant(e.bottom),width:y.constant(e.width),height:y.constant(e.height)}},Ac={create:function(e){return e.document.createRange()},replaceWith:function(e,t){Rc(e),e.insertNode(t.dom())},selectNodeContents:function(e,t){var n=e.document.createRange();return Cc(n,t),n},selectNodeContentsUsing:Cc,relativeToNative:function(e,t,n){var r,o,i=e.document.createRange();return r=i,t.fold(function(e){r.setStartBefore(e.dom())},function(e,t){r.setStart(e.dom(),t)},function(e){r.setStartAfter(e.dom())}),o=i,n.fold(function(e){o.setEndBefore(e.dom())},function(e,t){o.setEnd(e.dom(),t)},function(e){o.setEndAfter(e.dom())}),i},exactToNative:function(e,t,n,r,o){var i=e.document.createRange();return i.setStart(t.dom(),n),i.setEnd(r.dom(),o),i},deleteContents:Rc,cloneFragment:function(e){var t=e.cloneContents();return Y.fromDom(t)},getFirstRect:function(e){var t=e.getClientRects(),n=0<t.length?t[0]:e.getBoundingClientRect();return 0<n.width||0<n.height?x.some(n).map(Tc):x.none()},getBounds:function(e){var t=e.getBoundingClientRect();return 0<t.width||0<t.height?x.some(t).map(Tc):x.none()},isWithin:function(e,t){return t.compareBoundaryPoints(e.END_TO_START,e)<1&&-1<t.compareBoundaryPoints(e.START_TO_END,e)},toString:function(e){return e.toString()}},Dc=mr([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),kc=function(e,t,n){return t(Y.fromDom(n.startContainer),n.startOffset,Y.fromDom(n.endContainer),n.endOffset)},Nc=function(e,t){var o,n,r,i=(o=e,t.match({domRange:function(e){return{ltr:y.constant(e),rtl:x.none}},relative:function(e,t){return{ltr:fe(function(){return Ac.relativeToNative(o,e,t)}),rtl:fe(function(){return x.some(Ac.relativeToNative(o,t,e))})}},exact:function(e,t,n,r){return{ltr:fe(function(){return Ac.exactToNative(o,e,t,n,r)}),rtl:fe(function(){return x.some(Ac.exactToNative(o,n,r,e,t))})}}}));return(r=(n=i).ltr()).collapsed?n.rtl().filter(function(e){return!1===e.collapsed}).map(function(e){return Dc.rtl(Y.fromDom(e.endContainer),e.endOffset,Y.fromDom(e.startContainer),e.startOffset)}).getOrThunk(function(){return kc(0,Dc.ltr,r)}):kc(0,Dc.ltr,r)},Ec={ltr:Dc.ltr,rtl:Dc.rtl,diagnose:Nc,asLtrRange:function(i,e){return Nc(i,e).match({ltr:function(e,t,n,r){var o=i.document.createRange();return o.setStart(e.dom(),t),o.setEnd(n.dom(),r),o},rtl:function(e,t,n,r){var o=i.document.createRange();return o.setStart(n.dom(),r),o.setEnd(e.dom(),t),o}})}},Oc=function(e,t,n){return t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom},Bc=function(e,t,n,r,o){if(0===o)return 0;if(t===r)return o-1;for(var i=r,u=1;u<o;u++){var a=e(u),c=Math.abs(t-a.left);if(n>a.bottom);else{if(n<a.top||i<c)return u-1;i=c}}return 0},Pc={locate:function(l,s,f,d){var e=l.dom().createRange();e.selectNode(s.dom());var t=e.getClientRects();return qo(t,function(e){return Oc(e,f,d)?x.some(e):x.none()}).map(function(e){return n=l,r=s,t=f,o=d,i=e,u=function(e){var t=n.dom().createRange();return t.setStart(r.dom(),e),t.collapse(!0),t},a=hn.get(r).length,c=Bc(function(e){return u(e).getBoundingClientRect()},t,o,i.right,a),u(c);var n,r,t,o,i,u,a,c})}},Ic=function(t,e,n,r){var o=t.dom().createRange(),i=rt.children(e);return qo(i,function(e){return o.selectNode(e.dom()),Oc(o.getBoundingClientRect(),n,r)?Wc(t,e,n,r):x.none()})},Wc=function(e,t,n,r){return(dt.isText(t)?Pc.locate:Ic)(e,t,n,r)},Mc=function(e,t,n,r){var o=e.dom().createRange();o.selectNode(t.dom());var i=o.getBoundingClientRect(),u=Math.max(i.left,Math.min(i.right,n)),a=Math.max(i.top,Math.min(i.bottom,r));return Wc(e,t,u,a)},Lc=function(e,t){return t-e.left<e.right-t},qc=function(e,t,n){var r=e.dom().createRange();return r.selectNode(t.dom()),r.collapse(n),r},Fc=function(t,e,n){var r=t.dom().createRange();r.selectNode(e.dom());var o=r.getBoundingClientRect(),i=Lc(o,n);return(!0===i?Sn.first:Sn.last)(e).map(function(e){return qc(t,e,i)})},jc=function(e,t,n){var r=t.dom().getBoundingClientRect(),o=Lc(r,n);return x.some(qc(e,t,o))},zc=function(e,t,n){return(0===rt.children(t).length?jc:Fc)(e,t,n)},_c=document.caretPositionFromPoint?function(n,e,t){return x.from(n.dom().caretPositionFromPoint(e,t)).bind(function(e){if(null===e.offsetNode)return x.none();var t=n.dom().createRange();return t.setStart(e.offsetNode,e.offset),t.collapse(),x.some(t)})}:document.caretRangeFromPoint?function(e,t,n){return x.from(e.dom().caretRangeFromPoint(t,n))}:function(n,r,o){return Y.fromPoint(n,r,o).bind(function(e){var t=function(){return zc(n,e,r)};return 0===rt.children(e).length?t():function(e,t,n,r){var o=e.dom().createRange();o.selectNode(t.dom());var i=o.getBoundingClientRect(),u=Math.max(i.left,Math.min(i.right,n)),a=Math.max(i.top,Math.min(i.bottom,r));return Mc(e,t,u,a)}(n,e,r,o).orThunk(t)})},Hc=function(e,t,n){var r=Y.fromDom(e.document);return _c(r,t,n).map(function(e){return wc.range(Y.fromDom(e.startContainer),e.startOffset,Y.fromDom(e.endContainer),e.endOffset)})},Vc=function(e,t,n){var r,o,i,u,a,c,l=Ec.asLtrRange(e,t),s=Y.fromDom(l.commonAncestorContainer);return dt.isElement(s)?(r=e,o=s,i=l,u=n,a=Ac.create(r),c=(ne.is(o,u)?[o]:[]).concat(Ct.descendants(o,u)),E.filter(c,function(e){return Ac.selectNodeContentsUsing(a,e),Ac.isWithin(i,a)})):[]},Uc=function(e,t){var n=dt.name(e);return"input"===n?hc.after(e):E.contains(["br","img"],n)?0===t?hc.before(e):hc.after(e):hc.on(e,t)},Gc=function(e,t){var n=e.fold(hc.before,Uc,hc.after),r=t.fold(hc.before,Uc,hc.after);return wc.relative(n,r)},Xc=function(e,t,n,r){var o=Uc(e,t),i=Uc(n,r);return wc.relative(o,i)},Yc=function(e){return e.match({domRange:function(e){var t=Y.fromDom(e.startContainer),n=Y.fromDom(e.endContainer);return Xc(t,e.startOffset,n,e.endOffset)},relative:Gc,exact:Xc})},Kc=Gc,$c=Xc,Jc=function(e,t){x.from(e.getSelection()).each(function(e){e.removeAllRanges(),e.addRange(t)})},Qc=function(e,t,n,r,o){var i=Ac.exactToNative(e,t,n,r,o);Jc(e,i)},Zc=function(i,e){return Ec.diagnose(i,e).match({ltr:function(e,t,n,r){Qc(i,e,t,n,r)},rtl:function(e,t,n,r){var o=i.getSelection();o.setBaseAndExtent?o.setBaseAndExtent(e.dom(),t,n.dom(),r):o.extend?(o.collapse(e.dom(),t),o.extend(n.dom(),r)):Qc(i,n,r,e,t)}})},el=function(e){var t=Y.fromDom(e.anchorNode),n=Y.fromDom(e.focusNode);return xc(t,e.anchorOffset,n,e.focusOffset)?x.some(wc.range(Y.fromDom(e.anchorNode),e.anchorOffset,Y.fromDom(e.focusNode),e.focusOffset)):function(e){if(0<e.rangeCount){var t=e.getRangeAt(0),n=e.getRangeAt(e.rangeCount-1);return x.some(wc.range(Y.fromDom(t.startContainer),t.startOffset,Y.fromDom(n.endContainer),n.endOffset))}return x.none()}(e)},tl=function(e){var t=e.getSelection();return 0<t.rangeCount?el(t):x.none()},nl={setExact:function(e,t,n,r,o){var i=$c(t,n,r,o);Zc(e,i)},getExact:tl,get:function(e){return tl(e).map(function(e){return wc.exact(e.start(),e.soffset(),e.finish(),e.foffset())})},setRelative:function(e,t,n){var r=Kc(t,n);Zc(e,r)},toNative:function(e){var o=wc.getWin(e).dom(),t=function(e,t,n,r){return Ac.exactToNative(o,e,t,n,r)},n=Yc(e);return Ec.diagnose(o,n).match({ltr:t,rtl:t})},setToElement:function(e,t){var n=Ac.selectNodeContents(e,t);Jc(e,n)},clear:function(e){e.getSelection().removeAllRanges()},clone:function(e,t){var n=Ec.asLtrRange(e,t);return Ac.cloneFragment(n)},replace:function(e,t,n){var r=Ec.asLtrRange(e,t),o=Sc(n,e.document);Ac.replaceWith(r,o)},deleteAt:function(e,t){var n=Ec.asLtrRange(e,t);Ac.deleteContents(n)},forElement:function(e,t){var n=Ac.selectNodeContents(e,t);return wc.range(Y.fromDom(n.startContainer),n.startOffset,Y.fromDom(n.endContainer),n.endOffset)},getFirstRect:function(e,t){var n=Ec.asLtrRange(e,t);return Ac.getFirstRect(n)},getBounds:function(e,t){var n=Ec.asLtrRange(e,t);return Ac.getBounds(n)},getAtPoint:function(e,t,n){return Hc(e,t,n)},findWithin:function(e,t,n){return Vc(e,t,n)},getAsString:function(e,t){var n=Ec.asLtrRange(e,t);return Ac.toString(n)},isCollapsed:function(e,t,n,r){return Ke.eq(e,n)&&t===r}},rl=tinymce.util.Tools.resolve("tinymce.util.VK"),ol=function(e,t,n,r){return al(e,t,mc(n),r)},il=function(e,t,n,r){return al(e,t,gc(n),r)},ul=function(e,t){var n=wc.exact(t,0,t,0);return nl.toNative(n)},al=function(i,e,t,u,n){return t.fold(x.none,x.none,function(e,t){return Sn.first(t).map(function(e){return ul(0,e)})},function(o){return zt.table(o,e).bind(function(e){var t,n,r=Sr.noMenu(o);return i.undoManager.transact(function(){u.insertRowsAfter(e,r)}),t=e,n=Ct.descendants(t,"tr"),E.last(n).bind(function(e){return Wt.descendant(e,"td,th").map(function(e){return ul(0,e)})})})})},cl=["table","li","dl"],ll={handle:function(t,n,r,o){if(t.keyCode===rl.TAB){var i=Gu.getBody(n),u=function(e){var t=dt.name(e);return Ke.eq(e,i)||E.contains(cl,t)},e=n.selection.getRng();if(e.collapsed){var a=Y.fromDom(e.startContainer);zt.cell(a,u).each(function(e){t.preventDefault(),(t.shiftKey?il:ol)(n,u,e,r,o).each(function(e){n.selection.setRng(e)})})}}}},sl={response:F.immutable("selection","kill")},fl=function(t){return function(e){return e===t}},dl=fl(38),ml=fl(40),gl={ltr:{isBackward:fl(37),isForward:fl(39)},rtl:{isBackward:fl(39),isForward:fl(37)},isUp:dl,isDown:ml,isNavigation:function(e){return 37<=e&&e<=40}},pl={convertToRange:function(e,t){var n=Ec.asLtrRange(e,t);return{start:y.constant(Y.fromDom(n.startContainer)),soffset:y.constant(n.startOffset),finish:y.constant(Y.fromDom(n.endContainer)),foffset:y.constant(n.endOffset)}},makeSitus:function(e,t,n,r){return{start:y.constant(hc.on(e,t)),finish:y.constant(hc.on(n,r))}}},hl=Ge.detect().browser.isSafari(),vl=function(e){var t=e!==undefined?e.dom():document,n=t.body.scrollLeft||t.documentElement.scrollLeft,r=t.body.scrollTop||t.documentElement.scrollTop;return Xr(n,r)},bl=function(e,t,n){(n!==undefined?n.dom():document).defaultView.scrollTo(e,t)},wl=function(e,t){hl&&g.isFunction(e.dom().scrollIntoViewIfNeeded)?e.dom().scrollIntoViewIfNeeded(!1):e.dom().scrollIntoView(t)},yl={get:vl,to:bl,by:function(e,t,n){(n!==undefined?n.dom():document).defaultView.scrollBy(e,t)},preserve:function(e,t){var n=vl(e);t();var r=vl(e);n.top()===r.top()&&n.left()===r.left()||bl(n.left(),n.top(),e)},capture:function(t){var e=x.none(),n=function(){e=x.some(vl(t))};return n(),{save:n,restore:function(){e.each(function(e){bl(e.left(),e.top(),t)})}}},intoView:wl,intoViewIfNeeded:function(e,t){var n=t.dom().getBoundingClientRect(),r=e.dom().getBoundingClientRect();r.top<n.top?wl(e,!0):r.bottom>n.bottom&&wl(e,!1)},setToElement:function(e,t){var n=$r(t),r=Y.fromDom(e.document);bl(n.left(),n.top(),r)},scrollBarWidth:function(){var e=Y.fromHtml('<div style="width: 100px; height: 100px; overflow: scroll; position: absolute; top: -9999px;"></div>');nn.after(yt.body(),e);var t=e.dom().offsetWidth-e.dom().clientWidth;return un.remove(e),t}};function xl(i){return{elementFromPoint:function(e,t){return x.from(i.document.elementFromPoint(e,t)).map(Y.fromDom)},getRect:function(e){return e.dom().getBoundingClientRect()},getRangedRect:function(e,t,n,r){var o=wc.exact(e,t,n,r);return nl.getFirstRect(i,o).map(function(e){return M.map(e,y.apply)})},getSelection:function(){return nl.get(i).map(function(e){return pl.convertToRange(i,e)})},fromSitus:function(e){var t=wc.relative(e.start(),e.finish());return pl.convertToRange(i,t)},situsFromPoint:function(e,t){return nl.getAtPoint(i,e,t).map(function(e){return{start:y.constant(hc.on(e.start(),e.soffset())),finish:y.constant(hc.on(e.finish(),e.foffset()))}})},clearSelection:function(){nl.clear(i)},setSelection:function(e){nl.setExact(i,e.start(),e.soffset(),e.finish(),e.foffset())},setRelativeSelection:function(e,t){nl.setRelative(i,e,t)},selectContents:function(e){nl.setToElement(i,e)},getInnerHeight:function(){return i.innerHeight},getScrollY:function(){return yl.get(Y.fromDom(i.document)).top()},scrollBy:function(e,t){yl.by(e,t,Y.fromDom(i.document))}}}var Sl=function(n,e,r,t,o){return Ke.eq(r,t)?x.none():ur.identify(r,t,e).bind(function(e){var t=e.boxes().getOr([]);return 0<t.length?(o(n,t,e.start(),e.finish()),x.some(sl.response(x.some(pl.makeSitus(r,0,r,wn(r))),!0))):x.none()})},Cl={sync:function(n,r,e,t,o,i,u){return Ke.eq(e,o)&&t===i?x.none():Wt.closest(e,"td,th",r).bind(function(t){return Wt.closest(o,"td,th",r).bind(function(e){return Sl(n,r,t,e,u)})})},detect:Sl,update:function(e,t,n,r,o){return ur.shiftSelection(r,e,t,o.firstSelectedSelector(),o.lastSelectedSelector()).map(function(e){return o.clear(n),o.selectRange(n,e.boxes(),e.start(),e.finish()),e.boxes()})}},Rl=F.immutableBag(["left","top","right","bottom"],[]),Tl={nu:Rl,moveUp:function(e,t){return Rl({left:e.left(),top:e.top()-t,right:e.right(),bottom:e.bottom()-t})},moveDown:function(e,t){return Rl({left:e.left(),top:e.top()+t,right:e.right(),bottom:e.bottom()+t})},moveBottomTo:function(e,t){var n=e.bottom()-e.top();return Rl({left:e.left(),top:t-n,right:e.right(),bottom:t})},moveTopTo:function(e,t){var n=e.bottom()-e.top();return Rl({left:e.left(),top:t,right:e.right(),bottom:t+n})},getTop:function(e){return e.top()},getBottom:function(e){return e.bottom()},translate:function(e,t,n){return Rl({left:e.left()+t,top:e.top()+n,right:e.right()+t,bottom:e.bottom()+n})},toString:function(e){return"("+e.left()+", "+e.top()+") -> ("+e.right()+", "+e.bottom()+")"}},Al=function(e){return Tl.nu({left:e.left,top:e.top,right:e.right,bottom:e.bottom})},Dl=function(e,t){return x.some(e.getRect(t))},kl=function(e,t,n){return dt.isElement(t)?Dl(e,t).map(Al):dt.isText(t)?(r=e,o=t,i=n,0<=i&&i<wn(o)?r.getRangedRect(o,i,o,i+1):0<i?r.getRangedRect(o,i-1,o,i):x.none()).map(Al):x.none();var r,o,i},Nl=function(e,t){return dt.isElement(t)?Dl(e,t).map(Al):dt.isText(t)?e.getRangedRect(t,0,t,wn(t)).map(Al):x.none()},El=F.immutable("item","mode"),Ol=function(e,t,n,r){var o=r!==undefined?r:Bl;return e.property().parent(t).map(function(e){return El(e,o)})},Bl=function(e,t,n,r){var o=r!==undefined?r:Pl;return n.sibling(e,t).map(function(e){return El(e,o)})},Pl=function(e,t,n,r){var o=r!==undefined?r:Pl,i=e.property().children(t);return n.first(i).map(function(e){return El(e,o)})},Il=[{current:Ol,next:Bl,fallback:x.none()},{current:Bl,next:Pl,fallback:x.some(Ol)},{current:Pl,next:Pl,fallback:x.some(Bl)}],Wl=function(t,n,r,o,e){return e=e!==undefined?e:Il,E.find(e,function(e){return e.current===r}).bind(function(e){return e.current(t,n,o,e.next).orThunk(function(){return e.fallback.bind(function(e){return Wl(t,n,e,o)})})})},Ml={backtrack:Ol,sidestep:Bl,advance:Pl,go:Wl},Ll={left:function(){return{sibling:function(e,t){return e.query().prevSibling(t)},first:function(e){return 0<e.length?x.some(e[e.length-1]):x.none()}}},right:function(){return{sibling:function(e,t){return e.query().nextSibling(t)},first:function(e){return 0<e.length?x.some(e[0]):x.none()}}}},ql=function(t,e,n,r,o,i){return Ml.go(t,e,r,o).bind(function(e){return i(e.item())?x.none():n(e.item())?x.some(e.item()):ql(t,e.item(),n,e.mode(),o,i)})},Fl=function(e,t,n,r){return ql(e,t,n,Ml.sidestep,Ll.left(),r)},jl=function(e,t,n,r){return ql(e,t,n,Ml.sidestep,Ll.right(),r)},zl=function(e,t){return 0===e.property().children(t).length},_l=function(e,t,n,r){return Fl(e,t,n,r)},Hl=function(e,t,n,r){return jl(e,t,n,r)},Vl={before:function(e,t,n){return _l(e,t,y.curry(zl,e),n)},after:function(e,t,n){return Hl(e,t,y.curry(zl,e),n)},seekLeft:_l,seekRight:Hl,walkers:function(){return{left:Ll.left,right:Ll.right}},walk:function(e,t,n,r,o){return Ml.go(e,t,n,r,o)},backtrack:Ml.backtrack,sidestep:Ml.sidestep,advance:Ml.advance},Ul=On(),Gl={gather:function(e,t,n){return Vl.gather(Ul,e,t,n)},before:function(e,t){return Vl.before(Ul,e,t)},after:function(e,t){return Vl.after(Ul,e,t)},seekLeft:function(e,t,n){return Vl.seekLeft(Ul,e,t,n)},seekRight:function(e,t,n){return Vl.seekRight(Ul,e,t,n)},walkers:function(){return Vl.walkers()},walk:function(e,t,n,r){return Vl.walk(Ul,e,t,n,r)}},Xl=mr([{none:[]},{retry:["caret"]}]),Yl=function(t,e,r){return Pt.closest(e,No).fold(y.constant(!1),function(e){return Nl(t,e).exists(function(e){return n=e,(t=r).left()<n.left()||Math.abs(n.right()-t.left())<1||t.left()>n.right();var t,n})})},Kl={point:Tl.getTop,adjuster:function(e,t,n,r,o){var i=Tl.moveUp(o,5);return Math.abs(n.top()-r.top())<1?Xl.retry(i):n.bottom()<o.top()?Xl.retry(i):n.bottom()===o.top()?Xl.retry(Tl.moveUp(o,1)):Yl(e,t,o)?Xl.retry(Tl.translate(i,5,0)):Xl.none()},move:Tl.moveUp,gather:Gl.before},$l={point:Tl.getBottom,adjuster:function(e,t,n,r,o){var i=Tl.moveDown(o,5);return Math.abs(n.bottom()-r.bottom())<1?Xl.retry(i):n.top()>o.bottom()?Xl.retry(i):n.top()===o.bottom()?Xl.retry(Tl.moveDown(o,1)):Yl(e,t,o)?Xl.retry(Tl.translate(i,5,0)):Xl.none()},move:Tl.moveDown,gather:Gl.after},Jl=function(n,r,o,i,u){return 0===u?x.some(i):(c=n,l=i.left(),s=r.point(i),c.elementFromPoint(l,s).filter(function(e){return"table"===dt.name(e)}).isSome()?(t=i,a=u-1,Jl(n,e=r,o,e.move(t,5),a)):n.situsFromPoint(i.left(),r.point(i)).bind(function(e){return e.start().fold(x.none,function(t,e){return Nl(n,t,e).bind(function(e){return r.adjuster(n,t,e,o,i).fold(x.none,function(e){return Jl(n,r,o,e,u-1)})}).orThunk(function(){return x.some(i)})},x.none)}));var e,t,a,c,l,s},Ql=function(t,n,e){var r,o,i,u=t.move(e,5),a=Jl(n,t,e,u,100).getOr(u);return(r=t,o=a,i=n,r.point(o)>i.getInnerHeight()?x.some(r.point(o)-i.getInnerHeight()):r.point(o)<0?x.some(-r.point(o)):x.none()).fold(function(){return n.situsFromPoint(a.left(),t.point(a))},function(e){return n.scrollBy(0,e),n.situsFromPoint(a.left(),t.point(a)-e)})},Zl={tryUp:y.curry(Ql,Kl),tryDown:y.curry(Ql,$l),ieTryUp:function(e,t){return e.situsFromPoint(t.left(),t.top()-5)},ieTryDown:function(e,t){return e.situsFromPoint(t.left(),t.bottom()+5)},getJumpSize:y.constant(5)},es=mr([{none:["message"]},{success:[]},{failedUp:["cell"]},{failedDown:["cell"]}]),ts=function(e){return Wt.closest(e,"tr")},ns={verify:function(a,e,t,n,r,c,o){return Wt.closest(n,"td,th",o).bind(function(u){return Wt.closest(e,"td,th",o).map(function(i){return Ke.eq(u,i)?Ke.eq(n,u)&&wn(u)===r?c(i):es.none("in same cell"):zn(ts,[u,i]).fold(function(){return t=i,n=u,r=(e=a).getRect(t),(o=e.getRect(n)).right>r.left&&o.left<r.right?es.success():c(i);var e,t,n,r,o},function(e){return c(i)})})}).getOr(es.none("default"))},cata:function(e,t,n,r,o){return e.fold(t,n,r,o)},adt:es},rs={point:F.immutable("element","offset"),delta:F.immutable("element","deltaOffset"),range:F.immutable("element","start","finish"),points:F.immutable("begin","end"),text:F.immutable("element","text")},os=(F.immutable("ancestor","descendants","element","index"),F.immutable("parent","children","element","index")),is=function(e,t){return E.findIndex(e,y.curry(Ke.eq,t))},us=function(r){return rt.parent(r).bind(function(t){var n=rt.children(t);return is(n,r).map(function(e){return os(t,n,r,e)})})},as=function(e){return"br"===dt.name(e)},cs=function(e,t,n){return t(e,n).bind(function(e){return dt.isText(e)&&0===hn.get(e).trim().length?cs(e,t,n):x.some(e)})},ls=function(t,e,n,r){return(o=e,i=n,rt.child(o,i).filter(as).orThunk(function(){return rt.child(o,i-1).filter(as)})).bind(function(e){return r.traverse(e).fold(function(){return cs(e,r.gather,t).map(r.relative)},function(e){return us(e).map(function(e){return hc.on(e.parent(),e.index())})})});var o,i},ss=function(e,t,n,r){var o,i,u;return(as(t)?(o=e,i=t,(u=r).traverse(i).orThunk(function(){return cs(i,u.gather,o)}).map(u.relative)):ls(e,t,n,r)).map(function(e){return{start:y.constant(e),finish:y.constant(e)}})},fs=function(e){return ns.cata(e,function(e){return x.none()},function(){return x.none()},function(e){return x.some(rs.point(e,0))},function(e){return x.some(rs.point(e,wn(e)))})},ds=Ge.detect(),ms=function(r,o,i,u,a,c){return 0===c?x.none():hs(r,o,i,u,a).bind(function(e){var t=r.fromSitus(e),n=ns.verify(r,i,u,t.finish(),t.foffset(),a.failure,o);return ns.cata(n,function(){return x.none()},function(){return x.some(e)},function(e){return Ke.eq(i,e)&&0===u?gs(r,i,u,Tl.moveUp,a):ms(r,o,e,0,a,c-1)},function(e){return Ke.eq(i,e)&&u===wn(e)?gs(r,i,u,Tl.moveDown,a):ms(r,o,e,wn(e),a,c-1)})})},gs=function(t,e,n,r,o){return kl(t,e,n).bind(function(e){return ps(t,o,r(e,Zl.getJumpSize()))})},ps=function(e,t,n){return ds.browser.isChrome()||ds.browser.isSafari()||ds.browser.isFirefox()||ds.browser.isEdge()?t.otherRetry(e,n):ds.browser.isIE()?t.ieRetry(e,n):x.none()},hs=function(t,e,n,r,o){return kl(t,n,r).bind(function(e){return ps(t,o,e)})},vs=function(t,n,r){return(o=t,i=n,u=r,o.getSelection().bind(function(r){return ss(i,r.finish(),r.foffset(),u).fold(function(){return x.some(rs.point(r.finish(),r.foffset()))},function(e){var t=o.fromSitus(e),n=ns.verify(o,r.finish(),r.foffset(),t.finish(),t.foffset(),u.failure,i);return fs(n)})})).bind(function(e){return ms(t,n,e.element(),e.offset(),r,20).map(t.fromSitus)});var o,i,u},bs=function(e,t,n){return Pt.ancestor(e,t,n).isSome()},ws=Ge.detect(),ys=function(r,o,i,e,u){return Wt.closest(e,"td,th",o).bind(function(n){return Wt.closest(n,"table",o).bind(function(e){return t=e,bs(u,function(e){return rt.parent(e).exists(function(e){return Ke.eq(e,t)})})?vs(r,o,i).bind(function(t){return Wt.closest(t.finish(),"td,th",o).map(function(e){return{start:y.constant(n),finish:y.constant(e),range:y.constant(t)}})}):x.none();var t})})},xs=function(e,t,n,r,o,i){return ws.browser.isIE()?x.none():i(r,t).orThunk(function(){return ys(e,t,n,r,o).map(function(e){var t=e.range();return sl.response(x.some(pl.makeSitus(t.start(),t.soffset(),t.finish(),t.foffset())),!0)})})},Ss=function(e,t,n,r,o,i,u){return ys(e,n,r,o,i).bind(function(e){return Cl.detect(t,n,e.start(),e.finish(),u)})},Cs=function(e,r){return Wt.closest(e,"tr",r).bind(function(n){return Wt.closest(n,"table",r).bind(function(e){var t=Ct.descendants(e,"tr");return Ke.eq(n,t[0])?Gl.seekLeft(e,function(e){return Sn.last(e).isSome()},r).map(function(e){var t=wn(e);return sl.response(x.some(pl.makeSitus(e,t,e,t)),!0)}):x.none()})})},Rs=function(e,r){return Wt.closest(e,"tr",r).bind(function(n){return Wt.closest(n,"table",r).bind(function(e){var t=Ct.descendants(e,"tr");return Ke.eq(n,t[t.length-1])?Gl.seekRight(e,function(e){return Sn.first(e).isSome()},r).map(function(e){return sl.response(x.some(pl.makeSitus(e,0,e,0)),!0)}):x.none()})})},Ts=function(e,t){return Wt.closest(e,"td,th",t)},As={down:{traverse:rt.nextSibling,gather:Gl.after,relative:hc.before,otherRetry:Zl.tryDown,ieRetry:Zl.ieTryDown,failure:ns.adt.failedDown},up:{traverse:rt.prevSibling,gather:Gl.before,relative:hc.before,otherRetry:Zl.tryUp,ieRetry:Zl.ieTryUp,failure:ns.adt.failedUp}},Ds=F.immutable("rows","cols"),ks={mouse:function(e,t,n,r){var o,i,u,a,c,l,s=xl(e),f=(o=s,i=t,u=n,a=r,c=x.none(),l=function(){c=x.none()},{mousedown:function(e){a.clear(i),c=Ts(e.target(),u)},mouseover:function(e){c.each(function(r){a.clear(i),Ts(e.target(),u).each(function(n){ur.identify(r,n,u).each(function(e){var t=e.boxes().getOr([]);(1<t.length||1===t.length&&!Ke.eq(r,n))&&(a.selectRange(i,t,e.start(),e.finish()),o.selectContents(n))})})})},mouseup:function(){c.each(l)}});return{mousedown:f.mousedown,mouseover:f.mouseover,mouseup:f.mouseup}},keyboard:function(e,c,l,s){var f=xl(e),d=function(){return s.clear(c),x.none()};return{keydown:function(e,t,n,r,o,i){var u=e.raw().which,a=!0===e.raw().shiftKey;return ur.retrieve(c,s.selectedSelector()).fold(function(){return gl.isDown(u)&&a?y.curry(Ss,f,c,l,As.down,r,t,s.selectRange):gl.isUp(u)&&a?y.curry(Ss,f,c,l,As.up,r,t,s.selectRange):gl.isDown(u)?y.curry(xs,f,l,As.down,r,t,Rs):gl.isUp(u)?y.curry(xs,f,l,As.up,r,t,Cs):x.none},function(t){var e=function(e){return function(){return qo(e,function(e){return Cl.update(e.rows(),e.cols(),c,t,s)}).fold(function(){return ur.getEdges(c,s.firstSelectedSelector(),s.lastSelectedSelector()).map(function(e){var t=gl.isDown(u)||i.isForward(u)?hc.after:hc.before;return f.setRelativeSelection(hc.on(e.first(),0),t(e.table())),s.clear(c),sl.response(x.none(),!0)})},function(e){return x.some(sl.response(x.none(),!0))})}};return gl.isDown(u)&&a?e([Ds(1,0)]):gl.isUp(u)&&a?e([Ds(-1,0)]):i.isBackward(u)&&a?e([Ds(0,-1),Ds(-1,0)]):i.isForward(u)&&a?e([Ds(0,1),Ds(1,0)]):gl.isNavigation(u)&&!1===a?d:x.none})()},keyup:function(t,n,r,o,i){return ur.retrieve(c,s.selectedSelector()).fold(function(){var e=t.raw().which;return 0==(!0===t.raw().shiftKey)?x.none():gl.isNavigation(e)?Cl.sync(c,l,n,r,o,i,s.selectRange):x.none()},x.none)}}}},Ns=function(t,e){E.each(e,function(e){bi.remove(t,e)})},Es=function(t){return function(e){bi.add(e,t)}},Os=function(t){return function(e){Ns(e,t)}},Bs={byClass:function(o){var i=Es(o.selected()),n=Os([o.selected(),o.lastSelected(),o.firstSelected()]),u=function(e){var t=Ct.descendants(e,o.selectedSelector());E.each(t,n)};return{clear:u,selectRange:function(e,t,n,r){u(e),E.each(t,i),bi.add(n,o.firstSelected()),bi.add(r,o.lastSelected())},selectedSelector:o.selectedSelector,firstSelectedSelector:o.firstSelectedSelector,lastSelectedSelector:o.lastSelectedSelector}},byAttr:function(o){var n=function(e){vt.remove(e,o.selected()),vt.remove(e,o.firstSelected()),vt.remove(e,o.lastSelected())},i=function(e){vt.set(e,o.selected(),"1")},u=function(e){var t=Ct.descendants(e,o.selectedSelector());E.each(t,n)};return{clear:u,selectRange:function(e,t,n,r){u(e),E.each(t,i),vt.set(n,o.firstSelected(),"1"),vt.set(r,o.lastSelected(),"1")},selectedSelector:o.selectedSelector,firstSelectedSelector:o.firstSelectedSelector,lastSelectedSelector:o.lastSelectedSelector}}};function Ps(p,h){var v=F.immutableBag(["mousedown","mouseover","mouseup","keyup","keydown"],[]),b=x.none(),w=Bs.byAttr(dr);return p.on("init",function(e){var r=p.getWin(),i=Gu.getBody(p),t=Gu.getIsRoot(p),n=ks.mouse(r,i,t,w),a=ks.keyboard(r,i,t,w),c=function(e,t){!0===e.raw().shiftKey&&(t.kill()&&e.kill(),t.selection().each(function(e){var t=wc.relative(e.start(),e.finish()),n=Ec.asLtrRange(r,t);p.selection.setRng(n)}))},o=function(e){var t=s(e);if(t.raw().shiftKey&&gl.isNavigation(t.raw().which)){var n=p.selection.getRng(),r=Y.fromDom(n.startContainer),o=Y.fromDom(n.endContainer);a.keyup(t,r,n.startOffset,o,n.endOffset).each(function(e){c(t,e)})}},u=function(e){var t=s(e);h().each(function(e){e.hideBars()});var n=p.selection.getRng(),r=Y.fromDom(p.selection.getStart()),o=Y.fromDom(n.startContainer),i=Y.fromDom(n.endContainer),u=Ju.directionAt(r).isRtl()?gl.rtl:gl.ltr;a.keydown(t,o,n.startOffset,i,n.endOffset,u).each(function(e){c(t,e)}),h().each(function(e){e.showBars()})},l=function(e){return e.hasOwnProperty("x")&&e.hasOwnProperty("y")},s=function(e){var t=Y.fromDom(e.target),n=function(){e.stopPropagation()},r=function(){e.preventDefault()},o=y.compose(r,n);return{target:y.constant(t),x:y.constant(l(e)?e.x:null),y:y.constant(l(e)?e.y:null),stop:n,prevent:r,kill:o,raw:y.constant(e)}},f=function(e){return 0===e.button},d=function(e){f(e)&&n.mousedown(s(e))},m=function(e){var t;((t=e).buttons===undefined||0!=(1&t.buttons))&&n.mouseover(s(e))},g=function(e){f(e)&&n.mouseup(s(e))};p.on("mousedown",d),p.on("mouseover",m),p.on("mouseup",g),p.on("keyup",o),p.on("keydown",u),p.on("nodechange",function(){var e=p.selection,t=Y.fromDom(e.getStart()),n=Y.fromDom(e.getEnd()),r=zt.table(t),o=zt.table(n);r.bind(function(t){return o.bind(function(e){return Ke.eq(t,e)?x.some(!0):x.none()})}).fold(function(){w.clear(i)},y.noop)}),b=x.some(v({mousedown:d,mouseover:m,mouseup:g,keyup:o,keydown:u}))}),{clear:w.clear,destroy:function(){b.each(function(e){})}}}var Is=function(t){return{get:function(){var e=Gu.getBody(t);return ar(e,dr.selectedSelector()).fold(function(){return t.selection.getStart()===undefined?pr.none():pr.single(t.selection)},function(e){return pr.multiple(e)})}}},Ws=ga.each,Ms={addButtons:function(t){var n=[];function e(e){return function(){t.execCommand(e)}}Ws("inserttable tableprops deletetable | cell row column".split(" "),function(e){"|"===e?n.push({text:"-"}):n.push(t.menuItems[e])}),t.addButton("table",{type:"menubutton",title:"Table",menu:n}),t.addButton("tableprops",{title:"Table properties",onclick:y.curry(Ba,t,!0),icon:"table"}),t.addButton("tabledelete",{title:"Delete table",onclick:e("mceTableDelete")}),t.addButton("tablecellprops",{title:"Cell properties",onclick:e("mceTableCellProps")}),t.addButton("tablemergecells",{title:"Merge cells",onclick:e("mceTableMergeCells")}),t.addButton("tablesplitcells",{title:"Split cell",onclick:e("mceTableSplitCells")}),t.addButton("tableinsertrowbefore",{title:"Insert row before",onclick:e("mceTableInsertRowBefore")}),t.addButton("tableinsertrowafter",{title:"Insert row after",onclick:e("mceTableInsertRowAfter")}),t.addButton("tabledeleterow",{title:"Delete row",onclick:e("mceTableDeleteRow")}),t.addButton("tablerowprops",{title:"Row properties",onclick:e("mceTableRowProps")}),t.addButton("tablecutrow",{title:"Cut row",onclick:e("mceTableCutRow")}),t.addButton("tablecopyrow",{title:"Copy row",onclick:e("mceTableCopyRow")}),t.addButton("tablepasterowbefore",{title:"Paste row before",onclick:e("mceTablePasteRowBefore")}),t.addButton("tablepasterowafter",{title:"Paste row after",onclick:e("mceTablePasteRowAfter")}),t.addButton("tableinsertcolbefore",{title:"Insert column before",onclick:e("mceTableInsertColBefore")}),t.addButton("tableinsertcolafter",{title:"Insert column after",onclick:e("mceTableInsertColAfter")}),t.addButton("tabledeletecol",{title:"Delete column",onclick:e("mceTableDeleteCol")})},addToolbars:function(t){var e,n=""===(e=t.getParam("table_toolbar",Qu))||!1===e?[]:g.isString(e)?e.split(/[ ,]/):g.isArray(e)?e:[];0<n.length&&t.addContextToolbar(function(e){return t.dom.is(e,"table")&&t.getBody().contains(e)},n.join(" "))}},Ls={addMenuItems:function(o,n){var r=x.none(),i=[],u=[],a=[],c=[],l=function(e){e.disabled(!0)},s=function(e){e.disabled(!1)},e=function(){var t=this;i.push(t),r.fold(function(){l(t)},function(e){s(t)})},t=function(){var t=this;u.push(t),r.fold(function(){l(t)},function(e){s(t)})};o.on("init",function(){o.on("nodechange",function(e){var t=x.from(o.dom.getParent(o.selection.getStart(),"th,td"));(r=t.bind(function(e){var t=Y.fromDom(e);return zt.table(t).map(function(e){return Sr.forMenu(n,e,t)})})).fold(function(){E.each(i,l),E.each(u,l),E.each(a,l),E.each(c,l)},function(t){E.each(i,s),E.each(u,s),E.each(a,function(e){e.disabled(t.mergable().isNone())}),E.each(c,function(e){e.disabled(t.unmergable().isNone())})})})});var f=function(e,t,n,r){var o,i,u,a,c,l=r.getEl().getElementsByTagName("table")[0],s=r.isRtl()||"tl-tr"===r.parent().rel;for(l.nextSibling.innerHTML=t+1+" x "+(n+1),s&&(t=9-t),i=0;i<10;i++)for(o=0;o<10;o++)a=l.rows[i].childNodes[o].firstChild,c=(s?t<=o:o<=t)&&i<=n,e.dom.toggleClass(a,"mce-active",c),c&&(u=a);return u.parentNode},d=!1===o.getParam("table_grid",!0,"boolean")?{text:"Table",icon:"table",context:"table",onclick:y.curry(Ba,o)}:{text:"Table",icon:"table",context:"table",ariaHideMenu:!0,onclick:function(e){e.aria&&(this.parent().hideAll(),e.stopImmediatePropagation(),Ba(o))},onshow:function(){f(o,0,0,this.menu.items()[0])},onhide:function(){var e=this.menu.items()[0].getEl().getElementsByTagName("a");o.dom.removeClass(e,"mce-active"),o.dom.addClass(e[0],"mce-active")},menu:[{type:"container",html:function(){var e="";e='<table role="grid" class="mce-grid mce-grid-border" aria-readonly="true">';for(var t=0;t<10;t++){e+="<tr>";for(var n=0;n<10;n++)e+='<td role="gridcell" tabindex="-1"><a id="mcegrid'+(10*t+n)+'" href="#" data-mce-x="'+n+'" data-mce-y="'+t+'"></a></td>';e+="</tr>"}return e+="</table>",e+='<div class="mce-text-center" role="presentation">1 x 1</div>'}(),onPostRender:function(){this.lastX=this.lastY=0},onmousemove:function(e){var t,n,r=e.target;"A"===r.tagName.toUpperCase()&&(t=parseInt(r.getAttribute("data-mce-x"),10),n=parseInt(r.getAttribute("data-mce-y"),10),(this.isRtl()||"tl-tr"===this.parent().rel)&&(t=9-t),t===this.lastX&&n===this.lastY||(f(o,t,n,e.control),this.lastX=t,this.lastY=n))},onclick:function(e){var t=this;"A"===e.target.tagName.toUpperCase()&&(e.preventDefault(),e.stopPropagation(),t.parent().cancel(),o.undoManager.transact(function(){Na(o,t.lastX+1,t.lastY+1)}),o.addVisual())}}]};function m(e){return function(){o.execCommand(e)}}var g={text:"Table properties",context:"table",onPostRender:e,onclick:y.curry(Ba,o,!0)},p={text:"Delete table",context:"table",onPostRender:e,cmd:"mceTableDelete"},h={text:"Row",context:"table",menu:[{text:"Insert row before",onclick:m("mceTableInsertRowBefore"),onPostRender:t},{text:"Insert row after",onclick:m("mceTableInsertRowAfter"),onPostRender:t},{text:"Delete row",onclick:m("mceTableDeleteRow"),onPostRender:t},{text:"Row properties",onclick:m("mceTableRowProps"),onPostRender:t},{text:"-"},{text:"Cut row",onclick:m("mceTableCutRow"),onPostRender:t},{text:"Copy row",onclick:m("mceTableCopyRow"),onPostRender:t},{text:"Paste row before",onclick:m("mceTablePasteRowBefore"),onPostRender:t},{text:"Paste row after",onclick:m("mceTablePasteRowAfter"),onPostRender:t}]},v={text:"Column",context:"table",menu:[{text:"Insert column before",onclick:m("mceTableInsertColBefore"),onPostRender:t},{text:"Insert column after",onclick:m("mceTableInsertColAfter"),onPostRender:t},{text:"Delete column",onclick:m("mceTableDeleteCol"),onPostRender:t}]},b={separator:"before",text:"Cell",context:"table",menu:[{text:"Cell properties",onclick:m("mceTableCellProps"),onPostRender:t},{text:"Merge cells",onclick:m("mceTableMergeCells"),onPostRender:function(){var t=this;a.push(t),r.fold(function(){l(t)},function(e){t.disabled(e.mergable().isNone())})}},{text:"Split cell",onclick:m("mceTableSplitCells"),onPostRender:function(){var t=this;c.push(t),r.fold(function(){l(t)},function(e){t.disabled(e.unmergable().isNone())})}}]};o.addMenuItem("inserttable",d),o.addMenuItem("tableprops",g),o.addMenuItem("deletetable",p),o.addMenuItem("row",h),o.addMenuItem("column",v),o.addMenuItem("cell",b)}},qs=function(n,o){return{insertTable:function(e,t){return Na(n,e,t)},setClipboardRows:function(e){return t=e,n=o,r=E.map(t,Y.fromDom),void n.set(x.from(r));var t,n,r},getClipboardRows:function(){return o.get().fold(function(){},function(e){return E.map(e,function(e){return e.dom()})})}}};u.add("table",function(t){var n=uc(t),e=Ps(t,n.lazyResize),r=da(t,n.lazyWire),o=Is(t),i=fo(x.none());return Ia.registerCommands(t,r,e,o,i),Cr.registerEvents(t,o,r,e),Ls.addMenuItems(t,o),Ms.addButtons(t),Ms.addToolbars(t),t.on("PreInit",function(){t.serializer.addTempAttr(dr.firstSelected()),t.serializer.addTempAttr(dr.lastSelected())}),ta(t)&&t.on("keydown",function(e){ll.handle(e,t,r,n.lazyWire)}),t.on("remove",function(){n.destroy(),e.destroy()}),qs(t,i)})}();
|
