Skip to content

Commit

Permalink
Polish settings editor (#12045)
Browse files Browse the repository at this point in the history
* Fix settings heading hierarchy: do not use h3 for description

as it distorts the outline which is detrimental to accessibility;
instead use the `<header>` pattern as recommended by W3C in:
https://www.w3.org/TR/2017/WD-html52-20170228/common-idioms-without-dedicated-elements.html

Also, do not rely on style the caret icon by element but by class name
(using this pattern reduces cognitive burden and improves performance).

* Match font sizes to heading hierarchy

* Remove unused rule (`field-description` is a class, not an ID,

and this element is hidden anyways).

* Make settings compact, display descriptions for all fields

except for shortcuts which would take a lot of screen.
Use flex-wrap for responsive display

* Improve schema for settings editor

* Implement add/remove/edit for objects, use JupyterLab button styles
  • Loading branch information
krassowski committed Feb 16, 2022
1 parent 159b015 commit 6935ae0
Show file tree
Hide file tree
Showing 5 changed files with 243 additions and 85 deletions.
18 changes: 13 additions & 5 deletions packages/codemirror-extension/schema/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,24 +207,32 @@
}
],
"title": "Style Active Line",
"description": "Value is boolean, or { nonEmpty: boolean }",
"description": "Highlight active line. Value is boolean, or { nonEmpty: boolean }.",
"default": false
},
"styleSelectedText": {
"type": "boolean",
"title": "Style Selected Text",
"description": "Value is boolean",
"default": true
},
"selectionPointer": {
"oneOf": [{ "type": "boolean" }, { "type": "string" }],
"oneOf": [
{
"type": "boolean",
"title": "Use default"
},
{
"type": "string",
"title": "Cursor pointer name"
}
],
"title": "Selection Pointer",
"description": "Value is boolean or string, e.g. 'pointer'",
"description": "Control the mouse cursor appearance when hovering over the selection. Value is boolean or string, e.g. 'pointer'.",
"default": false
},
"lineWiseCopyCut": {
"type": ["boolean"],
"title": "Ctrl-C",
"title": "Line-wise Ctrl-C",
"description": "When enabled, which is the default, doing copy or cut when there is no selection will copy or cut the whole lines that have cursors on them.",
"default": true
}
Expand Down
10 changes: 6 additions & 4 deletions packages/console-extension/schema/tracker.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
},
"cursorBlinkRate": {
"type": "number",
"title": "Cursor blinking rate",
"title": "Cursor Blinking Rate",
"description": "Half-period in milliseconds used for cursor blinking. The default blink rate is 530ms. By setting this to zero, blinking can be disabled. A negative value hides the cursor entirely."
},
"fontFamily": {
Expand All @@ -126,7 +126,7 @@
},
"lineNumbers": {
"type": "boolean",
"title": "Line Numbers"
"title": "Show Line Numbers"
},
"lineWrap": {
"type": "string",
Expand All @@ -135,7 +135,7 @@
},
"matchBrackets": {
"type": "boolean",
"title": "match"
"title": "Match Brackets"
},
"readOnly": {
"type": "boolean",
Expand Down Expand Up @@ -165,7 +165,9 @@
"title": "Code Folding"
},
"lineWiseCopyCut": {
"type": "boolean"
"type": "boolean",
"title": "Line-wise Ctrl-C",
"description": "When enabled, which is the default, doing copy or cut when there is no selection will copy or cut the whole lines that have cursors on them."
}
},
"additionalProperties": false,
Expand Down
50 changes: 33 additions & 17 deletions packages/notebook-extension/schema/tracker.json
Original file line number Diff line number Diff line change
Expand Up @@ -649,73 +649,89 @@
"properties": {
"autoClosingBrackets": {
"type": "boolean",
"default": false
"default": false,
"title": "Auto Closing Brackets"
},
"cursorBlinkRate": {
"type": "number",
"title": "Cursor blinking rate",
"title": "Cursor Blinking Rate",
"description": "Half-period in milliseconds used for cursor blinking. The default blink rate is 530ms. By setting this to zero, blinking can be disabled. A negative value hides the cursor entirely.",
"default": 530
},
"fontFamily": {
"type": ["string", "null"],
"default": null
"default": null,
"title": "Font Family"
},
"fontSize": {
"type": ["integer", "null"],
"minimum": 1,
"maximum": 100,
"default": null
"default": null,
"title": "Font Size"
},
"lineHeight": {
"type": ["number", "null"],
"default": null
"default": null,
"title": "Line Height"
},
"lineNumbers": {
"type": "boolean",
"default": false
"default": false,
"title": "Show Line Numbers"
},
"lineWrap": {
"type": "string",
"enum": ["off", "on", "wordWrapColumn", "bounded"]
"enum": ["off", "on", "wordWrapColumn", "bounded"],
"title": "Line Wrap"
},
"matchBrackets": {
"type": "boolean"
"type": "boolean",
"title": "Match Brackets"
},
"readOnly": {
"type": "boolean",
"default": false
"default": false,
"title": "Read Only"
},
"insertSpaces": {
"type": "boolean",
"default": true
"default": true,
"title": "Insert Spaces"
},
"tabSize": {
"type": "number",
"default": 4
"default": 4,
"title": "Tab Size"
},
"wordWrapColumn": {
"type": "integer",
"default": 80
"default": 80,
"title": "Word Wrap Column"
},
"rulers": {
"type": "array",
"items": {
"type": "number"
},
"title": "Rulers",
"default": []
},
"codeFolding": {
"type": "boolean",
"default": false
"default": false,
"title": "Code Folding"
},
"lineWiseCopyCut": {
"type": "boolean",
"default": true
"default": true,
"title": "Line-wise Ctrl-C",
"description": "When enabled, which is the default, doing copy or cut when there is no selection will copy or cut the whole lines that have cursors on them."
},
"showTrailingSpace": {
"type": "boolean",
"default": false
"default": false,
"title": "Show Trailing Space"
}
},
"additionalProperties": false,
Expand Down Expand Up @@ -859,8 +875,8 @@
"default": "1000px"
},
"maxNumberOutputs": {
"title": "The maximum number of output cells to be rendered in the output area. Set to 0 to have the complete display.",
"description": "Defines the maximum number of output cells to be rendered in the output area for cells with many outputs. The output area will have a head and the remaining outputs will be trimmed and not displayed unless the user clicks on the information message.",
"title": "The maximum number of output cells to be rendered in the output area.",
"description": "Defines the maximum number of output cells to be rendered in the output area for cells with many outputs. The output area will have a head and the remaining outputs will be trimmed and not displayed unless the user clicks on the information message. Set to 0 to have the complete display.",
"type": "number",
"default": 50
},
Expand Down

0 comments on commit 6935ae0

Please sign in to comment.