Explorar o código

Alternate text command _doExecute method.

Szymon Kupś %!s(int64=9) %!d(string=hai) anos
pai
achega
e00fde2920

+ 10 - 2
packages/ckeditor5-image/src/imagealternatetext/imagealternatetextcommand.js

@@ -42,7 +42,15 @@ export default class ImageAlternateTextCommand extends Command {
 		return isImage( element );
 	}
 
-	_doExecute() {
-		console.log( 'attribute change command execute' );
+	_doExecute( options ) {
+		const editor = this.editor;
+		const doc = editor.document;
+		const imageElement = doc.selection.getSelectedElement();
+
+		doc.enqueueChanges( () => {
+			const batch = options.batch || doc.batch();
+
+			batch.setAttribute( imageElement, 'alt', options.newValue );
+		} );
 	}
 }