mirror of
https://github.com/google/blockly.git
synced 2026-01-11 02:47:09 +01:00
Migrate core/keyboard_nav/basic_cursor.js to goog.module
This commit is contained in:
@@ -11,7 +11,8 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
goog.provide('Blockly.BasicCursor');
|
||||
goog.module('Blockly.BasicCursor');
|
||||
goog.module.declareLegacyNamespace();
|
||||
|
||||
goog.require('Blockly.ASTNode');
|
||||
goog.require('Blockly.Cursor');
|
||||
@@ -25,16 +26,16 @@ goog.require('Blockly.registry');
|
||||
* @constructor
|
||||
* @extends {Blockly.Cursor}
|
||||
*/
|
||||
Blockly.BasicCursor = function() {
|
||||
Blockly.BasicCursor.superClass_.constructor.call(this);
|
||||
const BasicCursor = function() {
|
||||
BasicCursor.superClass_.constructor.call(this);
|
||||
};
|
||||
Blockly.utils.object.inherits(Blockly.BasicCursor, Blockly.Cursor);
|
||||
Blockly.utils.object.inherits(BasicCursor, Blockly.Cursor);
|
||||
|
||||
/**
|
||||
* Name used for registering a basic cursor.
|
||||
* @const {string}
|
||||
*/
|
||||
Blockly.BasicCursor.registrationName = 'basicCursor';
|
||||
BasicCursor.registrationName = 'basicCursor';
|
||||
|
||||
/**
|
||||
* Find the next node in the pre order traversal.
|
||||
@@ -42,7 +43,7 @@ Blockly.BasicCursor.registrationName = 'basicCursor';
|
||||
* not set or there is no next value.
|
||||
* @override
|
||||
*/
|
||||
Blockly.BasicCursor.prototype.next = function() {
|
||||
BasicCursor.prototype.next = function() {
|
||||
const curNode = this.getCurNode();
|
||||
if (!curNode) {
|
||||
return null;
|
||||
@@ -63,7 +64,7 @@ Blockly.BasicCursor.prototype.next = function() {
|
||||
* not set or there is no next value.
|
||||
* @override
|
||||
*/
|
||||
Blockly.BasicCursor.prototype.in = function() {
|
||||
BasicCursor.prototype.in = function() {
|
||||
return this.next();
|
||||
};
|
||||
|
||||
@@ -73,7 +74,7 @@ Blockly.BasicCursor.prototype.in = function() {
|
||||
* is not set or there is no previous value.
|
||||
* @override
|
||||
*/
|
||||
Blockly.BasicCursor.prototype.prev = function() {
|
||||
BasicCursor.prototype.prev = function() {
|
||||
const curNode = this.getCurNode();
|
||||
if (!curNode) {
|
||||
return null;
|
||||
@@ -94,7 +95,7 @@ Blockly.BasicCursor.prototype.prev = function() {
|
||||
* not set or there is no previous value.
|
||||
* @override
|
||||
*/
|
||||
Blockly.BasicCursor.prototype.out = function() {
|
||||
BasicCursor.prototype.out = function() {
|
||||
return this.prev();
|
||||
};
|
||||
|
||||
@@ -108,7 +109,7 @@ Blockly.BasicCursor.prototype.out = function() {
|
||||
* @return {Blockly.ASTNode} The next node in the traversal.
|
||||
* @protected
|
||||
*/
|
||||
Blockly.BasicCursor.prototype.getNextNode_ = function(node, isValid) {
|
||||
BasicCursor.prototype.getNextNode_ = function(node, isValid) {
|
||||
if (!node) {
|
||||
return null;
|
||||
}
|
||||
@@ -138,7 +139,7 @@ Blockly.BasicCursor.prototype.getNextNode_ = function(node, isValid) {
|
||||
* previous node exists.
|
||||
* @protected
|
||||
*/
|
||||
Blockly.BasicCursor.prototype.getPreviousNode_ = function(node, isValid) {
|
||||
BasicCursor.prototype.getPreviousNode_ = function(node, isValid) {
|
||||
if (!node) {
|
||||
return null;
|
||||
}
|
||||
@@ -164,7 +165,7 @@ Blockly.BasicCursor.prototype.getPreviousNode_ = function(node, isValid) {
|
||||
* @return {boolean} True if the node should be visited, false otherwise.
|
||||
* @protected
|
||||
*/
|
||||
Blockly.BasicCursor.prototype.validNode_ = function(node) {
|
||||
BasicCursor.prototype.validNode_ = function(node) {
|
||||
let isValid = false;
|
||||
const type = node && node.getType();
|
||||
if (type == Blockly.ASTNode.types.OUTPUT ||
|
||||
@@ -185,7 +186,7 @@ Blockly.BasicCursor.prototype.validNode_ = function(node) {
|
||||
* valid parents.
|
||||
* @private
|
||||
*/
|
||||
Blockly.BasicCursor.prototype.findSiblingOrParent_ = function(node) {
|
||||
BasicCursor.prototype.findSiblingOrParent_ = function(node) {
|
||||
if (!node) {
|
||||
return null;
|
||||
}
|
||||
@@ -204,7 +205,7 @@ Blockly.BasicCursor.prototype.findSiblingOrParent_ = function(node) {
|
||||
* if no child exists.
|
||||
* @private
|
||||
*/
|
||||
Blockly.BasicCursor.prototype.getRightMostChild_ = function(node) {
|
||||
BasicCursor.prototype.getRightMostChild_ = function(node) {
|
||||
if (!node.in()) {
|
||||
return node;
|
||||
}
|
||||
@@ -216,5 +217,7 @@ Blockly.BasicCursor.prototype.getRightMostChild_ = function(node) {
|
||||
};
|
||||
|
||||
Blockly.registry.register(
|
||||
Blockly.registry.Type.CURSOR, Blockly.BasicCursor.registrationName,
|
||||
Blockly.BasicCursor);
|
||||
Blockly.registry.Type.CURSOR, BasicCursor.registrationName,
|
||||
BasicCursor);
|
||||
|
||||
exports = BasicCursor;
|
||||
|
||||
@@ -88,7 +88,7 @@ goog.addDependency('../../core/interfaces/i_deletable.js', ['Blockly.IDeletable'
|
||||
goog.addDependency('../../core/interfaces/i_delete_area.js', ['Blockly.IDeleteArea'], ['Blockly.IDragTarget'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../core/interfaces/i_drag_target.js', ['Blockly.IDragTarget'], ['Blockly.IComponent'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../core/interfaces/i_draggable.js', ['Blockly.IDraggable'], ['Blockly.IDeletable'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../core/interfaces/i_flyout.js', ['Blockly.IFlyout'], [], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../core/interfaces/i_flyout.js', ['Blockly.IFlyout'], ['Blockly.IRegistrable'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../core/interfaces/i_keyboard_accessible.js', ['Blockly.IKeyboardAccessible'], [], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../core/interfaces/i_metrics_manager.js', ['Blockly.IMetricsManager'], []);
|
||||
goog.addDependency('../../core/interfaces/i_movable.js', ['Blockly.IMovable'], [], {'lang': 'es6', 'module': 'goog'});
|
||||
@@ -97,10 +97,10 @@ goog.addDependency('../../core/interfaces/i_registrable.js', ['Blockly.IRegistra
|
||||
goog.addDependency('../../core/interfaces/i_registrable_field.js', ['Blockly.IRegistrableField'], []);
|
||||
goog.addDependency('../../core/interfaces/i_selectable.js', ['Blockly.ISelectable'], [], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../core/interfaces/i_styleable.js', ['Blockly.IStyleable'], [], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../core/interfaces/i_toolbox.js', ['Blockly.IToolbox'], [], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../core/interfaces/i_toolbox.js', ['Blockly.IToolbox'], ['Blockly.IRegistrable'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../core/interfaces/i_toolbox_item.js', ['Blockly.ICollapsibleToolboxItem', 'Blockly.ISelectableToolboxItem', 'Blockly.IToolboxItem'], []);
|
||||
goog.addDependency('../../core/keyboard_nav/ast_node.js', ['Blockly.ASTNode'], ['Blockly.connectionTypes', 'Blockly.constants', 'Blockly.utils.Coordinate'], {'lang': 'es5'});
|
||||
goog.addDependency('../../core/keyboard_nav/basic_cursor.js', ['Blockly.BasicCursor'], ['Blockly.ASTNode', 'Blockly.Cursor', 'Blockly.registry'], {'lang': 'es5'});
|
||||
goog.addDependency('../../core/keyboard_nav/basic_cursor.js', ['Blockly.BasicCursor'], ['Blockly.ASTNode', 'Blockly.Cursor', 'Blockly.registry'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../core/keyboard_nav/cursor.js', ['Blockly.Cursor'], ['Blockly.ASTNode', 'Blockly.Marker', 'Blockly.registry', 'Blockly.utils.object'], {'lang': 'es5'});
|
||||
goog.addDependency('../../core/keyboard_nav/marker.js', ['Blockly.Marker'], ['Blockly.ASTNode']);
|
||||
goog.addDependency('../../core/keyboard_nav/tab_navigate_cursor.js', ['Blockly.TabNavigateCursor'], ['Blockly.ASTNode', 'Blockly.BasicCursor', 'Blockly.utils.object']);
|
||||
|
||||
Reference in New Issue
Block a user