Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 4x 4x 4x 4x 4x 4x 1x 4x 4x 1x 4x 4x 4x 4x 1x 1x 3x 3x 2x 4x 1x | /*! * VisualEditor UserInterface CommentInspector class. * * @copyright See AUTHORS.txt */ /** * Comment inspector. * * @class * @extends ve.ui.NodeInspector * * @constructor * @param {Object} [config] Configuration options */ ve.ui.CommentInspector = function VeUiCommentInspector() { // Parent constructor ve.ui.CommentInspector.super.apply( this, arguments ); }; /* Inheritance */ OO.inheritClass( ve.ui.CommentInspector, ve.ui.NodeInspector ); /* Static properties */ ve.ui.CommentInspector.static.name = 'comment'; ve.ui.CommentInspector.static.title = OO.ui.deferMsg( 'visualeditor-commentinspector-title' ); ve.ui.CommentInspector.static.modelClasses = [ ve.dm.CommentNode ]; ve.ui.CommentInspector.static.size = 'large'; ve.ui.CommentInspector.static.actions = [ { action: 'remove', label: OO.ui.deferMsg( 'visualeditor-inspector-remove-tooltip' ), flags: 'destructive', modes: 'edit' }, ...ve.ui.CommentInspector.super.static.actions ]; /* Methods */ /** * Handle frame ready events. */ ve.ui.CommentInspector.prototype.initialize = function () { // Parent method ve.ui.CommentInspector.super.prototype.initialize.call( this ); this.textWidget = new ve.ui.WhitespacePreservingTextInputWidget( { autosize: true } ); this.textWidget.connect( this, { resize: 'updateSize' } ); this.textWidget.$input.attr( 'aria-label', OO.ui.deferMsg( 'visualeditor-commentinspector-title' ) ); this.$content.addClass( 've-ui-commentInspector-content' ); this.form.$element.append( this.textWidget.$element ); }; /** * @inheritdoc */ ve.ui.CommentInspector.prototype.getActionProcess = function ( action ) { if ( action === 'remove' || action === 'insert' ) { return new OO.ui.Process( () => { this.close( { action: action } ); } ); } return ve.ui.CommentInspector.super.prototype.getActionProcess.call( this, action ); }; /** * Handle the inspector being setup. * * @param {Object} [data] Inspector opening data * @return {OO.ui.Process} */ ve.ui.CommentInspector.prototype.getSetupProcess = function ( data ) { return ve.ui.CommentInspector.super.prototype.getSetupProcess.call( this, data ) .next( () => { this.getFragment().getSurface().pushStaging(); this.commentNode = this.getSelectedNode(); if ( this.commentNode ) { this.textWidget.setValueAndWhitespace( this.commentNode.getAttribute( 'text' ) || '' ); } else E{ this.textWidget.setWhitespace( [ ' ', ' ' ] ); this.getFragment().insertContent( [ { type: 'comment', attributes: { text: '' } }, { type: '/comment' } ] ).select(); this.commentNode = this.getSelectedNode(); } this.textWidget.setReadOnly( this.isReadOnly() ); } ); }; /** * @inheritdoc */ ve.ui.CommentInspector.prototype.getReadyProcess = function ( data ) { return ve.ui.CommentInspector.super.prototype.getReadyProcess.call( this, data ) .next( () => { this.textWidget.focus(); } ); }; /** * @inheritdoc */ ve.ui.CommentInspector.prototype.getTeardownProcess = function ( data ) { data = data || {}; return ve.ui.CommentInspector.super.prototype.getTeardownProcess.call( this, data ) .first( () => { const surfaceModel = this.getFragment().getSurface(); // data.action can be 'done', 'remove' or undefined (cancel) if ( data.action === 'done' && this.textWidget.getValue() !== '' ) { // Edit comment node this.getFragment().changeAttributes( { text: this.textWidget.getValueAndWhitespace() } ); surfaceModel.applyStaging(); } else { surfaceModel.popStaging(); if ( data.action === 'remove' || data.action === 'done' ) { this.getFragment().removeContent(); } } // Reset inspector this.textWidget.setValueAndWhitespace( '' ); } ); }; /* Registration */ ve.ui.windowFactory.register( ve.ui.CommentInspector ); |