support exporting atomic lists from list watchers everywhere when in edit mode

snap7
Jens Mönig 2022-01-28 15:10:25 +01:00
rodzic 52ee2eb6d5
commit 5e8bcc6438
3 zmienionych plików z 31 dodań i 10 usunięć

Wyświetl plik

@ -3,10 +3,11 @@
## in development: ## in development:
* **New Features:** * **New Features:**
* support deleting and inserting individual variadic slots, script vars & ring params * deleting and inserting individual variadic slots, script vars & ring params
* support dragging blocks, costumes and sounds out from result bubbles, and from speech balloons and variable watchers when in edit mode * dragging blocks, costumes and sounds out from result bubbles, and from speech balloons and variable watchers when in edit mode
* support exporting costumes and sounds from result bubbles, and from speech balloons and variable watchers when in edit mode * exporting costumes and sounds from result bubbles, and from speech balloons and variable watchers when in edit mode
* support exporting text and numbers from result bubbles and speech balloons when in edit mode * exporting text and numbers from result bubbles and speech balloons when in edit mode
* exporting atomic lists from list watchers everywhere when in edit mode
* **Notable Changes:** * **Notable Changes:**
* **Notable Fixes:** * **Notable Fixes:**
* fixed layout for scrolling custom categories, thanks, Eckart, for the bug report! * fixed layout for scrolling custom categories, thanks, Eckart, for the bug report!
@ -24,6 +25,7 @@
* objects: support exporting sounds and costumes from variable watchers in edit mode * objects: support exporting sounds and costumes from variable watchers in edit mode
* blocks: support exporting numbers and text from result bubbles * blocks: support exporting numbers and text from result bubbles
* objects: support exporting numbers and text from speech balloons when in edit mode * objects: support exporting numbers and text from speech balloons when in edit mode
* lists: support exporting atomic lists from list watchers everywhere when in edit mode
### 2022-01-27 ### 2022-01-27
* blocks, gui: support dragging costumes and sounds out from result bubbles * blocks, gui: support dragging costumes and sounds out from result bubbles

Wyświetl plik

@ -22,7 +22,7 @@
<script src="src/scenes.js?version=2021-11-24"></script> <script src="src/scenes.js?version=2021-11-24"></script>
<script src="src/gui.js?version=2022-01-27"></script> <script src="src/gui.js?version=2022-01-27"></script>
<script src="src/paint.js?version=2021-07-05"></script> <script src="src/paint.js?version=2021-07-05"></script>
<script src="src/lists.js?version=2021-12-15"></script> <script src="src/lists.js?version=2022-01-28"></script>
<script src="src/byob.js?version=2022-01-07"></script> <script src="src/byob.js?version=2022-01-07"></script>
<script src="src/tables.js?version=2022-01-28"></script> <script src="src/tables.js?version=2022-01-28"></script>
<script src="src/sketch.js?version=2021-11-03"></script> <script src="src/sketch.js?version=2021-11-03"></script>

Wyświetl plik

@ -7,7 +7,7 @@
written by Jens Mönig and Brian Harvey written by Jens Mönig and Brian Harvey
jens@moenig.org, bh@cs.berkeley.edu jens@moenig.org, bh@cs.berkeley.edu
Copyright (C) 2021 by Jens Mönig and Brian Harvey Copyright (C) 2022 by Jens Mönig and Brian Harvey
This file is part of Snap!. This file is part of Snap!.
@ -65,7 +65,7 @@ ZERO, WHITE*/
// Global settings ///////////////////////////////////////////////////// // Global settings /////////////////////////////////////////////////////
modules.lists = '2021-December-15'; modules.lists = '2022-January-28';
var List; var List;
var ListWatcherMorph; var ListWatcherMorph;
@ -1472,7 +1472,10 @@ ListWatcherMorph.prototype.expand = function (maxExtent) {
// ListWatcherMorph context menu // ListWatcherMorph context menu
ListWatcherMorph.prototype.userMenu = function () { ListWatcherMorph.prototype.userMenu = function () {
if (!List.prototype.enableTables) { var world = this.world(),
ide = detect(world.children, m => m instanceof IDE_Morph);
if (!List.prototype.enableTables || ide.isAppMode) {
return this.escalateEvent('userMenu'); return this.escalateEvent('userMenu');
} }
var menu = new MenuMorph(this); var menu = new MenuMorph(this);
@ -1481,8 +1484,6 @@ ListWatcherMorph.prototype.userMenu = function () {
menu.addItem( menu.addItem(
'blockify', 'blockify',
() => { () => {
var world = this.world(),
ide = detect(world.children, m => m instanceof IDE_Morph);
this.list.blockify().pickUp(world); this.list.blockify().pickUp(world);
world.hand.grabOrigin = { world.hand.grabOrigin = {
origin: ide.palette, origin: ide.palette,
@ -1490,6 +1491,24 @@ ListWatcherMorph.prototype.userMenu = function () {
}; };
} }
); );
menu.addItem(
'export',
() => {
if (this.list.canBeCSV()) {
ide.saveFileAs(
this.list.asCSV(),
'text/csv;charset=utf-8', // RFC 4180
localize('data') // name
);
} else {
ide.saveFileAs(
this.list.asJSON(true), // guessObjects
'text/json;charset=utf-8',
localize('data') // name
);
}
}
);
} }
menu.addLine(); menu.addLine();
menu.addItem( menu.addItem(