kopia lustrzana https://github.com/backface/turtlestitch
support exporting atomic tables from table views everywhere when in edit mode
rodzic
5e8bcc6438
commit
589564a36f
|
@ -26,6 +26,7 @@
|
|||
* blocks: support exporting numbers and text from result bubbles
|
||||
* 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
|
||||
* tables: support exporting atomic tables from table views everywhere when in edit mode
|
||||
|
||||
### 2022-01-27
|
||||
* blocks, gui: support dragging costumes and sounds out from result bubbles
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
written by Jens Mönig
|
||||
jens@moenig.org
|
||||
|
||||
Copyright (C) 2021 by Jens Mönig
|
||||
Copyright (C) 2022 by Jens Mönig
|
||||
|
||||
This file is part of Snap!.
|
||||
|
||||
|
@ -69,7 +69,7 @@ MorphicPreferences, FrameMorph, HandleMorph, DialogBoxMorph, StringMorph, isNil,
|
|||
SpriteMorph, Context, Costume, BlockEditorMorph, SymbolMorph, IDE_Morph, Sound,
|
||||
SyntaxElementMorph, MenuMorph, SpriteBubbleMorph, SpeechBubbleMorph, CellMorph,
|
||||
ListWatcherMorph, BoxMorph, Variable, isSnapObject, useBlurredShadows,
|
||||
CostumeIconMorph, SoundIconMorph*/
|
||||
CostumeIconMorph, SoundIconMorph, localize*/
|
||||
|
||||
/*jshint esversion: 6*/
|
||||
|
||||
|
@ -1111,7 +1111,11 @@ TableMorph.prototype.columnAt = function (relativeX) {
|
|||
// TableMorph context menu
|
||||
|
||||
TableMorph.prototype.userMenu = function () {
|
||||
var menu = new MenuMorph(this);
|
||||
var menu = new MenuMorph(this),
|
||||
world = this.world(),
|
||||
ide = detect(world.children, m => m instanceof IDE_Morph);
|
||||
|
||||
if (ide.isAppMode) {return; }
|
||||
if (this.parentThatIsA(TableDialogMorph)) {
|
||||
if (this.colWidths.length) {
|
||||
menu.addItem('reset columns', 'resetColumns');
|
||||
|
@ -1121,11 +1125,6 @@ TableMorph.prototype.userMenu = function () {
|
|||
menu.addItem(
|
||||
'blockify',
|
||||
() => {
|
||||
var world = this.world(),
|
||||
ide = detect(
|
||||
world.children,
|
||||
m => m instanceof IDE_Morph
|
||||
);
|
||||
this.table.blockify().pickUp(world);
|
||||
world.hand.grabOrigin = {
|
||||
origin: ide.palette,
|
||||
|
@ -1133,6 +1132,24 @@ TableMorph.prototype.userMenu = function () {
|
|||
};
|
||||
}
|
||||
);
|
||||
menu.addItem(
|
||||
'export',
|
||||
() => {
|
||||
if (this.table.canBeCSV()) {
|
||||
ide.saveFileAs(
|
||||
this.table.asCSV(),
|
||||
'text/csv;charset=utf-8', // RFC 4180
|
||||
localize('data') // name
|
||||
);
|
||||
} else {
|
||||
ide.saveFileAs(
|
||||
this.table.asJSON(true), // guessObjects
|
||||
'text/json;charset=utf-8',
|
||||
localize('data') // name
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
menu.addItem('open in another dialog...', 'openInDialog');
|
||||
return menu;
|
||||
|
@ -1146,8 +1163,6 @@ TableMorph.prototype.userMenu = function () {
|
|||
menu.addItem(
|
||||
'blockify',
|
||||
() => {
|
||||
var world = this.world(),
|
||||
ide = detect(world.children, m => m instanceof IDE_Morph);
|
||||
this.table.blockify().pickUp(world);
|
||||
world.hand.grabOrigin = {
|
||||
origin: ide.palette,
|
||||
|
@ -1155,6 +1170,24 @@ TableMorph.prototype.userMenu = function () {
|
|||
};
|
||||
}
|
||||
);
|
||||
menu.addItem(
|
||||
'export',
|
||||
() => {
|
||||
if (this.table.canBeCSV()) {
|
||||
ide.saveFileAs(
|
||||
this.table.asCSV(),
|
||||
'text/csv;charset=utf-8', // RFC 4180
|
||||
localize('data') // name
|
||||
);
|
||||
} else {
|
||||
ide.saveFileAs(
|
||||
this.table.asJSON(true), // guessObjects
|
||||
'text/json;charset=utf-8',
|
||||
localize('data') // name
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
menu.addLine();
|
||||
menu.addItem('open in dialog...', 'openInDialog');
|
||||
|
|
Ładowanie…
Reference in New Issue