| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> | 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> |
| 4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 lineNumbers: false, | 770 lineNumbers: false, |
| 771 lineWrapping: Common.moduleSetting('domWordWrap').get(), | 771 lineWrapping: Common.moduleSetting('domWordWrap').get(), |
| 772 mimeType: 'text/html', | 772 mimeType: 'text/html', |
| 773 autoHeight: false, | 773 autoHeight: false, |
| 774 padBottom: false | 774 padBottom: false |
| 775 }); | 775 }); |
| 776 this._editing = | 776 this._editing = |
| 777 {commit: commit.bind(this), cancel: dispose.bind(this), editor: editor
, resize: resize.bind(this)}; | 777 {commit: commit.bind(this), cancel: dispose.bind(this), editor: editor
, resize: resize.bind(this)}; |
| 778 resize.call(this); | 778 resize.call(this); |
| 779 | 779 |
| 780 editor.widget().show(this._htmlEditElement); | 780 editor.show(this._htmlEditElement); |
| 781 editor.setText(initialValue); | 781 editor.setText(initialValue); |
| 782 editor.widget().focus(); | 782 editor.focus(); |
| 783 editor.widget().element.addEventListener('blur', this._editing.commit, tru
e); | 783 editor.element.addEventListener('blur', this._editing.commit, true); |
| 784 editor.widget().element.addEventListener('keydown', keydown.bind(this), tr
ue); | 784 editor.element.addEventListener('keydown', keydown.bind(this), true); |
| 785 | 785 |
| 786 this.treeOutline.setMultilineEditing(this._editing); | 786 this.treeOutline.setMultilineEditing(this._editing); |
| 787 } | 787 } |
| 788 | 788 |
| 789 /** | 789 /** |
| 790 * @this {Elements.ElementsTreeElement} | 790 * @this {Elements.ElementsTreeElement} |
| 791 */ | 791 */ |
| 792 function resize() { | 792 function resize() { |
| 793 this._htmlEditElement.style.width = this.treeOutline.visibleWidth() - this
._computeLeftIndent() - 30 + 'px'; | 793 this._htmlEditElement.style.width = this.treeOutline.visibleWidth() - this
._computeLeftIndent() - 30 + 'px'; |
| 794 this._editing.editor.onResize(); | 794 this._editing.editor.onResize(); |
| 795 } | 795 } |
| 796 | 796 |
| 797 /** | 797 /** |
| 798 * @this {Elements.ElementsTreeElement} | 798 * @this {Elements.ElementsTreeElement} |
| 799 */ | 799 */ |
| 800 function commit() { | 800 function commit() { |
| 801 commitCallback(initialValue, this._editing.editor.text()); | 801 commitCallback(initialValue, this._editing.editor.text()); |
| 802 dispose.call(this); | 802 dispose.call(this); |
| 803 } | 803 } |
| 804 | 804 |
| 805 /** | 805 /** |
| 806 * @this {Elements.ElementsTreeElement} | 806 * @this {Elements.ElementsTreeElement} |
| 807 */ | 807 */ |
| 808 function dispose() { | 808 function dispose() { |
| 809 this._editing.editor.widget().element.removeEventListener('blur', this._ed
iting.commit, true); | 809 this._editing.editor.element.removeEventListener('blur', this._editing.com
mit, true); |
| 810 this._editing.editor.widget().detach(); | 810 this._editing.editor.detach(); |
| 811 delete this._editing; | 811 delete this._editing; |
| 812 | 812 |
| 813 this.listItemElement.classList.remove('editing-as-html'); | 813 this.listItemElement.classList.remove('editing-as-html'); |
| 814 // Remove editor. | 814 // Remove editor. |
| 815 this.listItemElement.removeChild(this._htmlEditElement); | 815 this.listItemElement.removeChild(this._htmlEditElement); |
| 816 delete this._htmlEditElement; | 816 delete this._htmlEditElement; |
| 817 // Unhide children item. | 817 // Unhide children item. |
| 818 if (this.childrenListElement) | 818 if (this.childrenListElement) |
| 819 this.childrenListElement.style.removeProperty('display'); | 819 this.childrenListElement.style.removeProperty('display'); |
| 820 // Unhide header items. | 820 // Unhide header items. |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1609 Elements.ElementsTreeElement.ForbiddenClosingTagElements = new Set([ | 1609 Elements.ElementsTreeElement.ForbiddenClosingTagElements = new Set([ |
| 1610 'area', 'base', 'basefont', 'br', 'canvas', 'col', 'command', 'embed',
'frame', 'hr', | 1610 'area', 'base', 'basefont', 'br', 'canvas', 'col', 'command', 'embed',
'frame', 'hr', |
| 1611 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source',
'track', 'wbr' | 1611 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source',
'track', 'wbr' |
| 1612 ]); | 1612 ]); |
| 1613 | 1613 |
| 1614 // These tags we do not allow editing their tag name. | 1614 // These tags we do not allow editing their tag name. |
| 1615 Elements.ElementsTreeElement.EditTagBlacklist = new Set(['html', 'head', 'body']
); | 1615 Elements.ElementsTreeElement.EditTagBlacklist = new Set(['html', 'head', 'body']
); |
| 1616 | 1616 |
| 1617 /** @typedef {{cancel: function(), commit: function(), resize: function(), edito
r:!UI.TextEditor}} */ | 1617 /** @typedef {{cancel: function(), commit: function(), resize: function(), edito
r:!UI.TextEditor}} */ |
| 1618 Elements.MultilineEditorController; | 1618 Elements.MultilineEditorController; |
| OLD | NEW |