From 95d536e9039833596789703d38fd65e9b66eeaf5 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Mon, 11 Jan 2016 17:05:59 +0000 Subject: [PATCH] work in progress to support rich text editing in wiki --- codepot/src/codepot/controllers/issue.php | 266 ------------------- codepot/src/codepot/controllers/wiki.php | 37 ++- codepot/src/codepot/views/Makefile.am | 3 +- codepot/src/codepot/views/Makefile.in | 3 +- codepot/src/codepot/views/code_edit.php | 46 ++-- codepot/src/codepot/views/issue_delete.php | 90 ------- codepot/src/codepot/views/issue_edit.php | 173 ------------ codepot/src/codepot/views/issue_home.php | 94 +++---- codepot/src/codepot/views/issue_show.php | 210 +++++++-------- codepot/src/codepot/views/wiki_edit.php | 6 +- codepot/src/codepot/views/wiki_editx.php | 256 ++++++++++++++++++ codepot/src/codepot/views/wiki_home.php | 43 +++ codepot/src/codepot/views/wiki_show.php | 32 +-- codepot/src/css/Makefile.am | 3 + codepot/src/css/Makefile.in | 3 + codepot/src/css/code.css | 2 +- codepot/src/css/issue.css | 125 ++++----- codepot/src/css/medium-editor-tables.min.css | 1 + codepot/src/css/medium-editor-theme.min.css | 1 + codepot/src/css/medium-editor.min.css | 1 + codepot/src/css/wiki.css | 49 ++-- codepot/src/js/Makefile.am | 2 + codepot/src/js/Makefile.in | 2 + codepot/src/js/medium-editor-tables.min.js | 1 + codepot/src/js/medium-editor.min.js | 3 + 25 files changed, 610 insertions(+), 842 deletions(-) delete mode 100644 codepot/src/codepot/views/issue_delete.php delete mode 100644 codepot/src/codepot/views/issue_edit.php create mode 100644 codepot/src/codepot/views/wiki_editx.php create mode 100644 codepot/src/css/medium-editor-tables.min.css create mode 100644 codepot/src/css/medium-editor-theme.min.css create mode 100644 codepot/src/css/medium-editor.min.css create mode 100644 codepot/src/js/medium-editor-tables.min.js create mode 100644 codepot/src/js/medium-editor.min.js diff --git a/codepot/src/codepot/controllers/issue.php b/codepot/src/codepot/controllers/issue.php index e1077b14..1788901d 100644 --- a/codepot/src/codepot/controllers/issue.php +++ b/codepot/src/codepot/controllers/issue.php @@ -5,8 +5,6 @@ class Issue extends Controller var $VIEW_ERROR = 'error'; var $VIEW_HOME = 'issue_home'; var $VIEW_SHOW = 'issue_show'; - var $VIEW_EDIT = 'issue_edit'; - var $VIEW_DELETE = 'issue_delete'; function Issue () { @@ -257,270 +255,6 @@ class Issue extends Controller } } -/* -DEPRECATED - function _edit_issue ($projectid, $hexid, $mode) - { - $this->load->helper ('form'); - $this->load->library ('form_validation'); - $this->load->model ('ProjectModel', 'projects'); - $this->load->model ('IssueModel', 'issues'); - - $login = $this->login->getUser (); - if ($login['id'] == '') - redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); - $data['login'] = $login; - - $id = $this->converter->HexToAscii ($hexid); - - $project = $this->projects->get ($projectid); - if ($project === FALSE) - { - $data['message'] = 'DATABASE ERROR'; - $this->load->view ($this->VIEW_ERROR, $data); - } - else if ($project === NULL) - { - $data['message'] = - $this->lang->line('MSG_NO_SUCH_PROJECT') . - " - {$projectid}"; - $this->load->view ($this->VIEW_ERROR, $data); - } - else if (!$login['sysadmin?'] && $mode != 'create' && - $this->projects->projectHasMember($project->id, $login['id']) === FALSE) - { - $data['project'] = $project; - $data['message'] = sprintf ( - $this->lang->line('MSG_PROJECT_MEMBERSHIP_REQUIRED'), $projectid); - $this->load->view ($this->VIEW_ERROR, $data); - } - else - { - $this->form_validation->set_rules ( - 'issue_projectid', 'project ID', 'required|alpha_dash|max_length[32]'); - $this->form_validation->set_rules ( - 'issue_summary', 'summary', 'required|max_length[255]'); - $this->form_validation->set_rules ( - 'issue_description', 'description', 'required'); - $this->form_validation->set_rules ( - 'issue_type', 'type', 'required'); - $this->form_validation->set_rules ( - 'issue_type', 'status', 'required'); - $this->form_validation->set_rules ( - 'issue_type', 'priority', 'required'); - $this->form_validation->set_error_delimiters ( - '',''); - - $data['mode'] = $mode; - $data['message'] = ''; - $data['project'] = $project; - $data['issue_type_array'] = $this->issuehelper->_get_type_array($this->lang); - $data['issue_status_array'] = $this->issuehelper->_get_status_array($this->lang); - $data['issue_priority_array'] = $this->issuehelper->_get_priority_array($this->lang); - - if ($this->input->post('issue')) - { - $issue = new stdClass(); - $issue->projectid = $this->input->post('issue_projectid'); - $issue->id = $this->input->post('issue_id'); - $issue->summary = $this->input->post('issue_summary'); - $issue->description = $this->input->post('issue_description'); - $issue->type = $this->input->post('issue_type'); - $issue->status = $this->input->post('issue_status'); - $issue->priority = $this->input->post('issue_priority'); - $issue->owner = $this->input->post('issue_owner'); - - if ($this->form_validation->run()) - { - $id = ($mode == 'update')? - $this->issues->update_partial ($login['id'], $issue): - $this->issues->create ($login['id'], $issue); - if ($id === FALSE) - { - $data['message'] = 'DATABASE ERROR'; - $data['issue'] = $issue; - $this->load->view ($this->VIEW_EDIT, $data); - } - else - { - redirect ("issue/show/{$project->id}/" . - $this->converter->AsciiToHex((string)$id)); - } - } - else - { - $data['message'] = $this->lang->line('MSG_FORM_INPUT_INCOMPLETE'); - $data['issue'] = $issue; - $this->load->view ($this->VIEW_EDIT, $data); - } - } - else - { - if ($mode == 'update') - { - $issue = $this->issues->get ($login['id'], $project, $id); - if ($issue === FALSE) - { - $data['message'] = 'DATABASE ERROR'; - $this->load->view ($this->VIEW_ERROR, $data); - } - else if ($issue == NULL) - { - $data['message'] = sprintf ( - $this->lang->line('ISSUE_MSG_NO_SUCH_ISSUE'), $id); - $this->load->view ($this->VIEW_ERROR, $data); - } - else - { - $data['issue'] = $issue; - $this->load->view ($this->VIEW_EDIT, $data); - } - } - else - { - $issue = new stdClass(); - $issue->projectid = $projectid; - $issue->id = $id; - $issue->summary = ''; - $issue->description = ''; - $issue->type = $this->issuehelper->TYPE_DEFECT; - $issue->status = $this->issuehelper->STATUS_NEW; - $issue->priority = $this->issuehelper->PRIORITY_OTHER; - if ($this->projects->projectHasMember($project->id, $login['id'])) - { - // let the current user be the issue owner if he/she is a - // project memeber. - $issue->owner = $login['id']; - } - else - { - // if not, assign the issue to the first member. - $issue->owner = (count($project->members) > 0)? $project->members[0]: ''; - } - - $data['issue'] = $issue; - $this->load->view ($this->VIEW_EDIT, $data); - } - } - - } - } - - function create ($projectid = '') - { - return $this->_edit_issue ($projectid, '', 'create'); - } - - function update ($projectid = '', $hexid = '') - { - return $this->_edit_issue ($projectid, $hexid, 'update'); - } - - - function delete ($projectid = '', $hexid = '') - { - $this->load->helper ('form'); - $this->load->library ('form_validation'); - $this->load->model ('ProjectModel', 'projects'); - $this->load->model ('IssueModel', 'issues'); - - $login = $this->login->getUser (); - if ($login['id'] == '') - redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); - $data['login'] = $login; - - $id = $this->converter->HexToAscii ($hexid); - - $project = $this->projects->get ($projectid); - if ($project === FALSE) - { - $data['message'] = 'DATABASE ERROR'; - $this->load->view ($this->VIEW_ERROR, $data); - } - else if ($project === NULL) - { - $data['message'] = - $this->lang->line('MSG_NO_SUCH_PROJECT') . - " - {$projectid}"; - $this->load->view ($this->VIEW_ERROR, $data); - } - else if (!$login['sysadmin?'] && - $this->projects->projectHasMember($project->id, $login['id']) === FALSE) - { - $data['project'] = $project; - $data['message'] = sprintf ( - $this->lang->line('MSG_PROJECT_MEMBERSHIP_REQUIRED'), $projectid); - $this->load->view ($this->VIEW_ERROR, $data); - } - else - { - $data['message'] = ''; - $data['project'] = $project; - - $this->form_validation->set_rules ('issue_confirm', 'confirm', 'alpha'); - $this->form_validation->set_error_delimiters('',''); - - if($this->input->post('issue')) - { - $issue = new stdClass(); - $issue->projectid = $this->input->post('issue_projectid'); - $issue->id = $this->input->post('issue_id'); - $data['issue_confirm'] = $this->input->post('issue_confirm'); - - if ($this->form_validation->run()) - { - if ($data['issue_confirm'] == 'yes') - { - $result = $this->issues->delete ($login['id'], $issue); - if ($result === FALSE) - { - $data['message'] = 'DATABASE ERROR'; - $data['issue'] = $issue; - $this->load->view ($this->VIEW_DELETE, $data); - } - else - { - redirect ("issue/home/{$project->id}"); - } - } - else - { - redirect ("issue/show/{$project->id}/{$hexid}"); - } - } - else - { - $data['message'] = $this->lang->line('MSG_FORM_INPUT_INCOMPLETE'); - $data['issue'] = $issue; - $this->load->view ($this->VIEW_DELETE, $data); - } - } - else - { - $issue = $this->issues->get ($login['id'], $project, $id); - if ($issue === FALSE) - { - $data['message'] = 'DATABASE ERROR'; - $this->load->view ($this->VIEW_ERROR, $data); - } - else if ($issue === NULL) - { - $data['message'] = sprintf ( - $this->lang->line('ISSUE_MSG_NO_SUCH_ISSUE'), $id); - $this->load->view ($this->VIEW_ERROR, $data); - } - else - { - $data['issue_confirm'] = 'no'; - $data['issue'] = $issue; - $this->load->view ($this->VIEW_DELETE, $data); - } - } - - } - } -*/ - function xhr_create ($projectid = '') { $this->load->model ('ProjectModel', 'projects'); diff --git a/codepot/src/codepot/controllers/wiki.php b/codepot/src/codepot/controllers/wiki.php index 617304f2..17095ece 100644 --- a/codepot/src/codepot/controllers/wiki.php +++ b/codepot/src/codepot/controllers/wiki.php @@ -6,6 +6,7 @@ class Wiki extends Controller var $VIEW_HOME = 'wiki_home'; var $VIEW_SHOW = 'wiki_show'; var $VIEW_EDIT = 'wiki_edit'; + var $VIEW_EDITX = 'wiki_editx'; var $VIEW_DELETE = 'wiki_delete'; function Wiki () @@ -70,7 +71,7 @@ class Wiki extends Controller } } - function _show_wiki ($projectid, $name, $create) + private function _show_wiki ($projectid, $name, $create) { $this->load->model ('ProjectModel', 'projects'); $this->load->model ('WikiModel', 'wikis'); @@ -175,7 +176,7 @@ class Wiki extends Controller $this->_show_wiki ($projectid, $name, FALSE); } - function _edit_wiki ($projectid, $name, $mode) + private function _edit_wiki ($projectid, $name, $mode, $view_edit) { $this->load->helper ('form'); $this->load->library ('form_validation'); @@ -284,7 +285,7 @@ class Wiki extends Controller { $data['wiki'] = $wiki; $data['message'] = 'DATABASE ERROR'; - $this->load->view ($this->VIEW_EDIT, $data); + $this->load->view ($view_edit, $data); return; } $wiki->attachments = $atts; @@ -295,7 +296,7 @@ class Wiki extends Controller { $data['message'] = $this->lang->line('WIKI_MSG_NAME_DISALLOWED_CHARS'); $data['wiki'] = $wiki; - $this->load->view ($this->VIEW_EDIT, $data); + $this->load->view ($view_edit, $data); return; } @@ -307,7 +308,7 @@ class Wiki extends Controller $wiki->name ); $data['wiki'] = $wiki; - $this->load->view ($this->VIEW_EDIT, $data); + $this->load->view ($view_edit, $data); } else { @@ -317,7 +318,7 @@ class Wiki extends Controller { $data['wiki'] = $wiki; $data['message'] = $extra; - $this->load->view ($this->VIEW_EDIT, $data); + $this->load->view ($view_edit, $data); return; } @@ -333,7 +334,7 @@ class Wiki extends Controller $data['message'] = 'DATABASE ERROR'; $data['wiki'] = $wiki; - $this->load->view ($this->VIEW_EDIT, $data); + $this->load->view ($view_edit, $data); } else { @@ -366,7 +367,7 @@ class Wiki extends Controller { $data['wiki'] = $wiki; $data['message'] = 'DATABASE ERROR'; - $this->load->view ($this->VIEW_EDIT, $data); + $this->load->view ($view_edit, $data); return; } $wiki->attachments = $atts; @@ -374,7 +375,7 @@ class Wiki extends Controller $data['message'] = $this->lang->line('MSG_FORM_INPUT_INCOMPLETE'); $data['wiki'] = $wiki; - $this->load->view ($this->VIEW_EDIT, $data); + $this->load->view ($view_edit, $data); } } else @@ -397,7 +398,7 @@ class Wiki extends Controller else { $data['wiki'] = $wiki; - $this->load->view ($this->VIEW_EDIT, $data); + $this->load->view ($view_edit, $data); } } else @@ -409,7 +410,7 @@ class Wiki extends Controller $wiki->columns = '1'; $data['wiki'] = $wiki; - $this->load->view ($this->VIEW_EDIT, $data); + $this->load->view ($view_edit, $data); } } @@ -418,12 +419,22 @@ class Wiki extends Controller function create ($projectid = '', $name = '') { - return $this->_edit_wiki ($projectid, $name, 'create'); + return $this->_edit_wiki ($projectid, $name, 'create', $this->VIEW_EDIT); } function update ($projectid = '', $name = '') { - return $this->_edit_wiki ($projectid, $name, 'update'); + return $this->_edit_wiki ($projectid, $name, 'update', $this->VIEW_EDIT); + } + + function createx ($projectid = '', $name = '') + { + return $this->_edit_wiki ($projectid, $name, 'create', $this->VIEW_EDITX); + } + + function updatex ($projectid = '', $name = '') + { + return $this->_edit_wiki ($projectid, $name, 'update', $this->VIEW_EDITX); } function delete ($projectid = '', $name = '') diff --git a/codepot/src/codepot/views/Makefile.am b/codepot/src/codepot/views/Makefile.am index d95b0592..108e398f 100644 --- a/codepot/src/codepot/views/Makefile.am +++ b/codepot/src/codepot/views/Makefile.am @@ -15,8 +15,6 @@ www_DATA = \ footer.php \ graph_main.php \ index.html \ - issue_delete.php \ - issue_edit.php \ issue_home.php \ issue_show.php \ log.php \ @@ -36,6 +34,7 @@ www_DATA = \ user_settings.php \ wiki_delete.php \ wiki_edit.php \ + wiki_editx.php \ wiki_home.php \ wiki_show.php diff --git a/codepot/src/codepot/views/Makefile.in b/codepot/src/codepot/views/Makefile.in index 52b47303..9f2c1f46 100644 --- a/codepot/src/codepot/views/Makefile.in +++ b/codepot/src/codepot/views/Makefile.in @@ -160,8 +160,6 @@ www_DATA = \ footer.php \ graph_main.php \ index.html \ - issue_delete.php \ - issue_edit.php \ issue_home.php \ issue_show.php \ log.php \ @@ -181,6 +179,7 @@ www_DATA = \ user_settings.php \ wiki_delete.php \ wiki_edit.php \ + wiki_editx.php \ wiki_home.php \ wiki_show.php diff --git a/codepot/src/codepot/views/code_edit.php b/codepot/src/codepot/views/code_edit.php index 9870b2f1..ed59487d 100644 --- a/codepot/src/codepot/views/code_edit.php +++ b/codepot/src/codepot/views/code_edit.php @@ -40,7 +40,7 @@ var base_return_anchor = codepot_merge_path('', 'lang->line('Save')?>', autoOpen: false, modal: true, @@ -159,7 +159,7 @@ $(function () { 'lang->line('OK')?>': function () { if (saving_in_progress) return; - var save_message = $("#code_edit_mainarea_save_message").val(); + var save_message = $("#code_edit_save_message").val(); if (save_message == '') return false; editor.setReadOnly (true); @@ -173,8 +173,8 @@ $(function () { success: function(json, textStatus, jqXHR) { saving_in_progress = false; - $('#code_edit_mainarea_save_form').dialog('enable'); - $('#code_edit_mainarea_save_form').dialog('close'); + $('#code_edit_save_form').dialog('enable'); + $('#code_edit_save_form').dialog('close'); if (json.status == "ok") { set_editor_changed (false); @@ -194,15 +194,15 @@ $(function () { error: function(jqXHR, textStatus, errorThrown) { saving_in_progress = false; - $('#code_edit_mainarea_save_form').dialog('enable'); - $('#code_edit_mainarea_save_form').dialog('close'); + $('#code_edit_save_form').dialog('enable'); + $('#code_edit_save_form').dialog('close'); show_alert ('Not saved - ' + errorThrown, "lang->line('Error')?>"); editor.setReadOnly (false); save_button.button ("enable"); } }); - $('#code_edit_mainarea_save_form').dialog('disable'); + $('#code_edit_save_form').dialog('disable'); }, 'lang->line('Cancel')?>': function () { @@ -219,7 +219,7 @@ $(function () { save_button.click (function() { - if (editor_changed) $("#code_edit_mainarea_save_form").dialog('open'); + if (editor_changed) $("#code_edit_save_form").dialog('open'); return false; }); @@ -300,17 +300,17 @@ $this->load->view (
'; + print ''; print ' '; - print anchor ("code/${caller}/{$project->id}/{$hex_headpath}", $this->lang->line('Save'), 'id="code_edit_mainarea_save_button"'); + print anchor ("code/${caller}/{$project->id}/{$hex_headpath}", $this->lang->line('Save'), 'id="code_edit_save_button"'); print ' '; - print anchor ("code/${caller}/{$project->id}/{$hex_headpath}{$revreq}", $this->lang->line('Return'), 'id="code_edit_mainarea_return_button"'); + print anchor ("code/${caller}/{$project->id}/{$hex_headpath}{$revreq}", $this->lang->line('Return'), 'id="code_edit_return_button"'); ?>
-
+
-
0) @@ -352,18 +352,18 @@ else if ($fileext == 'bas') $fileext = 'basic'; if (!$is_image_stream)*/ print htmlspecialchars($file['content']); ?>
-
+
-
+
lang->line('Message'); ?>
- +
-
+
diff --git a/codepot/src/codepot/views/issue_delete.php b/codepot/src/codepot/views/issue_delete.php deleted file mode 100644 index 3d522a77..00000000 --- a/codepot/src/codepot/views/issue_delete.php +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - -<?php print htmlspecialchars($issue->id)?> - - - - -
- - - -load->view ('taskbar'); ?> - - - -load->view ( - 'projectbar', - array ( - 'banner' => NULL, - - 'page' => array ( - 'type' => 'project', - 'id' => 'issue', - 'project' => $project, - ), - - 'ctxmenuitems' => array () - ) -); -?> - - - -
- -'.htmlspecialchars($message).'
'; ?> - -
-id}/".$this->converter->AsciiToHex($issue->id))?> - -
-
- - lang->line('MSG_SURE_TO_DELETE_THIS')?> - id)?> - -
-
- -
- projectid))?> - id))?> -
- -
- lang->line('Delete'))?> -
- - -
- -
- - - -
- - - -load->view ('footer'); ?> - - - - - - - diff --git a/codepot/src/codepot/views/issue_edit.php b/codepot/src/codepot/views/issue_edit.php deleted file mode 100644 index 442a8f08..00000000 --- a/codepot/src/codepot/views/issue_edit.php +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - -<?php print htmlspecialchars($issue->id)?> - - - - -
- - - -load->view ('taskbar'); ?> - - - -load->view ( - 'projectbar', - array ( - 'banner' => NULL, - - 'page' => array ( - 'type' => 'project', - 'id' => 'issue', - 'project' => $project, - ), - - 'ctxmenuitems' => array () - ) -); -?> - - - -
- -'; - print htmlspecialchars($message); - print '
'; - } -?> - -
-id}/".$this->converter->AsciiToHex($issue->id))?> -
- id))?> - projectid))?> - status))?> - priority))?> - owner))?> -
- -
- type)); - } - else - { - print form_label($this->lang->line('Type').': ', 'issue_type'); - print form_dropdown ( - 'issue_type', - $issue_type_array, - set_value('issue_type', $issue->type), - 'id="issue_edit_mainarea_type"'); - print form_error('issue_type'); - } - ?> -
- -
- lang->line('Summary').': ', 'issue_summary')?> - -
-
- summary), - 'size="80" id="issue_edit_mainarea_summary"') - ?> -
- -
- lang->line('Description').': ', 'issue_description')?> - lang->line('Preview')?> - -
-
- 'issue_description', - 'value' => set_value ('issue_description', $issue->description), - 'id' => 'issue_edit_mainarea_description', - 'rows' => 20, - 'cols' => 80 - ); - print form_textarea ($xdata); - ?> -
-
- - - lang->line('Update'): $this->lang->line('Create'); ?> - - - -
- -
- - - - - - - -load->view ('footer'); ?> - - - - - - - diff --git a/codepot/src/codepot/views/issue_home.php b/codepot/src/codepot/views/issue_home.php index 49b28d0d..c480a046 100644 --- a/codepot/src/codepot/views/issue_home.php +++ b/codepot/src/codepot/views/issue_home.php @@ -35,7 +35,7 @@ $creole_file_base = site_url() . "/wiki/attachment0/{$project->id}/"; /* ", "" ); @@ -85,15 +85,15 @@ function populate_selected_files () var f = populated_file_obj[n]; if (f != null) { - var d = $('#issue_home_mainarea_new_file_desc_' + n); + var d = $('#issue_home_new_file_desc_' + n); if (d != null) issue_file_desc[f.name] = d.val(); } } - $('#issue_home_mainarea_new_file_table').empty(); + $('#issue_home_new_file_table').empty(); populated_file_obj = []; - var f = $('#issue_home_mainarea_new_files').get(0); + var f = $('#issue_home_new_files').get(0); var f_no = 0; for (var n = 0; n < f.files.length; n++) { @@ -102,9 +102,9 @@ function populate_selected_files () var desc = issue_file_desc[f.files[n].name]; if (desc == null) desc = ''; - $('#issue_home_mainarea_new_file_table').append ( + $('#issue_home_new_file_table').append ( codepot_sprintf ( - '%s', + '%s', f_no, f_no, f_no, codepot_htmlspecialchars(f.files[n].name), f_no, codepot_addslashes(desc) ) ); @@ -119,22 +119,22 @@ function populate_selected_files () function cancel_out_new_file (no) { - $('#issue_home_mainarea_new_file_row_' + no).remove (); + $('#issue_home_new_file_row_' + no).remove (); populated_file_obj[no] = null; } $(function () { - $('#issue_home_mainarea_new_files').change (function () { + $('#issue_home_new_files').change (function () { populate_selected_files (); }); - $('#issue_home_mainarea_new_description_tabs').tabs (); - $('#issue_home_mainarea_new_description_tabs').bind ('tabsshow', function (event, ui) { - if (ui.index == 1) preview_new_description ($('#issue_home_mainarea_new_description').val()); + $('#issue_home_new_description_tabs').tabs (); + $('#issue_home_new_description_tabs').bind ('tabsshow', function (event, ui) { + if (ui.index == 1) preview_new_description ($('#issue_home_new_description').val()); }); - $('#issue_home_mainarea_new_form').dialog ( + $('#issue_home_new_form').dialog ( { title: 'lang->line('New');?>', resizable: true, @@ -163,7 +163,7 @@ $(function () { { form_data.append ('issue_new_file_' + f_no, f); - var d = $('#issue_home_mainarea_new_file_desc_' + i); + var d = $('#issue_home_new_file_desc_' + i); if (d != null) form_data.append('issue_new_file_desc_' + f_no, d.val()); f_no++; @@ -171,11 +171,11 @@ $(function () { } form_data.append ('issue_new_file_count', f_no); - form_data.append ('issue_new_type', $('#issue_home_mainarea_new_type').val()); - form_data.append ('issue_new_summary', $('#issue_home_mainarea_new_summary').val()); - form_data.append ('issue_new_description', $('#issue_home_mainarea_new_description').val()); + form_data.append ('issue_new_type', $('#issue_home_new_type').val()); + form_data.append ('issue_new_summary', $('#issue_home_new_summary').val()); + form_data.append ('issue_new_description', $('#issue_home_new_description').val()); - $('#issue_home_mainarea_new_form').dialog('disable'); + $('#issue_home_new_form').dialog('disable'); $.ajax({ url: codepot_merge_path('', 'id}"; ?>'), type: 'POST', @@ -187,8 +187,8 @@ $(function () { success: function (data, textStatus, jqXHR) { work_in_progress = false; - $('#issue_home_mainarea_new_form').dialog('enable'); - $('#issue_home_mainarea_new_form').dialog('close'); + $('#issue_home_new_form').dialog('enable'); + $('#issue_home_new_form').dialog('close'); if (data == 'ok') { // refresh the page to the head revision @@ -202,8 +202,8 @@ $(function () { error: function (jqXHR, textStatus, errorThrown) { work_in_progress = false; - $('#issue_home_mainarea_new_form').dialog('enable'); - $('#issue_home_mainarea_new_form').dialog('close'); + $('#issue_home_new_form').dialog('enable'); + $('#issue_home_new_form').dialog('close'); var errmsg = ''; if (errmsg == '' && errorThrown != null) errmsg = errorThrown; if (errmsg == '' && textStatus != null) errmsg = textStatus; @@ -219,7 +219,7 @@ $(function () { }, 'lang->line('Cancel')?>': function () { if (work_in_progress) return; - $('#issue_home_mainarea_new_form').dialog('close'); + $('#issue_home_new_form').dialog('close'); } }, @@ -231,7 +231,7 @@ $(function () { ); - $("#issue_home_mainarea_search_form").dialog ({ + $("#issue_home_search_form").dialog ({ title: 'lang->line('Search')?>', autoOpen: false, modal: true, @@ -254,17 +254,17 @@ $(function () { - $("#issue_home_mainarea_new_button").button().click ( + $("#issue_home_new_button").button().click ( function () { - $('#issue_home_mainarea_new_form').dialog('open'); + $('#issue_home_new_form').dialog('open'); return false; // prevent the default behavior } ); - $("#issue_home_mainarea_search_button").button().click ( + $("#issue_home_search_button").button().click ( function () { - $('#issue_home_mainarea_search_form').dialog('open'); + $('#issue_home_search_form').dialog('open'); return false; // prevent the default behavior } ); @@ -315,14 +315,14 @@ $this->load->view (
lang->line('ISSUE_MSG_TOTAL_NUM_ISSUES'), $total_num_issues); ?> - lang->line('New')?> + lang->line('New')?> - lang->line('Search')?> + lang->line('Search')?>
-
+
'; + print ''; print ''; print ''; print ''; @@ -381,50 +381,50 @@ else print '
' . $this->lang->line('ID') . '' . $this->lang->line('Type') . '
'; - print '
'; + print '
'; print $page_links; print '
'; } ?> -
+
-
+
- '/> + '/>
-
+
-
- +
+
lang->line('Attachments'); ?> - -
+ +
-
+
-
+
lang->line('All'); $issue_status_array[''] = $this->lang->line('All'); @@ -478,7 +478,7 @@ else
-
+
diff --git a/codepot/src/codepot/views/issue_show.php b/codepot/src/codepot/views/issue_show.php index 16c113ed..adbc91c9 100644 --- a/codepot/src/codepot/views/issue_show.php +++ b/codepot/src/codepot/views/issue_show.php @@ -33,7 +33,7 @@ $creole_file_base = site_url() . "/issue/file/{$project->id}/{$issue->id}/"; function show_alert (outputMsg, titleMsg) { - $('#issue_show_mainarea_alert').html(outputMsg).dialog({ + $('#issue_show_alert').html(outputMsg).dialog({ title: titleMsg, resizable: true, modal: true, @@ -113,15 +113,15 @@ function populate_selected_files_for_adding () var f = populated_file_obj_for_adding[n]; if (f != null) { - var d = $('#issue_show_mainarea_add_file_desc_' + n); + var d = $('#issue_show_add_file_desc_' + n); if (d != null) file_desc[f.name] = d.val(); } } - $('#issue_show_mainarea_add_file_table').empty(); + $('#issue_show_add_file_table').empty(); populated_file_obj_for_adding = []; - var f = $('#issue_show_mainarea_add_files').get(0); + var f = $('#issue_show_add_files').get(0); var f_no = 0; for (var n = 0; n < f.files.length; n++) { @@ -130,9 +130,9 @@ function populate_selected_files_for_adding () var desc = file_desc[f.files[n].name]; if (desc == null) desc = ''; - $('#issue_show_mainarea_add_file_table').append ( + $('#issue_show_add_file_table').append ( codepot_sprintf ( - '%s', + '%s', f_no, f_no, f_no, codepot_htmlspecialchars(f.files[n].name), f_no, codepot_addslashes(desc) ) ); @@ -147,14 +147,14 @@ function populate_selected_files_for_adding () function cancel_out_add_file (no) { - $('#issue_show_mainarea_add_file_row_' + no).remove (); + $('#issue_show_add_file_row_' + no).remove (); populated_file_obj_for_adding[no] = null; } function kill_edit_file (no) { - var n = $('#issue_show_mainarea_edit_file_name_' + no); - var d = $('#issue_show_mainarea_edit_file_desc_' + no); + var n = $('#issue_show_edit_file_name_' + no); + var d = $('#issue_show_edit_file_desc_' + no); if (n && d) { if (d.prop('disabled')) @@ -175,7 +175,7 @@ function preview_edit_description (input_text) { creole_render_wiki_with_input_text ( input_text, - "issue_show_mainarea_edit_description_preview", + "issue_show_edit_description_preview", "", "/" ); @@ -209,18 +209,18 @@ var original_file_desc = [ $(function () { - $('#issue_show_mainarea_state').accordion({ + $('#issue_show_state').accordion({ collapsible: true, heightStyle: "content" }); - $('#issue_show_mainarea_edit_description_tabs').tabs (); - $('#issue_show_mainarea_edit_description_tabs').bind ('tabsshow', function (event, ui) { - if (ui.index == 1) preview_edit_description ($('#issue_show_mainarea_edit_description').val()); + $('#issue_show_edit_description_tabs').tabs (); + $('#issue_show_edit_description_tabs').bind ('tabsshow', function (event, ui) { + if (ui.index == 1) preview_edit_description ($('#issue_show_edit_description').val()); }); - $('#issue_show_mainarea_edit_form').dialog ( + $('#issue_show_edit_form').dialog ( { title: 'lang->line('Edit');?>', resizable: true, @@ -240,10 +240,10 @@ $(function () { var form_data = new FormData(); - form_data.append ('issue_edit_summary', $('#issue_show_mainarea_edit_summary').val()); - form_data.append ('issue_edit_description', $('#issue_show_mainarea_edit_description').val()); + form_data.append ('issue_edit_summary', $('#issue_show_edit_summary').val()); + form_data.append ('issue_edit_description', $('#issue_show_edit_description').val()); - $('#issue_show_mainarea_edit_form').dialog('disable'); + $('#issue_show_edit_form').dialog('disable'); $.ajax({ url: codepot_merge_path('', 'id}/{$hex_issue_id}"; ?>'), type: 'POST', @@ -255,8 +255,8 @@ $(function () { success: function (data, textStatus, jqXHR) { work_in_progress = false; - $('#issue_show_mainarea_edit_form').dialog('enable'); - $('#issue_show_mainarea_edit_form').dialog('close'); + $('#issue_show_edit_form').dialog('enable'); + $('#issue_show_edit_form').dialog('close'); if (data == 'ok') { // refresh the page to the head revision @@ -270,8 +270,8 @@ $(function () { error: function (jqXHR, textStatus, errorThrown) { work_in_progress = false; - $('#issue_show_mainarea_edit_form').dialog('enable'); - $('#issue_show_mainarea_edit_form').dialog('close'); + $('#issue_show_edit_form').dialog('enable'); + $('#issue_show_edit_form').dialog('close'); var errmsg = ''; if (errmsg == '' && errorThrown != null) errmsg = errorThrown; if (errmsg == '' && textStatus != null) errmsg = textStatus; @@ -287,7 +287,7 @@ $(function () { }, 'lang->line('Cancel')?>': function () { if (work_in_progress) return; - $('#issue_show_mainarea_edit_form').dialog('close'); + $('#issue_show_edit_form').dialog('close'); } }, @@ -298,7 +298,7 @@ $(function () { } ); - $('#issue_show_mainarea_delete_form').dialog ( + $('#issue_show_delete_form').dialog ( { title: 'lang->line('Delete');?>', resizable: true, @@ -317,10 +317,10 @@ $(function () { var form_data = new FormData(); - var f = $('#issue_show_mainarea_delete_confirm'); + var f = $('#issue_show_delete_confirm'); if (f != null && f.is(':checked')) form_data.append ('issue_delete_confirm', 'Y'); - $('#issue_show_mainarea_delete_form').dialog('disable'); + $('#issue_show_delete_form').dialog('disable'); $.ajax({ url: codepot_merge_path('', 'id}/{$hex_issue_id}"; ?>'), type: 'POST', @@ -332,8 +332,8 @@ $(function () { success: function (data, textStatus, jqXHR) { work_in_progress = false; - $('#issue_show_mainarea_delete_form').dialog('enable'); - $('#issue_show_mainarea_delete_form').dialog('close'); + $('#issue_show_delete_form').dialog('enable'); + $('#issue_show_delete_form').dialog('close'); if (data == 'ok') { // refresh the page to the head revision @@ -347,8 +347,8 @@ $(function () { error: function (jqXHR, textStatus, errorThrown) { work_in_progress = false; - $('#issue_show_mainarea_delete_form').dialog('enable'); - $('#issue_show_mainarea_delete_form').dialog('close'); + $('#issue_show_delete_form').dialog('enable'); + $('#issue_show_delete_form').dialog('close'); show_alert ('Failed - ' + errorThrown, "lang->line('Error')?>"); } }); @@ -360,7 +360,7 @@ $(function () { }, 'lang->line('Cancel')?>': function () { if (work_in_progress) return; - $('#issue_show_mainarea_delete_form').dialog('close'); + $('#issue_show_delete_form').dialog('close'); } }, @@ -374,11 +374,11 @@ $(function () { - $('#issue_show_mainarea_add_files').change (function () { + $('#issue_show_add_files').change (function () { populate_selected_files_for_adding (); }); - $('#issue_show_mainarea_add_file_form').dialog ( + $('#issue_show_add_file_form').dialog ( { title: 'lang->line('Add');?>', resizable: true, @@ -405,14 +405,14 @@ $(function () { { form_data.append ('issue_add_file_' + f_no, f); - var d = $('#issue_show_mainarea_add_file_desc_' + i); + var d = $('#issue_show_add_file_desc_' + i); if (d != null) form_data.append('issue_add_file_desc_' + f_no, d.val()); f_no++; } } form_data.append ('issue_add_file_count', f_no); - $('#issue_show_mainarea_add_file_form').dialog('disable'); + $('#issue_show_add_file_form').dialog('disable'); $.ajax({ url: codepot_merge_path('', 'id}/{$hex_issue_id}"; ?>'), type: 'POST', @@ -424,8 +424,8 @@ $(function () { success: function (data, textStatus, jqXHR) { work_in_progress = false; - $('#issue_show_mainarea_add_file_form').dialog('enable'); - $('#issue_show_mainarea_add_file_form').dialog('close'); + $('#issue_show_add_file_form').dialog('enable'); + $('#issue_show_add_file_form').dialog('close'); if (data == 'ok') { // refresh the page to the head revision @@ -439,8 +439,8 @@ $(function () { error: function (jqXHR, textStatus, errorThrown) { work_in_progress = false; - $('#issue_show_mainarea_add_file_form').dialog('enable'); - $('#issue_show_mainarea_add_file_form').dialog('close'); + $('#issue_show_add_file_form').dialog('enable'); + $('#issue_show_add_file_form').dialog('close'); show_alert ('Failed - ' + errorThrown, "lang->line('Error')?>"); } }); @@ -452,7 +452,7 @@ $(function () { }, 'lang->line('Cancel')?>': function () { if (work_in_progress) return; - $('#issue_show_mainarea_add_file_form').dialog('close'); + $('#issue_show_add_file_form').dialog('close'); } }, @@ -464,7 +464,7 @@ $(function () { } ); - $('#issue_show_mainarea_edit_file_form').dialog ( + $('#issue_show_edit_file_form').dialog ( { title: 'lang->line('Edit');?>', resizable: true, @@ -486,8 +486,8 @@ $(function () { var f_no = 0; for (var i = 0; i <= ; i++) { - var n = $('#issue_show_mainarea_edit_file_name_' + i); - var d = $('#issue_show_mainarea_edit_file_desc_' + i); + var n = $('#issue_show_edit_file_name_' + i); + var d = $('#issue_show_edit_file_desc_' + i); if (n && d) { @@ -507,7 +507,7 @@ $(function () { } form_data.append ('issue_edit_file_count', f_no); - $('#issue_show_mainarea_edit_file_form').dialog('disable'); + $('#issue_show_edit_file_form').dialog('disable'); $.ajax({ url: codepot_merge_path('', 'id}/{$hex_issue_id}"; ?>'), type: 'POST', @@ -519,8 +519,8 @@ $(function () { success: function (data, textStatus, jqXHR) { work_in_progress = false; - $('#issue_show_mainarea_edit_file_form').dialog('enable'); - $('#issue_show_mainarea_edit_file_form').dialog('close'); + $('#issue_show_edit_file_form').dialog('enable'); + $('#issue_show_edit_file_form').dialog('close'); if (data == 'ok') { // refresh the page to the head revision @@ -534,8 +534,8 @@ $(function () { error: function (jqXHR, textStatus, errorThrown) { work_in_progress = false; - $('#issue_show_mainarea_edit_file_form').dialog('enable'); - $('#issue_show_mainarea_edit_file_form').dialog('close'); + $('#issue_show_edit_file_form').dialog('enable'); + $('#issue_show_edit_file_form').dialog('close'); show_alert ('Failed - ' + errorThrown, "lang->line('Error')?>"); } }); @@ -547,7 +547,7 @@ $(function () { }, 'lang->line('Cancel')?>': function () { if (work_in_progress) return; - $('#issue_show_mainarea_edit_file_form').dialog('close'); + $('#issue_show_edit_file_form').dialog('close'); } }, @@ -568,7 +568,7 @@ $(function () { */ /*$("#issue_change_owner").combobox();*/ - $("#issue_show_mainarea_change_form").dialog ( + $("#issue_show_change_form").dialog ( { title: 'lang->line('Change')?>', autoOpen: false, @@ -600,42 +600,42 @@ $(function () { ); - $('#issue_show_mainarea_edit_button').button().click ( + $('#issue_show_edit_button').button().click ( function () { - $('#issue_show_mainarea_edit_form').dialog('open'); + $('#issue_show_edit_form').dialog('open'); return false; // prevent the default behavior } ); - $('#issue_show_mainarea_delete_button').button().click ( + $('#issue_show_delete_button').button().click ( function () { - $('#issue_show_mainarea_delete_form').dialog('open'); + $('#issue_show_delete_form').dialog('open'); return false; // prevent the default behavior } ); - $('#issue_show_mainarea_add_file_button').button().click ( + $('#issue_show_add_file_button').button().click ( function() { - $('#issue_show_mainarea_add_file_form').dialog('open'); + $('#issue_show_add_file_form').dialog('open'); return false; } ); - $('#issue_show_mainarea_edit_file_button').button().click ( + $('#issue_show_edit_file_button').button().click ( function() { - $('#issue_show_mainarea_edit_file_form').dialog('open'); + $('#issue_show_edit_file_form').dialog('open'); return false; } ); - $('#issue_show_mainarea_change_form_open').button().click ( + $('#issue_show_change_form_open').button().click ( function () { - $('#issue_show_mainarea_change_form').dialog('open'); + $('#issue_show_change_form').dialog('open'); return false; } ); - $('#issue_show_mainarea_undo_change_confirm').dialog ( + $('#issue_show_undo_change_confirm').dialog ( { title: 'lang->line('Undo')?>', resizable: false, @@ -655,9 +655,9 @@ $(function () { } ); - $('#issue_show_mainarea_undo_change').button().click ( + $('#issue_show_undo_change').button().click ( function () { - $('#issue_show_mainarea_undo_change_confirm').dialog('open'); + $('#issue_show_undo_change_confirm').dialog('open'); return false; } ); @@ -723,10 +723,10 @@ $this->load->view ( '; + print ''; print $this->lang->line('Edit'); print ''; - print ''; + print ''; print $this->lang->line('Delete'); print ''; } @@ -735,9 +735,9 @@ $this->load->view (
-
-
lang->line('State')?>
-
+
+
lang->line('State')?>
+
    load->view (
-
-
-
+
lang->line('Attachments'); ?> - lang->line('Add')?> - lang->line('Edit')?> + lang->line('Add')?> + lang->line('Edit')?> files)): ?> lang->line('Attachments'); ?> @@ -821,7 +821,7 @@ $this->load->view (
-
+'; - print ''; + print '
'; while ($count > 1) { $new = $issue->changes[--$count]; @@ -865,8 +865,8 @@ $this->load->view ( print '",e=0;c>=e;e++)f+="";f+=""}return f},_bindTabBehavior:function(){var a=this;[].forEach.call(this._editor.elements,function(b){b.addEventListener("keydown",function(b){a._onKeyDown(b)})})},_onKeyDown:function(a){var f,g=b(this._doc);a.which===i&&d(g,"table")&&(a.preventDefault(),a.stopPropagation(),f=this._getTableElements(g),a.shiftKey?this._tabBackwards(g.previousSibling,f.row):(this._isLastCell(g,f.row,f.root)&&this._insertRow(e(g,"tbody"),f.row.cells.length),c(this._doc,g)))},_getTableElements:function(a){return{cell:e(a,"td"),row:e(a,"tr"),root:e(a,"table")}},_tabBackwards:function(a,b){a=a||this._getPreviousRowLastCell(b),c(this._doc,a,!0)},_insertRow:function(a,b){var c,d=document.createElement("tr"),e="";for(c=0;b>c;c+=1)e+="";d.innerHTML=e,a.appendChild(d)},_isLastCell:function(a,b,c){return b.cells.length-1===a.cellIndex&&c.rows.length-1===b.rowIndex},_getPreviousRowLastCell:function(a){return a=a.previousSibling,a?a.cells[a.cells.length-1]:void 0}};var j=MediumEditor.extensions.form.extend({name:"table",aria:"create table",action:"table",contentDefault:"TBL",contentFA:'',handleClick:function(a){a.preventDefault(),a.stopPropagation(),this[this.isActive()===!0?"hide":"show"]()},hide:function(){this.setInactive(),this.builder.hide()},show:function(){this.setActive();var a=MediumEditor.selection.getSelectionRange(this.document);"td"===a.startContainer.nodeName.toLowerCase()||"td"===a.endContainer.nodeName.toLowerCase()||MediumEditor.util.getClosestTag(MediumEditor.selection.getSelectedParentElement(a),"td")?this.builder.setEditor(MediumEditor.selection.getSelectedParentElement(a)):this.builder.setBuilder(),this.builder.show(this.button.offsetLeft)},getForm:function(){return this.builder=new g({onClick:function(a,b){a>0&&b>0&&this.table.insert(a,b),this.hide()}.bind(this),ownerDocument:this.document,rows:this.rows||10,columns:this.columns||10}),this.table=new h(this.base),this.builder.getElement()}});return j}()); \ No newline at end of file diff --git a/codepot/src/js/medium-editor.min.js b/codepot/src/js/medium-editor.min.js new file mode 100644 index 00000000..cffc2f2c --- /dev/null +++ b/codepot/src/js/medium-editor.min.js @@ -0,0 +1,3 @@ +"classList"in document.createElement("_")||!function(a){"use strict";if("Element"in a){var b="classList",c="prototype",d=a.Element[c],e=Object,f=String[c].trim||function(){return this.replace(/^\s+|\s+$/g,"")},g=Array[c].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1},h=function(a,b){this.name=a,this.code=DOMException[a],this.message=b},i=function(a,b){if(""===b)throw new h("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(b))throw new h("INVALID_CHARACTER_ERR","String contains an invalid character");return g.call(a,b)},j=function(a){for(var b=f.call(a.getAttribute("class")||""),c=b?b.split(/\s+/):[],d=0,e=c.length;e>d;d++)this.push(c[d]);this._updateClassName=function(){a.setAttribute("class",this.toString())}},k=j[c]=[],l=function(){return new j(this)};if(h[c]=Error[c],k.item=function(a){return this[a]||null},k.contains=function(a){return a+="",-1!==i(this,a)},k.add=function(){var a,b=arguments,c=0,d=b.length,e=!1;do a=b[c]+"",-1===i(this,a)&&(this.push(a),e=!0);while(++ci;i++)e+=String.fromCharCode(f[i]);c.push(e)}else if("Blob"===b(a)||"File"===b(a)){if(!g)throw new h("NOT_READABLE_ERR");var k=new g;c.push(k.readAsBinaryString(a))}else a instanceof d?"base64"===a.encoding&&p?c.push(p(a.data)):"URI"===a.encoding?c.push(decodeURIComponent(a.data)):"raw"===a.encoding&&c.push(a.data):("string"!=typeof a&&(a+=""),c.push(unescape(encodeURIComponent(a))))},e.getBlob=function(a){return arguments.length||(a=null),new d(this.data.join(""),a,"raw")},e.toString=function(){return"[object BlobBuilder]"},f.slice=function(a,b,c){var e=arguments.length;return 3>e&&(c=null),new d(this.data.slice(a,e>1?b:this.data.length),c,this.encoding)},f.toString=function(){return"[object Blob]"},f.close=function(){this.size=0,delete this.data},c}(a);a.Blob=function(a,b){var d=b?b.type||"":"",e=new c;if(a)for(var f=0,g=a.length;g>f;f++)Uint8Array&&a[f]instanceof Uint8Array?e.append(a[f].buffer):e.append(a[f]);var h=e.getBlob(d);return!h.slice&&h.webkitSlice&&(h.slice=h.webkitSlice),h};var d=Object.getPrototypeOf||function(a){return a.__proto__};a.Blob.prototype=d(new a.Blob)}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content||this),function(a,b){"use strict";"object"==typeof module?module.exports=b:"function"==typeof define&&define.amd?define(function(){return b}):a.MediumEditor=b}(this,function(){"use strict";function a(a,b){return this.init(a,b)}return a.extensions={},function(b){function c(a,b){var c,d=Array.prototype.slice.call(arguments,2);b=b||{};for(var e=0;e-1,isMac:b.navigator.platform.toUpperCase().indexOf("MAC")>=0,keyCode:{BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,SPACE:32,DELETE:46,K:75,M:77},isMetaCtrlKey:function(a){return h.isMac&&a.metaKey||!h.isMac&&a.ctrlKey?!0:!1},isKey:function(a,b){var c=h.getKeyCode(a);return!1===Array.isArray(b)?c===b:-1===b.indexOf(c)?!1:!0},getKeyCode:function(a){var b=a.which;return null===b&&(b=null!==a.charCode?a.charCode:a.keyCode),b},blockContainerElementNames:["p","h1","h2","h3","h4","h5","h6","blockquote","pre","ul","li","ol","address","article","aside","audio","canvas","dd","dl","dt","fieldset","figcaption","figure","footer","form","header","hgroup","main","nav","noscript","output","section","video","table","thead","tbody","tfoot","tr","th","td"],emptyElementNames:["br","col","colgroup","hr","img","input","source","wbr"],extend:function(){var a=[!0].concat(Array.prototype.slice.call(arguments));return c.apply(this,a)},defaults:function(){var a=[!1].concat(Array.prototype.slice.call(arguments));return c.apply(this,a)},createLink:function(a,b,c,d){var e=a.createElement("a");return h.moveTextRangeIntoElement(b[0],b[b.length-1],e),e.setAttribute("href",c),d&&e.setAttribute("target",d),e},findOrCreateMatchingTextNodes:function(a,b,c){for(var d=a.createTreeWalker(b,NodeFilter.SHOW_ALL,null,!1),e=[],f=0,g=!1,i=null,j=null;null!==(i=d.nextNode());)if(!(i.nodeType>3))if(3===i.nodeType){if(!g&&c.startc.end+1)throw new Error("PerformLinking overshot the target!");g&&e.push(j||i),f+=i.nodeValue.length,null!==j&&(f+=j.nodeValue.length,d.nextNode()),j=null}else"img"===i.tagName.toLowerCase()&&(!g&&c.start<=f&&(g=!0),g&&e.push(i));return e},splitStartNodeIfNeeded:function(a,b,c){return b!==c?a.splitText(b-c):null},splitEndNodeIfNeeded:function(a,b,c,d){var e,f;e=d+(b||a).nodeValue.length+(b?a.nodeValue.length:0)-1,f=(b||a).nodeValue.length-(e+1-c),e>=c&&d!==e&&0!==f&&(b||a).splitText(f)},splitByBlockElements:function(b){if(3!==b.nodeType&&1!==b.nodeType)return[];var c=[],d=a.util.blockContainerElementNames.join(",");if(3===b.nodeType||0===b.querySelectorAll(d).length)return[b];for(var e=0;e0)break;d=f.nextNode()}return d},isDescendant:function(a,b,c){if(!a||!b)return!1;if(a===b)return!!c;if(1!==a.nodeType)return!1;if(d||3!==b.nodeType)return a.contains(b);for(var e=b.parentNode;null!==e;){if(e===a)return!0;e=e.parentNode}return!1},isElement:function(a){return!(!a||1!==a.nodeType)},throttle:function(a,b){var c,d,e,f=50,g=null,h=0,i=function(){h=Date.now(),g=null,e=a.apply(c,d),g||(c=d=null)};return b||0===b||(b=f),function(){var f=Date.now(),j=b-(f-h);return c=this,d=arguments,0>=j||j>b?(g&&(clearTimeout(g),g=null),h=f,e=a.apply(c,d),g||(c=d=null)):g||(g=setTimeout(i,j)),e}},traverseUp:function(a,b){if(!a)return!1;do{if(1===a.nodeType){if(b(a))return a;if(h.isMediumEditorElement(a))return!1}a=a.parentNode}while(a);return!1},htmlEntities:function(a){return String(a).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")},insertHTMLCommand:function(a,b){var c,d,e,f,g,i,j;if(a.queryCommandSupported("insertHTML"))try{return a.execCommand("insertHTML",!1,b)}catch(k){}if(c=a.getSelection(),c.rangeCount){if(d=c.getRangeAt(0),j=d.commonAncestorContainer,h.isMediumEditorElement(j)&&!j.firstChild)d.selectNode(j.appendChild(a.createTextNode("")));else if(3===j.nodeType&&0===d.startOffset&&d.endOffset===j.nodeValue.length||3!==j.nodeType&&j.innerHTML===d.toString()){for(;!h.isMediumEditorElement(j)&&j.parentNode&&1===j.parentNode.childNodes.length&&!h.isMediumEditorElement(j.parentNode);)j=j.parentNode;d.selectNode(j)}for(d.deleteContents(),e=a.createElement("div"),e.innerHTML=b,f=a.createDocumentFragment();e.firstChild;)g=e.firstChild,i=f.appendChild(g);d.insertNode(f),i&&(d=d.cloneRange(),d.setStartAfter(i),d.collapse(!0),c.removeAllRanges(),c.addRange(d))}},execFormatBlock:function(b,c){var d,e=h.getTopBlockContainer(a.selection.getSelectionStart(b));if("blockquote"===c){if(e&&(d=Array.prototype.slice.call(e.childNodes),d.some(function(a){return h.isBlockContainer(a)})))return b.execCommand("outdent",!1,null);if(h.isIE)return b.execCommand("indent",!1,c)}if(e&&c===e.nodeName.toLowerCase()&&(c="p"),h.isIE&&(c="<"+c+">"),e&&"blockquote"===e.nodeName.toLowerCase()){if(h.isIE&&"

"===c)return b.execCommand("outdent",!1,c);if(h.isFF&&"p"===c)return d=Array.prototype.slice.call(e.childNodes),d.some(function(a){return!h.isBlockContainer(a)})&&b.execCommand("formatBlock",!1,c),b.execCommand("outdent",!1,c)}return b.execCommand("formatBlock",!1,c)},setTargetBlank:function(a,b){var c,d=b||!1;if("a"===a.nodeName.toLowerCase())a.target="_blank";else for(a=a.getElementsByTagName("a"),c=0;cd?(e=e.parentNode,c-=1):(f=f.parentNode,d-=1);for(;e!==f;)e=e.parentNode,f=f.parentNode;return e},isElementAtBeginningOfBlock:function(a){for(var b,c;!h.isBlockContainer(a)&&!h.isMediumEditorElement(a);){for(c=a;c=c.previousSibling;)if(b=3===c.nodeType?c.nodeValue:c.textContent,b.length>0)return!1;a=a.parentNode}return!0},isMediumEditorElement:function(a){return a&&a.getAttribute&&!!a.getAttribute("data-medium-editor-element")},getContainerEditorElement:function(a){return h.traverseUp(a,function(a){return h.isMediumEditorElement(a)})},isBlockContainer:function(a){return a&&3!==a.nodeType&&-1!==h.blockContainerElementNames.indexOf(a.nodeName.toLowerCase())},getClosestBlockContainer:function(a){return h.traverseUp(a,function(a){return h.isBlockContainer(a)})},getTopBlockContainer:function(a){var b=a;return h.traverseUp(a,function(a){return h.isBlockContainer(a)&&(b=a),!1}),b},getFirstSelectableLeafNode:function(a){for(;a&&a.firstChild;)a=a.firstChild;if(a=h.traverseUp(a,function(a){return-1===h.emptyElementNames.indexOf(a.nodeName.toLowerCase())}),"table"===a.nodeName.toLowerCase()){var b=a.querySelector("th, td");b&&(a=b)}return a},getFirstTextNode:function(a){if(3===a.nodeType)return a;for(var b=0;b0){var e,f=d.getRangeAt(0),g=f.cloneRange();if(g.selectNodeContents(a),g.setEnd(f.startContainer,f.startOffset),e=g.toString().length,c={start:e,end:e+f.toString().length},0!==f.endOffset&&("img"===f.endContainer.nodeName.toLowerCase()||1===f.endContainer.nodeType&&f.endContainer.querySelector("img"))){var h=this.getTrailingImageCount(a,c,f.endContainer,f.endOffset);h&&(c.trailingImageCount=h)}if(0!==e){var i=this.getIndexRelativeToAdjacentEmptyBlocks(b,a,f.startContainer,f.startOffset);-1!==i&&(c.emptyBlocksIndex=i)}}return c},importSelection:function(a,b,c,d){if(a&&b){var e=c.createRange();e.setStart(b,0),e.collapse(!0);for(var f,g=b,h=[],i=0,j=!1,k=!1,l=0,m=!1;!m&&g;)if(!(g.nodeType>3)){if(3!==g.nodeType||k){if(a.trailingImageCount&&k&&("img"===g.nodeName.toLowerCase()&&l++,l===a.trailingImageCount)){for(var n=0;g.parentNode.childNodes[n]!==g;)n++;e.setEnd(g.parentNode,n+1),m=!0}if(!m&&1===g.nodeType)for(var o=g.childNodes.length-1;o>=0;)h.push(g.childNodes[o]),o-=1}else f=i+g.length,!j&&a.start>=i&&a.start<=f&&(e.setStart(g,a.start-i),j=!0),j&&a.end>=i&&a.end<=f&&(a.trailingImageCount?k=!0:(e.setEnd(g,a.end-i),m=!0)),i=f;m||(g=h.pop())}"undefined"!=typeof a.emptyBlocksIndex&&(e=this.importSelectionMoveCursorPastBlocks(c,b,a.emptyBlocksIndex,e)),d&&(e=this.importSelectionMoveCursorPastAnchor(a,e));var p=c.getSelection();p.removeAllRanges(),p.addRange(e)}},importSelectionMoveCursorPastAnchor:function(b,c){var d=function(a){return"a"===a.nodeName.toLowerCase()};if(b.start===b.end&&3===c.startContainer.nodeType&&c.startOffset===c.startContainer.nodeValue.length&&a.util.traverseUp(c.startContainer,d)){for(var e=c.startContainer,f=c.startContainer.parentNode;null!==f&&"a"!==f.nodeName.toLowerCase();)f.childNodes[f.childNodes.length-1]!==e?f=null:(e=f,f=f.parentNode);if(null!==f&&"a"===f.nodeName.toLowerCase()){for(var g=null,h=0;null===g&&h0)break}else g===i.currentNode&&(h=i.currentNode);return f.setStart(a.util.getFirstSelectableLeafNode(h),0),f},getIndexRelativeToAdjacentEmptyBlocks:function(c,d,e,f){if(e.textContent.length>0&&f>0)return-1;var g=e;if(3!==g.nodeType&&(g=e.childNodes[f]),g&&!a.util.isElementAtBeginningOfBlock(g))return-1;for(var h=a.util.getClosestBlockContainer(e),i=c.createTreeWalker(d,NodeFilter.SHOW_ELEMENT,b,!1),j=0;i.nextNode();){var k=""===i.currentNode.textContent;if((k||j>0)&&(j+=1),i.currentNode===h)return j;k||(j=0)}return j},getTrailingImageCount:function(a,b,c,d){for(var e=c.childNodes[d-1];e.hasChildNodes();)e=e.lastChild;for(var f,g=a,h=[],i=0,j=!1,k=!1,l=!1,m=0;!l&&g;)if(!(g.nodeType>3)){if(3!==g.nodeType||k){if("img"===g.nodeName.toLowerCase()&&m++,g===e)l=!0;else if(1===g.nodeType)for(var n=g.childNodes.length-1;n>=0;)h.push(g.childNodes[n]),n-=1}else m=0,f=i+g.length,!j&&b.start>=i&&b.start<=f&&(j=!0),j&&b.end>=i&&b.end<=f&&(k=!0),i=f;l||(g=h.pop())}return m},selectionContainsContent:function(a){var b=a.getSelection();if(!b||b.isCollapsed||!b.rangeCount)return!1;if(""!==b.toString().trim())return!0;var c=this.getSelectedParentElement(b.getRangeAt(0));return c&&("img"===c.nodeName.toLowerCase()||1===c.nodeType&&c.querySelector("img"))?!0:!1},selectionInContentEditableFalse:function(a){var b,c=this.findMatchingSelectionParent(function(a){var c=a&&a.getAttribute("contenteditable");return"true"===c&&(b=!0),"#text"!==a.nodeName&&"false"===c},a);return!b&&c},getSelectionHtml:function(a){var b,c,d,e="",f=a.getSelection();if(f.rangeCount){for(d=a.createElement("div"),b=0,c=f.rangeCount;c>b;b+=1)d.appendChild(f.getRangeAt(b).cloneContents());e=d.innerHTML}return e},getCaretOffsets:function(a,b){var c,d;return b||(b=window.getSelection().getRangeAt(0)),c=b.cloneRange(),d=b.cloneRange(),c.selectNodeContents(a),c.setEnd(b.endContainer,b.endOffset),d.selectNodeContents(a),d.setStart(b.endContainer,b.endOffset),{left:c.toString().length,right:d.toString().length}},rangeSelectsSingleNode:function(a){var b=a.startContainer;return b===a.endContainer&&b.hasChildNodes()&&a.endOffset===a.startOffset+1},getSelectedParentElement:function(a){return a?this.rangeSelectsSingleNode(a)&&3!==a.startContainer.childNodes[a.startOffset].nodeType?a.startContainer.childNodes[a.startOffset]:3===a.startContainer.nodeType?a.startContainer.parentNode:a.startContainer:null},getSelectedElements:function(a){var b,c,d,e=a.getSelection();if(!e.rangeCount||e.isCollapsed||!e.getRangeAt(0).commonAncestorContainer)return[];if(b=e.getRangeAt(0),3===b.commonAncestorContainer.nodeType){for(c=[],d=b.commonAncestorContainer;d.parentNode&&1===d.parentNode.childNodes.length;)c.push(d.parentNode),d=d.parentNode;return c}return[].filter.call(b.commonAncestorContainer.getElementsByTagName("*"),function(a){return"function"==typeof e.containsNode?e.containsNode(a,!0):!0})},selectNode:function(a,b){var c=b.createRange(),d=b.getSelection();c.selectNodeContents(a),d.removeAllRanges(),d.addRange(c)},select:function(a,b,c,d,e){a.getSelection().removeAllRanges();var f=a.createRange();return f.setStart(b,c),d?f.setEnd(d,e):f.collapse(!0),a.getSelection().addRange(f),f},moveCursor:function(a,b,c){this.select(a,b,c)},getSelectionRange:function(a){var b=a.getSelection();return 0===b.rangeCount?null:b.getRangeAt(0)},getSelectionStart:function(a){var b=a.getSelection().anchorNode,c=b&&3===b.nodeType?b.parentNode:b;return c}};a.selection=c}(),function(){var b=function(a){this.base=a,this.options=this.base.options,this.events=[],this.disabledEvents={},this.customEvents={},this.listeners={}};b.prototype={InputEventOnContenteditableSupported:!a.util.isIE,attachDOMEvent:function(a,b,c,d){a.addEventListener(b,c,d),this.events.push([a,b,c,d])},detachDOMEvent:function(a,b,c,d){var e,f=this.indexOfListener(a,b,c,d);-1!==f&&(e=this.events.splice(f,1)[0],e[0].removeEventListener(e[1],e[2],e[3]))},indexOfListener:function(a,b,c,d){var e,f,g;for(e=0,f=this.events.length;f>e;e+=1)if(g=this.events[e],g[0]===a&&g[1]===b&&g[2]===c&&g[3]===d)return e;return-1},detachAllDOMEvents:function(){for(var a=this.events.pop();a;)a[0].removeEventListener(a[1],a[2],a[3]),a=this.events.pop()},enableCustomEvent:function(a){void 0!==this.disabledEvents[a]&&delete this.disabledEvents[a]},disableCustomEvent:function(a){this.disabledEvents[a]=!0},attachCustomEvent:function(a,b){this.setupListener(a),this.customEvents[a]||(this.customEvents[a]=[]),this.customEvents[a].push(b)},detachCustomEvent:function(a,b){var c=this.indexOfCustomListener(a,b);-1!==c&&this.customEvents[a].splice(c,1)},indexOfCustomListener:function(a,b){return this.customEvents[a]&&this.customEvents[a].length?this.customEvents[a].indexOf(b):-1},detachAllCustomEvents:function(){this.customEvents={}},triggerCustomEvent:function(a,b,c){this.customEvents[a]&&!this.disabledEvents[a]&&this.customEvents[a].forEach(function(a){a(b,c)})},destroy:function(){this.detachAllDOMEvents(),this.detachAllCustomEvents(),this.detachExecCommand(),this.base.elements&&this.base.elements.forEach(function(a){a.removeAttribute("data-medium-focused")})},attachToExecCommand:function(){this.execCommandListener||(this.execCommandListener=function(a){this.handleDocumentExecCommand(a)}.bind(this),this.wrapExecCommand(),this.options.ownerDocument.execCommand.listeners.push(this.execCommandListener))},detachExecCommand:function(){var a=this.options.ownerDocument;if(this.execCommandListener&&a.execCommand.listeners){var b=a.execCommand.listeners.indexOf(this.execCommandListener);-1!==b&&a.execCommand.listeners.splice(b,1),a.execCommand.listeners.length||this.unwrapExecCommand()}},wrapExecCommand:function(){var a=this.options.ownerDocument;if(!a.execCommand.listeners){var b=function(b,c,d){var e=a.execCommand.orig.apply(this,arguments);if(!a.execCommand.listeners)return e;var f=Array.prototype.slice.call(arguments);return a.execCommand.listeners.forEach(function(a){a({command:b,value:d,args:f,result:e})}),e};b.orig=a.execCommand,b.listeners=[],a.execCommand=b}},unwrapExecCommand:function(){var a=this.options.ownerDocument;a.execCommand.orig&&(a.execCommand=a.execCommand.orig)},setupListener:function(a){if(!this.listeners[a]){switch(a){case"externalInteraction":this.attachDOMEvent(this.options.ownerDocument.body,"mousedown",this.handleBodyMousedown.bind(this),!0),this.attachDOMEvent(this.options.ownerDocument.body,"click",this.handleBodyClick.bind(this),!0),this.attachDOMEvent(this.options.ownerDocument.body,"focus",this.handleBodyFocus.bind(this),!0);break;case"blur":this.setupListener("externalInteraction");break;case"focus":this.setupListener("externalInteraction");break;case"editableInput":this.contentCache=[],this.base.elements.forEach(function(a){this.contentCache[a.getAttribute("medium-editor-index")]=a.innerHTML,this.InputEventOnContenteditableSupported&&this.attachDOMEvent(a,"input",this.handleInput.bind(this))}.bind(this)),this.InputEventOnContenteditableSupported||(this.setupListener("editableKeypress"),this.keypressUpdateInput=!0,this.attachDOMEvent(document,"selectionchange",this.handleDocumentSelectionChange.bind(this)),this.attachToExecCommand());break;case"editableClick":this.attachToEachElement("click",this.handleClick);break;case"editableBlur":this.attachToEachElement("blur",this.handleBlur);break;case"editableKeypress":this.attachToEachElement("keypress",this.handleKeypress);break;case"editableKeyup":this.attachToEachElement("keyup",this.handleKeyup);break;case"editableKeydown":this.attachToEachElement("keydown",this.handleKeydown);break;case"editableKeydownSpace":this.setupListener("editableKeydown");break;case"editableKeydownEnter":this.setupListener("editableKeydown");break;case"editableKeydownTab":this.setupListener("editableKeydown");break;case"editableKeydownDelete":this.setupListener("editableKeydown");break;case"editableMouseover":this.attachToEachElement("mouseover",this.handleMouseover);break;case"editableDrag":this.attachToEachElement("dragover",this.handleDragging),this.attachToEachElement("dragleave",this.handleDragging);break;case"editableDrop":this.attachToEachElement("drop",this.handleDrop);break;case"editablePaste":this.attachToEachElement("paste",this.handlePaste)}this.listeners[a]=!0}},attachToEachElement:function(a,b){this.base.elements.forEach(function(c){this.attachDOMEvent(c,a,b.bind(this))},this)},focusElement:function(a){a.focus(),this.updateFocus(a,{target:a,type:"focus"})},updateFocus:function(b,c){var d,e=this.base.getExtensionByName("toolbar"),f=e?e.getToolbarElement():null,g=this.base.getExtensionByName("anchor-preview"),h=g&&g.getPreviewElement?g.getPreviewElement():null,i=this.base.getFocusedElement();i&&"click"===c.type&&this.lastMousedownTarget&&(a.util.isDescendant(i,this.lastMousedownTarget,!0)||a.util.isDescendant(f,this.lastMousedownTarget,!0)||a.util.isDescendant(h,this.lastMousedownTarget,!0))&&(d=i),d||this.base.elements.some(function(c){return!d&&a.util.isDescendant(c,b,!0)&&(d=c),!!d},this);var j=!a.util.isDescendant(i,b,!0)&&!a.util.isDescendant(f,b,!0)&&!a.util.isDescendant(h,b,!0);d!==i&&(i&&j&&(i.removeAttribute("data-medium-focused"),this.triggerCustomEvent("blur",c,i)),d&&(d.setAttribute("data-medium-focused",!0),this.triggerCustomEvent("focus",c,d))),j&&this.triggerCustomEvent("externalInteraction",c)},updateInput:function(a,b){if(this.contentCache){var c=a.getAttribute("medium-editor-index");a.innerHTML!==this.contentCache[c]&&this.triggerCustomEvent("editableInput",b,a),this.contentCache[c]=a.innerHTML}},handleDocumentSelectionChange:function(b){if(b.currentTarget&&b.currentTarget.activeElement){var c,d=b.currentTarget.activeElement;this.base.elements.some(function(b){return a.util.isDescendant(b,d,!0)?(c=b,!0):!1},this),c&&this.updateInput(c,{target:d,currentTarget:c})}},handleDocumentExecCommand:function(){var a=this.base.getFocusedElement();a&&this.updateInput(a,{target:a,currentTarget:a})},handleBodyClick:function(a){this.updateFocus(a.target,a)},handleBodyFocus:function(a){this.updateFocus(a.target,a)},handleBodyMousedown:function(a){this.lastMousedownTarget=a.target},handleInput:function(a){this.updateInput(a.currentTarget,a)},handleClick:function(a){this.triggerCustomEvent("editableClick",a,a.currentTarget)},handleBlur:function(a){this.triggerCustomEvent("editableBlur",a,a.currentTarget)},handleKeypress:function(a){if(this.triggerCustomEvent("editableKeypress",a,a.currentTarget),this.keypressUpdateInput){var b={target:a.target,currentTarget:a.currentTarget};setTimeout(function(){this.updateInput(b.currentTarget,b)}.bind(this),0)}},handleKeyup:function(a){this.triggerCustomEvent("editableKeyup",a,a.currentTarget)},handleMouseover:function(a){this.triggerCustomEvent("editableMouseover",a,a.currentTarget)},handleDragging:function(a){this.triggerCustomEvent("editableDrag",a,a.currentTarget)},handleDrop:function(a){this.triggerCustomEvent("editableDrop",a,a.currentTarget)},handlePaste:function(a){this.triggerCustomEvent("editablePaste",a,a.currentTarget)},handleKeydown:function(b){return this.triggerCustomEvent("editableKeydown",b,b.currentTarget),a.util.isKey(b,a.util.keyCode.SPACE)?this.triggerCustomEvent("editableKeydownSpace",b,b.currentTarget):a.util.isKey(b,a.util.keyCode.ENTER)||b.ctrlKey&&a.util.isKey(b,a.util.keyCode.M)?this.triggerCustomEvent("editableKeydownEnter",b,b.currentTarget):a.util.isKey(b,a.util.keyCode.TAB)?this.triggerCustomEvent("editableKeydownTab",b,b.currentTarget):a.util.isKey(b,[a.util.keyCode.DELETE,a.util.keyCode.BACKSPACE])?this.triggerCustomEvent("editableKeydownDelete",b,b.currentTarget):void 0}},a.Events=b}(),function(){var b=a.Extension.extend({action:void 0,aria:void 0,tagNames:void 0,style:void 0,useQueryState:void 0,contentDefault:void 0,contentFA:void 0,classList:void 0,attrs:void 0,constructor:function(c){b.isBuiltInButton(c)?a.Extension.call(this,this.defaults[c]):a.Extension.call(this,c)},init:function(){a.Extension.prototype.init.apply(this,arguments),this.button=this.createButton(),this.on(this.button,"click",this.handleClick.bind(this))},getButton:function(){return this.button},getAction:function(){return"function"==typeof this.action?this.action(this.base.options):this.action},getAria:function(){return"function"==typeof this.aria?this.aria(this.base.options):this.aria},getTagNames:function(){return"function"==typeof this.tagNames?this.tagNames(this.base.options):this.tagNames},createButton:function(){var a=this.document.createElement("button"),b=this.contentDefault,c=this.getAria(),d=this.getEditorOption("buttonLabels");return a.classList.add("medium-editor-action"),a.classList.add("medium-editor-action-"+this.name),this.classList&&this.classList.forEach(function(b){a.classList.add(b)}),a.setAttribute("data-action",this.getAction()),c&&(a.setAttribute("title",c),a.setAttribute("aria-label",c)),this.attrs&&Object.keys(this.attrs).forEach(function(b){a.setAttribute(b,this.attrs[b])},this),"fontawesome"===d&&this.contentFA&&(b=this.contentFA),a.innerHTML=b,a},handleClick:function(a){a.preventDefault(),a.stopPropagation();var b=this.getAction();b&&this.execAction(b)},isActive:function(){return this.button.classList.contains(this.getEditorOption("activeButtonClass"))},setInactive:function(){this.button.classList.remove(this.getEditorOption("activeButtonClass")),delete this.knownState},setActive:function(){this.button.classList.add(this.getEditorOption("activeButtonClass")), +delete this.knownState},queryCommandState:function(){var a=null;return this.useQueryState&&(a=this.base.queryCommandState(this.getAction())),a},isAlreadyApplied:function(a){var b,c,d=!1,e=this.getTagNames();return this.knownState===!1||this.knownState===!0?this.knownState:(e&&e.length>0&&(d=-1!==e.indexOf(a.nodeName.toLowerCase())),!d&&this.style&&(b=this.style.value.split("|"),c=this.window.getComputedStyle(a,null).getPropertyValue(this.style.prop),b.forEach(function(a){this.knownState||(d=-1!==c.indexOf(a),(d||"text-decoration"!==this.style.prop)&&(this.knownState=d))},this)),d)}});b.isBuiltInButton=function(b){return"string"==typeof b&&a.extensions.button.prototype.defaults.hasOwnProperty(b)},a.extensions.button=b}(),function(){a.extensions.button.prototype.defaults={bold:{name:"bold",action:"bold",aria:"bold",tagNames:["b","strong"],style:{prop:"font-weight",value:"700|bold"},useQueryState:!0,contentDefault:"B",contentFA:''},italic:{name:"italic",action:"italic",aria:"italic",tagNames:["i","em"],style:{prop:"font-style",value:"italic"},useQueryState:!0,contentDefault:"I",contentFA:''},underline:{name:"underline",action:"underline",aria:"underline",tagNames:["u"],style:{prop:"text-decoration",value:"underline"},useQueryState:!0,contentDefault:"U",contentFA:''},strikethrough:{name:"strikethrough",action:"strikethrough",aria:"strike through",tagNames:["strike"],style:{prop:"text-decoration",value:"line-through"},useQueryState:!0,contentDefault:"A",contentFA:''},superscript:{name:"superscript",action:"superscript",aria:"superscript",tagNames:["sup"],contentDefault:"x1",contentFA:''},subscript:{name:"subscript",action:"subscript",aria:"subscript",tagNames:["sub"],contentDefault:"x1",contentFA:''},image:{name:"image",action:"image",aria:"image",tagNames:["img"],contentDefault:"image",contentFA:''},orderedlist:{name:"orderedlist",action:"insertorderedlist",aria:"ordered list",tagNames:["ol"],useQueryState:!0,contentDefault:"1.",contentFA:''},unorderedlist:{name:"unorderedlist",action:"insertunorderedlist",aria:"unordered list",tagNames:["ul"],useQueryState:!0,contentDefault:"",contentFA:''},indent:{name:"indent",action:"indent",aria:"indent",tagNames:[],contentDefault:"",contentFA:''},outdent:{name:"outdent",action:"outdent",aria:"outdent",tagNames:[],contentDefault:"",contentFA:''},justifyCenter:{name:"justifyCenter",action:"justifyCenter",aria:"center justify",tagNames:[],style:{prop:"text-align",value:"center"},contentDefault:"C",contentFA:''},justifyFull:{name:"justifyFull",action:"justifyFull",aria:"full justify",tagNames:[],style:{prop:"text-align",value:"justify"},contentDefault:"J",contentFA:''},justifyLeft:{name:"justifyLeft",action:"justifyLeft",aria:"left justify",tagNames:[],style:{prop:"text-align",value:"left"},contentDefault:"L",contentFA:''},justifyRight:{name:"justifyRight",action:"justifyRight",aria:"right justify",tagNames:[],style:{prop:"text-align",value:"right"},contentDefault:"R",contentFA:''},removeFormat:{name:"removeFormat",aria:"remove formatting",action:"removeFormat",contentDefault:"X",contentFA:''},quote:{name:"quote",action:"append-blockquote",aria:"blockquote",tagNames:["blockquote"],contentDefault:"",contentFA:''},pre:{name:"pre",action:"append-pre",aria:"preformatted text",tagNames:["pre"],contentDefault:"0101",contentFA:''},h1:{name:"h1",action:"append-h1",aria:"header type one",tagNames:["h1"],contentDefault:"H1",contentFA:'1'},h2:{name:"h2",action:"append-h2",aria:"header type two",tagNames:["h2"],contentDefault:"H2",contentFA:'2'},h3:{name:"h3",action:"append-h3",aria:"header type three",tagNames:["h3"],contentDefault:"H3",contentFA:'3'},h4:{name:"h4",action:"append-h4",aria:"header type four",tagNames:["h4"],contentDefault:"H4",contentFA:'4'},h5:{name:"h5",action:"append-h5",aria:"header type five",tagNames:["h5"],contentDefault:"H5",contentFA:'5'},h6:{name:"h6",action:"append-h6",aria:"header type six",tagNames:["h6"],contentDefault:"H6",contentFA:'6'}}}(),function(){var b=a.extensions.button.extend({init:function(){a.extensions.button.prototype.init.apply(this,arguments)},formSaveLabel:"✓",formCloseLabel:"×",hasForm:!0,getForm:function(){},isDisplayed:function(){},hideForm:function(){},showToolbarDefaultActions:function(){var a=this.base.getExtensionByName("toolbar");a&&a.showToolbarDefaultActions()},hideToolbarDefaultActions:function(){var a=this.base.getExtensionByName("toolbar");a&&a.hideToolbarDefaultActions()},setToolbarPosition:function(){var a=this.base.getExtensionByName("toolbar");a&&a.setToolbarPosition()}});a.extensions.form=b}(),function(){var b=a.extensions.form.extend({customClassOption:null,customClassOptionText:"Button",linkValidation:!1,placeholderText:"Paste or type a link",targetCheckbox:!1,targetCheckboxText:"Open in new window",name:"anchor",action:"createLink",aria:"link",tagNames:["a"],contentDefault:"#",contentFA:'',init:function(){a.extensions.form.prototype.init.apply(this,arguments),this.subscribe("editableKeydown",this.handleKeydown.bind(this))},handleClick:function(b){b.preventDefault(),b.stopPropagation();var c=a.selection.getSelectionRange(this.document);return"a"===c.startContainer.nodeName.toLowerCase()||"a"===c.endContainer.nodeName.toLowerCase()||a.util.getClosestTag(a.selection.getSelectedParentElement(c),"a")?this.execAction("unlink"):(this.isDisplayed()||this.showForm(),!1)},handleKeydown:function(b){a.util.isKey(b,a.util.keyCode.K)&&a.util.isMetaCtrlKey(b)&&!b.shiftKey&&this.handleClick(b)},getForm:function(){return this.form||(this.form=this.createForm()),this.form},getTemplate:function(){var a=[''];return a.push('',"fontawesome"===this.getEditorOption("buttonLabels")?'':this.formSaveLabel,""),a.push('',"fontawesome"===this.getEditorOption("buttonLabels")?'':this.formCloseLabel,""),this.targetCheckbox&&a.push('

','',"","
"),this.customClassOption&&a.push('
','',"","
"),a.join("")},isDisplayed:function(){return"block"===this.getForm().style.display},hideForm:function(){this.getForm().style.display="none",this.getInput().value=""},showForm:function(a){var b=this.getInput(),c=this.getAnchorTargetCheckbox(),d=this.getAnchorButtonCheckbox();if(a=a||{url:""},"string"==typeof a&&(a={url:a}),this.base.saveSelection(),this.hideToolbarDefaultActions(),this.getForm().style.display="block",this.setToolbarPosition(),b.value=a.url,b.focus(),c&&(c.checked="_blank"===a.target),d){var e=a.buttonClass?a.buttonClass.split(" "):[];d.checked=-1!==e.indexOf(this.customClassOption)}},destroy:function(){return this.form?(this.form.parentNode&&this.form.parentNode.removeChild(this.form),void delete this.form):!1},getFormOpts:function(){var a=this.getAnchorTargetCheckbox(),b=this.getAnchorButtonCheckbox(),c={url:this.getInput().value.trim()};return this.linkValidation&&(c.url=this.checkLinkFormat(c.url)),c.target="_self",a&&a.checked&&(c.target="_blank"),b&&b.checked&&(c.buttonClass=this.customClassOption),c},doFormSave:function(){var a=this.getFormOpts();this.completeFormSave(a)},completeFormSave:function(a){this.base.restoreSelection(),this.execAction(this.action,a),this.base.checkSelection()},checkLinkFormat:function(a){var b=/^([a-z]+:)?\/\/|^(mailto|tel|maps):/i,c=/^\+?\s?\(?(?:\d\s?\-?\)?){3,20}$/;return c.test(a)?"tel:"+a:(b.test(a)?"":"http://")+a},doFormCancel:function(){this.base.restoreSelection(),this.base.checkSelection()},attachFormEvents:function(a){var b=a.querySelector(".medium-editor-toolbar-close"),c=a.querySelector(".medium-editor-toolbar-save"),d=a.querySelector(".medium-editor-toolbar-input");this.on(a,"click",this.handleFormClick.bind(this)),this.on(d,"keyup",this.handleTextboxKeyup.bind(this)),this.on(b,"click",this.handleCloseClick.bind(this)),this.on(c,"click",this.handleSaveClick.bind(this),!0)},createForm:function(){var a=this.document,b=a.createElement("div");return b.className="medium-editor-toolbar-form",b.id="medium-editor-toolbar-form-anchor-"+this.getEditorId(),b.innerHTML=this.getTemplate(),this.attachFormEvents(b),b},getInput:function(){return this.getForm().querySelector("input.medium-editor-toolbar-input")},getAnchorTargetCheckbox:function(){return this.getForm().querySelector(".medium-editor-toolbar-anchor-target")},getAnchorButtonCheckbox:function(){return this.getForm().querySelector(".medium-editor-toolbar-anchor-button")},handleTextboxKeyup:function(b){return b.keyCode===a.util.keyCode.ENTER?(b.preventDefault(),void this.doFormSave()):void(b.keyCode===a.util.keyCode.ESCAPE&&(b.preventDefault(),this.doFormCancel()))},handleFormClick:function(a){a.stopPropagation()},handleSaveClick:function(a){a.preventDefault(),this.doFormSave()},handleCloseClick:function(a){a.preventDefault(),this.doFormCancel()}});a.extensions.anchor=b}(),function(){var b=a.Extension.extend({name:"anchor-preview",hideDelay:500,previewValueSelector:"a",showWhenToolbarIsVisible:!1,init:function(){this.anchorPreview=this.createPreview(),this.getEditorOption("elementsContainer").appendChild(this.anchorPreview),this.attachToEditables()},getPreviewElement:function(){return this.anchorPreview},createPreview:function(){var a=this.document.createElement("div");return a.id="medium-editor-anchor-preview-"+this.getEditorId(),a.className="medium-editor-anchor-preview",a.innerHTML=this.getTemplate(),this.on(a,"click",this.handleClick.bind(this)),a},getTemplate:function(){return'
'},destroy:function(){this.anchorPreview&&(this.anchorPreview.parentNode&&this.anchorPreview.parentNode.removeChild(this.anchorPreview),delete this.anchorPreview)},hidePreview:function(){this.anchorPreview.classList.remove("medium-editor-anchor-preview-active"),this.activeAnchor=null},showPreview:function(a){return this.anchorPreview.classList.contains("medium-editor-anchor-preview-active")||a.getAttribute("data-disable-preview")?!0:(this.previewValueSelector&&(this.anchorPreview.querySelector(this.previewValueSelector).textContent=a.attributes.href.value,this.anchorPreview.querySelector(this.previewValueSelector).href=a.attributes.href.value),this.anchorPreview.classList.add("medium-toolbar-arrow-over"),this.anchorPreview.classList.remove("medium-toolbar-arrow-under"),this.anchorPreview.classList.contains("medium-editor-anchor-preview-active")||this.anchorPreview.classList.add("medium-editor-anchor-preview-active"),this.activeAnchor=a,this.positionPreview(),this.attachPreviewHandlers(),this)},positionPreview:function(a){a=a||this.activeAnchor;var b,c,d=this.anchorPreview.offsetHeight,e=a.getBoundingClientRect(),f=(e.left+e.right)/2,g=this.diffLeft,h=this.diffTop;b=this.anchorPreview.offsetWidth/2;var i=this.base.getExtensionByName("toolbar");i&&(g=i.diffLeft,h=i.diffTop),c=g-b,this.anchorPreview.style.top=Math.round(d+e.bottom-h+this.window.pageYOffset-this.anchorPreview.offsetHeight)+"px",b>f?this.anchorPreview.style.left=c+b+"px":this.window.innerWidth-fthis.hideDelay&&this.detachPreviewHandlers()},detachPreviewHandlers:function(){clearInterval(this.intervalTimer),this.instanceHandlePreviewMouseover&&(this.off(this.anchorPreview,"mouseover",this.instanceHandlePreviewMouseover),this.off(this.anchorPreview,"mouseout",this.instanceHandlePreviewMouseout),this.activeAnchor&&(this.off(this.activeAnchor,"mouseover",this.instanceHandlePreviewMouseover),this.off(this.activeAnchor,"mouseout",this.instanceHandlePreviewMouseout))),this.hidePreview(),this.hovering=this.instanceHandlePreviewMouseover=this.instanceHandlePreviewMouseout=null},attachPreviewHandlers:function(){this.lastOver=(new Date).getTime(),this.hovering=!0,this.instanceHandlePreviewMouseover=this.handlePreviewMouseover.bind(this),this.instanceHandlePreviewMouseout=this.handlePreviewMouseout.bind(this),this.intervalTimer=setInterval(this.updatePreview.bind(this),200),this.on(this.anchorPreview,"mouseover",this.instanceHandlePreviewMouseover),this.on(this.anchorPreview,"mouseout",this.instanceHandlePreviewMouseout),this.on(this.activeAnchor,"mouseover",this.instanceHandlePreviewMouseover),this.on(this.activeAnchor,"mouseout",this.instanceHandlePreviewMouseout)}});a.extensions.anchorPreview=b}(),function(){function b(b){return!a.util.getClosestTag(b,"a")}var c,d,e,f;c=[" "," ","\n","\r"," "," "," "," "," ","\u2028","\u2029"],d="com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|ja|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw",e="(((?:(https?://|ftps?://|nntp://)|www\\d{0,3}[.]|[a-z0-9.\\-]+[.]("+d+")\\/)\\S+(?:[^\\s`!\\[\\]{};:'\".,?«»“”‘’])))|(([a-z0-9\\-]+\\.)?[a-z0-9\\-]+\\.("+d+"))",f=new RegExp("^("+d+")$","i");var g=a.Extension.extend({init:function(){a.Extension.prototype.init.apply(this,arguments),this.disableEventHandling=!1,this.subscribe("editableKeypress",this.onKeypress.bind(this)),this.subscribe("editableBlur",this.onBlur.bind(this)),this.document.execCommand("AutoUrlDetect",!1,!1)},destroy:function(){this.document.queryCommandSupported("AutoUrlDetect")&&this.document.execCommand("AutoUrlDetect",!1,!0)},onBlur:function(a,b){this.performLinking(b)},onKeypress:function(b){this.disableEventHandling||a.util.isKey(b,[a.util.keyCode.SPACE,a.util.keyCode.ENTER])&&(clearTimeout(this.performLinkingTimeout),this.performLinkingTimeout=setTimeout(function(){try{var a=this.base.exportSelection();this.performLinking(b.target)&&this.base.importSelection(a,!0)}catch(c){window.console&&window.console.error("Failed to perform linking",c),this.disableEventHandling=!0}}.bind(this),0))},performLinking:function(b){var c=a.util.splitByBlockElements(b),d=!1;0===c.length&&(c=[b]);for(var e=0;e0&&null!==g;)e=c.currentNode,f=e.nodeValue,f.length>b?(g=e.splitText(f.length-b),b=0):(g=c.previousNode(),b-=f.length);return g},performLinkingWithinElement:function(b){for(var c=this.findLinkableText(b),d=!1,e=0;e1;)e.appendChild(d.childNodes[1])}});a.extensions.autoLink=g}(),function(){function b(b){var d=a.util.getContainerEditorElement(b),e=Array.prototype.slice.call(d.parentElement.querySelectorAll("."+c));e.forEach(function(a){a.classList.remove(c)})}var c="medium-editor-dragover",d=a.Extension.extend({name:"fileDragging",allowedTypes:["image"],init:function(){a.Extension.prototype.init.apply(this,arguments),this.subscribe("editableDrag",this.handleDrag.bind(this)),this.subscribe("editableDrop",this.handleDrop.bind(this))},handleDrag:function(a){a.preventDefault(),a.dataTransfer.dropEffect="copy";var d=a.target.classList?a.target:a.target.parentElement;b(d),"dragover"===a.type&&d.classList.add(c)},handleDrop:function(a){a.preventDefault(),a.stopPropagation(),a.dataTransfer.files&&Array.prototype.slice.call(a.dataTransfer.files).forEach(function(a){this.isAllowedFile(a)&&a.type.match("image")&&this.insertImageFile(a)},this),b(a.target)},isAllowedFile:function(a){return this.allowedTypes.some(function(b){return!!a.type.match(b)})},insertImageFile:function(b){var c=new FileReader;c.readAsDataURL(b);var d="medium-img-"+ +new Date;a.util.insertHTMLCommand(this.document,''),c.onload=function(){var a=this.document.getElementById(d);a&&(a.removeAttribute("id"),a.removeAttribute("class"),a.src=c.result)}.bind(this)}});a.extensions.fileDragging=d}(),function(){var b=a.Extension.extend({name:"keyboard-commands",commands:[{command:"bold",key:"B",meta:!0,shift:!1,alt:!1},{command:"italic",key:"I",meta:!0,shift:!1,alt:!1},{command:"underline",key:"U",meta:!0,shift:!1,alt:!1}],init:function(){a.Extension.prototype.init.apply(this,arguments),this.subscribe("editableKeydown",this.handleKeydown.bind(this)),this.keys={},this.commands.forEach(function(a){var b=a.key.charCodeAt(0);this.keys[b]||(this.keys[b]=[]),this.keys[b].push(a)},this)},handleKeydown:function(b){var c=a.util.getKeyCode(b);if(this.keys[c]){var d=a.util.isMetaCtrlKey(b),e=!!b.shiftKey,f=!!b.altKey;this.keys[c].forEach(function(a){a.meta!==d||a.shift!==e||a.alt!==f&&void 0!==a.alt||(b.preventDefault(),b.stopPropagation(),!1!==a.command&&this.execAction(a.command))},this)}}});a.extensions.keyboardCommands=b}(),function(){var b=a.extensions.form.extend({name:"fontname",action:"fontName",aria:"change font name",contentDefault:"±",contentFA:'',fonts:["","Arial","Verdana","Times New Roman"],init:function(){a.extensions.form.prototype.init.apply(this,arguments)},handleClick:function(a){if(a.preventDefault(),a.stopPropagation(),!this.isDisplayed()){var b=this.document.queryCommandValue("fontName")+"";this.showForm(b)}return!1},getForm:function(){return this.form||(this.form=this.createForm()),this.form},isDisplayed:function(){return"block"===this.getForm().style.display},hideForm:function(){this.getForm().style.display="none",this.getSelect().value=""},showForm:function(a){var b=this.getSelect();this.base.saveSelection(),this.hideToolbarDefaultActions(),this.getForm().style.display="block",this.setToolbarPosition(),b.value=a||"",b.focus()},destroy:function(){return this.form?(this.form.parentNode&&this.form.parentNode.removeChild(this.form),void delete this.form):!1},doFormSave:function(){this.base.restoreSelection(),this.base.checkSelection()},doFormCancel:function(){this.base.restoreSelection(),this.clearFontName(),this.base.checkSelection()},createForm:function(){var a,b=this.document,c=b.createElement("div"),d=b.createElement("select"),e=b.createElement("a"),f=b.createElement("a");c.className="medium-editor-toolbar-form",c.id="medium-editor-toolbar-form-fontname-"+this.getEditorId(),this.on(c,"click",this.handleFormClick.bind(this));for(var g=0;g
':"✓",c.appendChild(f),this.on(f,"click",this.handleSaveClick.bind(this),!0),e.setAttribute("href","#"),e.className="medium-editor-toobar-close",e.innerHTML="fontawesome"===this.getEditorOption("buttonLabels")?'':"×",c.appendChild(e),this.on(e,"click",this.handleCloseClick.bind(this)),c},getSelect:function(){return this.getForm().querySelector("select.medium-editor-toolbar-select")},clearFontName:function(){a.selection.getSelectedElements(this.document).forEach(function(a){"font"===a.nodeName.toLowerCase()&&a.hasAttribute("face")&&a.removeAttribute("face")})},handleFontChange:function(){var a=this.getSelect().value;""===a?this.clearFontName():this.execAction("fontName",{name:a})},handleFormClick:function(a){a.stopPropagation()},handleSaveClick:function(a){a.preventDefault(),this.doFormSave()},handleCloseClick:function(a){a.preventDefault(),this.doFormCancel()}});a.extensions.fontName=b}(),function(){var b=a.extensions.form.extend({name:"fontsize",action:"fontSize",aria:"increase/decrease font size",contentDefault:"±",contentFA:'',init:function(){a.extensions.form.prototype.init.apply(this,arguments)},handleClick:function(a){if(a.preventDefault(),a.stopPropagation(),!this.isDisplayed()){var b=this.document.queryCommandValue("fontSize")+"";this.showForm(b)}return!1},getForm:function(){return this.form||(this.form=this.createForm()),this.form},isDisplayed:function(){return"block"===this.getForm().style.display},hideForm:function(){this.getForm().style.display="none",this.getInput().value=""},showForm:function(a){var b=this.getInput();this.base.saveSelection(),this.hideToolbarDefaultActions(),this.getForm().style.display="block",this.setToolbarPosition(),b.value=a||"",b.focus()},destroy:function(){return this.form?(this.form.parentNode&&this.form.parentNode.removeChild(this.form),void delete this.form):!1},doFormSave:function(){this.base.restoreSelection(),this.base.checkSelection()},doFormCancel:function(){this.base.restoreSelection(),this.clearFontSize(),this.base.checkSelection()},createForm:function(){var a=this.document,b=a.createElement("div"),c=a.createElement("input"),d=a.createElement("a"),e=a.createElement("a");return b.className="medium-editor-toolbar-form",b.id="medium-editor-toolbar-form-fontsize-"+this.getEditorId(),this.on(b,"click",this.handleFormClick.bind(this)),c.setAttribute("type","range"),c.setAttribute("min","1"),c.setAttribute("max","7"),c.className="medium-editor-toolbar-input",b.appendChild(c),this.on(c,"change",this.handleSliderChange.bind(this)),e.setAttribute("href","#"),e.className="medium-editor-toobar-save",e.innerHTML="fontawesome"===this.getEditorOption("buttonLabels")?'':"✓",b.appendChild(e),this.on(e,"click",this.handleSaveClick.bind(this),!0),d.setAttribute("href","#"),d.className="medium-editor-toobar-close",d.innerHTML="fontawesome"===this.getEditorOption("buttonLabels")?'':"×",b.appendChild(d),this.on(d,"click",this.handleCloseClick.bind(this)),b},getInput:function(){return this.getForm().querySelector("input.medium-editor-toolbar-input")},clearFontSize:function(){a.selection.getSelectedElements(this.document).forEach(function(a){"font"===a.nodeName.toLowerCase()&&a.hasAttribute("size")&&a.removeAttribute("size")})},handleSliderChange:function(){var a=this.getInput().value;"4"===a?this.clearFontSize():this.execAction("fontSize",{size:a})},handleFormClick:function(a){a.stopPropagation()},handleSaveClick:function(a){a.preventDefault(),this.doFormSave()},handleCloseClick:function(a){a.preventDefault(),this.doFormCancel()}});a.extensions.fontSize=b}(),function(){function b(){return[[new RegExp(/<[^>]*docs-internal-guid[^>]*>/gi),""],[new RegExp(/<\/b>(]*>)?$/gi),""],[new RegExp(/\s+<\/span>/g)," "],[new RegExp(/
/g),"
"],[new RegExp(/]*(font-style:italic;font-weight:bold|font-weight:bold;font-style:italic)[^>]*>/gi),''],[new RegExp(/]*font-style:italic[^>]*>/gi),''],[new RegExp(/]*font-weight:bold[^>]*>/gi),''],[new RegExp(/<(\/?)(i|b|a)>/gi),"<$1$2>"],[new RegExp(/<a(?:(?!href).)+href=(?:"|”|“|"|“|”)(((?!"|”|“|"|“|”).)*)(?:"|”|“|"|“|”)(?:(?!>).)*>/gi),''],[new RegExp(/<\/p>\n+/gi),"

"],[new RegExp(/\n+

/gi),""],["",""],["",""]]}var c=a.Extension.extend({forcePlainText:!0,cleanPastedHTML:!1,cleanReplacements:[],cleanAttrs:["class","style","dir"],cleanTags:["meta"],init:function(){a.Extension.prototype.init.apply(this,arguments),(this.forcePlainText||this.cleanPastedHTML)&&this.subscribe("editablePaste",this.handlePaste.bind(this))},handlePaste:function(b,c){var d,e,f,g,h="",i="text/html",j="text/plain";if(this.window.clipboardData&&void 0===b.clipboardData&&(b.clipboardData=this.window.clipboardData,i="Text",j="Text"),b.clipboardData&&b.clipboardData.getData&&!b.defaultPrevented){if(b.preventDefault(),f=b.clipboardData.getData(i),g=b.clipboardData.getData(j),this.cleanPastedHTML&&f)return this.cleanPaste(f);if(this.getEditorOption("disableReturn")||c.getAttribute("data-disable-return"))h=a.util.htmlEntities(g);else if(d=g.split(/[\r\n]+/g),d.length>1)for(e=0;e"+a.util.htmlEntities(d[e])+"

");else h=a.util.htmlEntities(d[0]);a.util.insertHTMLCommand(this.document,h)}},cleanPaste:function(a){var c,d,e,f,g=/"+a.split("

").join("

")+"

",d=e.querySelectorAll("a,p,div,br"),c=0;c"+d.innerHTML+"
":e.innerHTML=d.innerHTML,d.parentNode.replaceChild(e,d);for(f=b.querySelectorAll("span"),c=0;c0&&(d[0].classList.add(this.firstButtonClass),d[d.length-1].classList.add(this.lastButtonClass)),h},destroy:function(){this.toolbar&&(this.toolbar.parentNode&&this.toolbar.parentNode.removeChild(this.toolbar),delete this.toolbar)},getToolbarElement:function(){return this.toolbar||(this.toolbar=this.createToolbar()),this.toolbar},getToolbarActionsElement:function(){return this.getToolbarElement().querySelector(".medium-editor-toolbar-actions")},initThrottledMethods:function(){this.throttledPositionToolbar=a.util.throttle(function(){this.base.isActive&&this.positionToolbarIfShown()}.bind(this))},attachEventHandlers:function(){this.subscribe("blur",this.handleBlur.bind(this)),this.subscribe("focus",this.handleFocus.bind(this)),this.subscribe("editableClick",this.handleEditableClick.bind(this)),this.subscribe("editableKeyup",this.handleEditableKeyup.bind(this)),this.on(this.document.documentElement,"mouseup",this.handleDocumentMouseup.bind(this)),this["static"]&&this.sticky&&this.on(this.window,"scroll",this.handleWindowScroll.bind(this),!0),this.on(this.window,"resize",this.handleWindowResize.bind(this))},handleWindowScroll:function(){this.positionToolbarIfShown()},handleWindowResize:function(){this.throttledPositionToolbar()},handleDocumentMouseup:function(b){return b&&b.target&&a.util.isDescendant(this.getToolbarElement(),b.target)?!1:void this.checkState()},handleEditableClick:function(){setTimeout(function(){this.checkState()}.bind(this),0)},handleEditableKeyup:function(){this.checkState()},handleBlur:function(){clearTimeout(this.hideTimeout),clearTimeout(this.delayShowTimeout),this.hideTimeout=setTimeout(function(){this.hideToolbar()}.bind(this),1)},handleFocus:function(){this.checkState()},isDisplayed:function(){return this.getToolbarElement().classList.contains("medium-editor-toolbar-active")},showToolbar:function(){clearTimeout(this.hideTimeout),this.isDisplayed()||(this.getToolbarElement().classList.add("medium-editor-toolbar-active"),this.trigger("showToolbar",{},this.base.getFocusedElement()))},hideToolbar:function(){this.isDisplayed()&&(this.getToolbarElement().classList.remove("medium-editor-toolbar-active"),this.trigger("hideToolbar",{},this.base.getFocusedElement()))},isToolbarDefaultActionsDisplayed:function(){return"block"===this.getToolbarActionsElement().style.display},hideToolbarDefaultActions:function(){this.isToolbarDefaultActionsDisplayed()&&(this.getToolbarActionsElement().style.display="none")},showToolbarDefaultActions:function(){this.hideExtensionForms(),this.isToolbarDefaultActionsDisplayed()||(this.getToolbarActionsElement().style.display="block"),this.delayShowTimeout=this.base.delay(function(){this.showToolbar()}.bind(this))},hideExtensionForms:function(){this.forEachExtension(function(a){a.hasForm&&a.isDisplayed()&&a.hideForm()})},multipleBlockElementsSelected:function(){var b=/<[^\/>][^>]*><\/[^>]+>/gim,c=new RegExp("<("+a.util.blockContainerElementNames.join("|")+")[^>]*>","g"),d=a.selection.getSelectionHtml(this.document).replace(b,""),e=d.match(c);return!!e&&e.length>1},modifySelection:function(){var b=this.window.getSelection(),c=b.getRangeAt(0);if(this.standardizeSelectionStart&&c.startContainer.nodeValue&&c.startOffset===c.startContainer.nodeValue.length){var d=a.util.findAdjacentTextNodeWithContent(a.selection.getSelectionElement(this.window),c.startContainer,this.document);if(d){for(var e=0;0===d.nodeValue.substr(e,1).trim().length;)e+=1;c=a.selection.select(this.document,d,e,c.endContainer,c.endOffset)}}},checkState:function(){if(!this.base.preventSelectionUpdates){if(!this.base.getFocusedElement()||a.selection.selectionInContentEditableFalse(this.window))return this.hideToolbar();var b=a.selection.getSelectionElement(this.window);return!b||-1===this.getEditorElements().indexOf(b)||b.getAttribute("data-disable-toolbar")?this.hideToolbar():this.updateOnEmptySelection&&this["static"]?this.showAndUpdateToolbar():!a.selection.selectionContainsContent(this.document)||this.allowMultiParagraphSelection===!1&&this.multipleBlockElementsSelected()?this.hideToolbar():void this.showAndUpdateToolbar()}},showAndUpdateToolbar:function(){this.modifySelection(),this.setToolbarButtonStates(),this.trigger("positionToolbar",{},this.base.getFocusedElement()),this.showToolbarDefaultActions(),this.setToolbarPosition()},setToolbarButtonStates:function(){this.forEachExtension(function(a){"function"==typeof a.isActive&&"function"==typeof a.setInactive&&a.setInactive()}),this.checkActiveButtons()},checkActiveButtons:function(){var b,c=[],d=null,e=a.selection.getSelectionRange(this.document),f=function(a){"function"==typeof a.checkState?a.checkState(b):"function"==typeof a.isActive&&"function"==typeof a.isAlreadyApplied&&"function"==typeof a.setActive&&!a.isActive()&&a.isAlreadyApplied(b)&&a.setActive()};if(e&&(this.forEachExtension(function(a){return"function"==typeof a.queryCommandState&&(d=a.queryCommandState(),null!==d)?void(d&&"function"==typeof a.setActive&&a.setActive()):void c.push(a)}),b=a.selection.getSelectedParentElement(e),this.getEditorElements().some(function(c){return a.util.isDescendant(c,b,!0)})))for(;b&&(c.forEach(f),!a.util.isMediumEditorElement(b));)b=b.parentNode},positionToolbarIfShown:function(){this.isDisplayed()&&this.setToolbarPosition()},setToolbarPosition:function(){var a,b=this.base.getFocusedElement(),c=this.window.getSelection();return b?(this["static"]&&!this.relativeContainer?(this.showToolbar(),this.positionStaticToolbar(b)):c.isCollapsed||(this.showToolbar(),this.relativeContainer||this.positionToolbar(c)),a=this.base.getExtensionByName("anchor-preview"),void(a&&"function"==typeof a.hidePreview&&a.hidePreview())):this},positionStaticToolbar:function(a){this.getToolbarElement().style.left="0";var b,c=this.document.documentElement&&this.document.documentElement.scrollTop||this.document.body.scrollTop,d=this.window.innerWidth,e=this.getToolbarElement(),f=a.getBoundingClientRect(),g=f.top+c,h=f.left+f.width/2,i=e.offsetHeight,j=e.offsetWidth,k=j/2;switch(this.sticky?c>g+a.offsetHeight-i?(e.style.top=g+a.offsetHeight-i+"px",e.classList.remove("medium-editor-sticky-toolbar")):c>g-i?(e.classList.add("medium-editor-sticky-toolbar"),e.style.top="0px"):(e.classList.remove("medium-editor-sticky-toolbar"),e.style.top=g-i+"px"):e.style.top=g-i+"px",this.align){case"left":b=f.left;break;case"right":b=f.right-j;break;case"center":b=h-k}0>b?b=0:b+j>d&&(b=d-Math.ceil(j)-1),e.style.left=b+"px"},positionToolbar:function(a){this.getToolbarElement().style.left="0";var b=a.getRangeAt(0),c=b.getBoundingClientRect();(!c||0===c.height&&0===c.width&&b.startContainer===b.endContainer)&&(c=1===b.startContainer.nodeType&&b.startContainer.querySelector("img")?b.startContainer.querySelector("img").getBoundingClientRect():b.startContainer.getBoundingClientRect());var d=this.window.innerWidth,e=(c.left+c.right)/2,f=this.getToolbarElement(),g=f.offsetHeight,h=f.offsetWidth,i=h/2,j=50,k=this.diffLeft-i;c.tope?f.style.left=k+i+"px":i>d-e?f.style.left=d+k-i+"px":f.style.left=k+e+"px"}});a.extensions.toolbar=b}(),function(){var b=a.Extension.extend({init:function(){a.Extension.prototype.init.apply(this,arguments),this.subscribe("editableDrag",this.handleDrag.bind(this)),this.subscribe("editableDrop",this.handleDrop.bind(this))},handleDrag:function(a){var b="medium-editor-dragover";a.preventDefault(),a.dataTransfer.dropEffect="copy","dragover"===a.type?a.target.classList.add(b):"dragleave"===a.type&&a.target.classList.remove(b)},handleDrop:function(b){var c,d="medium-editor-dragover";b.preventDefault(),b.stopPropagation(),b.dataTransfer.files&&(c=Array.prototype.slice.call(b.dataTransfer.files,0),c.some(function(b){if(b.type.match("image")){var c,d;c=new FileReader,c.readAsDataURL(b),d="medium-img-"+ +new Date,a.util.insertHTMLCommand(this.document,''),c.onload=function(){var a=this.document.getElementById(d);a&&(a.removeAttribute("id"),a.removeAttribute("class"),a.src=c.result)}.bind(this)}}.bind(this))),b.target.classList.remove(d)}});a.extensions.imageDragging=b}(),function(){function b(b){var c=a.selection.getSelectionStart(this.options.ownerDocument),d=c.textContent,e=a.selection.getCaretOffsets(c);(void 0===d[e.left-1]||""===d[e.left-1].trim())&&b.preventDefault()}function c(b,c){if(this.options.disableReturn||c.getAttribute("data-disable-return"))b.preventDefault();else if(this.options.disableDoubleReturn||c.getAttribute("data-disable-double-return")){var d=a.selection.getSelectionStart(this.options.ownerDocument);(d&&""===d.textContent.trim()&&"li"!==d.nodeName.toLowerCase()||d.previousElementSibling&&"br"!==d.previousElementSibling.nodeName.toLowerCase()&&""===d.previousElementSibling.textContent.trim())&&b.preventDefault()}}function d(b){var c=a.selection.getSelectionStart(this.options.ownerDocument),d=c&&c.nodeName.toLowerCase();"pre"===d&&(b.preventDefault(),a.util.insertHTMLCommand(this.options.ownerDocument," ")),a.util.isListItem(c)&&(b.preventDefault(),b.shiftKey?this.options.ownerDocument.execCommand("outdent",!1,null):this.options.ownerDocument.execCommand("indent",!1,null))}function e(b){var c,d=a.selection.getSelectionStart(this.options.ownerDocument),e=d.nodeName.toLowerCase(),f=/^(\s+|)?$/i,g=/h\d/i;a.util.isKey(b,[a.util.keyCode.BACKSPACE,a.util.keyCode.ENTER])&&d.previousElementSibling&&g.test(e)&&0===a.selection.getCaretOffsets(d).left?a.util.isKey(b,a.util.keyCode.BACKSPACE)&&f.test(d.previousElementSibling.innerHTML)?(d.previousElementSibling.parentNode.removeChild(d.previousElementSibling),b.preventDefault()):a.util.isKey(b,a.util.keyCode.ENTER)&&(c=this.options.ownerDocument.createElement("p"),c.innerHTML="
",d.previousElementSibling.parentNode.insertBefore(c,d),b.preventDefault()):a.util.isKey(b,a.util.keyCode.DELETE)&&d.nextElementSibling&&d.previousElementSibling&&!g.test(e)&&f.test(d.innerHTML)&&g.test(d.nextElementSibling.nodeName.toLowerCase())?(a.selection.moveCursor(this.options.ownerDocument,d.nextElementSibling),d.previousElementSibling.parentNode.removeChild(d),b.preventDefault()):a.util.isKey(b,a.util.keyCode.BACKSPACE)&&"li"===e&&f.test(d.innerHTML)&&!d.previousElementSibling&&!d.parentElement.previousElementSibling&&d.nextElementSibling&&"li"===d.nextElementSibling.nodeName.toLowerCase()?(c=this.options.ownerDocument.createElement("p"),c.innerHTML="
",d.parentElement.parentElement.insertBefore(c,d.parentElement),a.selection.moveCursor(this.options.ownerDocument,c),d.parentElement.removeChild(d),b.preventDefault()):a.util.isKey(b,a.util.keyCode.BACKSPACE)&&a.util.getClosestTag(d,"blockquote")!==!1&&0===a.selection.getCaretOffsets(d).left&&(b.preventDefault(),a.util.execFormatBlock(this.options.ownerDocument,"p"))}function f(b){var c,d=a.selection.getSelectionStart(this.options.ownerDocument);d&&(a.util.isMediumEditorElement(d)&&0===d.children.length&&this.options.ownerDocument.execCommand("formatBlock",!1,"p"),a.util.isKey(b,a.util.keyCode.ENTER)&&!a.util.isListItem(d)&&(c=d.nodeName.toLowerCase(),"a"===c?this.options.ownerDocument.execCommand("unlink",!1,null):b.shiftKey||b.ctrlKey||/h\d/.test(c)||this.options.ownerDocument.execCommand("formatBlock",!1,"p")))}function g(a){a._mediumEditors||(a._mediumEditors=[null]),this.id||(this.id=a._mediumEditors.length),a._mediumEditors[this.id]=this}function h(a){a._mediumEditors&&a._mediumEditors[this.id]&&(a._mediumEditors[this.id]=null)}function i(b){b||(b=[]),"string"==typeof b&&(b=this.options.ownerDocument.querySelectorAll(b)),a.util.isElement(b)&&(b=[b]);var c=Array.prototype.slice.apply(b);this.elements=[],c.forEach(function(a,b){"textarea"===a.nodeName.toLowerCase()?this.elements.push(s.call(this,a,b)):this.elements.push(a)},this)}function j(a,b){return Object.keys(b).forEach(function(c){void 0===a[c]&&(a[c]=b[c])}),a}function k(a,b,c){var d={window:c.options.contentWindow,document:c.options.ownerDocument,base:c};return a=j(a,d),"function"==typeof a.init&&a.init(),a.name||(a.name=b),a}function l(){return this.elements.every(function(a){return!!a.getAttribute("data-disable-toolbar")})?!1:this.options.toolbar!==!1}function m(){return l.call(this)?this.options.anchorPreview!==!1:!1}function n(){return this.options.placeholder!==!1}function o(){return this.options.autoLink!==!1}function p(){return this.options.imageDragging!==!1}function q(){return this.options.keyboardCommands!==!1}function r(){return!this.options.extensions.imageDragging}function s(a,b){for(var c=this.options.ownerDocument.createElement("div"),d=Date.now(),e="medium-editor-"+d+"-"+b,f=a.attributes;this.options.ownerDocument.getElementById(e);)d++,e="medium-editor-"+d+"-"+b;c.className=a.className,c.id=e,c.innerHTML=a.value,a.setAttribute("medium-editor-textarea-id",e);for(var g=0,h=f.length;h>g;g++)c.hasAttribute(f[g].nodeName)||c.setAttribute(f[g].nodeName,f[g].nodeValue);return a.classList.add("medium-editor-hidden"),a.parentNode.insertBefore(c,a),c}function t(){var a=!1;this.elements.forEach(function(b,c){this.options.disableEditing||b.getAttribute("data-disable-editing")||(b.setAttribute("contentEditable",!0),b.setAttribute("spellcheck",this.options.spellcheck)),b.setAttribute("data-medium-editor-element",!0),b.setAttribute("role","textbox"),b.setAttribute("aria-multiline",!0),b.setAttribute("medium-editor-index",c),b.hasAttribute("medium-editor-textarea-id")&&(a=!0)},this),a&&this.subscribe("editableInput",function(a,b){var c=b.parentNode.querySelector('textarea[medium-editor-textarea-id="'+b.getAttribute("medium-editor-textarea-id")+'"]');c&&(c.value=this.serialize()[b.id].value)}.bind(this))}function u(){var a;if(this.subscribe("editableKeydownTab",d.bind(this)),this.subscribe("editableKeydownDelete",e.bind(this)),this.subscribe("editableKeydownEnter",e.bind(this)),this.options.disableExtraSpaces&&this.subscribe("editableKeydownSpace",b.bind(this)),this.options.disableReturn||this.options.disableDoubleReturn)this.subscribe("editableKeydownEnter",c.bind(this));else for(a=0;a=0&&(d=a.selection.exportSelection(b,this.options.ownerDocument)),null!==d&&0!==c&&(d.editableElementIndex=c),d},saveSelection:function(){this.selectionState=this.exportSelection()},importSelection:function(b,c){if(b){var d=this.elements[b.editableElementIndex||0];a.selection.importSelection(b,d,this.options.ownerDocument,c)}},restoreSelection:function(){this.importSelection(this.selectionState)},createLink:function(b){var c=a.selection.getSelectionElement(this.options.contentWindow),d={};if(-1!==this.elements.indexOf(c)){try{if(this.events.disableCustomEvent("editableInput"),b.url&&b.url.trim().length>0){var e=this.options.contentWindow.getSelection();if(e){var f,g,h,i,j=e.getRangeAt(0),k=j.commonAncestorContainer;if(3===j.endContainer.nodeType&&3!==j.startContainer.nodeType&&0===j.startOffset&&j.startContainer.firstChild===j.endContainer&&(k=j.endContainer),g=a.util.getClosestBlockContainer(j.startContainer),h=a.util.getClosestBlockContainer(j.endContainer),3!==k.nodeType&&0!==k.textContent.length&&g===h){var l=g||c,m=this.options.ownerDocument.createDocumentFragment();this.execAction("unlink"),f=this.exportSelection(),m.appendChild(l.cloneNode(!0)),c===l?a.selection.select(this.options.ownerDocument,l.firstChild,0,l.lastChild,3===l.lastChild.nodeType?l.lastChild.nodeValue.length:l.lastChild.childNodes.length):a.selection.select(this.options.ownerDocument,l,0,l,l.childNodes.length);var n=this.exportSelection();i=a.util.findOrCreateMatchingTextNodes(this.options.ownerDocument,m,{start:f.start-n.start,end:f.end-n.start,editableElementIndex:f.editableElementIndex}),0===i.length&&(m=this.options.ownerDocument.createDocumentFragment(),m.appendChild(k.cloneNode(!0)),i=[m.firstChild.firstChild,m.firstChild.lastChild]),a.util.createLink(this.options.ownerDocument,i,b.url.trim());var o=(m.firstChild.innerHTML.match(/^\s+/)||[""])[0].length;a.util.insertHTMLCommand(this.options.ownerDocument,m.firstChild.innerHTML.replace(/^\s+/,"")),f.start-=o,f.end-=o,this.importSelection(f)}else this.options.ownerDocument.execCommand("createLink",!1,b.url);(this.options.targetBlank||"_blank"===b.target)&&a.util.setTargetBlank(a.selection.getSelectionStart(this.options.ownerDocument),b.url),b.buttonClass&&a.util.addClassToAnchors(a.selection.getSelectionStart(this.options.ownerDocument),b.buttonClass)}}if(this.options.targetBlank||"_blank"===b.target||b.buttonClass){d=this.options.ownerDocument.createEvent("HTMLEvents"),d.initEvent("input",!0,!0,this.options.contentWindow);for(var p=0;p1?b[1]:"";return{major:parseInt(c[0],10),minor:parseInt(c[1],10),revision:parseInt(c[2],10),preRelease:d,toString:function(){return[c[0],c[1],c[2]].join(".")+(d?"-"+d:"")}}},a.version=a.parseVersionString.call(this,{version:"5.12.0"}.version),a}()); \ No newline at end of file
'; if ($new->comment != "") { - print "
"; - print "
";
+			print "
"; + print "
";
 			print htmlspecialchars($new->comment);
 			print '
'; print '
'; @@ -955,46 +955,46 @@ $this->load->view (
-
+
type), - 'id="issue_show_mainarea_edit_type" disabled="disabled"' + 'id="issue_show_edit_type" disabled="disabled"' ); ?> - ' value='summary); ?>'/> + ' value='summary); ?>'/>
-
+
-
- +
+
-
+
-
- +
+ lang->line('MSG_SURE_TO_DELETE_THIS') . ' - ' . $issue->id . ': ' . htmlspecialchars($issue->summary); ?>
-
-
- -
+
+
+ +
-
+
load->view ( print ''; } ?> @@ -1016,7 +1016,7 @@ $this->load->view ( -
+
id}/{$hex_issue_id}/", 'id="issue_change_form"')?> @@ -1096,11 +1096,11 @@ $this->load->view (
-
+
lang->line ('ISSUE_MSG_CONFIRM_UNDO')?>
-
+
@@ -1118,8 +1118,8 @@ $this->load->view ( function render_wiki() { creole_render_wiki ( - "issue_show_mainarea_description_pre", - "issue_show_mainarea_description", + "issue_show_description_pre", + "issue_show_description", "", "" ); @@ -1130,8 +1130,8 @@ function render_wiki() for ($xxx = 0; $xxx < $commentno; $xxx++) { print "creole_render_wiki ( - 'issue_show_mainarea_changes_comment_pre_{$xxx}', - 'issue_show_mainarea_changes_comment_{$xxx}', + 'issue_show_changes_comment_pre_{$xxx}', + 'issue_show_changes_comment_{$xxx}', '{$creole_base}', '{$creole_file_base}');"; } diff --git a/codepot/src/codepot/views/wiki_edit.php b/codepot/src/codepot/views/wiki_edit.php index 2bc7ce78..6b4674ab 100644 --- a/codepot/src/codepot/views/wiki_edit.php +++ b/codepot/src/codepot/views/wiki_edit.php @@ -23,7 +23,7 @@ converter->AsciiToHex ($wiki->name); +$hex_wikiname = $this->converter->AsciiToHex ($wiki->name); ?> + + + + + + + + + + + + + + + + + + + + + + + + + +converter->AsciiToHex ($wiki->name); +?> + + + +<?php print htmlspecialchars($wiki->name)?> + + + + +
+ + + +load->view ('taskbar'); ?> + + + +load->view ( + 'projectbar', + array ( + 'banner' => NULL, + + 'page' => array ( + 'type' => 'project', + 'id' => 'wiki', + 'project' => $project, + ), + + 'ctxmenuitems' => array () + ) +); +?> + + + +
+ +
+
+ + + +
+
+ +
+ attachments)): ?> + lang->line('WIKI_ATTACHMENTS').': ', 'wiki_edit_attachment_list')?> + +
    + attachments as $att) + { + $hexattname = + $this->converter->AsciiToHex($att->name) . + '@' . + $this->converter->AsciiToHex($att->encname); + $escattname = htmlspecialchars($att->name); + + print '
  • '; + print ""; + print $escattname; + print '
  • '; + } + ?> +
+ + + + lang->line('WIKI_NEW_ATTACHMENTS').': ', 'wiki_edit_new_attachment_list')?> + + lang->line('WIKI_MORE_NEW_ATTACHMENTS')?> + + +
    +
  • + + +
  • +
+
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+ + + +load->view ('footer'); ?> + + + + + + + diff --git a/codepot/src/codepot/views/wiki_home.php b/codepot/src/codepot/views/wiki_home.php index 382c4b09..5cda72de 100644 --- a/codepot/src/codepot/views/wiki_home.php +++ b/codepot/src/codepot/views/wiki_home.php @@ -15,6 +15,42 @@ <?php print htmlspecialchars($project->name)?> + + + @@ -55,6 +91,10 @@ $this->load->view (
lang->line('Wikis');?>
@@ -78,6 +118,9 @@ else } ?>
+ +
+ diff --git a/codepot/src/codepot/views/wiki_show.php b/codepot/src/codepot/views/wiki_show.php index 5af5ca97..5fa223bc 100644 --- a/codepot/src/codepot/views/wiki_show.php +++ b/codepot/src/codepot/views/wiki_show.php @@ -41,7 +41,7 @@ function render_wiki() if (x_column_count > 1) { column_count = x_column_count.toString(); - $("#wiki_show_mainarea_wiki").css ({ + $("#wiki_show_wiki").css ({ "-moz-column-count": column_count, "-webkit-column-count": column_count, "column-count": column_count @@ -49,8 +49,8 @@ function render_wiki() } creole_render_wiki ( - "wiki_show_mainarea_wiki_text", - "wiki_show_mainarea_wiki", + "wiki_show_wiki_text", + "wiki_show_wiki", "/wiki/show/id?>/", "/wiki/attachment/id?>//" ); @@ -59,7 +59,7 @@ function render_wiki() } $(function () { - $('#wiki_show_mainarea_metadata').accordion({ + $('#wiki_show_metadata').accordion({ collapsible: true, heightStyle: "content" }); @@ -113,14 +113,14 @@ $this->load->view (
-
+
-
-
lang->line('Metadata')?>
-
+
+
lang->line('Metadata')?>
+
-
-
    +
    +
    • lang->line('Created on')?> createdon); ?>
    • lang->line('Created by')?> createdby); ?>
    • lang->line('Last updated on')?> updatedon); ?>
    • @@ -128,8 +128,8 @@ $this->load->view (
    -
    -
      +
      +
        attachments as $att) { @@ -150,13 +150,13 @@ $this->load->view (
      -
      -
      -
    +
diff --git a/codepot/src/css/Makefile.am b/codepot/src/css/Makefile.am index 8bd4472f..808faf59 100644 --- a/codepot/src/css/Makefile.am +++ b/codepot/src/css/Makefile.am @@ -10,6 +10,9 @@ www_DATA = \ jquery-ui.css \ jqueryui-editable.css \ log.css \ + medium-editor.min.css \ + medium-editor-tables.min.css \ + medium-editor-theme.min.css \ project.css \ site.css \ user.css \ diff --git a/codepot/src/css/Makefile.in b/codepot/src/css/Makefile.in index 66a4bc02..8d1c7090 100644 --- a/codepot/src/css/Makefile.in +++ b/codepot/src/css/Makefile.in @@ -163,6 +163,9 @@ www_DATA = \ jquery-ui.css \ jqueryui-editable.css \ log.css \ + medium-editor.min.css \ + medium-editor-tables.min.css \ + medium-editor-theme.min.css \ project.css \ site.css \ user.css \ diff --git a/codepot/src/css/code.css b/codepot/src/css/code.css index c3321333..ddb73764 100644 --- a/codepot/src/css/code.css +++ b/codepot/src/css/code.css @@ -193,7 +193,7 @@ /*----------------------------------------------- * project source edit view *-----------------------------------------------*/ -#code_edit_mainarea_result_code { +#code_edit_result_code { font-family: consolas, monaco, "Andale Mono", monospace; overflow: auto; border: none; diff --git a/codepot/src/css/issue.css b/codepot/src/css/issue.css index 43ce8f1c..8806f9b8 100644 --- a/codepot/src/css/issue.css +++ b/codepot/src/css/issue.css @@ -95,107 +95,107 @@ li.issue-owner { /*--------------------------------------------- * issue home *---------------------------------------------*/ -#issue_home_mainarea_result { +#issue_home_result { overflow: auto; } -#issue_home_mainarea_result_table tr { +#issue_home_result_table tr { vertical-align: text-top; } -#issue_home_mainarea_result_table tr.new td.status, -#issue_home_mainarea_result_table tr.new td.summary { +#issue_home_result_table tr.new td.status, +#issue_home_result_table tr.new td.summary { background-color: #ffccbb; background-color: rgba(255, 204, 187, 0.5); } -#issue_home_mainarea_result_table tr.accepted td.status, -#issue_home_mainarea_result_table tr.accepted td.summary { +#issue_home_result_table tr.accepted td.status, +#issue_home_result_table tr.accepted td.summary { } -#issue_home_mainarea_result_table tr.rejected td.status, -#issue_home_mainarea_result_table tr.rejected td.summary { +#issue_home_result_table tr.rejected td.status, +#issue_home_result_table tr.rejected td.summary { background-color: #ffeedd; background-color: rgba(255, 238, 221, 0.5); } -#issue_home_mainarea_result_table tr.started td.status, -#issue_home_mainarea_result_table tr.started td.summary { +#issue_home_result_table tr.started td.status, +#issue_home_result_table tr.started td.summary { background-color: #ddeeff; background-color: rgba(221, 238, 255, 0.5); } -#issue_home_mainarea_result_table tr.stalled td.status, -#issue_home_mainarea_result_table tr.stalled td.summary { +#issue_home_result_table tr.stalled td.status, +#issue_home_result_table tr.stalled td.summary { background-color: #bbccff; background-color: rgba(187, 204, 255, 0.5); } -#issue_home_mainarea_result_table tr.resolved td.status, -#issue_home_mainarea_result_table tr.resolved td.summary { +#issue_home_result_table tr.resolved td.status, +#issue_home_result_table tr.resolved td.summary { background-color: #ddffdd; background-color: rgba(221, 255, 221, 0.5); } -#issue_home_mainarea_result_table tr.other td.status, -#issue_home_mainarea_result_table tr.other td.summary { +#issue_home_result_table tr.other td.status, +#issue_home_result_table tr.other td.summary { background-color: #ddeeff; background-color: rgba(221, 238, 255, 0.5); } -#issue_home_mainarea_result_table td.id, -#issue_home_mainarea_result_table td.type, -#issue_home_mainarea_result_table td.status, -#issue_home_mainarea_result_table td.priority, -#issue_home_mainarea_result_table td.owner { +#issue_home_result_table td.id, +#issue_home_result_table td.type, +#issue_home_result_table td.status, +#issue_home_result_table td.priority, +#issue_home_result_table td.owner { width: 1px; } -#issue_home_mainarea_result_table td.summary { +#issue_home_result_table td.summary { white-space: normal; } -#issue_home_mainarea_result_pages { +#issue_home_result_pages { margin-top: 1em; text-align: center; width: 100%; } -#issue_home_mainarea_search_form { +#issue_home_search_form { } -#issue_home_mainarea_search_form div { +#issue_home_search_form div { padding: 0.2em; } /*--------------------------------------------- * issue show *---------------------------------------------*/ -#issue_show_mainarea_state_body { +#issue_show_state_body { background-color: #FCFCFC; padding: 1em 1em; } -#issue_show_mainarea_state_body ul { +#issue_show_state_body ul { padding: 0; margin: 0; list-style: outside none none; } -#issue_show_mainarea_state_body ul li { +#issue_show_state_body ul li { padding: 0.2em 0.2em 0.2em 0.2em; margin: 0 0.2em 0 0.2em; float: left; } -#issue_show_mainarea_change_form { +#issue_show_change_form { } -#issue_show_mainarea_change_form div { +#issue_show_change_form div { padding: 0.2em; } -#issue_show_mainarea_change_form textarea { +#issue_show_change_form textarea { -moz-box-shadow: 0 2px 4px #bbb inset; -webkit-box-shadow: 0 2px 4px #BBB inset; box-shadow: 0 2px 4px #BBB inset; @@ -208,47 +208,47 @@ li.issue-owner { font-size: 0.9em; } -#issue_show_mainarea_files { +#issue_show_files { padding-top: 0.5em; } -#issue_show_mainarea_changes { +#issue_show_changes { margin-top: 1em; padding-top: 0.5em; padding-bottom: 0.5em; overflow: auto; } -#issue_show_mainarea_changes .infostrip { +#issue_show_changes .infostrip { margin-bottom: 0.5em; } -#issue_show_mainarea_changes .infostrip .title { +#issue_show_changes .infostrip .title { float: left; } -#issue_show_mainarea_changes_table td.date { +#issue_show_changes_table td.date { min-width: 5em; width: 1px; } -#issue_show_mainarea_changes_table td.updater { +#issue_show_changes_table td.updater { width: 1px; } -#issue_show_mainarea_changes_table td.details { +#issue_show_changes_table td.details { overflow: auto; } -#issue_show_mainarea_changes_table td.details .list { +#issue_show_changes_table td.details .list { background-color: #F1F1FF; } -#issue_show_mainarea_changes_table td.details .list ul li { +#issue_show_changes_table td.details .list ul li { padding-bottom: 0.3em; } -#issue_show_mainarea_changes_table .issue_changes_comment .prettyprint { +#issue_show_changes_table .issue_changes_comment .prettyprint { /* special pre-wrap rule to make the pretty-printed text to wrap * in the issue comment listing. i didn't manage to get oveflow: auto * or overflow: scroll to make make a scroll bar show up. */ @@ -293,51 +293,28 @@ li.issue-owner { font-size: 0.8em; } -/*--------------------------------------------- - * issue edit - *---------------------------------------------*/ -#issue_edit_mainarea_type { - padding-bottom: 0.3em; -} - -#issue_edit_mainarea form textarea { - display: block; - padding: 1px; - font-size: inherit; - width: 100%; -} - -#project_issue_summary { - width: 100%; -} - -#issue_edit_mainarea_buttons { - padding-top: 0.5em; -} - - /*----------------------------------------------- * issue home view - new issue dialog *-----------------------------------------------*/ -#issue_home_mainarea_new_description_tabs { +#issue_home_new_description_tabs { border: none !important; } -#issue_home_mainarea_new_description_tabs .ui-tabs-panel { +#issue_home_new_description_tabs .ui-tabs-panel { padding: 0.2em 0em 0em 0em !important; } -#issue_home_mainarea_new_description_tabs .ui-widget-header { +#issue_home_new_description_tabs .ui-widget-header { border: none !important; background: none !important; padding: 0em !important; } -#issue_home_mainarea_new_description_tabs .ui-tabs-nav { +#issue_home_new_description_tabs .ui-tabs-nav { padding: 0em !important; } -/* #issue_home_mainarea_new_description_tabs .ui-tabs-nav li { */ +/* #issue_home_new_description_tabs .ui-tabs-nav li { */ .ui-tabs .ui-tabs-nav li.ui-state-default { border-bottom: 1px solid #cccccc !important; } @@ -349,25 +326,25 @@ li.issue-owner { /*----------------------------------------------- * issue home show - edit issue dialog *-----------------------------------------------*/ -#issue_show_mainarea_edit_description_tabs { +#issue_show_edit_description_tabs { border: none !important; } -#issue_show_mainarea_edit_description_tabs .ui-tabs-panel { +#issue_show_edit_description_tabs .ui-tabs-panel { padding: 0.2em 0em 0em 0em !important; } -#issue_show_mainarea_edit_description_tabs .ui-widget-header { +#issue_show_edit_description_tabs .ui-widget-header { border: none !important; background: none !important; padding: 0em !important; } -#issue_show_mainarea_edit_description_tabs .ui-tabs-nav { +#issue_show_edit_description_tabs .ui-tabs-nav { padding: 0em !important; } -/* #issue_show_mainarea_edit_description_tabs .ui-tabs-nav li { */ +/* #issue_show_edit_description_tabs .ui-tabs-nav li { */ .ui-tabs .ui-tabs-nav li.ui-state-default { border-bottom: 1px solid #cccccc !important; } diff --git a/codepot/src/css/medium-editor-tables.min.css b/codepot/src/css/medium-editor-tables.min.css new file mode 100644 index 00000000..0547e296 --- /dev/null +++ b/codepot/src/css/medium-editor-tables.min.css @@ -0,0 +1 @@ +.medium-editor-table-builder{display:none;position:absolute;left:0;top:101%}.medium-editor-table-builder *{box-sizing:border-box}.medium-editor-table-builder-grid{border:1px solid #000;border-radius:3px;height:162px;overflow:hidden;width:162px}.medium-editor-table-builder-cell{background-color:#333;border:1px solid #000;display:block;float:left;height:16px;margin:0;width:16px}.medium-editor-table-builder-cell.active,.medium-editor-table-builder-cell:hover{background-color:#ccc}.medium-editor-table{border-collapse:collapse;resize:both;table-layout:fixed}.medium-editor-table,.medium-editor-table td{border:1px dashed #e3e3e3}.medium-editor-table-builder-toolbar{display:block;background-color:#333;font-size:.8em;color:#fff}.medium-editor-table-builder-toolbar span{width:45px;display:block;float:left;margin-left:5px}.medium-editor-table-builder-toolbar button{margin:0 3px;background-color:#333;border:0;width:30px;cursor:pointer}.medium-editor-table-builder-toolbar button i{color:#fff} \ No newline at end of file diff --git a/codepot/src/css/medium-editor-theme.min.css b/codepot/src/css/medium-editor-theme.min.css new file mode 100644 index 00000000..526f6888 --- /dev/null +++ b/codepot/src/css/medium-editor-theme.min.css @@ -0,0 +1 @@ +.medium-toolbar-arrow-under:after{border-color:#000 transparent transparent;top:40px}.medium-toolbar-arrow-over:before{border-color:transparent transparent #000}.medium-editor-toolbar{background-color:#000;border:none;border-radius:50px}.medium-editor-toolbar li button{background-color:transparent;border:none;box-sizing:border-box;color:#ccc;height:40px;min-width:40px;padding:5px 12px;-webkit-transition:background-color .2s ease-in,color .2s ease-in;transition:background-color .2s ease-in,color .2s ease-in}.medium-editor-toolbar li .medium-editor-button-active,.medium-editor-toolbar li button:hover{background-color:#000;color:#a2d7c7}.medium-editor-toolbar li .medium-editor-button-first{border-bottom-left-radius:50px;border-top-left-radius:50px;padding-left:24px}.medium-editor-toolbar li .medium-editor-button-last{border-bottom-right-radius:50px;border-right:none;border-top-right-radius:50px;padding-right:24px}.medium-editor-toolbar-form{background:#000;border-radius:50px;color:#ccc;overflow:hidden}.medium-editor-toolbar-form .medium-editor-toolbar-input{background:#000;box-sizing:border-box;color:#ccc;height:40px;padding-left:16px;width:220px}.medium-editor-toolbar-form .medium-editor-toolbar-input::-webkit-input-placeholder{color:#f8f5f3;color:rgba(248,245,243,.8)}.medium-editor-toolbar-form .medium-editor-toolbar-input:-moz-placeholder{color:#f8f5f3;color:rgba(248,245,243,.8)}.medium-editor-toolbar-form .medium-editor-toolbar-input::-moz-placeholder{color:#f8f5f3;color:rgba(248,245,243,.8)}.medium-editor-toolbar-form .medium-editor-toolbar-input:-ms-input-placeholder{color:#f8f5f3;color:rgba(248,245,243,.8)}.medium-editor-toolbar-form a{color:#ccc;-webkit-transform:translateY(2px);-ms-transform:translateY(2px);transform:translateY(2px)}.medium-editor-toolbar-form .medium-editor-toolbar-close{margin-right:16px}.medium-editor-toolbar-anchor-preview{background:#000;border-radius:50px;padding:5px 12px}.medium-editor-anchor-preview a{color:#ccc;text-decoration:none} \ No newline at end of file diff --git a/codepot/src/css/medium-editor.min.css b/codepot/src/css/medium-editor.min.css new file mode 100644 index 00000000..b4d76117 --- /dev/null +++ b/codepot/src/css/medium-editor.min.css @@ -0,0 +1 @@ +.medium-editor-anchor-preview,.medium-editor-toolbar{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:16px;z-index:2000}@-webkit-keyframes medium-editor-image-loading{0%{-webkit-transform:scale(0);transform:scale(0)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes medium-editor-image-loading{0%{-webkit-transform:scale(0);transform:scale(0)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes medium-editor-pop-upwards{0%{opacity:0;-webkit-transform:matrix(.97,0,0,1,0,12);transform:matrix(.97,0,0,1,0,12)}20%{opacity:.7;-webkit-transform:matrix(.99,0,0,1,0,2);transform:matrix(.99,0,0,1,0,2)}40%{opacity:1;-webkit-transform:matrix(1,0,0,1,0,-1);transform:matrix(1,0,0,1,0,-1)}100%{-webkit-transform:matrix(1,0,0,1,0,0);transform:matrix(1,0,0,1,0,0)}}@keyframes medium-editor-pop-upwards{0%{opacity:0;-webkit-transform:matrix(.97,0,0,1,0,12);transform:matrix(.97,0,0,1,0,12)}20%{opacity:.7;-webkit-transform:matrix(.99,0,0,1,0,2);transform:matrix(.99,0,0,1,0,2)}40%{opacity:1;-webkit-transform:matrix(1,0,0,1,0,-1);transform:matrix(1,0,0,1,0,-1)}100%{-webkit-transform:matrix(1,0,0,1,0,0);transform:matrix(1,0,0,1,0,0)}}.medium-editor-anchor-preview{left:0;line-height:1.4;max-width:280px;position:absolute;text-align:center;top:0;word-break:break-all;word-wrap:break-word;visibility:hidden}.medium-editor-anchor-preview a{color:#fff;display:inline-block;margin:5px 5px 10px}.medium-editor-anchor-preview-active{visibility:visible}.medium-editor-dragover{background:#ddd}.medium-editor-image-loading{-webkit-animation:medium-editor-image-loading 1s infinite ease-in-out;animation:medium-editor-image-loading 1s infinite ease-in-out;background-color:#333;border-radius:100%;display:inline-block;height:40px;width:40px}.medium-editor-placeholder{position:relative}.medium-editor-placeholder:after{content:attr(data-placeholder)!important;font-style:italic;left:0;position:absolute;top:0;white-space:pre;padding:inherit;margin:inherit}.medium-toolbar-arrow-over:before,.medium-toolbar-arrow-under:after{border-style:solid;content:'';display:block;height:0;left:50%;margin-left:-8px;position:absolute;width:0}.medium-toolbar-arrow-under:after{border-width:8px 8px 0}.medium-toolbar-arrow-over:before{border-width:0 8px 8px;top:-8px}.medium-editor-toolbar{left:0;position:absolute;top:0;visibility:hidden}.medium-editor-toolbar ul{margin:0;padding:0}.medium-editor-toolbar li{float:left;list-style:none;margin:0;padding:0}.medium-editor-toolbar li button{box-sizing:border-box;cursor:pointer;display:block;font-size:14px;line-height:1.33;margin:0;padding:15px;text-decoration:none}.medium-editor-toolbar li button:focus{outline:0}.medium-editor-toolbar li .medium-editor-action-underline{text-decoration:underline}.medium-editor-toolbar li .medium-editor-action-pre{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;font-weight:100;padding:15px 0}.medium-editor-toolbar-active{visibility:visible}.medium-editor-sticky-toolbar{position:fixed;top:1px}.medium-editor-relative-toolbar{position:relative}.medium-editor-toolbar-active.medium-editor-stalker-toolbar{-webkit-animation:medium-editor-pop-upwards 160ms forwards linear;animation:medium-editor-pop-upwards 160ms forwards linear}.medium-editor-action-bold{font-weight:bolder}.medium-editor-action-italic{font-style:italic}.medium-editor-toolbar-form{display:none}.medium-editor-toolbar-form a,.medium-editor-toolbar-form input{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif}.medium-editor-toolbar-form .medium-editor-toolbar-form-row{line-height:14px;margin-left:5px;padding-bottom:5px}.medium-editor-toolbar-form .medium-editor-toolbar-input,.medium-editor-toolbar-form label{border:none;box-sizing:border-box;font-size:14px;margin:0;padding:6px;width:316px;display:inline-block}.medium-editor-toolbar-form .medium-editor-toolbar-input:focus,.medium-editor-toolbar-form label:focus{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;box-shadow:none;outline:0}.medium-editor-toolbar-form a{display:inline-block;font-size:24px;font-weight:bolder;margin:0 10px;text-decoration:none}.medium-editor-toolbar-actions:after{clear:both;content:"";display:table}[data-medium-editor-element] img{max-width:100%}[data-medium-editor-element] sub{vertical-align:sub}[data-medium-editor-element] sup{vertical-align:super}.medium-editor-hidden{display:none} \ No newline at end of file diff --git a/codepot/src/css/wiki.css b/codepot/src/css/wiki.css index ba4bb66e..b7d403c2 100644 --- a/codepot/src/css/wiki.css +++ b/codepot/src/css/wiki.css @@ -2,11 +2,11 @@ * wiki show *---------------------------------------------*/ -#wiki_show_mainarea_result { +#wiki_show_result { position: relative; } -#wiki_show_mainarea_wiki { +#wiki_show_wiki { margin-top: 0.5em; -moz-column-rule: 1px dotted grey; @@ -18,33 +18,33 @@ column-gap: 2em; } -#wiki_show_mainarea_metadata_body { +#wiki_show_metadata_body { background-color: #FCFCFC; } -#wiki_show_mainarea_metadata_body ul { +#wiki_show_metadata_body ul { padding: 0em 0.5em 0em 0.5em; margin: 0; } -#wiki_show_mainarea_metadata_list_div { +#wiki_show_metadata_list_div { float: left; } -#wiki_show_mainarea_attachment_list_div { +#wiki_show_attachment_list_div { margin-left: 2em; float: left; } -#wiki_show_mainarea_attachment_list { +#wiki_show_attachment_list { } -#wiki_show_mainarea_attachment_list a, -#wiki_show_mainarea_attachment_list a:visited, -#wiki_show_mainarea_attachment_list a:focus { +#wiki_show_attachment_list a, +#wiki_show_attachment_list a:visited, +#wiki_show_attachment_list a:focus { text-decoration: none; color: #111111; } -#wiki_show_mainarea_attachment_list a:hover { +#wiki_show_attachment_list a:hover { background-color: #1C94C4; color: #FFFFFF; } @@ -52,25 +52,18 @@ /*--------------------------------------------- * wiki edit *---------------------------------------------*/ -#wiki_edit_mainarea_form { - border: #D4DBE8 1px solid; - padding: 0.5em; +#wiki_edit_form { } -#wiki_edit_mainarea_text { - width: 100%; +#wiki_edit_text_editor { + margin: 0 !important; + padding: 0 !important; + width: 100% !important; + border: none !important; + background-color: #F9F9F9 !important; + overflow-y: auto !important; + overflow-x: visible !important; + outline: none !important; } -#wiki_edit_mainarea_text_preview { - -moz-column-rule: 1px dotted grey; - -webkit-column-rule: 1px dotted grey; - column-rule: 1px dotted grey; - -moz-column-gap: 2em; - -webkit-column-gap: 2em; - column-gap: 2em; -} - -#wiki_edit_mainarea_text_column_count { - font-size: 80%; -} diff --git a/codepot/src/js/Makefile.am b/codepot/src/js/Makefile.am index 3f0a9cd3..ee3bb3c8 100644 --- a/codepot/src/js/Makefile.am +++ b/codepot/src/js/Makefile.am @@ -24,6 +24,8 @@ www_DATA = \ excanvas.min.js \ jquery.flot.tickrotor.js \ jqueryui-editable.min.js \ + medium-editor.min.js \ + medium-editor-tables.min.js \ d3.min.js \ CodeFlower.js diff --git a/codepot/src/js/Makefile.in b/codepot/src/js/Makefile.in index 3e220d80..51e734fc 100644 --- a/codepot/src/js/Makefile.in +++ b/codepot/src/js/Makefile.in @@ -177,6 +177,8 @@ www_DATA = \ excanvas.min.js \ jquery.flot.tickrotor.js \ jqueryui-editable.min.js \ + medium-editor.min.js \ + medium-editor-tables.min.js \ d3.min.js \ CodeFlower.js diff --git a/codepot/src/js/medium-editor-tables.min.js b/codepot/src/js/medium-editor-tables.min.js new file mode 100644 index 00000000..fa6af802 --- /dev/null +++ b/codepot/src/js/medium-editor-tables.min.js @@ -0,0 +1 @@ +!function(a,b){"use strict";"object"==typeof module?module.exports=b:"function"==typeof define&&define.amd?define(b):a.MediumEditorTable=b}(this,function(){"use strict";function a(a){return a.getSelection?a.getSelection().toString():a.selection&&"Control"!==a.selection.type?a.selection.createRange().text:""}function b(a){var b=a.getSelection().anchorNode,c=b&&3===b.nodeType?b.parentNode:b;return c}function c(a,b,c){if(void 0!==a.getSelection&&b){var d=a.createRange(),e=a.getSelection();c?d.setStartBefore(b):d.setStartAfter(b),d.collapse(!0),e.removeAllRanges(),e.addRange(d)}}function d(a,b){if(!a)return!1;for(var c=a.parentNode,d=c.tagName.toLowerCase();"body"!==d;){if(d===b)return!0;if(c=c.parentNode,!c||!c.tagName)return!1;d=c.tagName.toLowerCase()}return!1}function e(a,b){var c=a&&a.tagName?a.tagName.toLowerCase():!1;if(!c)return!1;for(;c&&"body"!==c;){if(c===b)return a;a=a.parentNode,c=a&&a.tagName?a.tagName.toLowerCase():!1}}function f(a,b,c,d){return this.init(a,b,c,d)}function g(a){return this.init(a)}function h(a){return this.init(a)}f.prototype={init:function(a,b,c,d){return this._root=a,this._callback=b,this.rows=c,this.columns=d,this._render()},setCurrentCell:function(a){this._currentCell=a},markCells:function(){[].forEach.call(this._cellsElements,function(a){var b={column:parseInt(a.dataset.column,10),row:parseInt(a.dataset.row,10)},c=this._currentCell&&b.row<=this._currentCell.row&&b.column<=this._currentCell.column;c===!0?a.classList.add("active"):a.classList.remove("active")}.bind(this))},_generateCells:function(){this._cells=[];for(var a=0;a"},_cellsHTML:function(){var a="";return this._generateCells(),this._cells.map(function(b){a+='',a+=""}),a},_render:function(){this._root.innerHTML=this._html(),this._cellsElements=this._root.querySelectorAll("a"),this._bindEvents()},_bindEvents:function(){[].forEach.call(this._cellsElements,function(a){this._onMouseEnter(a),this._onClick(a)}.bind(this))},_onMouseEnter:function(a){var b,c=this;a.addEventListener("mouseenter",function(){clearTimeout(b);var a=this.dataset;b=setTimeout(function(){c._currentCell={column:parseInt(a.column,10),row:parseInt(a.row,10)},c.markCells()},50)})},_onClick:function(a){var b=this;a.addEventListener("click",function(a){a.preventDefault(),b._callback(this.dataset.row,this.dataset.column)})}},g.prototype={init:function(a){this.options=a,this._doc=a.ownerDocument||document,this._root=this._doc.createElement("div"),this._root.className="medium-editor-table-builder",this.grid=new f(this._root,this.options.onClick,this.options.rows,this.options.columns),this._range=null,this._toolbar=this._doc.createElement("div"),this._toolbar.className="medium-editor-table-builder-toolbar";var b=this._doc.createElement("span");b.innerHTML="Row:",this._toolbar.appendChild(b);var c=this._doc.createElement("button");c.title="Add row before",c.innerHTML='',c.onclick=this.addRow.bind(this,!0),this._toolbar.appendChild(c);var d=this._doc.createElement("button");d.title="Add row after",d.innerHTML='',d.onclick=this.addRow.bind(this,!1),this._toolbar.appendChild(d);var e=this._doc.createElement("button");e.title="Remove row",e.innerHTML='',e.onclick=this.removeRow.bind(this),this._toolbar.appendChild(e);var g=this._doc.createElement("span");g.innerHTML="Column:",this._toolbar.appendChild(g);var h=this._doc.createElement("button");h.title="Add column before",h.innerHTML='',h.onclick=this.addColumn.bind(this,!0),this._toolbar.appendChild(h);var i=this._doc.createElement("button");i.title="Add column after",i.innerHTML='',i.onclick=this.addColumn.bind(this,!1),this._toolbar.appendChild(i);var j=this._doc.createElement("button");j.title="Remove column",j.innerHTML='',j.onclick=this.removeColumn.bind(this),this._toolbar.appendChild(j);var k=this._doc.createElement("button");k.title="Remove table",k.innerHTML='',k.onclick=this.removeTable.bind(this),this._toolbar.appendChild(k);var l=this._root.childNodes[0];this._root.insertBefore(this._toolbar,l),console.log(this._root)},getElement:function(){return this._root},hide:function(){this._root.style.display="",this.grid.setCurrentCell({column:-1,row:-1}),this.grid.markCells()},show:function(a){this._root.style.display="block",this._root.style.left=a+"px"},setEditor:function(a){this._range=a,this._doc.getElementsByClassName("medium-editor-table-builder-toolbar")[0].style.display="block"},setBuilder:function(){this._range=null,this._doc.getElementsByClassName("medium-editor-table-builder-toolbar")[0].style.display="none";for(var a=this._doc.getElementsByClassName("medium-editor-table-builder-grid"),b=0;be;e++)c.childNodes[e].removeChild(c.childNodes[e].childNodes[b]);this.options.onClick(0,0)},removeTable:function(a){a.preventDefault(),a.stopPropagation();var b=(Array.prototype.indexOf.call(this._range.parentNode.childNodes,this._range),this._range.parentNode.parentNode.parentNode);b.parentNode.removeChild(b),this.options.onClick(0,0)}};var i=9;h.prototype={init:function(a){this._editor=a,this._doc=this._editor.options.ownerDocument,this._bindTabBehavior()},insert:function(a,b){var d=this._html(a,b);this._editor.pasteHTML('
'; printf ('', $i); print ''; - printf ('%s', $i, htmlspecialchars($f->filename)); + printf ('%s', $i, htmlspecialchars($f->filename)); print ''; - printf ('', $i, addslashes($f->description)); + printf ('', $i, addslashes($f->description)); print '
'+d+"
",{cleanAttrs:[],cleanTags:[]});var e=this._doc.getElementById("medium-editor-table");e.removeAttribute("id"),c(this._doc,e.querySelector("td"),!0),this._editor.checkSelection()},_html:function(b,c){var d,e,f="",g=a(this._doc);for(d=0;b>=d;d++){for(f+="
"+(0===d&&0===e?g:"
")+"