From a9acd532f007f939e605420d77c686e21a1ff63d Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Tue, 12 Nov 2019 11:22:38 -0800 Subject: [PATCH] Pull comment CSS into comment modules. --- core/comment.js | 18 +++++++++ core/css.js | 70 ----------------------------------- core/workspace_comment_svg.js | 65 ++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 70 deletions(-) diff --git a/core/comment.js b/core/comment.js index ce4dbf2bc..8fe065aeb 100644 --- a/core/comment.js +++ b/core/comment.js @@ -413,3 +413,21 @@ Blockly.Comment.prototype.dispose = function() { this.block_.comment = null; Blockly.Icon.prototype.dispose.call(this); }; + +/** + * CSS for block comment. See css.js for use. + */ +Blockly.Css.register([ + /* eslint-disable indent */ + '.blocklyCommentTextarea {', + 'background-color: #fef49c;', + 'border: 0;', + 'outline: 0;', + 'margin: 0;', + 'padding: 3px;', + 'resize: none;', + 'display: block;', + 'overflow: hidden;', + '}' + /* eslint-enable indent */ +]); diff --git a/core/css.js b/core/css.js index 761ac9e39..110d4bd5d 100644 --- a/core/css.js +++ b/core/css.js @@ -412,76 +412,6 @@ Blockly.Css.CONTENT = [ 'padding: 0;', '}', - '.blocklyCommentForeignObject {', - 'position: relative;', - 'z-index: 0;', - '}', - - '.blocklyCommentRect {', - 'fill: #E7DE8E;', - 'stroke: #bcA903;', - 'stroke-width: 1px', - '}', - - '.blocklyCommentTarget {', - 'fill: transparent;', - 'stroke: #bcA903;', - '}', - - '.blocklyCommentTargetFocused {', - 'fill: none;', - '}', - - '.blocklyCommentHandleTarget {', - 'fill: none;', - '}', - - '.blocklyCommentHandleTargetFocused {', - 'fill: transparent;', - '}', - - '.blocklyFocused>.blocklyCommentRect {', - 'fill: #B9B272;', - 'stroke: #B9B272;', - '}', - - '.blocklySelected>.blocklyCommentTarget {', - 'stroke: #fc3;', - 'stroke-width: 3px;', - '}', - - - '.blocklyCommentTextarea {', - 'background-color: #fef49c;', - 'border: 0;', - 'outline: 0;', - 'margin: 0;', - 'padding: 3px;', - 'resize: none;', - 'display: block;', - 'overflow: hidden;', - '}', - - '.blocklyCommentDeleteIcon {', - 'cursor: pointer;', - 'fill: #000;', - 'display: none', - '}', - - '.blocklySelected > .blocklyCommentDeleteIcon {', - 'display: block', - '}', - - '.blocklyDeleteIconShape {', - 'fill: #000;', - 'stroke: #000;', - 'stroke-width: 1px;', - '}', - - '.blocklyDeleteIconShape.blocklyDeleteIconHighlighted {', - 'stroke: #fc3;', - '}', - '.blocklyHtmlInput {', 'border: none;', 'border-radius: 4px;', diff --git a/core/workspace_comment_svg.js b/core/workspace_comment_svg.js index d8d79ff00..39d7566b2 100644 --- a/core/workspace_comment_svg.js +++ b/core/workspace_comment_svg.js @@ -610,3 +610,68 @@ Blockly.WorkspaceCommentSvg.prototype.toXmlWithXY = function(opt_noId) { element.setAttribute('w', this.getWidth()); return element; }; + +/** + * CSS for workspace comment. See css.js for use. + */ +Blockly.Css.register([ + /* eslint-disable indent */ + '.blocklyCommentForeignObject {', + 'position: relative;', + 'z-index: 0;', + '}', + + '.blocklyCommentRect {', + 'fill: #E7DE8E;', + 'stroke: #bcA903;', + 'stroke-width: 1px', + '}', + + '.blocklyCommentTarget {', + 'fill: transparent;', + 'stroke: #bcA903;', + '}', + + '.blocklyCommentTargetFocused {', + 'fill: none;', + '}', + + '.blocklyCommentHandleTarget {', + 'fill: none;', + '}', + + '.blocklyCommentHandleTargetFocused {', + 'fill: transparent;', + '}', + + '.blocklyFocused>.blocklyCommentRect {', + 'fill: #B9B272;', + 'stroke: #B9B272;', + '}', + + '.blocklySelected>.blocklyCommentTarget {', + 'stroke: #fc3;', + 'stroke-width: 3px;', + '}', + + '.blocklyCommentDeleteIcon {', + 'cursor: pointer;', + 'fill: #000;', + 'display: none', + '}', + + '.blocklySelected > .blocklyCommentDeleteIcon {', + 'display: block', + '}', + + '.blocklyDeleteIconShape {', + 'fill: #000;', + 'stroke: #000;', + 'stroke-width: 1px;', + '}', + + '.blocklyDeleteIconShape.blocklyDeleteIconHighlighted {', + 'stroke: #fc3;', + '}' + /* eslint-enable indent */ +]);