From 2f12e70941b04d3329138f89227813f144925ea9 Mon Sep 17 00:00:00 2001 From: Marc Wouts Date: Thu, 7 Nov 2019 23:43:43 +0100 Subject: [PATCH] Disable the unpair notebook menu entry when the notebook is not paired --- .../jupyterlab-jupytext-1.1.0.tgz | Bin 4964 -> 4985 bytes packages/labextension/src/index.ts | 19 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/packages/labextension/jupyterlab-jupytext-1.1.0.tgz b/packages/labextension/jupyterlab-jupytext-1.1.0.tgz index d9e6aa5df83ce047618017894294c35275f85018..8756e7ba28c14c672a4e7875c7dde6c8c53c3bbc 100644 GIT binary patch literal 4985 zcmV-<6Nc;`iwFP!000003hg{=bK1z3^VwDY4;@l9K&}wrOguBrdhR7QPPl6uFD8?u zyjjzr24o9KR}T|z%KO{*oPOwq1lVyrGqvt=*&ubFcb}J9cIoJvPFUR)fAuThv442r z(P%VwcXvtNbr?H4%?A15<*VIBv$?z5_=)@gA71_R3jRJcA$cS81L^@O-wH=CL!!Tb zk@0nVi;$8{XRNeGN>`z~2$*NlVNHDe5|lJPDV}_sW0Ar}*(?`j1}QkQe77NINQz0U&8)R{3C z>>7!i27&AE)$0>8n1(}rX5q=$j$FK$1VK_m`ze*}X z&)N`y>H8t`Ifb_Zlx2hHq4;B`autt6^ zsC)nkdC#cH4FRb#ZG(LQhaw3N7A_||aSth$cRl7hz8N^)A|Y2?f-69v5tSRuTE|rh zK?_4os%;pWmVv+me-yzVS&VWPJagvJF#&3$doEB(Jx-GC&WIP7zM{Lq{>bhVaRPC<+iT2&{yf82=f8`|G3E0qauA@mQ zT5b;W$q`cEYj*Tqy%~Y#>f|EDoB#U~oI*1RGO<}>Xz@PUBY_t(K7V@)e*S1b`2TfC zFIPW!*E)UMKJLENXU0S0SRMbHuXcW3ivP{V&QttajpnblX0z6KS>4{+ z-l~z4&&`Y(5yKgUGiC?eSrOA7Ss~;G zB!F8M#8V>k2V#e_A$;U1!O#h&QC>jK77+7nLT!WJ45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${Eq0&u& z*GLkOw!;M*z2oWgqt))2njIKafy!9+S{Wfo`#JWVMHQhba(VjiL*R{T3B9u~p0%Ed zlLA_zWY9Y*bLtD@_^jZ|Cr7)a0+2Ly%0OGNCU7`^%{mOnV!Gu_Dy7^L5_y8b2lMJ# zRm#}F5kyZVQd=BHwthhaXw%WOQlZ`i$}W%E*ID}FEh5i@?-87QQ4(KEpWo!oRfjG1 z;@9hTOOfSdmVm(Y=)18-?8YFVn(z$u!hhti2xWWgw>XM7sd4Vx_b@2P&yVQjAozM9BzYc+8D@}9kCiNmVd6VhcwQ)ewux^I zh;|EbF*YZmC$gnNQR5Icb3c#p0J%P89hM#6zrcC~0m;aQ$zskB`{m%NHzY2AFY|;Sp@lpqSQ(9secjVb!yFG{zY`YS5U?lL8?kEa;>W< zkkm`Za{+Kyp~o@w7`pD!BO&j{GNTv}Zh4U}ggl{M7P%y?e`3o?a=Ic*Q{!n&2M14^B8pa|mk)^m z*-l7yfDwIQ(pbca&gdLeWJ)vj{xlv*^^0N26ph^`ijRwB`uzhK61K7hi1dxMOew*t zXkcKa@FaE;3p9aqxnvVmEsaS9SmRLT>lU*o!IW>hjZ38`AVWzCa&2fa^;o=u{~fD$D8kxh>TL2+`EGIZrM-2wjNJf zK%Z&1dJ}&)Zzl>FM0AiI9wTS=D0PrPjnK0a{~jwc9eh~~%n~T$Z&oq8F5dE~moggB zvI^k>LXgaIck!*7EY>_xWu^$}HVTCISaLaR{qr#-GN%91@qeCuN69pc&FVz8MDWZz za+!{e@!XlPB$}C?w@%ys;XTb2Ex;#_p)2rzw>DuaL`O&z zfJ<@aM6^O`)Ut}w!xiilcT=;LzD_s$S?k|V>rnIZ^O;4J@A5wR<62h%k|jdTTG#3x zeL+&d{{a@J1)o|c$7BlboOy+k{TAE&{jBm2Z;yqQL$+cl0 = { } return jupytext_formats.indexOf(format)!=-1; }, - isEnabled: () => { - if (!notebook_tracker.currentWidget) - return false; + isEnabled: () => { + if (!notebook_tracker.currentWidget) + return false; - const notebook_extension: string | undefined = notebook_tracker.currentWidget.context.path.split('.').pop(); - if (format===notebook_extension) - return false; + const notebook_extension: string | undefined = notebook_tracker.currentWidget.context.path.split('.').pop(); + if (format === notebook_extension) + return false; - return true; + if (format === 'none') { + const formats = get_selected_formats(notebook_tracker); + return formats.length > 1; + } + + return true; }, execute: () => { const jupytext: JupytextSection = (notebook_tracker.currentWidget.context.model.metadata.get(