diff --git a/CHANGELOG.md b/CHANGELOG.md index 56fae6b54..b03ef9bc5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,54 +1,150 @@ +# 4.11.0 (WIP) + +## Goals + +## Update notes + +* warning about lack of support for internet explorer + * existing support will get worse over time. please update. + * we only support IE for the home page and related info pages. Apps with complex functionality assume you are using a regularly updated browser. +* this release includes new clientside dependencies. Don't forget to run `bower update` + +To update from 4.10.0 to 4.11.0: + +1. Stop your server +2. Get the latest code with git +3. Install the latest dependencies with `bower update` and `npm i` +4. Restart your server +5. Confirm that your instance is passing all the tests included on the `/checkup/` page (on whatever devices you intend to support) + +## Features + +* unify unregistered/non-registered/anonymous terminology as 'guest' +* support + * prompt users that need support to subscribe + * refactor debugging data generation to easily show users what data is included +* form improvements + * include bar graphs for multiple-answer form questions + * move the tally of empty responses to the top of each question's summary (rather than the bottom) + * conditionally displayed sections depending on the state of previous answers + * nicer participant view without CryptPad toolbar or popups + * response page to with customizable message to thank those that have responded + * more granular form controls and clearer text + * anonymization settings for answers + * optional restriction of a form to registered users only + * real-time form authorship. + * changes are saved as you type, so you no longer need to "save" each question. + * co-author surveys with other users and edit the same question concurrently. + * avoid redrawing active parts of the UI when other authors make a change (datepicker UI, dropdowns, etc.) + * redraw no more than once every 500ms for performance reasons + * preserve current scroll position when other users make changes + * easier access to basic for form authors in the left sidebar: + * preview a form + * copy the participant link + * view existing responses + * more intuitive display of answers + * bar charts throughout, wherever applicable + * options with no answers are still displayed with zero results in the summary rather than not being displayed at all + * options are displayed according to the order of their appearance in the original question, rather than according to the order in which participants chose them + * the number of empty answers is displayed above the scrollable section of each answer's summary rather than at the bottom + * more intuitive controls and default options + * placeholders for text inputs instead of pre-filled fields + * "enter" creates a new field + * "esc" clears an empty field + * easy navigation using the tab key + * convert between related question types: + * radio, checkbox, ranked choices + * multi-radio, multi-check + * more form validation options: + * required questions + * validated question types + * summarize invalid answers at the bottom of the form. jump to the relevant question when clicked. + * CryptPad logo displayed at the bottom of the participant page which links to the home page + * we've pre-filled some options in our "simple scheduling poll" template. +* bar charts on the admin page's 'Performance' tab +* enhancements for guest users and registered users without names or avatars + * two initials for users with a custom name but no avatar (previously one initial, always capitalized) + * animal avatars as defaults instead of indistinguishable initials (A for Anonymous, G for Guest) + * configurable via `AppConfig.emojiAvatars = []` + * authorship data for guests in rich text comments, code editor author data + * emojis in cursor tooltips for guests (rich text, code, slide, kanban) + * emojis in the share and access modals for contacts with empty names +* script to identify unnecessary duplication of translations +* improvements to upload and media-tag UI + * support for adding descriptive text at upload time + * preview of uploaded media in the upload modal +* our link creation UI from 4.9.0 now highlights the URL input field as you type to indicate whether the current URL value is valid +* the share menu now makes its primary actions more clear, with explicit text ("copy link" instead of just "copy") on its main buttons, as well as icons that better match button UI on the rest of the platform. +* we're working towards better accessibility for screen readers with better alt-text and `aria-` attributes to suppress descriptions of strictly visual UI features. + +## Bug fixes + +* fix empty name fields in various places across the platform where we did not fall back to "anonymous/guest" + * teams + * contacts + * ??? +* clarified a comment in the nginx config about _professional support_ +* handled an edge case in ICS import to calendars where DTEND was not defined (use duration or consider it an "all-day" event +* links shared by contacts could be previewed in a modal when viewing their notification. The color of the previewed link was overridden by some bootstrap styles. we now use a better color. +* better validation for team invite links where badly formed invite content could have triggered a type error. + + # 4.10.0 ## Goals +August is typically a quiet month for CryptPad's development team, as members of our team and many of our users take their (northern hemisphere) summer holidays. We took the opportunity to catch up on some regular maintentance and to review and some prototype branches of our code that had been ready for integration for some time. + +It seems that some browser developers thought to do the same thing, because we noticed some significant regressions in some APIs that we rely on. Some of our time went towards addressing the resulting bugs and restructuring some code to avoid future regressions for browser behaviour that seem likely to be changed again in the near future. ## Update notes +4.10.0 includes some minor changes to [the checkup page](https://docs.cryptpad.fr/fr/admin_guide/installation.html#diagnostics). Some admins have included screenshots of this page in bug reports or requests for support along with details of problems they suspect of being related. Because we've observed that the root of many issues is the browser (sometimes in addition to the server) we have decided to include details about the browser in this page's summary. + +Up until now the checkup page only tested observable behaviour of the server such as HTTP headers on particular resources, configuration parameters distributed to the client, and the availability of essential resources. This practice meant that a report for an instance should have been the same regardless of the device that was used to generate the report. In light of a serious regression in Chrome (and all its derivatives) we decided that objectiveness was less important than utility and introduced some tests which check whether the client running the diagnostics interprets the provided server configuration. Terrible browsers (ie. every browser that is available on iOS) will fail these tests every time because they don't implement the expected APIs, but we've tried to detect these cases and warn that they are expected. + +For the most part you (as an admin) will not need to do anything special for this release as a result. If you notice weird issues on particular browsers in the future, however, it might be helpful to view this page from the affected browser/device and include any information that is provided in bug reports. + +To update from 4.9.0 to 4.10.0: + +1. Stop your server +2. Get the latest code with git +3. Install the latest dependencies with `bower update` and `npm i` +4. Restart your server +5. Confirm that your instance is passing all the tests included on the `/checkup/` page (on whatever devices you intend to support) + ## Features -* screen real-estate - * kanban - * narrower 'add board' button - * 'Tools' menu to collapse the tag and view mode UI - * general - * main toolbar collapse -* remove unused files - * /common/noscriptfix.js -* more detailed inventory of dependencies - * see cryptpad/www/lib/changelog.md -* include vendor and appVersion in support ticket data -* log when trimming history -* rewrite some translation keys to use a single syntax for BR tags -* translations - * more linting - * standardized capitalization of "CryptPad" - * avoid raw injection of HTML strictly for adding line breaks - * remove some unnecessary cases of raw HTML injection -* checkup - * better styles - * improved formatting for returned values in failed tests - * display browser and OS for when people send us screenshots instead of URLs - * test for support of some features in the browser (inside the sandbox) -* mark password inputs as _new passwords_ so that browsers don't suggest you input and share your account password +As noted above, web standards and the browsers that implement them are constantly changing. Web applications like CryptPad which use new and advanced browser features are particularly prone to regressions even when we use browser features exactly as intended and advertized. The "Features" section of each release's notes typically highlights visible things, like clickable buttons or improvements to the interface. This point is included as a reminder that _regular maintenance is at least as important to an open-source software project_, even though it gets little attention and far less funding. The funding bodies that have generously supported our work typically award grants for research and the development of novel features, but we are sorely in need of increased support to allow us the flexibility to deal with unanticipated problems as they arise. If you are fortunate enough to have some disposable income and value the work that keeps CryptPad functional we would greatly appreciate a one-time or recurring donation to [our OpenCollative campaign](https://opencollective.com/cryptpad/contribute). + +* This release coincided the yearly seminar of [XWiki (our parent organization)](https://www.xwiki.com) which always features a day-long hackathon. This year our team was joined by [@aemi-dev](https://github.com/aemi-dev) who has been working as an intern within XWiki's product team. Together we worked on adding some data visualization to our recently introduced _Form_ app. The improvements include a timeline to visualize how many responses were submitted to the form during each day and bar charts for a variety of question types to complement the existing tally of results. There's still more work to be done in this direction, but we established some useful foundations during our relatively short session. +* Frequent users of small screens will be pleased to hear that CryptPad's app toolbar now includes a button to collapse the upper segment of the toolbar which includes CryptPad's logo, the current document's title, status indicator (saved, editing, disconnected, etc.), and the user administration menu. +* Likewise, Kanban users may note that the app's toolbar also features a "Tools" menu (like that in the markdown editor) which toggles display of the controls which filter board items by tag and select view state (detailed or brief). +* Password fields that are specific to files and documents now have the `autocomplete="new-password"` attribute applied to prevent browsers and integrated password managers from suggesting that users enter their account password. This lowers the risk that users will inadvertently reveal their account password in the future. Additionally, Firefox will now prompt users to use a high-entropy password instead. +* Our integrated support ticket functionality automatically includes some commonly needed information about the user's account and browser. As of this release this data will also include the browser's `vendor` and `appVersion`, which are useful hints about the host browser and OS (which we almost always have to ask about when the ticket is for a bug report). This data will also include the browser's current width and height, as some issues only occur at particular resolutions and can otherwise be difficult to reproduce. +* We reviewed a range of third-party dependencies that are included in our repository and updated `cryptpad/www/lib/changelog.md` to better indicate their exact version, source, and any CryptPad-specific modifications we've made to them. + * We found `less.js` had been duplicated, with one version (provided by bower) being used for custom styles in our slide editor while the rest of the platform used a custom version that fixed an apparent bug in the _reference import_ syntax. We've standardized on our custom version and removed the alternative from our `bower.json` file. + * We also identified a few files that were no longer in use and removed them. There's still more work to be done to document the exact versions and source of some dependencies, so we've made this process a part of our regular release checklist. +* During a manual review we noticed some inconsistencies between different translations of CryptPad and have automated these checks by adding them to a script which we use to review translations before each release. These have helped us standardize things like the capitalization of "CryptPad", the syntax for some basic markup like `
` tags, and the consistent use of both dialect-specific suffixes in English and punctuation rules in French. We have only added tests for languages in which members of our team are fluent, so if you maintain a translation in another language and can suggest additional qualities we could test we would welcome your suggestions. +* The improved consistency of our translations has also enabled us to construct some translated UI components programmatically without directly using their inline HTML. This provides an extra layer of security in the event that + 1. malicious code was included in a translation file + 2. our tests failed to identify the code before it was included in a release + 3. the release was deployed by an admin that had failed to take advantage of the sandboxing system that prevents the injection of scripts into the UI ## Bug fixes -* Sheet export - * most exports broken by Chrome 92, mostly fixed - * we discovered that CSV export was not working in any major browser, though it's unclear why. We've disabled CSV export in the meantime - * updated translation to stop referring to Microsoft since we support OpenDocument formats - * some new browser-specific checkup tests to make it easier to detect future regressions in the APIs -* drive bug fixes - * guard against a few possible type errors - * "burn this drive" button works again in Firefox -* clear login token - 1. when you delete your account - 2. when logging in -* use single version of less.js on the client -* abort subsequent actions when metadata fails to load during owned channel archival -* handle warnings when trimming history (not just errors) -* filter channel ids with invalid lengths when generating a list of all channels you use +* The Chrome development team made some changes related to the availability of the `SharedArrayBuffer` API in cross-site-isolated contexts such as that of our sandboxing system which resulted in it being disabled despite the fact that our usage conformed to a specification that should have been supported. We use this modern browser feature (where available) to convert spreadsheets between different formats in the browser itself, whereas other services (even those advertizing their use of encryption for documents) send users' content to their server for conversion. Since Chrome's engine is used as the basis for a wide variety of other browsers, this broke sheet export everywhere except Firefox (which correctly implements the specification). Luckily, we found a simple workaround to use the same underlying feature using an alternate syntax that they had failed to disable. This is only a short-term solution as we have no expectation that it will continue to work, so we are actively investigating making this conversion a trusted process that will be run outside of our sandboxing system. +* On the topic of spreadsheet conversion, we updated our translations of the warning that is displayed in our conversion UI when the required browser features are not available. Rather than referring to "Microsoft Office formats" we now refer to _"Office formats"_ since we offer support for ODS in addition to XLSX. +* We found that CSV export mysteriously stopped working as well (seemingly everywhere, not just Chrome and derivatives). We're still not sure why this is the case, but the option is disabled in the UI until we can find and fix the problem. +* The _drive_ app includes a button that lets guest users wipe their personal data from their browser's session. We noticed that this button did nothing after approximately 50% of page loads in Firefox, suggesting there was an unpredictable quality related to either how the button was being created or how "click handlers" were declared. We traced it back to the jQuery library and rewrote the handler to use "VanillaJS". We don't have the time or budget to dig into why it stopped working, so unless someone else can figure it out for us then you, dear reader, may never learn the answer to this mystery. +* While investigating the drive we also added some guards against some possible type errors. +* We noticed that the `loginToken` attribute was not correctly removed from clients' localStorage when they deleted their account. The value of this token is random and is of no use to attackers (especially when the token belongs to a deleted account), but it was a cause of some inconvenience to us when testing account deletion, as the mismatch between the token stored locally and in accounts (after login) required us to login in a second time before. We've updated the related code to: + 1. correctly delete the token when you delete an account from the settings page + 2. ensure that no such token is present when logging in +* Document ids with invalid lengths are excluded from accounts' lists of "pinned documents" (those which should not be deleted from the server). We recently implemented a similar fix, but found that this list could be constructed in more than one way depending on the context. +* We identified and fixed two problems with our "history trim" functionality (accessible via documents' "Properties" menu): + 1. In the extremely unlikely event that a user requested that the server trim the history of a document and its metadata failed to load, the server would respond to the user with an error but did not correctly abort from the subsequent process to trim the document's history. In theory this could have been used by non-owners to archive parts of the documents history, however, we have no reason to believe that this was possible in practice. In any case, the flaw has been corrected. + 2. Complex documents like spreadsheets that use more than one channel to store different types of content would trim their respective histories in parallel, however, in such cases any errors were returned to the calling function as a list of warnings rather than a singular error. This format was not handled by the UI, resulting in an apparent success in cases of a partial or complete failure for such document types. # 4.9.0 diff --git a/bower.json b/bower.json index efa70c1bb..81acde661 100644 --- a/bower.json +++ b/bower.json @@ -30,7 +30,7 @@ "secure-fabric.js": "secure-v1.7.9", "hyperjson": "~1.4.0", "chainpad-crypto": "^0.2.0", - "chainpad-listmap": "^0.10.0", + "chainpad-listmap": "^1.0.0", "chainpad": "^5.2.0", "file-saver": "1.3.1", "alertifyjs": "1.0.11", diff --git a/customize.dist/fonts/cptools/fonts/cptools.eot b/customize.dist/fonts/cptools/fonts/cptools.eot new file mode 100644 index 000000000..dbfc79bf7 Binary files /dev/null and b/customize.dist/fonts/cptools/fonts/cptools.eot differ diff --git a/customize.dist/fonts/cptools/fonts/cptools.svg b/customize.dist/fonts/cptools/fonts/cptools.svg index 12d2fe9d6..29461075f 100644 --- a/customize.dist/fonts/cptools/fonts/cptools.svg +++ b/customize.dist/fonts/cptools/fonts/cptools.svg @@ -7,28 +7,28 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - + + + + + @@ -38,4 +38,5 @@ + \ No newline at end of file diff --git a/customize.dist/fonts/cptools/fonts/cptools.ttf b/customize.dist/fonts/cptools/fonts/cptools.ttf index 788b7f881..41ae6ef37 100644 Binary files a/customize.dist/fonts/cptools/fonts/cptools.ttf and b/customize.dist/fonts/cptools/fonts/cptools.ttf differ diff --git a/customize.dist/fonts/cptools/fonts/cptools.woff b/customize.dist/fonts/cptools/fonts/cptools.woff index f2faf5aa2..dca533fcd 100644 Binary files a/customize.dist/fonts/cptools/fonts/cptools.woff and b/customize.dist/fonts/cptools/fonts/cptools.woff differ diff --git a/customize.dist/fonts/cptools/style.css b/customize.dist/fonts/cptools/style.css index 874b6068f..7b3227453 100644 --- a/customize.dist/fonts/cptools/style.css +++ b/customize.dist/fonts/cptools/style.css @@ -1,10 +1,10 @@ @font-face { font-family: 'cptools'; - src: url('fonts/cptools.eot?chd5a1'); - src: url('fonts/cptools.eot?chd5a1#iefix') format('embedded-opentype'), - url('fonts/cptools.ttf?chd5a1') format('truetype'), - url('fonts/cptools.woff?chd5a1') format('woff'), - url('fonts/cptools.svg?chd5a1#cptools') format('svg'); + src: url('fonts/cptools.eot?6tk5ck'); + src: url('fonts/cptools.eot?6tk5ck#iefix') format('embedded-opentype'), + url('fonts/cptools.ttf?6tk5ck') format('truetype'), + url('fonts/cptools.woff?6tk5ck') format('woff'), + url('fonts/cptools.svg?6tk5ck#cptools') format('svg'); font-weight: normal; font-style: normal; font-display: block; @@ -14,7 +14,7 @@ /* use !important to prevent issues with browser extensions that change fonts */ font-family: 'cptools' !important; display: inline-block; - speak: none; + speak: never; font-style: normal; font-weight: normal; font-variant: normal; @@ -26,6 +26,9 @@ -moz-osx-font-smoothing: grayscale; } +.cptools-form-conditional:before { + content: "\e900"; +} .cptools-form-poll:before { content: "\e910"; } @@ -57,65 +60,65 @@ content: "\e91d"; } .cptools-folder-no-color:before { - content: "\e900"; + content: "\e901"; } .cptools-whiteboard:before { - content: "\e901"; + content: "\e902"; } .cptools-new-template:before { - content: "\e902"; + content: "\e903"; } .cptools-shared-folder:before { - content: "\e903"; + content: "\e904"; } .cptools-file-upload:before { - content: "\e904"; + content: "\e905"; } .cptools-template:before { - content: "\e905"; + content: "\e906"; } .cptools-poll:before { - content: "\e906"; + content: "\e907"; } .cptools-slide:before { - content: "\e907"; + content: "\e908"; } .cptools-sheet:before { - content: "\e908"; + content: "\e909"; } .cptools-folder-open:before { - content: "\e909"; + content: "\e90a"; } .cptools-kanban:before { - content: "\e90a"; + content: "\e90b"; } .cptools-folder:before { - content: "\e90b"; + content: "\e90c"; } .cptools-shared-folder-open:before { - content: "\e90c"; + content: "\e90d"; } .cptools-code:before { - content: "\e90d"; + content: "\e90e"; } .cptools-richtext:before { - content: "\e90e"; + content: "\e90f"; } .cptools-file:before { - content: "\e90f"; + content: "\e911"; } .cptools-palette:before { - content: "\e911"; + content: "\e912"; } .cptools-folder-upload:before { - content: "\e912"; + content: "\e913"; } .cptools-add-bottom:before { - content: "\e913"; + content: "\e914"; } .cptools-add-top:before { - content: "\e914"; + content: "\e915"; } .cptools-destroy:before { - content: "\e915"; + content: "\e91f"; } diff --git a/customize.dist/login.js b/customize.dist/login.js index 5cab49934..1ba0eb470 100644 --- a/customize.dist/login.js +++ b/customize.dist/login.js @@ -1,6 +1,6 @@ define([ 'jquery', - '/bower_components/chainpad-listmap/chainpad-listmap.js', + 'chainpad-listmap', '/bower_components/chainpad-crypto/crypto.js', '/common/common-util.js', '/common/outer/network-config.js', diff --git a/customize.dist/pages.js b/customize.dist/pages.js index fa183f90c..7a520c3c0 100644 --- a/customize.dist/pages.js +++ b/customize.dist/pages.js @@ -105,7 +105,7 @@ define([ var imprintUrl = AppConfig.imprint && (typeof(AppConfig.imprint) === "boolean" ? '/imprint.html' : AppConfig.imprint); - Pages.versionString = "v4.10.0"; + Pages.versionString = "v4.11.0"; // used for the about menu diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index 96b8e7cde..5c829cec4 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -166,6 +166,9 @@ color: @cryptpad_text_col; text-decoration: underline; } + pre.cp-link-preview { + color: @cryptpad_text_col; + } .cp-info-menu-container { .logo-block { text-align: center; diff --git a/customize.dist/src/less2/include/avatar.less b/customize.dist/src/less2/include/avatar.less index 725c7748f..acaa13351 100644 --- a/customize.dist/src/less2/include/avatar.less +++ b/customize.dist/src/less2/include/avatar.less @@ -4,7 +4,11 @@ @width: 30px ) { @avatar-width: @width; - @avatar-font-size: @width / 1.2; + @avatar-font-size: @width / 1.8; + // scale animal avatar to be somewhat larger, because: + // 1. emojis are wider than most latin characters + // 2. they should occupy the width of two average characters + @avatar-font-size-animal: @avatar-font-size * (6/5); } .avatar_main(@width: 30px) { --LessLoader_require: LessLoader_currentFile(); @@ -40,7 +44,9 @@ color: @cp_avatar-fg; font-size: @avatar-font-size; font-size: var(--avatar-font-size); - text-transform: capitalize; + .animal { + font-size: @avatar-font-size-animal; + } } media-tag { min-height: @avatar-width; diff --git a/customize.dist/src/less2/include/charts.less b/customize.dist/src/less2/include/charts.less index 022a327cf..ea402094f 100644 --- a/customize.dist/src/less2/include/charts.less +++ b/customize.dist/src/less2/include/charts.less @@ -51,22 +51,55 @@ } } + .cp-charts-cell { + border: 1px solid @cp_form-border; + display: table-cell; + padding: 5px 10px; + background: @cp_form-bg2; + } - - &.bar { - th { - //width: 200px !important; - font-size: 10px; // XXX + .cp-form-results-type-radio { + .cp-form-results-type-multiradio-data { + display: flex; + flex-flow: column; } + .cp-form-results-type-radio-data { + display: table-row; + border: 1px solid @cp_form-border; + & > span { + .cp-charts-cell(); + } + } + } + .cp-charts.cp-bar-table, .cp-charts.cp-text-table { + display: table; + width: 100%; + .cp-charts-row { + display: table-row; + border: 1px solid @cp_form-border; + &.full { + display: flex; + flex-flow: column; + } - - - td { - margin-top: 0.25em; - background: @cryptpad_color_brand_fade !important; - color: @cryptpad_color_grey_100 !important; //text_col !important; - font-weight: bold; + & > span { + .cp-charts-cell(); + display: table-cell; + &.cp-value { + min-width: 200px; + } + &.cp-bar-container { + width: 99%; + padding: 0px; + position: relative; + .cp-bar { + position: absolute; + background: @cryptpad_color_brand; + height: 100%; + } + } + } } } } diff --git a/customize.dist/src/less2/include/colortheme-dark.less b/customize.dist/src/less2/include/colortheme-dark.less index 5c1649850..1c71d4f05 100644 --- a/customize.dist/src/less2/include/colortheme-dark.less +++ b/customize.dist/src/less2/include/colortheme-dark.less @@ -68,6 +68,25 @@ @cryptpad_color_yellow_fader: fade(#FFE69C, 15%); // not in light theme @cryptpad_color_lighter_blue: #d2e1f2; +@cp_palette: + #FFD4D4, + #FFDECA, + #FFE69C, + #DBFFB7, + #AFFDC2, + #C9FFFE, + #C8D6FF, + #E4CAFF; +@cp_palette-dark: + darken(desaturate(extract(@cp_palette, 1),60%), 60%), + darken(desaturate(extract(@cp_palette, 2),60%), 60%), + darken(desaturate(extract(@cp_palette, 3),55%), 60%), + darken(desaturate(extract(@cp_palette, 4),55%), 70%), + darken(desaturate(extract(@cp_palette, 5),60%), 65%), + darken(desaturate(extract(@cp_palette, 6),60%), 70%), + darken(desaturate(extract(@cp_palette, 7),60%), 60%), + darken(desaturate(extract(@cp_palette, 8),70%), 60%); + @cryptpad_color_link:@cryptpad_color_brand_300; // Premium plans colors @@ -353,15 +372,7 @@ @cp_kanban-add-hover: fade(@cryptpad_color_black, 10%); @cp_kanban-trash-bg: @cryptpad_color_warn_red; @cp_kanban-color0: @cryptpad_color_grey_600; -@cp_kanban-colors: - darken(desaturate(#FFD4D4,60%), 60%), - darken(desaturate(#FFDECA,60%), 60%), - darken(desaturate(#FFE69C,55%), 60%), - darken(desaturate(#DBFFB7,55%), 70%), - darken(desaturate(#AFFDC2,60%), 65%), - darken(desaturate(#C9FFFE,60%), 70%), - darken(desaturate(#C8D6FF,60%), 60%), - darken(desaturate(#E4CAFF,70%), 60%); +@cp_kanban-colors: @cp_palette-dark; // Notifications @cp_notif-hover: fade(@cryptpad_color_black, 10%); @@ -438,3 +449,5 @@ @cp_form-poll-maybe: @cryptpad_color_grey_700; @cp_form-poll-yes-color: @cryptpad_color_green; @cp_form-invalid: @cryptpad_color_light_red; +@cp_form-palette: @cp_palette-dark; +@cp_form-palette2: @cp_palette; diff --git a/customize.dist/src/less2/include/colortheme.less b/customize.dist/src/less2/include/colortheme.less index 18dcb1c0a..dd6115ea1 100644 --- a/customize.dist/src/less2/include/colortheme.less +++ b/customize.dist/src/less2/include/colortheme.less @@ -67,6 +67,25 @@ @cryptpad_color_yellow_fade: fade(#FFE69C, 50%); // different from dark @cryptpad_color_lighter_blue: #d2e1f2; +@cp_palette: + #FFD4D4, + #FFDECA, + #FFE69C, + #DBFFB7, + #AFFDC2, + #C9FFFE, + #C8D6FF, + #E4CAFF; +@cp_palette-dark: + darken(extract(@cp_palette, 1), 50%), + darken(extract(@cp_palette, 2), 51%), + darken(extract(@cp_palette, 3), 52%), + darken(extract(@cp_palette, 4), 61%), + darken(extract(@cp_palette, 5), 57%), + darken(extract(@cp_palette, 6), 65%), + darken(extract(@cp_palette, 7), 50%), + darken(extract(@cp_palette, 8), 50%); + @cryptpad_color_link: @cryptpad_color_brand; // Premium plans colors @@ -299,7 +318,7 @@ @cp_usergrid-selected-fg: @cryptpad_color_white; // Other -@cp_shadow-color: fade(@cryptpad_color_black, 40%); +@cp_shadow-color: fade(@cryptpad_color_black, 30%); // Apps @cp_app-bg: @cryptpad_color_grey_100; @@ -352,15 +371,7 @@ @cp_kanban-add-hover: fade(@cryptpad_color_black, 10%); @cp_kanban-trash-bg: @cryptpad_color_warn_red; @cp_kanban-color0: @cryptpad_color_grey_400; -@cp_kanban-colors: - #FFD4D4, - #FFDECA, - #FFE69C, - #DBFFB7, - #AFFDC2, - #C9FFFE, - #C8D6FF, - #E4CAFF; +@cp_kanban-colors: @cp_palette; // Notifications @cp_notif-hover: fade(@cryptpad_color_black, 10%); @@ -428,8 +439,8 @@ @cp_calendar-now-fg: @cryptpad_color_grey_200; // Forms -@cp_form-bg1: @cryptpad_color_grey_200; -@cp_form-bg2: @cryptpad_color_grey_100; +@cp_form-bg1: @cryptpad_color_grey_50; +@cp_form-bg2: @cryptpad_color_grey_200; @cp_form-border: @cryptpad_color_grey_200; @cp_form-poll-color: @cryptpad_color_grey_800; @cp_form-poll-no: fade(@cryptpad_color_light_red, 75%); @@ -437,3 +448,5 @@ @cp_form-poll-maybe: @cryptpad_color_grey_300; @cp_form-poll-yes-color: @cryptpad_color_green; @cp_form-invalid: @cryptpad_color_red; +@cp_form-palette: @cp_palette; +@cp_form-palette2: @cp_palette-dark; diff --git a/customize.dist/src/less2/include/creation.less b/customize.dist/src/less2/include/creation.less index f4f4d0193..b15863c57 100644 --- a/customize.dist/src/less2/include/creation.less +++ b/customize.dist/src/less2/include/creation.less @@ -364,9 +364,9 @@ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; - min-height: 20px; - height: 20px; - line-height: 20px; + min-height: 25px; + height: 25px; + line-height: 25px; max-width: 100%; } .fa, .cptools { diff --git a/customize.dist/src/less2/include/forms.less b/customize.dist/src/less2/include/forms.less index 4fb799e13..2eace9f29 100644 --- a/customize.dist/src/less2/include/forms.less +++ b/customize.dist/src/less2/include/forms.less @@ -112,8 +112,10 @@ border-radius: 0; transition: none; - .fa, .cptools { - margin-right: 5px; + i, .fa, .cptools { + &:not(.nomargin) { + margin-right: 5px; + } } .cptools { vertical-align: middle; diff --git a/customize.dist/src/less2/include/modals-ui-elements.less b/customize.dist/src/less2/include/modals-ui-elements.less index 7ec19a699..ffb6f95c9 100644 --- a/customize.dist/src/less2/include/modals-ui-elements.less +++ b/customize.dist/src/less2/include/modals-ui-elements.less @@ -273,4 +273,29 @@ } } } + #cp-upload-preview-container { + max-width: 100%; + max-height: 300px; + overflow: auto; + margin-bottom: 15px; + // FIXME these styles yield weird results for tall, thin images + // maybe img { object-fit: contain; } or scale-down are options + // but they have problems too + media-tag { + max-width: 100%; + iframe { + // pdfs don't take the full width unless we tell them to + width: 100%; + } + & > * { + max-width: 100%; + } + } + } + input#cp-app-drive-link-url { + &.cp-input-invalid { + border: 2px solid @cryptpad_color_red; + color: @cp_form-invalid; + } + } } diff --git a/customize.dist/src/less2/include/sidebar-layout.less b/customize.dist/src/less2/include/sidebar-layout.less index ef93eae4a..564067fb7 100644 --- a/customize.dist/src/less2/include/sidebar-layout.less +++ b/customize.dist/src/less2/include/sidebar-layout.less @@ -69,7 +69,6 @@ background: @cp_sidebar-right-bg; color: @cp_sidebar-right-fg; overflow: auto; - padding-bottom: 200px; // Following rules are only in settings .cp-sidebarlayout-element { diff --git a/customize.dist/src/less2/include/toolbar.less b/customize.dist/src/less2/include/toolbar.less index b0f9b5e42..6ccec507d 100644 --- a/customize.dist/src/less2/include/toolbar.less +++ b/customize.dist/src/less2/include/toolbar.less @@ -532,7 +532,13 @@ &> button { height: @toolbar_line-height; width: @toolbar_line-height; - span { font-size: unset; } + span { + .avatar_vars(36px); + font-size: @avatar-font-size; + .animal { + font-size: @avatar-font-size-animal; + } + } } &> button.cp-avatar.cp-avatar { media-tag { @@ -855,10 +861,14 @@ span { text-align: center; width: 100%; - font-size: 48px; + .avatar_vars(72px); + font-size: @avatar-font-size; display: inline-flex; justify-content: center; align-items: center; + .animal { + font-size: @avatar-font-size-animal; + } } &.cp-avatar { .avatar_main(64px); diff --git a/docs/example.nginx.conf b/docs/example.nginx.conf index 8bc47d9f8..14a3d4fc2 100644 --- a/docs/example.nginx.conf +++ b/docs/example.nginx.conf @@ -2,7 +2,7 @@ # to work with CryptPad. This example WILL NOT WORK AS IS. For best results, # compare the sections of this configuration file against a working CryptPad # installation (http server by the Nodejs process). If you are using CryptPad -# in production, contact sales@cryptpad.fr +# in production and require professional support please contact sales@cryptpad.fr server { listen 443 ssl http2; diff --git a/lib/env.js b/lib/env.js index 4db282d77..5ad0bbdac 100644 --- a/lib/env.js +++ b/lib/env.js @@ -123,7 +123,7 @@ module.exports.create = function (config) { maxWorkers: config.maxWorkers, disableIntegratedTasks: config.disableIntegratedTasks || false, - disableIntegratedEviction: typeof(config.disableIntegratedEviction) === 'undefined'? true: config.disableIntegratedEviction, // XXX 4.10.0 false, + disableIntegratedEviction: typeof(config.disableIntegratedEviction) === 'undefined'? true: config.disableIntegratedEviction, // XXX 4.11.0 false, lastEviction: +new Date(), evictionReport: {}, commandTimers: {}, diff --git a/package-lock.json b/package-lock.json index a3b92de86..c795956c9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cryptpad", - "version": "4.10.0", + "version": "4.11.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1591,9 +1591,9 @@ } }, "jszip": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.6.0.tgz", - "integrity": "sha512-jgnQoG9LKnWO3mnVNBnfhkh0QknICd1FGSrXcgrl67zioyJ4wgx25o9ZqwNtrROSflGBCGYnJfjrIyRIby1OoQ==", + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.7.1.tgz", + "integrity": "sha512-ghL0tz1XG9ZEmRMcEN2vt7xabrDdqHHeykgARpmZ0BiIctWxM47Vt63ZO2dnp4QYt/xJVLLy5Zv1l/xRdh2byg==", "dev": true, "requires": { "lie": "~3.3.0", diff --git a/package.json b/package.json index a844167f5..26fbc968a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cryptpad", "description": "realtime collaborative visual editor with zero knowlege server", - "version": "4.10.0", + "version": "4.11.0", "license": "AGPL-3.0+", "repository": { "type": "git", @@ -45,8 +45,8 @@ "lint:js": "jshint --config .jshintrc --exclude-path .jshintignore .", "lint:server": "jshint --config .jshintrc lib", "lint:less": "./node_modules/lesshint/bin/lesshint -c ./.lesshintrc ./customize.dist/src/less2/", - "lint:translations": "node ./scripts/lint-translations.js", - "unused-translations": "node ./scripts/unused-translations.js", + "lint:translations": "node ./scripts/translations/lint-translations.js", + "unused-translations": "node ./scripts/translations/unused-translations.js", "test": "node scripts/TestSelenium.js", "test-rpc": "cd scripts/tests && node test-rpc", "template": "cd customize.dist/src && for page in ../index.html ../privacy.html ../terms.html ../contact.html ../what-is-cryptpad.html ../features.html ../../www/login/index.html ../../www/register/index.html ../../www/user/index.html;do echo $page; cp template.html $page; done;", diff --git a/scripts/translations/find-duplicate-translations.js b/scripts/translations/find-duplicate-translations.js new file mode 100644 index 000000000..a6bc53613 --- /dev/null +++ b/scripts/translations/find-duplicate-translations.js @@ -0,0 +1,111 @@ +var Assert = require("assert"); +var Util = require("../../lib/common-util"); +var addIfAbsent = function (A, e) { + if (A.includes(e)) { return; } + A.push(e); +}; + +var findDuplicates = function (map) { + var keys = Object.keys(map); + + + var duplicates = {}; + var markDuplicate = function (value, key1, key2) { + //console.log("[%s] === [%s] (%s)", key1, key2, value); + if (!Array.isArray(duplicates[value])) { + duplicates[value] = []; + } + addIfAbsent(duplicates[value], key1); + addIfAbsent(duplicates[value], key2); + }; + + keys.forEach(function (key) { + var value = map[key]; + + //var duplicates = []; + keys.forEach(function (key2) { + if (key === key2) { return; } + var value2 = map[key2]; + if (value === value2) { + markDuplicate(value, key, key2); + } + }); + }); + + var temp = {}; + // sort keys and construct a new index using the first key in the sorted array + Object.keys(duplicates).forEach(function (key) { + var val = duplicates[key]; // should be an array + val.sort(); // default js sort + var new_key = val[0]; + temp[new_key] = val; + }); + + var canonical = {}; + Object.keys(temp).sort().forEach(function (key) { + canonical[key] = temp[key]; + }); + return canonical; +}; + +/* +var logDuplicates = function (duplicates) { + // indicate which strings are duplicated and could potentially be changed to use one key + Object.keys(duplicates).forEach(function (val) { + console.log('\"%s\" => %s', val, JSON.stringify(duplicates[val])); + }); +}; +*/ + +var FULL_LANGUAGES = { + EN: Util.clone(require("../../www/common/translations/messages.json")), + FR: Util.clone(require("../../www/common/translations/messages.fr.json")), + DE: Util.clone(require("../../www/common/translations/messages.de.json")), + JP: Util.clone(require("../../www/common/translations/messages.ja.json")), +}; + +var DUPLICATES = {}; + +Object.keys(FULL_LANGUAGES).forEach(function (code) { + DUPLICATES[code] = findDuplicates(FULL_LANGUAGES[code]); +}); + +var extraneousKeys = 0; + +// 1) check whether the same mapping exists across languages +// ie. English has "Open" (verb) and "Open" (adjective) +// while French has "Ouvrir" and "Ouvert(s)" +// such keys should not be simplified/deduplicated +Object.keys(DUPLICATES.EN).forEach(function (key) { + var reference = DUPLICATES.EN[key]; + if (!['FR', 'DE', 'JP'].every(function (code) { + try { + Assert.deepEqual(reference, DUPLICATES[code][key]); + } catch (err) { + return false; + } + return true; + })) { + return; + } + console.log("The key [%s] (\"%s\") is duplicated identically across all fully supported languages", key, FULL_LANGUAGES.EN[key]); + console.log("Values:", JSON.stringify(['EN', 'FR', 'DE', 'JP'].map(function (code) { + return FULL_LANGUAGES[code][key]; + }))); + console.log("Keys:", JSON.stringify(reference)); + console.log(); + extraneousKeys += reference.length - 1; + + //console.log("\n" + code + "\n==\n"); + //logDuplicates(map); +}); + +console.log("Total extraneous keys: %s", extraneousKeys); + + +// TODO +// find instances where +// one of the duplicated keys is not translated +// perhaps we could automatically use the translated one everywhere +// and improve the completeness of translations + diff --git a/scripts/lint-translations.js b/scripts/translations/lint-translations.js similarity index 92% rename from scripts/lint-translations.js rename to scripts/translations/lint-translations.js index bc18dd724..e02bca46a 100644 --- a/scripts/lint-translations.js +++ b/scripts/translations/lint-translations.js @@ -1,4 +1,4 @@ -var EN = require("../www/common/translations/messages.json"); +var EN = require("../../www/common/translations/messages.json"); var simpleTags = [ '
', @@ -68,7 +68,7 @@ var processLang = function (map, lang, primary) { if (typeof(s) !== 'string') { return; } var usesHTML; - s.replace(/<.*?>/g, function (html) { + s.replace(/<[\s\S]*?>/g, function (html) { if (simpleTags.indexOf(html) !== -1) { return; } announce(); usesHTML = true; @@ -118,7 +118,7 @@ processLang(EN, 'en', true); 'zh', ].forEach(function (lang) { try { - var map = require("../www/common/translations/messages." + lang + ".json"); + var map = require("../../www/common/translations/messages." + lang + ".json"); if (!Object.keys(map).length) { return; } processLang(map, lang); } catch (err) { diff --git a/scripts/unused-translations.js b/scripts/translations/unused-translations.js similarity index 98% rename from scripts/unused-translations.js rename to scripts/translations/unused-translations.js index 26156cd03..941835cba 100644 --- a/scripts/unused-translations.js +++ b/scripts/translations/unused-translations.js @@ -1,4 +1,4 @@ -var Messages = require("../www/common/translations/messages.json"); +var Messages = require("../../www/common/translations/messages.json"); var Exec = require("child_process").exec; var ignoreLines = function (source, pattern) { diff --git a/temp.md b/temp.md new file mode 100644 index 000000000..e69de29bb diff --git a/www/admin/app-admin.less b/www/admin/app-admin.less index 227792540..f66eb75f7 100644 --- a/www/admin/app-admin.less +++ b/www/admin/app-admin.less @@ -1,12 +1,14 @@ @import (reference) '../../customize/src/less2/include/framework.less'; @import (reference) '../../customize/src/less2/include/sidebar-layout.less'; @import (reference) '../../customize/src/less2/include/support.less'; +@import (reference) '../../customize/src/less2/include/charts.less'; &.cp-app-admin { .framework_min_main(); .sidebar-layout_main(); .support_main(); + .charts_main(); .cp-hidden { display: none !important; @@ -294,5 +296,27 @@ } } } + span.cp-bar.profiling-percentage { + text-align: center; + padding: 5px; + } + span.profiling-label { + position: absolute; + z-index: 1; + width: 100%; + text-align: center; + padding: 5px; + } + #profiling-chart { + .cp-bar-container { + max-width: 400px; + } + } + .width-constrained { + max-width: 800px; + } + .cp-charts-row.heading { + font-weight: bold; + } } diff --git a/www/admin/inner.js b/www/admin/inner.js index e8d567d41..63c516614 100644 --- a/www/admin/inner.js +++ b/www/admin/inner.js @@ -1673,34 +1673,51 @@ define([ var $div = makeBlock('performance-profiling'); // Msg.admin_performanceProfilingHint, .admin_performanceProfilingTitle var onRefresh = function () { - var body = h('tbody'); + var createBody = function () { + return h('div#profiling-chart.cp-charts.cp-bar-table', [ + h('span.cp-charts-row.heading', [ + h('span', Messages.admin_performanceKeyHeading), + h('span', Messages.admin_performanceTimeHeading), + h('span', Messages.admin_performancePercentHeading), + //h('span', ''), //Messages.admin_performancePercentHeading), + ]), + ]); + }; - var table = h('table#cp-performance-table', [ - h('thead', [ - h('th', Messages.admin_performanceKeyHeading), - h('th', Messages.admin_performanceTimeHeading), - h('th', Messages.admin_performancePercentHeading), - ]), - body, - ]); - var appendRow = function (key, time, percent) { - console.log("[%s] %ss running time (%s%)", key, time, percent); - body.appendChild(h('tr', [ key, time, percent ].map(function (x) { - return h('td', x); - }))); + var body = createBody(); + var appendRow = function (key, time, percent, scaled) { + //console.log("[%s] %ss running time (%s%)", key, time, percent); + body.appendChild(h('span.cp-charts-row', [ + h('span', key), + h('span', time), + //h('span', percent), + h('span.cp-bar-container', [ + h('span.cp-bar.profiling-percentage', { + style: 'width: ' + scaled + '%', + }, ' ' ), + h('span.profiling-label', percent + '%'), + ]), + ])); }; var process = function (_o) { + $('#profiling-chart').remove(); + body = createBody(); var o = _o[0]; var sorted = Object.keys(o).sort(function (a, b) { if (o[b] - o[a] <= 0) { return -1; } return 1; }); + + var values = sorted.map(function (k) { return o[k]; }); var total = 0; - sorted.forEach(function (k) { total += o[k]; }); + values.forEach(function (value) { total += value; }); + var max = Math.max.apply(null, values); + sorted.forEach(function (k) { var percent = Math.floor((o[k] / total) * 1000) / 10; - appendRow(k, o[k], percent); + appendRow(k, o[k], percent, (o[k] / max) * 100); }); + $div.append(h('div.width-constrained', body)); }; sFrameChan.query('Q_ADMIN_RPC', { @@ -1710,10 +1727,7 @@ define([ UI.warn(Messages.error); return void console.error(e, data); } - //console.info(data); - $div.find("table").remove(); process(data); - $div.append(table); }); }; diff --git a/www/calendar/export.js b/www/calendar/export.js index 64775762b..5967e2027 100644 --- a/www/calendar/export.js +++ b/www/calendar/export.js @@ -123,6 +123,7 @@ define([ var jcalData = ICAL.parse(content); vcalendar = new ICAL.Component(jcalData); } catch (e) { + console.error(e); return void cb(e); } @@ -147,6 +148,18 @@ define([ var isAllDay = false; var start = ev.getFirstPropertyValue('dtstart'); var end = ev.getFirstPropertyValue('dtend'); + var duration = ev.getFirstPropertyValue('duration'); + if (!end && !duration) { + if (start.isDate) { + end = start.clone(); + end.adjust(1); // Add one day + } else { + end = start.clone(); + } + } else if (!end) { + end = start.clone(); + end.addDuration(duration); + } if (start.isDate && end.isDate) { isAllDay = true; start = String(start); @@ -175,7 +188,7 @@ define([ hidden.push(al.toString()); } var trigger = al.getFirstPropertyValue('trigger'); - var minutes = -trigger.toSeconds() / 60; + var minutes = trigger ? (-trigger.toSeconds() / 60) : 0; if (reminders.indexOf(minutes) === -1) { reminders.push(minutes); } }); diff --git a/www/calendar/inner.js b/www/calendar/inner.js index 21cb12789..fbc910bdb 100644 --- a/www/calendar/inner.js +++ b/www/calendar/inner.js @@ -566,7 +566,7 @@ define([ attributes: { 'class': 'fa fa-trash-o', }, - content: h('span', Messages.kanban_delete), + content: h('span', Messages.poll_remove), action: function (e) { e.stopPropagation(); var cal = APP.calendars[id]; @@ -586,8 +586,9 @@ define([ }, function (err) { if (err) { console.error(err); - UI.warn(Messages.error); + return void UI.warn(Messages.error); } + renderCalendar(); }); }); } @@ -722,7 +723,7 @@ define([ if (!calendars.length) { return; } var team = privateData.teams[teamId]; var avatar = h('span.cp-avatar'); - common.displayAvatar($(avatar), team.avatar, team.displayName); + common.displayAvatar($(avatar), team.avatar, team.displayName || team.name); APP.$calendars.append(h('div.cp-calendar-team', [ avatar, h('span.cp-name', {title: team.name}, team.name) diff --git a/www/code/markers.js b/www/code/markers.js index b070e68fc..48e5a25fb 100644 --- a/www/code/markers.js +++ b/www/code/markers.js @@ -3,7 +3,9 @@ define([ '/common/sframe-common-codemirror.js', '/customize/messages.js', '/bower_components/chainpad/chainpad.dist.js', -], function (Util, SFCodeMirror, Messages, ChainPad) { + '/common/inner/common-mediatag.js', + '/common/common-interface.js', +], function (Util, SFCodeMirror, Messages, ChainPad, MT, UI) { var Markers = {}; /* TODO Known Issues @@ -38,7 +40,17 @@ define([ }); } uid = Number(uid); - var name = Util.fixHTML(author.name || Messages.anonymous); + var name = Util.fixHTML(UI.getDisplayName(author.name)); + var animal; + if ((!name || name === Messages.anonymous) && typeof(author.uid) === 'string') { + animal = MT.getPseudorandomAnimal(author.uid); + if (animal) { + name = animal + ' ' + Messages.anonymous; + } else { + name = Messages.anonymous; + } + } + var col = Util.hexToRGB(author.color); var rgba = 'rgba('+col[0]+','+col[1]+','+col[2]+','+Env.opacity+');'; return Env.editor.markText(from, to, { @@ -520,7 +532,8 @@ define([ Env.authormarks.authors[Env.myAuthorId] = { name: userData.name, curvePublic: userData.curvePublic, - color: userData.color + color: userData.color, + uid: userData.uid, }; if (!old || (old.name === userData.name && old.color === userData.color)) { return; } return true; diff --git a/www/common/application_config_internal.js b/www/common/application_config_internal.js index 3be979f17..4a58085ab 100644 --- a/www/common/application_config_internal.js +++ b/www/common/application_config_internal.js @@ -208,5 +208,7 @@ define(function() { // the driveless mode by changing the following value to "false" AppConfig.allowDrivelessMode = true; + AppConfig.emojiAvatars = '🙈 🦀 🐞 🦋 🐬 🐋 🐢 🦉 🦆 🐧 🦡 🦘 🦨 🦦 🦥 🐼 🐻 🦝 🦓 🐄 💮️ 🐙️ 🌸️ 🌻️ 🐝️ 🐐 🦙 🦒 🐘 🦏 🐁 🐹 🐰 🦫 🦔 🐨 🐱 🐺 👺 👹 👽 👾 🤖'.split(/\s+/); + return AppConfig; }); diff --git a/www/common/boot2.js b/www/common/boot2.js index ada5b794c..d143da87d 100644 --- a/www/common/boot2.js +++ b/www/common/boot2.js @@ -34,6 +34,7 @@ try { define([ '/common/requireconfig.js' ], function (RequireConfig) { + require.config(RequireConfig()); // most of CryptPad breaks if you don't support isArray @@ -91,4 +92,10 @@ define([ } catch (e) { console.error(e); failStore(); } require([document.querySelector('script[data-bootload]').getAttribute('data-bootload')]); + if (typeof(Promise) !== 'function') { + setTimeout(function () { + var s = "Internet Explorer is not supported anymore, including by Microsoft.\n\nMost of CryptPad's collaborative functionality requires a modern browser to work.\n\nWe recommend Mozilla Firefox."; + window.alert(s); + }); + } }); diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 71a1ed8af..5c2431efd 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -41,6 +41,10 @@ define([ return e; }; + UI.getDisplayName = function (name) { + return (typeof(name) === 'string'? name: "").trim() || Messages.anonymous; + }; + // FIXME almost everywhere this is used would also be // a good candidate for sframe-common's getMediatagFromHref UI.mediaTag = function (src, key) { diff --git a/www/common/common-messaging.js b/www/common/common-messaging.js index 65f05961e..4a3eb2a91 100644 --- a/www/common/common-messaging.js +++ b/www/common/common-messaging.js @@ -17,7 +17,8 @@ define([ edPublic: proxy.edPublic, curvePublic: proxy.curvePublic, notifications: Util.find(proxy, ['mailboxes', 'notifications', 'channel']), - avatar: proxy.profile && proxy.profile.avatar + avatar: proxy.profile && proxy.profile.avatar, + uid: proxy.uid, }; if (hash === false) { delete data.channel; } return data; diff --git a/www/common/common-thumbnail.js b/www/common/common-thumbnail.js index 01e89e5d1..e3b328dc1 100644 --- a/www/common/common-thumbnail.js +++ b/www/common/common-thumbnail.js @@ -196,7 +196,7 @@ define([ reader.readAsText(blob); }; Thumb.fromBlob = function (blob, _cb) { - var cb = Util.once(_cb); + var cb = Util.once(Util.mkAsync(_cb)); // The blob is already in memory, it should be super-fast to make a thumbnail // ==> 1s timeout setTimeout(function () { diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 81327844f..08e0bcf07 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -156,9 +156,11 @@ define([ var icons = Object.keys(users).map(function (key, i) { var data = users[key]; - var name = data.displayName || data.name || Messages.anonymous; - var avatar = h('span.cp-usergrid-avatar.cp-avatar'); - common.displayAvatar($(avatar), data.avatar, name); + var name = UI.getDisplayName(data.displayName || data.name); + var avatar = h('span.cp-usergrid-avatar.cp-avatar', { + 'aria-hidden': true, + }); + common.displayAvatar($(avatar), data.avatar, name, Util.noop, data.uid); var removeBtn, el; if (config.remove) { removeBtn = h('span.fa.fa-times'); @@ -649,7 +651,7 @@ define([ if (!AppConfig.enableTemplates) { return; } if (!common.isLoggedIn()) { return; } button = $('",'",""].join(""),i.tpl=_.template(this.template)(i),Common.UI.Window.prototype.initialize.call(this,i)},render:function(){Common.UI.Window.prototype.render.call(this),this.conditions=[{value:Asc.c_oAscCustomAutoFilter.equals,displayValue:this.capCondition1},{value:Asc.c_oAscCustomAutoFilter.doesNotEqual,displayValue:this.capCondition2},{value:Asc.c_oAscCustomAutoFilter.isGreaterThan,displayValue:this.capCondition3},{value:Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo,displayValue:this.capCondition4},{value:Asc.c_oAscCustomAutoFilter.isLessThan,displayValue:this.capCondition5},{value:Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo,displayValue:this.capCondition6},{value:-2,displayValue:this.capCondition13},{value:-3,displayValue:this.capCondition14}],"label"==this.type&&(this.conditions=this.conditions.concat([{value:Asc.c_oAscCustomAutoFilter.beginsWith,displayValue:this.capCondition7},{value:Asc.c_oAscCustomAutoFilter.doesNotBeginWith,displayValue:this.capCondition8},{value:Asc.c_oAscCustomAutoFilter.endsWith,displayValue:this.capCondition9},{value:Asc.c_oAscCustomAutoFilter.doesNotEndWith,displayValue:this.capCondition10},{value:Asc.c_oAscCustomAutoFilter.contains,displayValue:this.capCondition11},{value:Asc.c_oAscCustomAutoFilter.doesNotContain,displayValue:this.capCondition12}])),this.cmbCondition1=new Common.UI.ComboBox({el:$("#id-cond-digital-combo",this.$window),menuStyle:"min-width: 100%;max-height: 135px;",style:"width:100%;",cls:"input-group-nr",data:this.conditions,scrollAlwaysVisible:!0,editable:!1,takeFocusOnClose:!0}),this.cmbCondition1.setValue(Asc.c_oAscCustomAutoFilter.equals),this.cmbCondition1.on("selected",_.bind(function(t,e){var i=-2==e.value||-3==e.value;this.inputValue2.setVisible(i),this.lblAnd.toggleClass("hidden",!i),this.inputValue.$el.width(i?100:225);var n=this;_.defer(function(){n.inputValue&&n.inputValue.focus()},10)},this)),this.cmbFields=new Common.UI.ComboBox({el:$("#id-field-digital-combo",this.$window),menuStyle:"min-width: 100%;max-height: 135px;",style:"width:100%;",cls:"input-group-nr",data:[],scrollAlwaysVisible:!0,editable:!1,takeFocusOnClose:!0}),this.cmbFields.setVisible("value"==this.type),this.cmbFields.on("selected",_.bind(function(t,e){var i=this;_.defer(function(){i.inputValue&&i.inputValue.focus()},10)},this)),this.inputValue=new Common.UI.InputField({el:$("#id-input-digital-value1"),allowBlank:!1,style:"width: 100%;",validateOnBlur:!1}),this.inputValue2=new Common.UI.InputField({el:$("#id-input-digital-value2"),allowBlank:!1,style:"width: 100%;",validateOnBlur:!1}),this.lblAnd=this.$window.find("#id-label-digital-and"),this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.loadDefaults()},getFocusedComponents:function(){return[this.cmbFields,this.cmbCondition1,this.inputValue,this.inputValue2]},getDefaultFocusableComponent:function(){return this.inputValue},close:function(){this.api&&this.api.asc_enableKeyEvents(!0),Common.UI.Window.prototype.close.call(this)},onBtnClick:function(t){t.currentTarget.attributes&&t.currentTarget.attributes.result&&("ok"===t.currentTarget.attributes.result.value&&this.save(),this.close())},setSettings:function(t){this.properties=t},loadDefaults:function(){if(this.properties&&this.cmbCondition1&&this.cmbFields&&this.inputValue){var t=this.properties.asc_getPivotObj(),e=t.asc_getDataFieldIndexFilter(),i=t.asc_getDataFields();if(this.setTitle(this.options.title+" ("+i[0]+")"),"value"==this.type){i.shift();var n=[];i&&i.forEach(function(t,e){t&&n.push({value:e,displayValue:t})}),this.cmbFields.setData(n),this.cmbFields.setValue(0!==e?e-1:0)}var s=this.properties.asc_getFilterObj();if(s.asc_getType()==Asc.c_oAscAutoFilterTypes.CustomFilters){var o=s.asc_getFilter(),a=o.asc_getCustomFilters(),l=a[0].asc_getOperator();if(a.length>1){var r=o.asc_getAnd(),c=a[0].asc_getOperator()==Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo&&a[1].asc_getOperator()==Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo,h=a[0].asc_getOperator()==Asc.c_oAscCustomAutoFilter.isLessThan&&a[1].asc_getOperator()==Asc.c_oAscCustomAutoFilter.isGreaterThan;r&&c?l=-2:!r&&h&&(l=-3)}this.cmbCondition1.setValue(l||Asc.c_oAscCustomAutoFilter.equals),this.inputValue.setValue(null===a[0].asc_getVal()?"":a[0].asc_getVal()),this.inputValue.$el.width(-2==l||-3==l?100:225),this.lblAnd.toggleClass("hidden",!(-2==l||-3==l)),this.inputValue2.setVisible(-2==l||-3==l),this.inputValue2.setValue(a.length>1?null===a[1].asc_getVal()?"":a[1].asc_getVal():"")}}},save:function(){if(this.api&&this.properties&&this.cmbCondition1&&this.cmbFields&&this.inputValue){var t=this.properties.asc_getFilterObj();t.asc_setFilter(new Asc.CustomFilters),t.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters);var e=t.asc_getFilter(),i=this.cmbCondition1.getValue();if(-2==i){e.asc_setCustomFilters([new Asc.CustomFilter,new Asc.CustomFilter]),e.asc_setAnd(!0);var n=e.asc_getCustomFilters();n[0].asc_setOperator(Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo),n[0].asc_setVal(this.inputValue.getValue()),n[1].asc_setOperator(Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo),n[1].asc_setVal(this.inputValue2.getValue())}else if(-3==i){e.asc_setCustomFilters([new Asc.CustomFilter,new Asc.CustomFilter]),e.asc_setAnd(!1);var n=e.asc_getCustomFilters();n[0].asc_setOperator(Asc.c_oAscCustomAutoFilter.isLessThan),n[0].asc_setVal(this.inputValue.getValue()),n[1].asc_setOperator(Asc.c_oAscCustomAutoFilter.isGreaterThan),n[1].asc_setVal(this.inputValue2.getValue())}else{e.asc_setCustomFilters([new Asc.CustomFilter]),e.asc_setAnd(!0);var n=e.asc_getCustomFilters();n[0].asc_setOperator(this.cmbCondition1.getValue()),n[0].asc_setVal(this.inputValue.getValue())}this.properties.asc_getPivotObj().asc_setDataFieldIndexFilter("value"==this.type?this.cmbFields.getValue()+1:0),this.api.asc_applyAutoFilter(this.properties)}},onPrimary:function(){return this.save(),this.close(),!1},capCondition1:"equals",capCondition10:"does not end with",capCondition11:"contains",capCondition12:"does not contain",capCondition2:"does not equal",capCondition3:"is greater than",capCondition4:"is greater than or equal to",capCondition5:"is less than",capCondition6:"is less than or equal to",capCondition7:"begins with",capCondition8:"does not begin with",capCondition9:"ends with",textShowLabel:"Show items for which the label:",textShowValue:"Show items for which:",textUse1:"Use ? to present any single character",textUse2:"Use * to present any series of character",txtTitleValue:"Value Filter",txtTitleLabel:"Label Filter",capCondition13:"between",capCondition14:"not between",txtAnd:"and"},SSE.Views.PivotDigitalFilterDialog||{})),SSE.Views.SortFilterDialog=Common.UI.Window.extend(_.extend({initialize:function(t){var e=this,i={};this.type=t.type,_.extend(i,{width:250,height:215,contentWidth:180,header:!0,cls:"filter-dlg",contentTemplate:"",title:e.txtTitle,items:[],buttons:["ok","cancel"]},t),this.template=t.template||['
','
','
','
','
','
',"
","
",'
'].join(""),this.api=t.api,this.handler=t.handler,i.tpl=_.template(this.template)(i),Common.UI.Window.prototype.initialize.call(this,i)},render:function(){Common.UI.Window.prototype.render.call(this),this.radioAsc=new Common.UI.RadioBox({el:$("#id-sort-filter-radio-asc"),labelText:this.textAsc,name:"asc-radio-sort",checked:!0}),this.radioAsc.on("change",_.bind(function(t,e){e&&this.cmbFieldsAsc.setDisabled(!1),e&&this.cmbFieldsDesc.setDisabled(!0)},this)),this.radioDesc=new Common.UI.RadioBox({el:$("#id-sort-filter-radio-desc"),labelText:this.textDesc,name:"asc-radio-sort"}),this.radioDesc.on("change",_.bind(function(t,e){e&&this.cmbFieldsAsc.setDisabled(!0),e&&this.cmbFieldsDesc.setDisabled(!1)},this)),this.cmbFieldsAsc=new Common.UI.ComboBox({el:$("#id-sort-filter-fields-asc",this.$window),menuStyle:"min-width: 100%;max-height: 135px;",style:"width:100%;",cls:"input-group-nr",data:[],scrollAlwaysVisible:!0,editable:!1}),this.cmbFieldsDesc=new Common.UI.ComboBox({el:$("#id-sort-filter-fields-desc",this.$window),menuStyle:"min-width: 100%;max-height: 135px;",style:"width:100%;",cls:"input-group-nr",data:[],scrollAlwaysVisible:!0,editable:!1,disabled:!0}),this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.loadDefaults()},show:function(){Common.UI.Window.prototype.show.call(this)},close:function(){this.api&&this.api.asc_enableKeyEvents(!0),Common.UI.Window.prototype.close.call(this)},onBtnClick:function(t){t.currentTarget.attributes&&t.currentTarget.attributes.result&&("ok"===t.currentTarget.attributes.result.value&&this.save(),this.close())},setSettings:function(t){this.properties=t},loadDefaults:function(){if(this.properties){var t=this.properties.asc_getPivotObj(),e=t.asc_getDataFieldIndexSorting(),i=t.asc_getDataFields(),n=this.properties.asc_getSortState();this.setTitle(this.txtTitle+" ("+i[0]+")");var s=[];i&&i.forEach(function(t,e){t&&s.push({value:e,displayValue:t})}),this.cmbFieldsAsc.setData(s),this.cmbFieldsAsc.setValue(e>=0?e:0),this.cmbFieldsDesc.setData(s),this.cmbFieldsDesc.setValue(e>=0?e:0),this.radioDesc.setValue(n==Asc.c_oAscSortOptions.Descending,!0),this.cmbFieldsDesc.setDisabled(n!==Asc.c_oAscSortOptions.Descending)}},save:function(){if(this.api&&this.properties){var t=this.radioAsc.getValue()?this.cmbFieldsAsc:this.cmbFieldsDesc;this.properties.asc_getPivotObj().asc_setDataFieldIndexSorting(t.getValue()),this.properties.asc_setSortState(this.radioAsc.getValue()?Asc.c_oAscSortOptions.Ascending:Asc.c_oAscSortOptions.Descending),this.api.asc_applyAutoFilter(this.properties)}},onPrimary:function(){return this.save(),this.close(),!1},txtTitle:"Sort",textAsc:"Ascenging (A to Z) by",textDesc:"Descending (Z to A) by"},SSE.Views.SortFilterDialog||{})),SSE.Views.AutoFilterDialog=Common.UI.Window.extend(_.extend({initialize:function(t){var e=this,i={},n=450,s=void 0;Common.Utils.InternalSettings.get("sse-settings-size-filter-window")&&(n=Common.Utils.InternalSettings.get("sse-settings-size-filter-window")[0],s=Common.Utils.InternalSettings.get("sse-settings-size-filter-window")[1]),_.extend(i,{width:n||450,height:s||265,contentWidth:n-50||400,header:!1,cls:"filter-dlg",contentTemplate:"",title:e.txtTitle,modal:!1,animate:!1,items:[],resizable:!0,minwidth:450,minheight:265},t),this.template=t.template||['
','
','
','','
','
',"
","
",'","
",'","
"].join(""),this.api=t.api,this.handler=t.handler,this.throughIndexes=[],this.filteredIndexes=[],this.curSize=null,i.tpl=_.template(this.template)(i),Common.UI.Window.prototype.initialize.call(this,i),this.on("resizing",_.bind(this.onWindowResizing,this)),this.on("resize",_.bind(this.onWindowResize,this))},render:function(){var t=this;Common.UI.Window.prototype.render.call(this);var e=this.$window.find(".resize-border");this.$window.find(".resize-border.left, .resize-border.top").css({cursor:"default"}),e.css({background:"none",border:"none"}),e.removeClass("left"),e.removeClass("top"),this.$window.find(".btn").on("click",_.bind(this.onBtnClick,this)),this.btnOk=new Common.UI.Button({cls:"btn normal dlg-btn primary",caption:this.okButtonText,enableToggle:!1,allowDepress:!1}),this.btnOk&&(this.btnOk.render($("#id-apply-filter",this.$window)),this.btnOk.on("click",_.bind(this.onApplyFilter,this))),this.miSortLow2High=new Common.UI.MenuItem({caption:this.txtSortLow2High,toggleGroup:"menufiltersort",checkable:!0,checked:!1}),this.miSortLow2High.on("click",_.bind(this.onSortType,this,Asc.c_oAscSortOptions.Ascending)),this.miSortHigh2Low=new Common.UI.MenuItem({caption:this.txtSortHigh2Low,toggleGroup:"menufiltersort",checkable:!0,checked:!1}),this.miSortHigh2Low.on("click",_.bind(this.onSortType,this,Asc.c_oAscSortOptions.Descending)),this.miSortOptions=new Common.UI.MenuItem({caption:this.txtSortOption}),this.miSortOptions.on("click",_.bind(this.onSortOptions,this)),this.miSortCellColor=new Common.UI.MenuItem({caption:this.txtSortCellColor,toggleGroup:"menufiltersort",checkable:!0,checked:!1,menu:new Common.UI.Menu({style:"min-width: inherit; padding: 0px;",menuAlign:"tl-tr",items:[{template:_.template('
')}]})}),this.miSortFontColor=new Common.UI.MenuItem({caption:this.txtSortFontColor,toggleGroup:"menufiltersort",checkable:!0,checked:!1,menu:new Common.UI.Menu({style:"min-width: inherit; padding: 0px;",menuAlign:"tl-tr",items:[{template:_.template('
')}]})}),this.miNumFilter=new Common.UI.MenuItem({caption:this.txtNumFilter,toggleGroup:"menufilterfilter",checkable:!0,checked:!1,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{value:Asc.c_oAscCustomAutoFilter.equals,caption:this.txtEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.doesNotEqual,caption:this.txtNotEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.isGreaterThan,caption:this.txtGreater,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo,caption:this.txtGreaterEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.isLessThan,caption:this.txtLess,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo,caption:this.txtLessEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:-2,caption:this.txtBetween,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.top10,caption:this.txtTop10,checkable:!0,type:Asc.c_oAscAutoFilterTypes.Top10},{value:Asc.c_oAscDynamicAutoFilter.aboveAverage,caption:this.txtAboveAve,checkable:!0,type:Asc.c_oAscAutoFilterTypes.DynamicFilter},{value:Asc.c_oAscDynamicAutoFilter.belowAverage,caption:this.txtBelowAve,checkable:!0,type:Asc.c_oAscAutoFilterTypes.DynamicFilter},{value:-1,caption:this.btnCustomFilter+"...",checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters}]})});for(var i=this.miNumFilter.menu.items,n=0;n')}]})}),this.miFilterFontColor=new Common.UI.MenuItem({caption:this.txtFilterFontColor,toggleGroup:"menufilterfilter",checkable:!0,checked:!1,menu:new Common.UI.Menu({style:"min-width: inherit; padding: 0px;",menuAlign:"tl-tr",items:[{template:_.template('
')}]})}),this.miClear=new Common.UI.MenuItem({caption:this.txtClear,checkable:!1}),this.miClear.on("click",_.bind(this.onClear,this)),this.miReapply=new Common.UI.MenuItem({caption:this.txtReapply,checkable:!1}),this.miReapply.on("click",_.bind(this.onReapply,this)),this.miReapplySeparator=new Common.UI.MenuItem({caption:"--"}),this.miValueFilter=new Common.UI.MenuItem({caption:this.txtValueFilter,toggleGroup:"menufilterfilter",checkable:!0,checked:!1,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{value:Asc.c_oAscCustomAutoFilter.equals,caption:this.txtEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"value"},{value:Asc.c_oAscCustomAutoFilter.doesNotEqual,caption:this.txtNotEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"value"},{value:Asc.c_oAscCustomAutoFilter.isGreaterThan,caption:this.txtGreater,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"value"},{value:Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo,caption:this.txtGreaterEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"value"},{value:Asc.c_oAscCustomAutoFilter.isLessThan,caption:this.txtLess,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"value"},{value:Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo,caption:this.txtLessEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"value"},{value:-2,caption:this.txtBetween,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"value"},{value:-3,caption:this.txtNotBetween,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"value"},{value:Asc.c_oAscCustomAutoFilter.top10,caption:this.txtTop10,checkable:!0,type:Asc.c_oAscAutoFilterTypes.Top10,pivottype:"value"}]})}),this.miValueFilter.menu.on("item:click",_.bind(this.onValueFilterMenuClick,this)),this.miLabelFilter=new Common.UI.MenuItem({caption:this.txtLabelFilter,toggleGroup:"menufilterfilter",checkable:!0,checked:!1,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{value:Asc.c_oAscCustomAutoFilter.equals,caption:this.txtEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"},{value:Asc.c_oAscCustomAutoFilter.doesNotEqual,caption:this.txtNotEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"},{value:Asc.c_oAscCustomAutoFilter.beginsWith,caption:this.txtBegins,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"},{value:Asc.c_oAscCustomAutoFilter.doesNotBeginWith,caption:this.txtNotBegins,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"},{value:Asc.c_oAscCustomAutoFilter.endsWith,caption:this.txtEnds,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"},{value:Asc.c_oAscCustomAutoFilter.doesNotEndWith,caption:this.txtNotEnds,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"},{value:Asc.c_oAscCustomAutoFilter.contains,caption:this.txtContains,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"},{value:Asc.c_oAscCustomAutoFilter.doesNotContain,caption:this.txtNotContains,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"},{caption:"--"},{value:Asc.c_oAscCustomAutoFilter.isGreaterThan,caption:this.txtGreater,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"},{value:Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo,caption:this.txtGreaterEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"},{value:Asc.c_oAscCustomAutoFilter.isLessThan,caption:this.txtLess,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"},{value:Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo,caption:this.txtLessEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"},{value:-2,caption:this.txtBetween,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"},{value:-3,caption:this.txtNotBetween,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters,pivottype:"label"}]})}),this.miLabelFilter.menu.on("item:click",_.bind(this.onLabelFilterMenuClick,this)),this.filtersMenu=new Common.UI.Menu({items:[this.miSortLow2High,this.miSortHigh2Low,this.miSortOptions,this.miSortCellColor,this.miSortFontColor,{caption:"--"},this.miLabelFilter,this.miValueFilter,this.miNumFilter,this.miTextFilter,this.miFilterCellColor,this.miFilterFontColor,this.miClear,this.miReapplySeparator,this.miReapply]});var s=this.$window.find("#menu-container-filters");this.filtersMenu.render(s),this.filtersMenu.cmpEl.attr({tabindex:"-1"}),this.mnuSortColorCellsPicker=new Common.UI.ColorPaletteExt({el:$("#filter-dlg-sort-cells-color"),colors:[]}),this.mnuSortColorCellsPicker.on("select",_.bind(this.onSortColorSelect,this,Asc.c_oAscSortOptions.ByColorFill)),this.mnuSortColorFontPicker=new Common.UI.ColorPaletteExt({el:$("#filter-dlg-sort-font-color"),colors:[]}),this.mnuSortColorFontPicker.on("select",_.bind(this.onSortColorSelect,this,Asc.c_oAscSortOptions.ByColorFont)),this.mnuFilterColorCellsPicker=new Common.UI.ColorPaletteExt({el:$("#filter-dlg-filter-cells-color"),colors:[]}),this.mnuFilterColorCellsPicker.on("select",_.bind(this.onFilterColorSelect,this,!0)),this.mnuFilterColorFontPicker=new Common.UI.ColorPaletteExt({el:$("#filter-dlg-filter-font-color"),colors:[]}),this.mnuFilterColorFontPicker.on("select",_.bind(this.onFilterColorSelect,this,!1)),this.input=new Common.UI.InputField({el:$("#id-sd-cell-search",this.$window),allowBlank:!0,placeHolder:this.txtEmpty,validateOnChange:!0,validation:function(){return!0}}).on("changing",function(e,i){i.length?(i=i.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),t.filter=new RegExp(i,"ig")):t.filter=void 0,t.setupDataCells()}),this.cells=new Common.UI.DataViewStore,this.filterExcludeCells=new Common.UI.DataViewStore,this.cells&&(this.cellsList=new Common.UI.ListView({el:$("#id-dlg-filter-values",this.$window),store:this.cells,simpleAddMode:!0,template:_.template(['
'].join("")),itemTemplate:_.template(["
",'",'
','
<%= Common.Utils.String.htmlEncode(value) %>
','<% if (typeof count !=="undefined" && count) { %>','
<%= count%>
',"<% } %>","
","
"].join(""))}),this.cellsList.store.comparator=function(t,e){if("0"==t.get("groupid"))return-1;if("0"==e.get("groupid"))return 1;if("2"==t.get("groupid"))return-1;if("2"==e.get("groupid"))return 1;var i=t.get("intval"),n=e.get("intval"),s=void 0!==i;return s!==(void 0!==n)?s?-1:1:(!s&&(i=t.get("cellvalue").toLowerCase())&&(n=e.get("cellvalue").toLowerCase()),i==n?0:""==n||""!==i&&i1?r[1].asc_getOperator()||0:0,i=null===r[0].asc_getVal()?"":r[0].asc_getVal(),n=r.length>1?null===r[1].asc_getVal()?"":r[1].asc_getVal():""}if(-1!==t.value){var c=new Asc.CustomFilters;c.asc_setCustomFilters(-2==t.value||-3==t.value?[new Asc.CustomFilter,new Asc.CustomFilter]:[new Asc.CustomFilter]);var h=c.asc_getCustomFilters();if(h[0].asc_setOperator(-2==t.value?Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo:-3==t.value?Asc.c_oAscCustomAutoFilter.isLessThan:t.value),-2==t.value){var d=s==Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo&&o==Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo;c.asc_setAnd(!d||a),h[0].asc_setVal(d?i:""),h[1].asc_setOperator(Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo),h[1].asc_setVal(d?n:"")}else if(-3==t.value){var p=s==Asc.c_oAscCustomAutoFilter.isLessThan&&o==Asc.c_oAscCustomAutoFilter.isGreaterThan;c.asc_setAnd(!!p&&a),h[0].asc_setVal(p?i:""),h[1].asc_setOperator(Asc.c_oAscCustomAutoFilter.isGreaterThan),h[1].asc_setVal(p?n:"")}else c.asc_setAnd(!0),h[0].asc_setVal(t.value==s?i:"");e.asc_setFilter(c),e.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters)}var m,u=this;m="label"==t.options.pivottype||"value"==t.options.pivottype?new SSE.Views.PivotDigitalFilterDialog({api:this.api,type:t.options.pivottype}).on({close:function(){u.close()}}):new SSE.Views.DigitalFilterDialog({api:this.api,type:"number"}).on({close:function(){u.close()}}),this.close(),m.setSettings(this.configTo),m.show()},onTextFilterMenuClick:function(t,e){var i=this.configTo.asc_getFilterObj(),n="",s=Asc.c_oAscCustomAutoFilter.equals;if(i.asc_getType()==Asc.c_oAscAutoFilterTypes.CustomFilters){var o=i.asc_getFilter(),a=o.asc_getCustomFilters();o.asc_getAnd(),s=a[0].asc_getOperator(),a.length>1?a[1].asc_getOperator()||0:0,n=null===a[0].asc_getVal()?"":a[0].asc_getVal(),a.length>1?null===a[1].asc_getVal()?"":a[1].asc_getVal():""}if(-1!==e.value){var l=new Asc.CustomFilters;l.asc_setCustomFilters([new Asc.CustomFilter]);var r=l.asc_getCustomFilters();l.asc_setAnd(!0),r[0].asc_setOperator(e.value),r[0].asc_setVal(e.value==s?n:""),i.asc_setFilter(l),i.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters)}var c,h=this;c="label"==e.options.pivottype||"value"==e.options.pivottype?new SSE.Views.PivotDigitalFilterDialog({api:this.api,type:e.options.pivottype}).on({ close:function(){h.close()}}):new SSE.Views.DigitalFilterDialog({api:this.api,type:"text"}).on({close:function(){h.close()}}),this.close(),c.setSettings(this.configTo),c.show()},onNumDynamicFilterItemClick:function(t){var e=this.configTo.asc_getFilterObj();e.asc_getType()!==Asc.c_oAscAutoFilterTypes.DynamicFilter&&(e.asc_setFilter(new Asc.DynamicFilter),e.asc_setType(Asc.c_oAscAutoFilterTypes.DynamicFilter)),e.asc_getFilter().asc_setType(t.value),this.api.asc_applyAutoFilter(this.configTo),this.close()},onTop10FilterItemClick:function(t){var e=this,i=new SSE.Views.Top10FilterDialog({api:this.api,type:t.options.pivottype}).on({close:function(){e.close()}});this.close(),i.setSettings(this.configTo),i.show()},onLabelFilterMenuClick:function(t,e){e.value==Asc.c_oAscCustomAutoFilter.isGreaterThan||e.value==Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo||e.value==Asc.c_oAscCustomAutoFilter.isLessThan||e.value==Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo||-2==e.value||-3==e.value?this.onNumCustomFilterItemClick(e):this.onTextFilterMenuClick(t,e)},onValueFilterMenuClick:function(t,e){var i=this;this.configTo.asc_getPivotObj().asc_getDataFields().length<2?Common.UI.warning({title:this.textWarning,msg:this.warnFilterError,callback:function(){_.delay(function(){i.close()},10)}}):e.options.type==Asc.c_oAscAutoFilterTypes.CustomFilters?this.onNumCustomFilterItemClick(e):this.onTop10FilterItemClick(e)},onFilterColorSelect:function(t,e,i){var n=this.configTo.asc_getFilterObj();n.asc_getType()!==Asc.c_oAscAutoFilterTypes.ColorFilter&&(n.asc_setFilter(new Asc.ColorFilter),n.asc_setType(Asc.c_oAscAutoFilterTypes.ColorFilter));var s=n.asc_getFilter();s.asc_setCellColor(!!t&&null),s.asc_setCColor(t&&"transparent"==i||!t&&"#000000"==i?null:Common.Utils.ThemeColor.getRgbColor(i)),this.api.asc_applyAutoFilter(this.configTo),this.close()},onSortColorSelect:function(t,e,i){if(this.api&&this.configTo){var n=t==Asc.c_oAscSortOptions.ByColorFill;this.api.asc_sortColFilter(t,this.configTo.asc_getCellId(),this.configTo.asc_getDisplayName(),n&&"transparent"==i||!n&&"#000000"==i?null:Common.Utils.ThemeColor.getRgbColor(i))}this.close()},onCellCheck:function(t,e,i){if(!this.checkCellTrigerBlock){var n="",s=!1,o=null,a=window.event?window.event:window._event;if(a){if(n=$(a.currentTarget).find(".list-item"),n.length){o=n.get(0).getBoundingClientRect();var l=a.clientX*Common.Utils.zoom(),r=a.clientY*Common.Utils.zoom();o.left1&&(s[parseInt(t.get("throughIndex"))]=i))});else{e.set("check",i),s[parseInt(e.get("throughIndex"))]=i;for(var o=i,a=0;a0;if(this.miSortFontColor.setVisible(m),this.miFilterFontColor.setVisible(!i&&m),m){var u=[];h.forEach(function(t,e){t?u.push(Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()).toLocaleUpperCase()):u.push("000000")}),this.mnuSortColorFontPicker.updateColors(u),this.mnuFilterColorFontPicker.updateColors(u),this.miFilterFontColor.setChecked(!1,!0),this.miSortFontColor.setChecked(d==Asc.c_oAscSortOptions.ByColorFont,!0),d==Asc.c_oAscSortOptions.ByColorFont&&this.mnuSortColorFontPicker.select(p||"000000",!0)}if(m=c&&c.length>0,this.miSortCellColor.setVisible(m),this.miFilterCellColor.setVisible(!i&&m),m){var u=[];c.forEach(function(t,e){t?u.push(Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()).toLocaleUpperCase()):u.push("transparent")}),this.mnuSortColorCellsPicker.updateColors(u),this.mnuFilterColorCellsPicker.updateColors(u),this.miFilterCellColor.setChecked(!1,!0),this.miSortCellColor.setChecked(d==Asc.c_oAscSortOptions.ByColorFill,!0),d==Asc.c_oAscSortOptions.ByColorFill&&this.mnuSortColorCellsPicker.select(p||"transparent",!0)}if(o){var g=s.asc_getFilter(),b=g.asc_getCustomFilters(),f=(g.asc_getAnd(),b[0].asc_getOperator()),C=b.length>1?b[1].asc_getOperator()||0:0,v=i?n?this.miValueFilter.menu.items:this.miLabelFilter.menu.items:r?this.miTextFilter.menu.items:this.miNumFilter.menu.items,_=!0;1==b.length?v.forEach(function(t){var e=t.options.type==Asc.c_oAscAutoFilterTypes.CustomFilters&&t.value==f;t.setChecked(e,!0),e&&(_=!1)}):!i&&r||f!=Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo||C!=Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo?i&&f==Asc.c_oAscCustomAutoFilter.isLessThan&&C==Asc.c_oAscCustomAutoFilter.isGreaterThan&&(v[n?7:14].setChecked(!0,!0),_=!1):(v[i&&!n?13:6].setChecked(!0,!0),_=!1),_&&v[v.length-1].setChecked(!0,!0)}else if(this.initialFilterType===Asc.c_oAscAutoFilterTypes.ColorFilter){var y=s.asc_getFilter(),x=y.asc_getCColor();x&&(x=Common.Utils.ThemeColor.getHexColor(x.get_r(),x.get_g(),x.get_b()).toLocaleUpperCase()),null===y.asc_getCellColor()?(this.miFilterCellColor.setChecked(!0,!0),this.mnuFilterColorCellsPicker.select(x||"transparent",!0)):!1===y.asc_getCellColor()&&(this.miFilterFontColor.setChecked(!0,!0),this.mnuFilterColorFontPicker.select(x||"000000",!0))}else if(a||l){var w=a?s.asc_getFilter().asc_getType():null,v=i?this.miValueFilter.menu.items:this.miNumFilter.menu.items;v.forEach(function(t){t.setChecked(a&&t.options.type==Asc.c_oAscAutoFilterTypes.DynamicFilter&&t.value==w||l&&t.options.type==Asc.c_oAscAutoFilterTypes.Top10,!0)})}this.miClear.setDisabled(this.initialFilterType===Asc.c_oAscAutoFilterTypes.None),this.miReapply.setDisabled(this.initialFilterType===Asc.c_oAscAutoFilterTypes.None),this.btnOk.setDisabled(this.initialFilterType!==Asc.c_oAscAutoFilterTypes.Filters&&this.initialFilterType!==Asc.c_oAscAutoFilterTypes.None),this.menuPanelWidth=t.innerWidth();var S=this.getWidth();S-this.menuPanelWidth<260&&(S=Math.ceil(this.menuPanelWidth+260),this.setResizable(!0,[S,this.initConfig.minheight])),Common.Utils.InternalSettings.get("sse-settings-size-filter-window")&&(S=Common.Utils.InternalSettings.get("sse-settings-size-filter-window")[0]+this.menuPanelWidth),i&&e.asc_getIsPageFilter()&&(this.setResizable(!0,[this.initConfig.minwidth-this.menuPanelWidth,this.initConfig.minheight]),t.addClass("hidden"),S-=this.menuPanelWidth,this.menuPanelWidth=0),this.setSize(S,this.getHeight())},setupDataCells:function(){function t(t){return!isNaN(parseFloat(t))&&isFinite(t)}var e,i,n,s=this,o=0,a=2,l=!0,r=!1,c=0,h=[],d=[],p=s.filter?s.filteredIndexes:s.throughIndexes;this.configTo.asc_getValues().forEach(function(r){i=r.asc_getText(),e=t(i),l=!0,n=r.asc_getRepeats?r.asc_getRepeats():void 0,s.filter?(null===i.match(s.filter)&&(l=!1),p[a]=l):void 0==p[a]&&(p[a]=r.asc_getVisible()),l?(h.push(new Common.UI.DataViewModel({id:++o,selected:!1,allowSelected:!0,cellvalue:i,value:e?i:i.length>0?i:s.textEmptyItem,intval:e?parseFloat(i):void 0,strval:e?"":i,groupid:"1",check:p[a],throughIndex:a,count:n?n.toString():""})),p[a]&&c++):d.push(new Common.UI.DataViewModel({cellvalue:i})),++a}),c==h.length?r=!0:c>0&&(r="indeterminate"),(s.filter||void 0==p[0])&&(p[0]=!0),(!s.filter||h.length>0)&&h.unshift(new Common.UI.DataViewModel({id:++o,selected:!1,allowSelected:!0,value:s.filter?this.textSelectAllResults:this.textSelectAll,groupid:"0",check:p[0],throughIndex:0})),s.filter&&h.length>1&&(void 0==p[1]&&(p[1]=!1),h.splice(1,0,new Common.UI.DataViewModel({id:++o,selected:!1,allowSelected:!0,value:this.textAddSelection,groupid:"2",check:p[1],throughIndex:1}))),this.cells.reset(h),this.filterExcludeCells.reset(d),this.cells.length&&(this.checkCellTrigerBlock=!0,this.cells.at(0).set("check",r),this.checkCellTrigerBlock=void 0),this.btnOk.setDisabled(this.cells.length<1),this.cellsList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0,suppressScrollX:!0}),this.cellsList.cmpEl.toggleClass("scroll-padding",this.cellsList.scroller.isVisible())},testFilter:function(){var t=this,e=!1;return this.cells&&(this.filter&&this.filteredIndexes[1]?e=!0:this.cells.forEach(function(t){if("1"==t.get("groupid")&&t.get("check"))return e=!0,!0})),e||(t._skipCheckDocumentClick=!0,Common.UI.warning({title:this.textWarning,msg:this.warnNoSelected,callback:function(){t._skipCheckDocumentClick=!1,_.delay(function(){t.input.focus()},100,this)}})),e},save:function(){if(this.api&&this.configTo&&this.cells&&this.filterExcludeCells){var t=this.configTo.asc_getValues(),e=!1;if(this.filter&&this.filteredIndexes[1])this.initialFilterType===Asc.c_oAscAutoFilterTypes.CustomFilters&&t.forEach(function(t,e){t.asc_setVisible(!0)}),this.cells.each(function(e){"1"==e.get("groupid")&&t[parseInt(e.get("throughIndex"))-2].asc_setVisible(e.get("check"))}),t.forEach(function(t,i){if(t.asc_getVisible())return e=!0,!0});else{var i=this.filter?this.filteredIndexes:this.throughIndexes;t.forEach(function(t,e){t.asc_setVisible(i[e+2])}),e=!0}if(e){var n=this.configTo.asc_getPivotObj();n&&n.asc_getIsPageFilter()&&n.asc_setIsMultipleItemSelectionAllowed(!0),this.configTo.asc_getFilterObj().asc_setType(Asc.c_oAscAutoFilterTypes.Filters),this.api.asc_applyAutoFilter(this.configTo)}}},onPrimary:function(){return this.save(),this.close(),!1},onWindowResize:function(t){if(t&&"start"==t[1])this.curSize={resize:!1,height:this.getSize()[1]};else if(this.curSize.resize){var e=this.getSize();this.$window.find(".combo-values").css({height:e[1]-100+"px"}),this.cellsList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0,suppressScrollX:!0})}},onWindowResizing:function(){if(this.curSize){var t=this.getSize();t[1]!==this.curSize.height&&(this.curSize.resize||(this.curSize.resize=!0,this.cellsList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!1,suppressScrollX:!0})),this.$window.find(".combo-values").css({height:t[1]-100+"px"}),this.curSize.height=t[1]),t[0]-=this.menuPanelWidth,Common.Utils.InternalSettings.set("sse-settings-size-filter-window",t)}},onItemChanged:function(t,e){var i=e.model.get("check");"indeterminate"==i?$("input[type=checkbox]",e.$el).prop("indeterminate",!0):$("input[type=checkbox]",e.$el).prop({checked:i,indeterminate:!1})},btnCustomFilter:"Custom Filter",textSelectAll:"Select All",txtTitle:"Filter",warnNoSelected:"You must choose at least one value",textWarning:"Warning",textEmptyItem:"{Blanks}",txtEmpty:"Enter cell's filter",txtSortLow2High:"Sort Lowest to Highest",txtSortHigh2Low:"Sort Highest to Lowest",txtSortCellColor:"Sort by cells color",txtSortFontColor:"Sort by font color",txtNumFilter:"Number filter",txtTextFilter:"Text filter",txtFilterCellColor:"Filter by cells color",txtFilterFontColor:"Filter by font color",txtClear:"Clear",txtReapply:"Reapply",txtEquals:"Equals...",txtNotEquals:"Does not equal...",txtGreater:"Greater than...",txtGreaterEquals:"Greater than or equal to...",txtLess:"Less than...",txtLessEquals:"Less than or equal to...",txtBetween:"Between...",txtTop10:"Top 10",txtAboveAve:"Above average",txtBelowAve:"Below average",txtBegins:"Begins with...",txtNotBegins:"Does not begin with...",txtEnds:"Ends with...",txtNotEnds:"Does not end with...",txtContains:"Contains...",txtNotContains:"Does not contain...",textSelectAllResults:"Select All Search Results",textAddSelection:"Add current selection to filter",txtValueFilter:"Value filter",txtLabelFilter:"Label filter",warnFilterError:"You need at least one field in the Values area in order to apply a value filter.",txtNotBetween:"Not between...",txtSortOption:"More sort options..."},SSE.Views.AutoFilterDialog||{}))}),define("spreadsheeteditor/main/app/view/SpecialPasteDialog",["common/main/lib/util/utils","common/main/lib/component/RadioBox","common/main/lib/component/CheckBox","common/main/lib/view/AdvancedSettingsWindow"],function(){"use strict";SSE.Views.SpecialPasteDialog=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:350,height:385},initialize:function(t){var e=this;_.extend(this.options,{title:this.textTitle,template:['
','
','
','',"",'","","",'",'","","",'",'","","",'",'","","",'",'","","",'",'","","",'",'","","",'","","",'",'","","",'",'","","",'",'","","",'","","",'",'","","
','","
','
',"
','
',"
','
',"
','
',"
','
',"
','
',"
','
',"
','
',"
','
',"
','
',"
','
',"
','
',"
','","
','
',"
','
',"
','
',"
','
',"
','
',"
',"
',"
','
',"
','
',"
","
","
","
"].join("")},t),this.handler=t.handler,this.props=t.props,this._changedProps=null,this.isTable=!!t.isTable,Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);this.propControls=[],this.radioAll=new Common.UI.RadioBox({el:$("#paste-radio-all"),name:"asc-radio-paste",labelText:this.textAll,value:Asc.c_oSpecialPasteProps.paste,disabled:!0}),this.radioAll.on("change",_.bind(this.onRadioPasteChange,this)),this.propControls[Asc.c_oSpecialPasteProps.paste]=this.radioAll,this.radioFormulas=new Common.UI.RadioBox({el:$("#paste-radio-formulas"),name:"asc-radio-paste",labelText:this.textFormulas,value:Asc.c_oSpecialPasteProps.pasteOnlyFormula,disabled:!0}),this.radioFormulas.on("change",_.bind(this.onRadioPasteChange,this)),this.propControls[Asc.c_oSpecialPasteProps.pasteOnlyFormula]=this.radioFormulas,this.radioValues=new Common.UI.RadioBox({el:$("#paste-radio-values"),name:"asc-radio-paste",labelText:this.textValues,value:Asc.c_oSpecialPasteProps.pasteOnlyValues,disabled:!0}),this.radioValues.on("change",_.bind(this.onRadioPasteChange,this)),this.propControls[Asc.c_oSpecialPasteProps.pasteOnlyValues]=this.radioValues,this.radioFormats=new Common.UI.RadioBox({el:$("#paste-radio-formats"),name:"asc-radio-paste",labelText:this.textFormats,value:Asc.c_oSpecialPasteProps.pasteOnlyFormating,disabled:!0}),this.radioFormats.on("change",_.bind(this.onRadioPasteChange,this)),this.propControls[Asc.c_oSpecialPasteProps.pasteOnlyFormating]=this.radioFormats,this.radioComments=new Common.UI.RadioBox({el:$("#paste-radio-comments"),name:"asc-radio-paste",labelText:this.textComments,value:Asc.c_oSpecialPasteProps.comments,disabled:!0}),this.radioComments.on("change",_.bind(this.onRadioPasteChange,this)),this.propControls[Asc.c_oSpecialPasteProps.comments]=this.radioComments,this.radioColWidth=new Common.UI.RadioBox({el:$("#paste-radio-col-width"),name:"asc-radio-paste",labelText:this.textColWidth,value:Asc.c_oSpecialPasteProps.columnWidth,disabled:!0}),this.radioColWidth.on("change",_.bind(this.onRadioPasteChange,this)),this.propControls[Asc.c_oSpecialPasteProps.columnWidth]=this.radioColWidth,this.radioWBorders=new Common.UI.RadioBox({el:$("#paste-radio-without-borders"),name:"asc-radio-paste",labelText:this.textWBorders,value:Asc.c_oSpecialPasteProps.formulaWithoutBorders,disabled:!0}),this.radioWBorders.on("change",_.bind(this.onRadioPasteChange,this)),this.propControls[Asc.c_oSpecialPasteProps.formulaWithoutBorders]=this.radioWBorders,this.radioFFormat=new Common.UI.RadioBox({el:$("#paste-radio-formula-formats"),name:"asc-radio-paste",labelText:this.textFFormat,value:Asc.c_oSpecialPasteProps.formulaAllFormatting,disabled:!0}),this.radioFFormat.on("change",_.bind(this.onRadioPasteChange,this)),this.propControls[Asc.c_oSpecialPasteProps.formulaAllFormatting]=this.radioFFormat,this.radioFWidth=new Common.UI.RadioBox({el:$("#paste-radio-formula-col-width"),name:"asc-radio-paste",labelText:this.textFWidth,value:Asc.c_oSpecialPasteProps.formulaColumnWidth,disabled:!0}),this.radioFWidth.on("change",_.bind(this.onRadioPasteChange,this)),this.propControls[Asc.c_oSpecialPasteProps.formulaColumnWidth]=this.radioFWidth,this.radioFNFormat=new Common.UI.RadioBox({el:$("#paste-radio-formula-num-format"),name:"asc-radio-paste",labelText:this.textFNFormat,value:Asc.c_oSpecialPasteProps.formulaNumberFormat,disabled:!0}),this.radioFNFormat.on("change",_.bind(this.onRadioPasteChange,this)),this.propControls[Asc.c_oSpecialPasteProps.formulaNumberFormat]=this.radioFNFormat,this.radioVNFormat=new Common.UI.RadioBox({el:$("#paste-radio-value-num-format"),name:"asc-radio-paste",labelText:this.textVNFormat,value:Asc.c_oSpecialPasteProps.valueNumberFormat,disabled:!0}),this.radioVNFormat.on("change",_.bind(this.onRadioPasteChange,this)),this.propControls[Asc.c_oSpecialPasteProps.valueNumberFormat]=this.radioVNFormat,this.radioVFormat=new Common.UI.RadioBox({el:$("#paste-radio-value-formats"),name:"asc-radio-paste",labelText:this.textVFormat,value:Asc.c_oSpecialPasteProps.valueAllFormating,disabled:!0}),this.radioVFormat.on("change",_.bind(this.onRadioPasteChange,this)),this.propControls[Asc.c_oSpecialPasteProps.valueAllFormating]=this.radioVFormat,this.radioNone=new Common.UI.RadioBox({el:$("#paste-radio-none"),name:"asc-radio-paste-operation",labelText:this.textNone,value:Asc.c_oSpecialPasteOperation.none,checked:!0}),this.radioNone.on("change",_.bind(this.onRadioOperationChange,this)),this.radioAdd=new Common.UI.RadioBox({el:$("#paste-radio-add"),name:"asc-radio-paste-operation",labelText:this.textAdd,value:Asc.c_oSpecialPasteOperation.add}),this.radioAdd.on("change",_.bind(this.onRadioOperationChange,this)),this.radioMult=new Common.UI.RadioBox({el:$("#paste-radio-mult"),name:"asc-radio-paste-operation",labelText:this.textMult,value:Asc.c_oSpecialPasteOperation.multiply}),this.radioMult.on("change",_.bind(this.onRadioOperationChange,this)),this.radioSub=new Common.UI.RadioBox({el:$("#paste-radio-sub"),name:"asc-radio-paste-operation",labelText:this.textSub,value:Asc.c_oSpecialPasteOperation.subtract}),this.radioSub.on("change",_.bind(this.onRadioOperationChange,this)),this.radioDiv=new Common.UI.RadioBox({el:$("#paste-radio-div"),name:"asc-radio-paste-operation",labelText:this.textDiv,value:Asc.c_oSpecialPasteOperation.divide}),this.radioDiv.on("change",_.bind(this.onRadioOperationChange,this)),this.chBlanks=new Common.UI.CheckBox({el:$("#paste-checkbox-blanks"),labelText:this.textBlanks}),this.chTranspose=new Common.UI.CheckBox({el:$("#paste-checkbox-transpose"),labelText:this.textTranspose}),this.afterRender()},afterRender:function(){this._setDefaults(this.props)},show:function(){Common.Views.AdvancedSettingsWindow.prototype.show.apply(this,arguments)},_setDefaults:function(t){var e=this;t&&_.each(t,function(t,i){e.propControls[t]&&e.propControls[t].setDisabled(!1)}),this._changedProps=new Asc.SpecialPasteProps,this._changedProps.asc_setProps(Asc.c_oSpecialPasteProps.paste),this._changedProps.asc_setOperation(Asc.c_oSpecialPasteOperation.none),this.radioAll.setValue(!0)},getSettings:function(){return this._changedProps&&(this._changedProps.asc_setTranspose("checked"==this.chTranspose.getValue()),this._changedProps.asc_setSkipBlanks("checked"==this.chBlanks.getValue())),this._changedProps},onDlgBtnClick:function(t){this._handleInput("object"==typeof t?t.currentTarget.attributes.result.value:t)},onPrimary:function(){return this._handleInput("ok"),!1},_handleInput:function(t){this.handler&&this.handler.call(this,t,"ok"==t?this.getSettings():void 0),this.close()},onRadioPasteChange:function(t,e,i){if(e&&this._changedProps){this._changedProps.asc_setProps(t.options.value);var n=t.options.value==Asc.c_oSpecialPasteProps.pasteOnlyFormating||t.options.value==Asc.c_oSpecialPasteProps.comments||t.options.value==Asc.c_oSpecialPasteProps.columnWidth,s=this.isTable&&!!this._changedProps.asc_getTableAllowed();this.radioNone.setDisabled(n||s),this.radioAdd.setDisabled(n||s),this.radioDiv.setDisabled(n||s),this.radioSub.setDisabled(n||s),this.radioMult.setDisabled(n||s),this.chBlanks.setDisabled(s),this.chTranspose.setDisabled(s)}},onRadioOperationChange:function(t,e,i){e&&this._changedProps&&this._changedProps.asc_setOperation(t.options.value)},textTitle:"Paste Special",textAll:"All",textFormulas:"Formulas",textValues:"Values",textFormats:"Formats",textComments:"Comments",textColWidth:"Column widths",textWBorders:"All except borders",textFFormat:"Formulas & formatting",textFWidth:"Formulas & column widths",textFNFormat:"Formulas & number formats",textVNFormat:"Values & number formats",textVFormat:"Values & formatting",textNone:"None",textAdd:"Add",textMult:"Multiply",textDiv:"Divide",textSub:"Subtract",textBlanks:"Skip blanks",textTranspose:"Transpose",textOperation:"Operation",textPaste:"Paste"},SSE.Views.SpecialPasteDialog||{}))}),define("text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.template",[],function(){return'
\n
\n
\n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n
\n \n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \x3c!--
--\x3e\n
\n
\n
\n
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n
\n
\n
\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n \n \n
\n \n
\n
\n
'}),void 0===Common)var Common={};define("common/main/lib/component/ComboDataView",["common/main/lib/component/BaseView","common/main/lib/component/DataView"],function(){"use strict";Common.UI.ComboDataView=Common.UI.BaseView.extend({options:{id:null,cls:"",style:"",hint:!1,itemWidth:80,itemHeight:40,menuMaxHeight:300,enableKeyEvents:!1,beforeOpenHandler:null,additionalMenuItems:null,showLast:!0,minWidth:-1},template:_.template(['
','
','
',"
"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.id=this.options.id||Common.UI.getId(),this.cls=this.options.cls,this.style=this.options.style,this.hint=this.options.hint,this.store=this.options.store||new Common.UI.DataViewStore,this.itemWidth=this.options.itemWidth,this.itemHeight=this.options.itemHeight,this.menuMaxHeight=this.options.menuMaxHeight,this.beforeOpenHandler=this.options.beforeOpenHandler,this.showLast=this.options.showLast,this.rootWidth=0,this.rootHeight=0,this.rendered=!1,this.needFillComboView=!1,this.minWidth=this.options.minWidth,this.fieldPicker=new Common.UI.DataView({cls:"field-picker",allowScrollbar:!1,itemTemplate:_.template(['
','','<% if (typeof title !== "undefined") {%>','<%= title %>',"<% } %>","
"].join(""))}),this.openButton=new Common.UI.Button({cls:"open-menu",menu:new Common.UI.Menu({menuAlign:"tl-tl",offset:[0,3],items:[{template:_.template('')}]})}),null!=this.options.additionalMenuItems&&(this.openButton.menu.items=this.openButton.menu.items.concat(this.options.additionalMenuItems)),this.menuPicker=new Common.UI.DataView({cls:"menu-picker",parentMenu:this.openButton.menu,restoreHeight:this.menuMaxHeight,style:"max-height: "+this.menuMaxHeight+"px;",enableKeyEvents:this.options.enableKeyEvents,store:this.store, itemTemplate:_.template(['
','','<% if (typeof title !== "undefined") {%>','<%= title %>',"<% } %>","
"].join(""))}),setInterval(_.bind(this.checkSize,this),500),this.options.el&&this.render()},render:function(t){if(!this.rendered){var e=this;e.trigger("render:before",e),e.cmpEl=e.$el||$(e.el);var i=e.template({id:e.id,cls:e.cls,style:e.style});t?(e.setElement(t,!1),e.cmpEl=$(i),t.html(e.cmpEl)):e.cmpEl.html(i),e.rootWidth=e.cmpEl.width(),e.rootHeight=e.cmpEl.height(),e.fieldPicker.render($(".view",e.cmpEl)),e.openButton.render($(".button",e.cmpEl)),e.menuPicker.render($(".menu-picker-container",e.cmpEl)),e.openButton.menu.cmpEl&&e.openButton.menu.cmpEl&&(e.openButton.menu.menuAlignEl=e.cmpEl,e.openButton.menu.cmpEl.css("min-width",e.itemWidth),e.openButton.menu.on("show:before",_.bind(e.onBeforeShowMenu,e)),e.openButton.menu.on("show:after",_.bind(e.onAfterShowMenu,e)),e.openButton.cmpEl.on("hide.bs.dropdown",_.bind(e.onBeforeHideMenu,e)),e.openButton.cmpEl.on("hidden.bs.dropdown",_.bind(e.onAfterHideMenu,e))),e.options.hint&&(e.cmpEl.attr("data-toggle","tooltip"),e.cmpEl.tooltip({title:e.options.hint,placement:e.options.hintAnchor||"cursor"})),e.fieldPicker.on("item:select",_.bind(e.onFieldPickerSelect,e)),e.menuPicker.on("item:select",_.bind(e.onMenuPickerSelect,e)),e.fieldPicker.on("item:click",_.bind(e.onFieldPickerClick,e)),e.menuPicker.on("item:click",_.bind(e.onMenuPickerClick,e)),e.fieldPicker.on("item:contextmenu",_.bind(e.onPickerItemContextMenu,e)),e.menuPicker.on("item:contextmenu",_.bind(e.onPickerItemContextMenu,e)),e.fieldPicker.el.addEventListener("contextmenu",_.bind(e.onPickerComboContextMenu,e),!1),e.menuPicker.el.addEventListener("contextmenu",_.bind(e.onPickerComboContextMenu,e),!1),e.onResize(),e.rendered=!0,e.trigger("render:after",e)}return this},checkSize:function(){if(this.cmpEl&&this.cmpEl.is(":visible")){var t=this,e=this.cmpEl.width(),i=this.cmpEl.height();if(e div:not(.grouped-data):not(.ps-scrollbar-x-rail):not(.ps-scrollbar-y-rail)")[0]);a.length>0&&(n.itemMarginLeft=parseInt(a.css("margin-left")),n.itemMarginRight=parseInt(a.css("margin-right")),n.itemPaddingLeft=parseInt(a.css("padding-left")),n.itemPaddingRight=parseInt(a.css("padding-right")),n.itemBorderLeft=parseInt(a.css("border-left-width")),n.itemBorderRight=parseInt(a.css("border-right-width")))}var l=s.indexOf(t);if(l<0)return;var r=s.length,c=Math.floor(Math.max(o.width(),n.minWidth)/(n.itemWidth+(n.itemMarginLeft||0)+(n.itemMarginRight||0)+(n.itemPaddingLeft||0)+(n.itemPaddingRight||0)+(n.itemBorderLeft||0)+(n.itemBorderRight||0))),h=[];o.height()/n.itemHeight>2&&(c*=Math.floor(o.height()/n.itemHeight)),l=Math.floor(l/c)*c,r-l1?t/2:t)},setItemHeight:function(t){this.itemHeight!=t&&(this.itemHeight=window.devicePixelRatio>1?t/2:t)},removeTips:function(){var t=this.menuPicker;_.each(t.dataViewItems,function(t){var e=t.$el.data("bs.tooltip");e&&e.tip().remove()},t)}})}),define("spreadsheeteditor/main/app/view/SlicerSettingsAdvanced",["text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/MetricSpinner","common/main/lib/component/CheckBox","common/main/lib/component/RadioBox","common/main/lib/component/ComboDataView"],function(t){"use strict";SSE.Views.SlicerSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:330,height:435,toggleGroup:"slicer-adv-settings-group",storageName:"sse-slicer-settings-adv-category"},initialize:function(e){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-slicer-style",panelCaption:this.strStyleSize},{panelId:"id-adv-slicer-sorting",panelCaption:this.strSorting},{panelId:"id-adv-slicer-references",panelCaption:this.strReferences},{panelId:"id-adv-slicer-snap",panelCaption:this.textSnap},{panelId:"id-adv-slicer-alttext",panelCaption:this.textAlt}],contentTemplate:_.template(t)({scope:this})},e),this.options.handler=function(t,i){return"ok"==t&&!this.isNameValid()||void(e.handler&&e.handler.call(this,t,i))},Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this._changedProps=null,this._noApply=!0,this.spinners=[],this._nRatio=1,this._originalProps=this.options.imageProps},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this;this.inputHeader=new Common.UI.InputField({el:$("#sliceradv-text-header"),allowBlank:!0,style:"width: 178px;"}).on("changed:after",function(){t.isCaptionChanged=!0}),this.chHeader=new Common.UI.CheckBox({el:$("#sliceradv-checkbox-header"),labelText:this.strShowHeader}),this.chHeader.on("change",_.bind(function(t,e,i,n){this._changedProps&&this._changedProps.asc_setShowCaption("checked"==t.getValue())},this)),this.btnSlicerStyle=new Common.UI.Button({parentEl:$("#sliceradv-btn-style"),cls:"btn-large-dataview sheet-template-slicer",iconCls:"icon-template-slicer",menu:new Common.UI.Menu({style:"width: 333px;",additionalAlign:this.menuAddAlign,items:[{template:_.template('')}]})}),this.mnuSlicerPicker=new Common.UI.DataView({el:$("#sliceradv-menu-style"),parentMenu:this.btnSlicerStyle.menu,restoreHeight:325,groups:new Common.UI.DataViewGroupStore,store:new Common.UI.DataViewStore,itemTemplate:_.template('
'),style:"max-height: 325px;"}),this.mnuSlicerPicker.on("item:click",_.bind(this.onSelectSlicerStyle,this,this.btnSlicerStyle)),this.numWidth=new Common.UI.MetricSpinner({el:$("#sliceradv-spin-width"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:5963.9,minValue:0}),this.numWidth.on("change",_.bind(function(t,e,i,n){if(this.btnRatio.pressed){var s=t.getNumberValue(),o=s/this._nRatio;o>this.numHeight.options.maxValue&&(o=this.numHeight.options.maxValue,s=o*this._nRatio,this.numWidth.setValue(s,!0)),this.numHeight.setValue(o,!0)}this._originalProps&&(this._originalProps.put_Width(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this._originalProps.put_Height(Common.Utils.Metric.fnRecalcToMM(this.numHeight.getNumberValue())))},this)),this.spinners.push(this.numWidth),this.numHeight=new Common.UI.MetricSpinner({el:$("#sliceradv-spin-height"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:5963.9,minValue:0}),this.numHeight.on("change",_.bind(function(t,e,i,n){var s=t.getNumberValue(),o=null;this.btnRatio.pressed&&(o=s*this._nRatio,o>this.numWidth.options.maxValue&&(o=this.numWidth.options.maxValue,s=o/this._nRatio,this.numHeight.setValue(s,!0)),this.numWidth.setValue(o,!0)),this._originalProps&&(this._originalProps.put_Width(Common.Utils.Metric.fnRecalcToMM(this.numWidth.getNumberValue())),this._originalProps.put_Height(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.numHeight),this.btnRatio=new Common.UI.Button({parentEl:$("#sliceradv-button-ratio"),cls:"btn-toolbar",iconCls:"toolbar__icon advanced-btn-ratio",style:"margin-bottom: 1px;",enableToggle:!0,hint:this.textKeepRatio}),this.btnRatio.on("click",_.bind(function(t,e){t.pressed&&this.numHeight.getNumberValue()>0&&(this._nRatio=this.numWidth.getNumberValue()/this.numHeight.getNumberValue()),this._originalProps&&this._originalProps.asc_putLockAspect(t.pressed)},this)),this.numColHeight=new Common.UI.MetricSpinner({el:$("#sliceradv-spin-col-height"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:5963.9,minValue:0}),this.numColHeight.on("change",_.bind(function(t,e,i,n){var s=t.getNumberValue();this._changedProps&&this._changedProps.asc_setRowHeight(36e3*Common.Utils.Metric.fnRecalcToMM(s))},this)),this.spinners.push(this.numColHeight),this.numCols=new Common.UI.MetricSpinner({el:$("#sliceradv-spin-columns"),step:1,width:85,defaultUnit:"",defaultValue:1,value:"1",allowDecimal:!1,maxValue:2e4,minValue:1}),this.numCols.on("change",_.bind(function(t,e,i,n){var s=t.getNumberValue();this._changedProps&&this._changedProps.asc_setColumnCount(s)},this)),this.radioAsc=new Common.UI.RadioBox({el:$("#sliceradv-radio-asc"),name:"asc-radio-sliceradv-sort",labelText:this.textAsc,checked:!0}),this.radioAsc.on("change",_.bind(function(t,e,i){e&&this._changedProps&&this._changedProps.asc_setSortOrder(Asc.ST_tabularSlicerCacheSortOrder.Ascending)},this)),this.radioDesc=new Common.UI.RadioBox({el:$("#sliceradv-radio-desc"),name:"asc-radio-sliceradv-sort",labelText:this.textDesc,checked:!1}),this.radioDesc.on("change",_.bind(function(t,e,i){e&&this._changedProps&&this._changedProps.asc_setSortOrder(Asc.ST_tabularSlicerCacheSortOrder.Descending)},this)),this.chHideNoData=new Common.UI.CheckBox({el:$("#sliceradv-check-hide-nodata"),labelText:this.strHideNoData}),this.chHideNoData.on("change",_.bind(function(t,e,i,n){var s="checked"==t.getValue();this.chIndNoData.setDisabled(s),this.chShowNoData.setDisabled(s||"checked"!=this.chIndNoData.getValue()),this.chShowDel.setDisabled(s),this._changedProps&&this._changedProps.asc_setHideItemsWithNoData(s)},this)),this.chIndNoData=new Common.UI.CheckBox({el:$("#sliceradv-check-indicate-nodata"),labelText:this.strIndNoData}),this.chIndNoData.on("change",_.bind(function(t,e,i,n){var s="checked"==t.getValue();this.chShowNoData.setDisabled(!s),this._changedProps&&this._changedProps.asc_setIndicateItemsWithNoData(s)},this)),this.chShowNoData=new Common.UI.CheckBox({el:$("#sliceradv-check-show-nodata-last"),disabled:!0,labelText:this.strShowNoData}),this.chShowNoData.on("change",_.bind(function(t,e,i,n){this._changedProps&&this._changedProps.asc_setShowItemsWithNoDataLast("checked"==t.getValue())},this)),this.chShowDel=new Common.UI.CheckBox({el:$("#sliceradv-check-show-deleted"),labelText:this.strShowDel}),this.chShowDel.on("change",_.bind(function(t,e,i,n){this._changedProps},this)),this.inputName=new Common.UI.InputField({el:$("#sliceradv-text-name"),allowBlank:!1,blankError:t.txtEmpty,style:"width: 178px;"}).on("changed:after",function(){t.isNameChanged=!0}),this.lblSource=$("#sliceradv-lbl-source"),this.lblFormula=$("#sliceradv-lbl-formula"),this.radioTwoCell=new Common.UI.RadioBox({el:$("#slicer-advanced-radio-twocell"),name:"asc-radio-snap",labelText:this.textTwoCell,value:AscCommon.c_oAscCellAnchorType.cellanchorTwoCell}),this.radioTwoCell.on("change",_.bind(this.onRadioSnapChange,this)),this.radioOneCell=new Common.UI.RadioBox({el:$("#slicer-advanced-radio-onecell"),name:"asc-radio-snap",labelText:this.textOneCell,value:AscCommon.c_oAscCellAnchorType.cellanchorOneCell}),this.radioOneCell.on("change",_.bind(this.onRadioSnapChange,this)),this.radioAbsolute=new Common.UI.RadioBox({el:$("#slicer-advanced-radio-absolute"),name:"asc-radio-snap",labelText:this.textAbsolute,value:AscCommon.c_oAscCellAnchorType.cellanchorAbsolute}),this.radioAbsolute.on("change",_.bind(this.onRadioSnapChange,this)),this.inputAltTitle=new Common.UI.InputField({el:$("#sliceradv-alt-title"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"}).on("changed:after",function(){t.isAltTitleChanged=!0}),this.textareaAltDescription=this.$window.find("textarea"),this.textareaAltDescription.keydown(function(e){e.keyCode==Common.UI.Keys.RETURN&&e.stopPropagation(),t.isAltDescChanged=!0}),this.afterRender()},getFocusedComponents:function(){return[this.inputHeader,this.numWidth,this.numHeight,this.numCols,this.numColHeight,this.inputName,this.inputAltTitle,this.textareaAltDescription]},onCategoryClick:function(t,e){Common.Views.AdvancedSettingsWindow.prototype.onCategoryClick.call(this,t,e);var i=this;setTimeout(function(){switch(e){case 0:i.inputHeader.focus();break;case 2:i.inputName.focus();break;case 4:i.inputAltTitle.focus()}},10)},getSettings:function(){return this.isCaptionChanged&&this._changedProps.asc_setCaption(this.inputHeader.getValue()),this.isNameChanged&&this._changedProps.asc_setName(this.inputName.getValue()),this.isAltTitleChanged&&this._originalProps.asc_putTitle(this.inputAltTitle.getValue()),this.isAltDescChanged&&this._originalProps.asc_putDescription(this.textareaAltDescription.val()),{imageProps:this._originalProps}},_setDefaults:function(t){if(t){var e=t.asc_getWidth();switch(this.numWidth.setValue(null!==e?Common.Utils.Metric.fnRecalcFromMM(e).toFixed(2):"",!0),e=t.asc_getHeight(),this.numHeight.setValue(null!==e?Common.Utils.Metric.fnRecalcFromMM(e).toFixed(2):"",!0),t.asc_getHeight()>0&&(this._nRatio=t.asc_getWidth()/t.asc_getHeight()),e=t.asc_getLockAspect(),this.btnRatio.toggle(e),e=t.asc_getTitle(),this.inputAltTitle.setValue(e||""),e=t.asc_getDescription(),this.textareaAltDescription.val(e||""),e=t.asc_getAnchor()){case AscCommon.c_oAscCellAnchorType.cellanchorTwoCell:this.radioTwoCell.setValue(!0,!0);break;case AscCommon.c_oAscCellAnchorType.cellanchorOneCell:this.radioOneCell.setValue(!0,!0);break;case AscCommon.c_oAscCellAnchorType.cellanchorAbsolute:this.radioAbsolute.setValue(!0,!0)}var i=t.asc_getSlicerProperties();if(i){this._noApply=!0,this.numCols.setValue(i.asc_getColumnCount(),!0),this.numColHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(i.asc_getRowHeight()/36e3).toFixed(2),!0),this.inputHeader.setValue(i.asc_getCaption(),!0);var n=i.asc_getShowCaption();this.chHeader.setValue(null!==n&&void 0!==n?n:"indeterminate",!0),this.radioAsc.setCaption(this.textAsc+" ("+this.textAZ+")"),this.radioDesc.setCaption(this.textDesc+" ("+this.textZA+")"),i.asc_getSortOrder()==Asc.ST_tabularSlicerCacheSortOrder.Ascending?this.radioAsc.setValue(!0,!0):this.radioDesc.setValue(!0,!0),n=i.asc_getIndicateItemsWithNoData(),this.chIndNoData.setValue(null!==n&&void 0!==n?n:"indeterminate",!0),n=i.asc_getShowItemsWithNoDataLast(),this.chShowNoData.setValue(null!==n&&void 0!==n?n:"indeterminate",!0),n=i.asc_getHideItemsWithNoData(),this.chHideNoData.setValue(null!==n&&void 0!==n?n:"indeterminate",!0),this.chIndNoData.setDisabled(n),this.chShowNoData.setDisabled(n||"checked"!=this.chIndNoData.getValue()),this.chShowDel.setDisabled(n),e=i.asc_getName(),this.inputName.setValue(null!==e&&void 0!==e?e:""),this.inputName.setDisabled(null===e||void 0===e),this.lblSource.text(i.asc_getSourceName()),this.lblFormula.text(i.asc_getNameInFormulas()),e=i.asc_getStyle();var s=this.mnuSlicerPicker.store.findWhere({type:e});!s&&this.mnuSlicerPicker.store.length>0&&(s=this.mnuSlicerPicker.store.at(0)),s?(this.btnSlicerStyle.suspendEvents(),this.mnuSlicerPicker.selectRecord(s,!0),this.btnSlicerStyle.resumeEvents(),this.$window.find(".icon-template-slicer").css({"background-image":"url("+s.get("imageUrl")+")",height:"49px",width:"36px","background-position":"center","background-size":"cover"})):this.$window.find(".icon-template-slicer").css({height:"49px",width:"36px","background-position":"center","background-size":"cover"}),this._noApply=!1,this._changedProps=i}}},updateMetricUnit:function(){if(this.spinners)for(var t=0;t0){n.asc_setFilter(new Asc.ColorFilter),n.asc_setType(Asc.c_oAscAutoFilterTypes.ColorFilter);var s=n.asc_getFilter();s.asc_setCellColor(1==e.value&&null),s.asc_setCColor(1==e.value?this.documentHolder.ssMenu.cellColor:this.documentHolder.ssMenu.fontColor)}else{n.asc_setFilter(new Asc.CustomFilters),n.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters);var o=n.asc_getFilter();o.asc_setCustomFilters([new Asc.CustomFilter]),o.asc_setAnd(!0);o.asc_getCustomFilters()[0].asc_setOperator(Asc.c_oAscCustomAutoFilter.equals)}i.asc_setFilterObj(n),this.api.asc_applyAutoFilterByType(i),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Filter Cells")}},onReapply:function(){this.api.asc_reapplyAutoFilter(this.documentHolder.ssMenu.formatTableName)},onClear:function(t,e){this.api&&(this.api.asc_emptyCells(e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Clear"))},onSelectTable:function(t,e){this.api&&this.documentHolder.ssMenu.formatTableName&&(this.api.asc_changeSelectionFormatTable(this.documentHolder.ssMenu.formatTableName,e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Select Table"))},onInsertTable:function(t,e){this.api&&this.documentHolder.ssMenu.formatTableName&&(this.api.asc_insertCellsInTable(this.documentHolder.ssMenu.formatTableName,e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Insert to Table"))},onDeleteTable:function(t,e){this.api&&this.documentHolder.ssMenu.formatTableName&&(this.api.asc_deleteCellsInTable(this.documentHolder.ssMenu.formatTableName,e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Delete from Table"))},onInsFunction:function(t){var e=this.getApplication().getController("FormulaDialog");e&&this.api&&e.showDialog(void 0,t.value==Asc.ETotalsRowFunction.totalrowfunctionCustom)},onInsHyperlink:function(t){var e,i,n=this;if(n.api){for(var s=n.api.asc_getWorksheetsCount(),o=-1,a=[];++o-1&&e.value<6?(this.api.asc_setSelectedDrawingObjectAlign(e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Objects Align")):6==e.value?(this.api.asc_DistributeSelectedDrawingObjectHor(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Distribute")):7==e.value&&(this.api.asc_DistributeSelectedDrawingObjectVer(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Distribute")))},onParagraphVAlign:function(t,e){if(this.api){var i=new Asc.asc_CImgProperty;i.asc_putVerticalTextAlign(e.value),this.api.asc_setGraphicObjectProps(i),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Paragraph Vertical Align")}},onParagraphDirection:function(t,e){if(this.api){var i=new Asc.asc_CImgProperty;i.asc_putVert(e.options.direction),this.api.asc_setGraphicObjectProps(i),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Text Direction")}},onSelectBulletMenu:function(t,e){if(this.api)if(-1==e.options.value)this.api.asc_setListType(0,e.options.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","List Type");else if("settings"==e.options.value){for(var i,n=this,s=n.api.asc_getGraphicObjectProps(),o=0;o0;r--)switch(t[r-1].asc_getType()){case Asc.c_oAscMouseMoveType.Hyperlink:e=r;break;case Asc.c_oAscMouseMoveType.Comment:i=r;break;case Asc.c_oAscMouseMoveType.LockedObject:n=r;break;case Asc.c_oAscMouseMoveType.ResizeColumn:s=r;break;case Asc.c_oAscMouseMoveType.ResizeRow:o=r;break;case Asc.c_oAscMouseMoveType.Filter:a=r;break;case Asc.c_oAscMouseMoveType.Tooltip:l=r}var c=this,h=[0,0],d=c.tooltips.coauth,p=c.tooltips.comment,m=c.tooltips.hyperlink,u=c.tooltips.row_column,g=c.tooltips.filter,b=c.tooltips.slicer,f=[c.documentHolder.cmpEl.offset().left-$(window).scrollLeft(),c.documentHolder.cmpEl.offset().top-$(window).scrollTop()];if(e||c.hideHyperlinkTip(),void 0===s&&void 0===o&&!u.isHidden&&u.ref&&(u.ref.hide(),u.ref=void 0,u.text="",u.isHidden=!0),(c.permissions.isEdit||c.permissions.canViewComments)&&(!i||this.popupmenu)&&(p.moveCommentId=void 0,void 0!=p.viewCommentId)){p={};var C=this.getApplication().getController("Common.Controllers.Comments");C&&(this.permissions.canCoAuthoring&&this.permissions.canViewComments?setTimeout(function(){C.onApiHideComment(!0)},200):C.onApiHideComment(!0))}c.permissions.isEdit&&(n||c.hideCoAuthTips(),void 0===l&&!b.isHidden&&b.ref&&(b.ref.hide(),b.ref=void 0,b.text="",b.isHidden=!0)),(void 0===a||c.dlgFilter&&c.dlgFilter.isVisible()||c.currentMenu&&c.currentMenu.isVisible())&&!g.isHidden&&g.ref&&(g.ref.hide(),g.ref=void 0,g.text="",g.isHidden=!0);if(e){m.parentEl||(m.parentEl=$('
'),c.documentHolder.cmpEl.append(m.parentEl));var v=t[e-1],_=v.asc_getHyperlink();if(_.asc_getType()==Asc.c_oAscHyperlinkType.WebLink){var y=_.asc_getTooltip();y=y?Common.Utils.String.htmlEncode(y)+"
"+c.textCtrlClick+"":Common.Utils.String.htmlEncode(_.asc_getHyperlinkUrl())+"
"+c.textCtrlClick+""}else y=Common.Utils.String.htmlEncode(_.asc_getTooltip()||_.asc_getLocation()),y+="
"+c.textCtrlClick+"";if(m.ref&&m.ref.isVisible()&&m.text!=y&&(m.ref.hide(),m.ref=void 0,m.text="",m.isHidden=!0),!m.ref||!m.ref.isVisible()){m.text=y,m.ref=new Common.UI.Tooltip({owner:m.parentEl,html:!0,title:y}),m.ref.show([-1e4,-1e4]),m.isHidden=!1,h=[v.asc_getX(),v.asc_getY()],h[0]+=f[0]+6,h[1]+=f[1]-20,h[1]-=m.ref.getBSTip().$tip.height();var x=m.ref.getBSTip().$tip.width();h[0]+x>c.tooltips.coauth.bodyWidth&&(h[0]=c.tooltips.coauth.bodyWidth-x),m.ref.getBSTip().$tip.css({top:h[1]+"px",left:h[0]+"px"})}}if(void 0!==s||void 0!==o){u.parentEl||(u.parentEl=$('
'),c.documentHolder.cmpEl.append(u.parentEl));var v=t[void 0!==s?s-1:o-1],w=Common.Utils.String.format(void 0!==s?this.textChangeColumnWidth:this.textChangeRowHeight,v.asc_getSizeCCOrPt().toFixed(2),v.asc_getSizePx().toFixed());if(u.ref&&u.ref.isVisible()&&u.text!=w&&(u.text=w,u.ref.setTitle(w),u.ref.updateTitle()),!u.ref||!u.ref.isVisible()){u.text=w,u.ref=new Common.UI.Tooltip({owner:u.parentEl,html:!0,title:w}),u.ref.show([-1e4,-1e4]),u.isHidden=!1,h=[v.asc_getX(),v.asc_getY()],h[0]+=f[0]+6,h[1]+=f[1]-20-u.ttHeight;var x=u.ref.getBSTip().$tip.width();h[0]+x>c.tooltips.coauth.bodyWidth&&(h[0]=c.tooltips.coauth.bodyWidth-x-20),u.ref.getBSTip().$tip.css({top:h[1]+"px",left:h[0]+"px"})}}if((c.permissions.isEdit||c.permissions.canViewComments)&&i&&!this.popupmenu&&(v=t[i-1],!p.editCommentId&&p.moveCommentId!=v.asc_getCommentIndexes()[0])){p.moveCommentId=v.asc_getCommentIndexes()[0],p.moveCommentTimer&&clearTimeout(p.moveCommentTimer);var S=v.asc_getCommentIndexes(),A=v.asc_getX(),k=v.asc_getY(),T=v.asc_getReverseX();p.moveCommentTimer=setTimeout(function(){if(p.moveCommentId&&!p.editCommentId){p.viewCommentId=p.moveCommentId;var t=c.getApplication().getController("Common.Controllers.Comments");t&&(t.isSelectedComment||t.onApiShowComment(S,A,k,T,!1,!0))}},400)}if(c.permissions.isEdit&&n&&(v=t[n-1],d.XY||c.onDocumentResize(),d.x_point!=v.asc_getX()||d.y_point!=v.asc_getY())){c.hideCoAuthTips(),d.x_point=v.asc_getX(),d.y_point=v.asc_getY();var I=$(document.createElement("div")),E=v.asc_getLockedObjectType()==Asc.c_oAscMouseMoveLockedObjectType.Sheet||v.asc_getLockedObjectType()==Asc.c_oAscMouseMoveLockedObjectType.TableProperties;d.ref=I,I.addClass("username-tip"),I.css({height:d.ttHeight+"px",position:"absolute",zIndex:"900",visibility:"visible"}),$(document.body).append(I),h=[E?d.x_point+d.rightMenuWidth:d.bodyWidth-(d.x_point+d.XY[0]),d.y_point+d.XY[1]],h[1]>=d.XY[1]&&h[1]+d.ttHeight'),c.documentHolder.cmpEl.append(g.parentEl));var v=t[a-1],w=c.makeFilterTip(v.asc_getFilter());if(g.ref&&g.ref.isVisible()&&g.text!=w&&(g.text=w,g.ref.setTitle(w),g.ref.updateTitle()),!g.ref||!g.ref.isVisible()){g.text=w,g.ref=new Common.UI.Tooltip({owner:g.parentEl,html:!1,title:w,cls:"auto-tooltip"}),g.ref.show([-1e4,-1e4]),g.isHidden=!1,h=[v.asc_getX()+f[0]-10,v.asc_getY()+f[1]+20];g.ref.getBSTip().$tip.width();h[1]+g.ttHeight>c.tooltips.coauth.bodyHeight&&(h[1]=c.tooltips.coauth.bodyHeight-g.ttHeight-5,h[0]+=20);var x=g.ref.getBSTip().$tip.width();h[0]+x>c.tooltips.coauth.bodyWidth&&(h[0]=c.tooltips.coauth.bodyWidth-x-20),g.ref.getBSTip().$tip.css({top:h[1]+"px",left:h[0]+"px"})}}if(void 0!==l&&c.permissions.isEdit){b.parentEl||(b.parentEl=$('
'),c.documentHolder.cmpEl.append(b.parentEl));var v=t[l-1],w=v.asc_getTooltip();if(b.ref&&b.ref.isVisible()&&b.text!=w&&(b.text=w,b.ref.setTitle(w),b.ref.updateTitle()),!b.ref||!b.ref.isVisible()){b.text=w,b.ref=new Common.UI.Tooltip({owner:b.parentEl,html:!0,title:w}),b.ref.show([-1e4,-1e4]),b.isHidden=!1,h=[v.asc_getX(),v.asc_getY()],h[0]+=f[0]+6,h[1]+=f[1]-20-b.ttHeight;var x=b.ref.getBSTip().$tip.width();h[0]+x>c.tooltips.coauth.bodyWidth&&(h[0]=c.tooltips.coauth.bodyWidth-x-20),b.ref.getBSTip().$tip.css({top:h[1]+"px",left:h[0]+"px"})}}}},onApiHideComment:function(){this.tooltips.comment.viewCommentId=this.tooltips.comment.editCommentId=this.tooltips.comment.moveCommentId=void 0},onApiHyperlinkClick:function(t){if(!t)return void Common.UI.alert({msg:this.errorInvalidLink,title:this.notcriticalErrorTitle,iconCls:"warn",buttons:["ok"],callback:_.bind(function(t){Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},this)});try{window.parent.APP.openURL(t)}catch(i){console.error(i);var e=window.open(t,"_blank");e&&e.focus()}},onApiAutofilter:function(t){var e=this;if(!e.tooltips.filter.isHidden&&e.tooltips.filter.ref&&(e.tooltips.filter.ref.hide(),e.tooltips.filter.ref=void 0,e.tooltips.filter.text="",e.tooltips.filter.isHidden=!0),e.permissions.isEdit)if(e.dlgFilter)e.dlgFilter.close();else{e.dlgFilter=new SSE.Views.AutoFilterDialog({api:this.api}).on({close:function(){e.api&&e.api.asc_enableKeyEvents(!0),e.dlgFilter=void 0}}),e.api&&e.api.asc_enableKeyEvents(!1),Common.UI.Menu.Manager.hideAll(),e.dlgFilter.setSettings(t);var i=e.documentHolder.cmpEl.offset(),n=t.asc_getCellCoord(),s=n.asc_getX()+n.asc_getWidth()+i.left,o=n.asc_getY()+n.asc_getHeight()+i.top,a=Common.Utils.innerWidth(),l=Common.Utils.innerHeight();s+e.dlgFilter.options.width>a&&(s=a-e.dlgFilter.options.width-5),o+e.dlgFilter.options.height>l&&(o=l-e.dlgFilter.options.height-5),e.dlgFilter.show(s,o)}},makeFilterTip:function(t){var e=t.asc_getFilterObj(),i=e.asc_getType(),n=(t.asc_getIsTextFilter(),t.asc_getColorsFill(),t.asc_getColorsFont(),"");if(i===Asc.c_oAscAutoFilterTypes.CustomFilters){var s=e.asc_getFilter(),o=s.asc_getCustomFilters();n=this.getFilterName(Asc.c_oAscAutoFilterTypes.CustomFilters,o[0].asc_getOperator())+' "'+o[0].asc_getVal()+'"',o.length>1&&(n=n+" "+(s.asc_getAnd()?this.txtAnd:this.txtOr),n=n+" "+this.getFilterName(Asc.c_oAscAutoFilterTypes.CustomFilters,o[1].asc_getOperator())+' "'+o[1].asc_getVal()+'"')}else if(i===Asc.c_oAscAutoFilterTypes.ColorFilter){var a=e.asc_getFilter();null===a.asc_getCellColor()?n=this.txtEqualsToCellColor:!1===a.asc_getCellColor()&&(n=this.txtEqualsToFontColor)}else if(i===Asc.c_oAscAutoFilterTypes.DynamicFilter)n=this.getFilterName(Asc.c_oAscAutoFilterTypes.DynamicFilter,e.asc_getFilter().asc_getType());else if(i===Asc.c_oAscAutoFilterTypes.Top10){var l=e.asc_getFilter(),r=l.asc_getPercent();n=this.getFilterName(Asc.c_oAscAutoFilterTypes.Top10,l.asc_getTop()),n+=" "+l.asc_getVal()+" "+(r||null===r?this.txtPercent:this.txtItems)}else if(i===Asc.c_oAscAutoFilterTypes.Filters){var c=0,h=0,d=void 0,p=t.asc_getValues();p.forEach(function(t){t.asc_getVisible()&&(h++,c<100&&t.asc_getText()&&(n+=t.asc_getText()+"; ",c=n.length)),t.asc_getText()||(d=t.asc_getVisible())}),h==p.length?n=this.txtAll:1==h&&d?n=this.txtEquals+' "'+this.txtBlanks+'"':h==p.length-1&&0==d?n=this.txtNotEquals+' "'+this.txtBlanks+'"':(d&&(n+=this.txtBlanks+"; "),n=this.txtEquals+' "'+n.substring(0,n.length-2)+'"')}else i===Asc.c_oAscAutoFilterTypes.None&&(n=this.txtAll);return n.length>100&&(n=n.substring(0,100)+"..."),n=""+(t.asc_getColumnName()||"("+this.txtColumn+" "+t.asc_getSheetColumnName()+")")+":
"+n},getFilterName:function(t,e){var i="";if(t==Asc.c_oAscAutoFilterTypes.CustomFilters)switch(e){case Asc.c_oAscCustomAutoFilter.equals:i=this.txtEquals;break;case Asc.c_oAscCustomAutoFilter.isGreaterThan:i=this.txtGreater;break;case Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo:i=this.txtGreaterEquals;break;case Asc.c_oAscCustomAutoFilter.isLessThan:i=this.txtLess;break;case Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo:i=this.txtLessEquals;break;case Asc.c_oAscCustomAutoFilter.doesNotEqual:i=this.txtNotEquals;break;case Asc.c_oAscCustomAutoFilter.beginsWith:i=this.txtBegins;break;case Asc.c_oAscCustomAutoFilter.doesNotBeginWith:i=this.txtNotBegins;break;case Asc.c_oAscCustomAutoFilter.endsWith:i=this.txtEnds;break;case Asc.c_oAscCustomAutoFilter.doesNotEndWith:i=this.txtNotEnds;break;case Asc.c_oAscCustomAutoFilter.contains:i=this.txtContains;break;case Asc.c_oAscCustomAutoFilter.doesNotContain:i=this.txtNotContains}else if(t==Asc.c_oAscAutoFilterTypes.DynamicFilter)switch(e){case Asc.c_oAscDynamicAutoFilter.aboveAverage:i=this.txtAboveAve;break;case Asc.c_oAscDynamicAutoFilter.belowAverage:i=this.txtBelowAve}else t==Asc.c_oAscAutoFilterTypes.Top10&&(i=e||null===e?this.txtFilterTop:this.txtFilterBottom);return i},onUndo:function(){this.api&&(this.api.asc_Undo(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder))},onApiContextMenu:function(t){var e=this;_.delay(function(){e.showObjectMenu.call(e,t)},10)},onAfterRender:function(t){},onDocumentResize:function(t){var e=this;e.documentHolder&&(e.tooltips.coauth.XY=[e.documentHolder.cmpEl.offset().left-$(window).scrollLeft(),e.documentHolder.cmpEl.offset().top-$(window).scrollTop()],e.tooltips.coauth.apiHeight=e.documentHolder.cmpEl.height(),e.tooltips.coauth.rightMenuWidth=$("#right-menu").width(),e.tooltips.coauth.bodyWidth=$(window).width(),e.tooltips.coauth.bodyHeight=$(window).height())},onDocumentWheel:function(t){if(this.api&&!this.isEditCell){var e=_.isUndefined(t.originalEvent)?t.wheelDelta:t.originalEvent.wheelDelta;if(_.isUndefined(e)&&(e=t.deltaY),(t.ctrlKey||t.metaKey)&&!t.altKey){var i=this.api.asc_getZoom();e<0?(i=Math.ceil(10*i)/10,(i-=.1)<.5||this.api.asc_setZoom(i)):e>0&&(i=Math.floor(10*i)/10,(i+=.1)>0&&!(i>2)&&this.api.asc_setZoom(i)),t.preventDefault(),t.stopPropagation()}}},onDocumentKeyDown:function(t){if(this.api){var e=t.keyCode;if(!t.ctrlKey&&!t.metaKey||t.shiftKey||t.altKey){if(e==Common.UI.Keys.F10&&t.shiftKey)return this.showObjectMenu(t),t.preventDefault(),t.stopPropagation(),!1}else if(e===Common.UI.Keys.NUM_PLUS||e===Common.UI.Keys.EQUALITY||Common.Utils.isGecko&&e===Common.UI.Keys.EQUALITY_FF||Common.Utils.isOpera&&43==e){if(!this.api.isCellEdited){var i=Math.floor(10*this.api.asc_getZoom())/10;return i+=.1,i>0&&!(i>2)&&this.api.asc_setZoom(i),t.preventDefault(),t.stopPropagation(),!1}}else if(e===Common.UI.Keys.NUM_MINUS||e===Common.UI.Keys.MINUS||Common.Utils.isGecko&&e===Common.UI.Keys.MINUS_FF||Common.Utils.isOpera&&45==e){if(!this.api.isCellEdited)return i=Math.ceil(10*this.api.asc_getZoom())/10,i-=.1,i<.5||this.api.asc_setZoom(i),t.preventDefault(),t.stopPropagation(),!1}else if((48===e||96===e)&&!this.api.isCellEdited)return this.api.asc_setZoom(1),t.preventDefault(),t.stopPropagation(),!1}},onDocumentRightDown:function(t){0==t.button&&(this.mouse.isLeftButtonDown=!0)},onDocumentRightUp:function(t){0==t.button&&(this.mouse.isLeftButtonDown=!1)},onProcessMouse:function(t){"mouseup"==t.type&&(this.mouse.isLeftButtonDown=!1)},onDragEndMouseUp:function(){this.mouse.isLeftButtonDown=!1},onDocumentMouseMove:function(t){"canvas"!==t.target.localName&&this.hideHyperlinkTip()},showObjectMenu:function(t){!this.api||this.mouse.isLeftButtonDown||this.rangeSelectionMode||(this.permissions.isEdit&&!this._isDisabled?this.fillMenuProps(this.api.asc_getCellInfo(),!0,t):this.fillViewMenuProps(this.api.asc_getCellInfo(),!0,t))},onSelectionChanged:function(t){!this.mouse.isLeftButtonDown&&!this.rangeSelectionMode&&this.currentMenu&&this.currentMenu.isVisible()&&(this.permissions.isEdit&&!this._isDisabled?this.fillMenuProps(t,!0):this.fillViewMenuProps(t,!0))},fillMenuProps:function(t,e,i){var n,s,o,a,l,r,c,h,d,p,m,u=this.documentHolder,g=t.asc_getSelectionType(),b=t.asc_getLocked(),f=!0===t.asc_getLockedTable(),C=!1,v=this.getApplication().getController("Common.Controllers.Comments"),y=this.permissions.isEditMailMerge||this.permissions.isEditDiagram,x=t.asc_getXfs();switch(g){case Asc.c_oAscSelectionType.RangeCells:n=!0;break;case Asc.c_oAscSelectionType.RangeRow:s=!0;break;case Asc.c_oAscSelectionType.RangeCol:o=!0;break;case Asc.c_oAscSelectionType.RangeMax:a=!0;break;case Asc.c_oAscSelectionType.RangeSlicer:case Asc.c_oAscSelectionType.RangeImage:r=!y;break;case Asc.c_oAscSelectionType.RangeShape:h=!y;break;case Asc.c_oAscSelectionType.RangeChart:l=!y;break;case Asc.c_oAscSelectionType.RangeChartText:d=!y;break;case Asc.c_oAscSelectionType.RangeShapeText:c=!y}if(this.api.asc_getHeaderFooterMode()){if(!u.copyPasteMenu||!e&&!u.copyPasteMenu.isVisible())return;e&&this.showPopupMenu(u.copyPasteMenu,{},i)}else if(r||h||l){if(!u.imgMenu||!e&&!u.imgMenu.isVisible())return;r=h=l=m=!1,u.mnuImgAdvanced.imageInfo=void 0;for(var w,S=!1,A=this.api.asc_getGraphicObjectProps(),k=0;k-1),u.menuImageArrange.setDisabled(C),u.menuImgRotate.setVisible(!(l||null!==P&&void 0!==P||m)),u.menuImgRotate.setDisabled(C),u.menuImgCrop.setVisible(this.api.asc_canEditCrop()),u.menuImgCrop.setDisabled(C);var V=!!w;u.menuSignatureEditSign.setVisible(V),u.menuSignatureEditSetup.setVisible(V),u.menuEditSignSeparator.setVisible(V),e&&this.showPopupMenu(u.imgMenu,{},i),u.mnuShapeSeparator.setVisible(u.mnuShapeAdvanced.isVisible()||u.mnuChartEdit.isVisible()||u.mnuImgAdvanced.isVisible()),u.mnuSlicerSeparator.setVisible(u.mnuSlicerAdvanced.isVisible()),V&&(u.menuSignatureEditSign.cmpEl.attr("data-value",w),u.menuSignatureEditSetup.cmpEl.attr("data-value",w))}else if(c||d){if(!u.textInShapeMenu||!e&&!u.textInShapeMenu.isVisible())return;u.pmiTextAdvanced.textInfo=void 0;for(var A=this.api.asc_getGraphicObjectProps(),M=!1,k=0;k0){n.asc_setFilter(new Asc.ColorFilter),n.asc_setType(Asc.c_oAscAutoFilterTypes.ColorFilter);var s=n.asc_getFilter();s.asc_setCellColor(1==e.value&&null),s.asc_setCColor(1==e.value?this.documentHolder.ssMenu.cellColor:this.documentHolder.ssMenu.fontColor)}else{n.asc_setFilter(new Asc.CustomFilters),n.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters);var o=n.asc_getFilter();o.asc_setCustomFilters([new Asc.CustomFilter]),o.asc_setAnd(!0);o.asc_getCustomFilters()[0].asc_setOperator(Asc.c_oAscCustomAutoFilter.equals)}i.asc_setFilterObj(n),this.api.asc_applyAutoFilterByType(i),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Filter Cells")}},onReapply:function(){this.api.asc_reapplyAutoFilter(this.documentHolder.ssMenu.formatTableName)},onClear:function(t,e){this.api&&(this.api.asc_emptyCells(e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Clear"))},onSelectTable:function(t,e){this.api&&this.documentHolder.ssMenu.formatTableName&&(this.api.asc_changeSelectionFormatTable(this.documentHolder.ssMenu.formatTableName,e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Select Table"))},onInsertTable:function(t,e){this.api&&this.documentHolder.ssMenu.formatTableName&&(this.api.asc_insertCellsInTable(this.documentHolder.ssMenu.formatTableName,e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Insert to Table"))},onDeleteTable:function(t,e){this.api&&this.documentHolder.ssMenu.formatTableName&&(this.api.asc_deleteCellsInTable(this.documentHolder.ssMenu.formatTableName,e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Delete from Table"))},onInsFunction:function(t){var e=this.getApplication().getController("FormulaDialog");e&&this.api&&e.showDialog(void 0,t.value==Asc.ETotalsRowFunction.totalrowfunctionCustom)},onInsHyperlink:function(t){var e,i,n=this;if(n.api){for(var s=n.api.asc_getWorksheetsCount(),o=-1,a=[];++o-1&&e.value<6?(this.api.asc_setSelectedDrawingObjectAlign(e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Objects Align")):6==e.value?(this.api.asc_DistributeSelectedDrawingObjectHor(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Distribute")):7==e.value&&(this.api.asc_DistributeSelectedDrawingObjectVer(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Distribute")))},onParagraphVAlign:function(t,e){if(this.api){var i=new Asc.asc_CImgProperty;i.asc_putVerticalTextAlign(e.value),this.api.asc_setGraphicObjectProps(i),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Paragraph Vertical Align")}},onParagraphDirection:function(t,e){if(this.api){var i=new Asc.asc_CImgProperty;i.asc_putVert(e.options.direction),this.api.asc_setGraphicObjectProps(i),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Text Direction")}},onSelectBulletMenu:function(t,e){if(this.api)if(-1==e.options.value)this.api.asc_setListType(0,e.options.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","List Type");else if("settings"==e.options.value){for(var i,n=this,s=n.api.asc_getGraphicObjectProps(),o=0;o0;r--)switch(t[r-1].asc_getType()){case Asc.c_oAscMouseMoveType.Hyperlink:e=r;break;case Asc.c_oAscMouseMoveType.Comment:i=r;break;case Asc.c_oAscMouseMoveType.LockedObject:n=r;break;case Asc.c_oAscMouseMoveType.ResizeColumn:s=r;break;case Asc.c_oAscMouseMoveType.ResizeRow:o=r;break;case Asc.c_oAscMouseMoveType.Filter:a=r;break;case Asc.c_oAscMouseMoveType.Tooltip:l=r}var c=this,h=[0,0],d=c.tooltips.coauth,p=c.tooltips.comment,m=c.tooltips.hyperlink,u=c.tooltips.row_column,g=c.tooltips.filter,b=c.tooltips.slicer,f=[c.documentHolder.cmpEl.offset().left-$(window).scrollLeft(),c.documentHolder.cmpEl.offset().top-$(window).scrollTop()];if(e||c.hideHyperlinkTip(),void 0===s&&void 0===o&&!u.isHidden&&u.ref&&(u.ref.hide(),u.ref=void 0,u.text="",u.isHidden=!0),(c.permissions.isEdit||c.permissions.canViewComments)&&(!i||this.popupmenu)&&(p.moveCommentId=void 0,void 0!=p.viewCommentId)){p={};var C=this.getApplication().getController("Common.Controllers.Comments");C&&(this.permissions.canCoAuthoring&&this.permissions.canViewComments?setTimeout(function(){C.onApiHideComment(!0)},200):C.onApiHideComment(!0))}c.permissions.isEdit&&(n||c.hideCoAuthTips(),void 0===l&&!b.isHidden&&b.ref&&(b.ref.hide(),b.ref=void 0,b.text="",b.isHidden=!0)),(void 0===a||c.dlgFilter&&c.dlgFilter.isVisible()||c.currentMenu&&c.currentMenu.isVisible())&&!g.isHidden&&g.ref&&(g.ref.hide(),g.ref=void 0,g.text="",g.isHidden=!0);if(e){m.parentEl||(m.parentEl=$('
'),c.documentHolder.cmpEl.append(m.parentEl));var v=t[e-1],_=v.asc_getHyperlink();if(_.asc_getType()==Asc.c_oAscHyperlinkType.WebLink){var y=_.asc_getTooltip();y=y?Common.Utils.String.htmlEncode(y)+"
"+c.textCtrlClick+"":Common.Utils.String.htmlEncode(_.asc_getHyperlinkUrl())+"
"+c.textCtrlClick+""}else y=Common.Utils.String.htmlEncode(_.asc_getTooltip()||_.asc_getLocation()),y+="
"+c.textCtrlClick+"";if(m.ref&&m.ref.isVisible()&&m.text!=y&&(m.ref.hide(),m.ref=void 0,m.text="",m.isHidden=!0),!m.ref||!m.ref.isVisible()){m.text=y,m.ref=new Common.UI.Tooltip({owner:m.parentEl,html:!0,title:y}),m.ref.show([-1e4,-1e4]),m.isHidden=!1,h=[v.asc_getX(),v.asc_getY()],h[0]+=f[0]+6,h[1]+=f[1]-20,h[1]-=m.ref.getBSTip().$tip.height();var x=m.ref.getBSTip().$tip.width();h[0]+x>c.tooltips.coauth.bodyWidth&&(h[0]=c.tooltips.coauth.bodyWidth-x),m.ref.getBSTip().$tip.css({top:h[1]+"px",left:h[0]+"px"})}}if(void 0!==s||void 0!==o){u.parentEl||(u.parentEl=$('
'),c.documentHolder.cmpEl.append(u.parentEl));var v=t[void 0!==s?s-1:o-1],w=Common.Utils.String.format(void 0!==s?this.textChangeColumnWidth:this.textChangeRowHeight,v.asc_getSizeCCOrPt().toFixed(2),v.asc_getSizePx().toFixed());if(u.ref&&u.ref.isVisible()&&u.text!=w&&(u.text=w,u.ref.setTitle(w),u.ref.updateTitle()),!u.ref||!u.ref.isVisible()){u.text=w,u.ref=new Common.UI.Tooltip({owner:u.parentEl,html:!0,title:w}),u.ref.show([-1e4,-1e4]),u.isHidden=!1,h=[v.asc_getX(),v.asc_getY()],h[0]+=f[0]+6,h[1]+=f[1]-20-u.ttHeight;var x=u.ref.getBSTip().$tip.width();h[0]+x>c.tooltips.coauth.bodyWidth&&(h[0]=c.tooltips.coauth.bodyWidth-x-20),u.ref.getBSTip().$tip.css({top:h[1]+"px",left:h[0]+"px"})}}if((c.permissions.isEdit||c.permissions.canViewComments)&&i&&!this.popupmenu&&(v=t[i-1],!p.editCommentId&&p.moveCommentId!=v.asc_getCommentIndexes()[0])){p.moveCommentId=v.asc_getCommentIndexes()[0],p.moveCommentTimer&&clearTimeout(p.moveCommentTimer);var S=v.asc_getCommentIndexes(),A=v.asc_getX(),k=v.asc_getY(),T=v.asc_getReverseX();p.moveCommentTimer=setTimeout(function(){if(p.moveCommentId&&!p.editCommentId){p.viewCommentId=p.moveCommentId;var t=c.getApplication().getController("Common.Controllers.Comments");t&&(t.isSelectedComment||t.onApiShowComment(S,A,k,T,!1,!0))}},400)}if(c.permissions.isEdit&&n&&(v=t[n-1],d.XY||c.onDocumentResize(),d.x_point!=v.asc_getX()||d.y_point!=v.asc_getY())){c.hideCoAuthTips(),d.x_point=v.asc_getX(),d.y_point=v.asc_getY();var I=$(document.createElement("div")),E=v.asc_getLockedObjectType()==Asc.c_oAscMouseMoveLockedObjectType.Sheet||v.asc_getLockedObjectType()==Asc.c_oAscMouseMoveLockedObjectType.TableProperties;d.ref=I,I.addClass("username-tip"),I.css({height:d.ttHeight+"px",position:"absolute",zIndex:"900",visibility:"visible"}),$(document.body).append(I),h=[E?d.x_point+d.rightMenuWidth:d.bodyWidth-(d.x_point+d.XY[0]),d.y_point+d.XY[1]],h[1]>=d.XY[1]&&h[1]+d.ttHeight'),c.documentHolder.cmpEl.append(g.parentEl));var v=t[a-1],w=c.makeFilterTip(v.asc_getFilter());if(g.ref&&g.ref.isVisible()&&g.text!=w&&(g.text=w,g.ref.setTitle(w),g.ref.updateTitle()),!g.ref||!g.ref.isVisible()){g.text=w,g.ref=new Common.UI.Tooltip({owner:g.parentEl,html:!0,title:w,cls:"auto-tooltip"}),g.ref.show([-1e4,-1e4]),g.isHidden=!1,h=[v.asc_getX()+f[0]-10,v.asc_getY()+f[1]+20];g.ref.getBSTip().$tip.width();h[1]+g.ttHeight>c.tooltips.coauth.bodyHeight&&(h[1]=c.tooltips.coauth.bodyHeight-g.ttHeight-5,h[0]+=20);var x=g.ref.getBSTip().$tip.width();h[0]+x>c.tooltips.coauth.bodyWidth&&(h[0]=c.tooltips.coauth.bodyWidth-x-20),g.ref.getBSTip().$tip.css({top:h[1]+"px",left:h[0]+"px"})}}if(void 0!==l&&c.permissions.isEdit){b.parentEl||(b.parentEl=$('
'),c.documentHolder.cmpEl.append(b.parentEl));var v=t[l-1],w=v.asc_getTooltip();if(b.ref&&b.ref.isVisible()&&b.text!=w&&(b.text=w,b.ref.setTitle(w),b.ref.updateTitle()),!b.ref||!b.ref.isVisible()){b.text=w,b.ref=new Common.UI.Tooltip({owner:b.parentEl,html:!0,title:w}),b.ref.show([-1e4,-1e4]),b.isHidden=!1,h=[v.asc_getX(),v.asc_getY()],h[0]+=f[0]+6,h[1]+=f[1]-20-b.ttHeight;var x=b.ref.getBSTip().$tip.width();h[0]+x>c.tooltips.coauth.bodyWidth&&(h[0]=c.tooltips.coauth.bodyWidth-x-20),b.ref.getBSTip().$tip.css({top:h[1]+"px",left:h[0]+"px"})}}}},onApiHideComment:function(){this.tooltips.comment.viewCommentId=this.tooltips.comment.editCommentId=this.tooltips.comment.moveCommentId=void 0},onApiHyperlinkClick:function(t){if(!t)return void Common.UI.alert({msg:this.errorInvalidLink,title:this.notcriticalErrorTitle,iconCls:"warn",buttons:["ok"],callback:_.bind(function(t){Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},this)});try{window.parent.APP.openURL(t)}catch(i){console.error(i);var e=window.open(t,"_blank");e&&e.focus()}},onApiAutofilter:function(t){var e=this;if(!e.tooltips.filter.isHidden&&e.tooltips.filter.ref&&(e.tooltips.filter.ref.hide(),e.tooltips.filter.ref=void 0,e.tooltips.filter.text="",e.tooltips.filter.isHidden=!0),e.permissions.isEdit)if(e.dlgFilter)e.dlgFilter.close();else{e.dlgFilter=new SSE.Views.AutoFilterDialog({api:this.api}).on({close:function(){e.api&&e.api.asc_enableKeyEvents(!0),e.dlgFilter=void 0}}),e.api&&e.api.asc_enableKeyEvents(!1),Common.UI.Menu.Manager.hideAll(),e.dlgFilter.setSettings(t);var i=e.documentHolder.cmpEl.offset(),n=t.asc_getCellCoord(),s=n.asc_getX()+n.asc_getWidth()+i.left,o=n.asc_getY()+n.asc_getHeight()+i.top,a=Common.Utils.innerWidth(),l=Common.Utils.innerHeight();s+e.dlgFilter.options.width>a&&(s=a-e.dlgFilter.options.width-5),o+e.dlgFilter.options.height>l&&(o=l-e.dlgFilter.options.height-5),e.dlgFilter.show(s,o)}},makeFilterTip:function(t){var e=t.asc_getFilterObj(),i=e.asc_getType(),n=(t.asc_getIsTextFilter(),t.asc_getColorsFill(),t.asc_getColorsFont(),"");if(i===Asc.c_oAscAutoFilterTypes.CustomFilters){var s=e.asc_getFilter(),o=s.asc_getCustomFilters();n=this.getFilterName(Asc.c_oAscAutoFilterTypes.CustomFilters,o[0].asc_getOperator())+' "'+o[0].asc_getVal()+'"',o.length>1&&(n=n+" "+(s.asc_getAnd()?this.txtAnd:this.txtOr),n=n+" "+this.getFilterName(Asc.c_oAscAutoFilterTypes.CustomFilters,o[1].asc_getOperator())+' "'+o[1].asc_getVal()+'"')}else if(i===Asc.c_oAscAutoFilterTypes.ColorFilter){var a=e.asc_getFilter();null===a.asc_getCellColor()?n=this.txtEqualsToCellColor:!1===a.asc_getCellColor()&&(n=this.txtEqualsToFontColor)}else if(i===Asc.c_oAscAutoFilterTypes.DynamicFilter)n=this.getFilterName(Asc.c_oAscAutoFilterTypes.DynamicFilter,e.asc_getFilter().asc_getType());else if(i===Asc.c_oAscAutoFilterTypes.Top10){var l=e.asc_getFilter(),r=l.asc_getPercent();n=this.getFilterName(Asc.c_oAscAutoFilterTypes.Top10,l.asc_getTop()),n+=" "+l.asc_getVal()+" "+(r||null===r?this.txtPercent:this.txtItems)}else if(i===Asc.c_oAscAutoFilterTypes.Filters){var c=0,h=0,d=void 0,p=t.asc_getValues();p.forEach(function(t){t.asc_getVisible()&&(h++,c<100&&t.asc_getText()&&(n+=t.asc_getText()+"; ",c=n.length)),t.asc_getText()||(d=t.asc_getVisible())}),h==p.length?n=this.txtAll:1==h&&d?n=this.txtEquals+' "'+this.txtBlanks+'"':h==p.length-1&&0==d?n=this.txtNotEquals+' "'+this.txtBlanks+'"':(d&&(n+=this.txtBlanks+"; "),n=this.txtEquals+' "'+n.substring(0,n.length-2)+'"')}else i===Asc.c_oAscAutoFilterTypes.None&&(n=this.txtAll);return n.length>100&&(n=n.substring(0,100)+"..."),n=""+(t.asc_getColumnName()||"("+this.txtColumn+" "+t.asc_getSheetColumnName()+")")+":
"+n},getFilterName:function(t,e){var i="";if(t==Asc.c_oAscAutoFilterTypes.CustomFilters)switch(e){case Asc.c_oAscCustomAutoFilter.equals:i=this.txtEquals;break;case Asc.c_oAscCustomAutoFilter.isGreaterThan:i=this.txtGreater;break;case Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo:i=this.txtGreaterEquals;break;case Asc.c_oAscCustomAutoFilter.isLessThan:i=this.txtLess;break;case Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo:i=this.txtLessEquals;break;case Asc.c_oAscCustomAutoFilter.doesNotEqual:i=this.txtNotEquals;break;case Asc.c_oAscCustomAutoFilter.beginsWith:i=this.txtBegins;break;case Asc.c_oAscCustomAutoFilter.doesNotBeginWith:i=this.txtNotBegins;break;case Asc.c_oAscCustomAutoFilter.endsWith:i=this.txtEnds;break;case Asc.c_oAscCustomAutoFilter.doesNotEndWith:i=this.txtNotEnds;break;case Asc.c_oAscCustomAutoFilter.contains:i=this.txtContains;break;case Asc.c_oAscCustomAutoFilter.doesNotContain:i=this.txtNotContains}else if(t==Asc.c_oAscAutoFilterTypes.DynamicFilter)switch(e){case Asc.c_oAscDynamicAutoFilter.aboveAverage:i=this.txtAboveAve;break;case Asc.c_oAscDynamicAutoFilter.belowAverage:i=this.txtBelowAve}else t==Asc.c_oAscAutoFilterTypes.Top10&&(i=e||null===e?this.txtFilterTop:this.txtFilterBottom);return i},onUndo:function(){this.api&&(this.api.asc_Undo(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder))},onApiContextMenu:function(t){var e=this;_.delay(function(){e.showObjectMenu.call(e,t)},10)},onAfterRender:function(t){},onDocumentResize:function(t){var e=this;e.documentHolder&&(e.tooltips.coauth.XY=[e.documentHolder.cmpEl.offset().left-$(window).scrollLeft(),e.documentHolder.cmpEl.offset().top-$(window).scrollTop()],e.tooltips.coauth.apiHeight=e.documentHolder.cmpEl.height(),e.tooltips.coauth.rightMenuWidth=$("#right-menu").width(),e.tooltips.coauth.bodyWidth=$(window).width(),e.tooltips.coauth.bodyHeight=$(window).height())},onDocumentWheel:function(t){if(this.api&&!this.isEditCell){var e=_.isUndefined(t.originalEvent)?t.wheelDelta:t.originalEvent.wheelDelta;if(_.isUndefined(e)&&(e=t.deltaY),(t.ctrlKey||t.metaKey)&&!t.altKey){var i=this.api.asc_getZoom();e<0?(i=Math.ceil(10*i)/10,(i-=.1)<.5||this.api.asc_setZoom(i)):e>0&&(i=Math.floor(10*i)/10,(i+=.1)>0&&!(i>2)&&this.api.asc_setZoom(i)),t.preventDefault(),t.stopPropagation()}}},onDocumentKeyDown:function(t){if(this.api){var e=t.keyCode;if(!t.ctrlKey&&!t.metaKey||t.shiftKey||t.altKey){if(e==Common.UI.Keys.F10&&t.shiftKey)return this.showObjectMenu(t),t.preventDefault(),t.stopPropagation(),!1}else if(e===Common.UI.Keys.NUM_PLUS||e===Common.UI.Keys.EQUALITY||Common.Utils.isGecko&&e===Common.UI.Keys.EQUALITY_FF||Common.Utils.isOpera&&43==e){if(!this.api.isCellEdited){var i=Math.floor(10*this.api.asc_getZoom())/10;return i+=.1,i>0&&!(i>2)&&this.api.asc_setZoom(i),t.preventDefault(),t.stopPropagation(),!1}}else if(e===Common.UI.Keys.NUM_MINUS||e===Common.UI.Keys.MINUS||Common.Utils.isGecko&&e===Common.UI.Keys.MINUS_FF||Common.Utils.isOpera&&45==e){if(!this.api.isCellEdited)return i=Math.ceil(10*this.api.asc_getZoom())/10,i-=.1,i<.5||this.api.asc_setZoom(i),t.preventDefault(),t.stopPropagation(),!1}else if((48===e||96===e)&&!this.api.isCellEdited)return this.api.asc_setZoom(1),t.preventDefault(),t.stopPropagation(),!1}},onDocumentRightDown:function(t){0==t.button&&(this.mouse.isLeftButtonDown=!0)},onDocumentRightUp:function(t){0==t.button&&(this.mouse.isLeftButtonDown=!1)},onProcessMouse:function(t){"mouseup"==t.type&&(this.mouse.isLeftButtonDown=!1)},onDragEndMouseUp:function(){this.mouse.isLeftButtonDown=!1},onDocumentMouseMove:function(t){"canvas"!==t.target.localName&&this.hideHyperlinkTip()},showObjectMenu:function(t){!this.api||this.mouse.isLeftButtonDown||this.rangeSelectionMode||(this.permissions.isEdit&&!this._isDisabled?this.fillMenuProps(this.api.asc_getCellInfo(),!0,t):this.fillViewMenuProps(this.api.asc_getCellInfo(),!0,t))},onSelectionChanged:function(t){!this.mouse.isLeftButtonDown&&!this.rangeSelectionMode&&this.currentMenu&&this.currentMenu.isVisible()&&(this.permissions.isEdit&&!this._isDisabled?this.fillMenuProps(t,!0):this.fillViewMenuProps(t,!0))},fillMenuProps:function(t,e,i){var n,s,o,a,l,r,c,h,d,p,m,u=this.documentHolder,g=t.asc_getSelectionType(),b=t.asc_getLocked(),f=!0===t.asc_getLockedTable(),C=!1,v=this.getApplication().getController("Common.Controllers.Comments"),y=this.permissions.isEditMailMerge||this.permissions.isEditDiagram,x=t.asc_getXfs();switch(g){case Asc.c_oAscSelectionType.RangeCells:n=!0;break;case Asc.c_oAscSelectionType.RangeRow:s=!0;break;case Asc.c_oAscSelectionType.RangeCol:o=!0;break;case Asc.c_oAscSelectionType.RangeMax:a=!0;break;case Asc.c_oAscSelectionType.RangeSlicer:case Asc.c_oAscSelectionType.RangeImage:r=!y;break;case Asc.c_oAscSelectionType.RangeShape:h=!y;break;case Asc.c_oAscSelectionType.RangeChart:l=!y;break;case Asc.c_oAscSelectionType.RangeChartText:d=!y;break;case Asc.c_oAscSelectionType.RangeShapeText:c=!y}if(this.api.asc_getHeaderFooterMode()){if(!u.copyPasteMenu||!e&&!u.copyPasteMenu.isVisible())return;e&&this.showPopupMenu(u.copyPasteMenu,{},i)}else if(r||h||l){if(!u.imgMenu||!e&&!u.imgMenu.isVisible())return;r=h=l=m=!1,u.mnuImgAdvanced.imageInfo=void 0;for(var w,S=!1,A=this.api.asc_getGraphicObjectProps(),k=0;k-1),u.menuImageArrange.setDisabled(C),u.menuImgRotate.setVisible(!(l||null!==P&&void 0!==P||m)),u.menuImgRotate.setDisabled(C),u.menuImgCrop.setVisible(this.api.asc_canEditCrop()),u.menuImgCrop.setDisabled(C);var V=!!w;u.menuSignatureEditSign.setVisible(V),u.menuSignatureEditSetup.setVisible(V),u.menuEditSignSeparator.setVisible(V),e&&this.showPopupMenu(u.imgMenu,{},i),u.mnuShapeSeparator.setVisible(u.mnuShapeAdvanced.isVisible()||u.mnuChartEdit.isVisible()||u.mnuImgAdvanced.isVisible()),u.mnuSlicerSeparator.setVisible(u.mnuSlicerAdvanced.isVisible()),V&&(u.menuSignatureEditSign.cmpEl.attr("data-value",w),u.menuSignatureEditSetup.cmpEl.attr("data-value",w))}else if(c||d){if(!u.textInShapeMenu||!e&&!u.textInShapeMenu.isVisible())return;u.pmiTextAdvanced.textInfo=void 0;for(var A=this.api.asc_getGraphicObjectProps(),M=!1,k=0;k',t.id)),s.cmpEl.append(a)),t.render(a),t.cmpEl.attr({tabindex:"-1"})),2!==i.button){var l=n.api.asc_getActiveCellCoord(),r={left:0,top:0};o[0]=l.asc_getX()+l.asc_getWidth()+r.left,o[1]=(l.asc_getY()<0?0:l.asc_getY())+l.asc_getHeight()+r.top}a.css({left:o[0],top:o[1]}),_.isFunction(t.options.initMenu)&&(t.options.initMenu(e),t.alignPosition()),_.delay(function(){t.cmpEl.focus()},10),t.show(),n.currentMenu=t}},onEntriesListMenu:function(t,e,i){if(e&&e.length>0){var n=this,s=n.documentHolder,o=s.entriesMenu,a=s.cmpEl.find(Common.Utils.String.format("#menu-container-{0}",o.id));if(t&&o.isVisible())return void o.hide();for(var l=0;l',o.id)),s.cmpEl.append(a)),o.render(a),o.cmpEl.attr({tabindex:"-1"}));var r=n.api.asc_getActiveCellCoord(),c={left:0,top:0},h=[r.asc_getX()+c.left,(r.asc_getY()<0?0:r.asc_getY())+r.asc_getHeight()+c.top];a.css({left:h[0],top:h[1]}),n._preventClick=t,t&&a.attr("data-value","prevent-canvas-click"),o.show(),o.alignPosition(),_.delay(function(){o.cmpEl.focus()},10)}else this.documentHolder.entriesMenu.hide(),!t&&Common.UI.warning({title:this.notcriticalErrorTitle,maxwidth:600,msg:this.txtNoChoices,callback:_.bind(function(t){Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},this)})},onTableTotalMenu:function(t){if(void 0!==t){var e=this,i=e.documentHolder,n=i.tableTotalMenu,s=i.cmpEl.find(Common.Utils.String.format("#menu-container-{0}",n.id));if(n.isVisible())return void n.hide();Common.UI.Menu.Manager.hideAll(),n.rendered||(s.length<1&&(s=$(Common.Utils.String.format('',n.id)),i.cmpEl.append(s)),n.render(s),n.cmpEl.attr({tabindex:"-1"})),n.clearAll();var o=_.find(n.items,function(e){return e.value==t});o&&o.setChecked(!0,!0);var a=e.api.asc_getActiveCellCoord(),l={left:0,top:0},r=[a.asc_getX()+l.left,(a.asc_getY()<0?0:a.asc_getY())+a.asc_getHeight()+l.top];s.css({left:r[0],top:r[1]}),e._preventClick=!0,s.attr("data-value","prevent-canvas-click"),n.show(),n.alignPosition(),_.delay(function(){n.cmpEl.focus()},10)}else this.documentHolder.tableTotalMenu.hide()},onTotalMenuClick:function(t,e){e.value==Asc.ETotalsRowFunction.totalrowfunctionCustom?this.onInsFunction(e):this.api.asc_insertInCell(e.value,Asc.c_oAscPopUpSelectorType.TotalRowFunc),Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},onFormulaCompleteMenu:function(t){if(this.documentHolder.funcMenu&&!Common.Utils.ModalWindow.isVisible()&&!this.rangeSelectionMode)if(t){for(var e=this,i=e.documentHolder,n=i.funcMenu,s=i.cmpEl.find("#menu-formula-selection"),o=e.getApplication().getController("FormulaDialog").getDescription(Common.Utils.InternalSettings.get("sse-settings-func-locale")),a=0;an?1:0}),_.each(t,function(t,i){var s=t.asc_getType(),a=t.asc_getName(!0),l=e.api.asc_getFormulaNameByLocale(a),r="btn-named-range";switch(s){case Asc.c_oAscPopUpSelectorType.Func:r="btn-function";break;case Asc.c_oAscPopUpSelectorType.Table:r="btn-menu-table";break;case Asc.c_oAscPopUpSelectorType.Slicer:r="btn-slicer"}var c=new Common.UI.MenuItem({iconCls:"menu__icon "+r,caption:a,hint:o&&o[l]?o[l].d:""}).on("click",function(t,i){setTimeout(function(){e.api.asc_insertInCell(t.caption,s,!1)},10)});n.addItem(c)}),n.rendered||(s.length<1&&(s=$(Common.Utils.String.format('')),i.cmpEl.append(s)),n.onAfterKeydownMenu=function(t){if(t.keyCode!=Common.UI.Keys.RETURN||!t.ctrlKey&&!t.altKey){var e;if(arguments.length>1&&arguments[1]instanceof KeyboardEvent&&(t=arguments[1]),s.hasClass("open"))if(t.keyCode==Common.UI.Keys.TAB||t.keyCode==Common.UI.Keys.RETURN&&!t.ctrlKey&&!t.altKey)e=s.find("a.focus").closest("li");else if(t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.DOWN){var i=n.cmpEl,o=i.offset().top,a=s.find("a.focus").closest("li"),l=a.offset().top;(lo+i.height())&&(n.scroller?n.scroller.scrollTop(i.scrollTop()+l-o,0):i.scrollTop(i.scrollTop()+l-o))}e&&(e.length>0&&e.click(),Common.UI.Menu.Manager.hideAll())}},n.on("hide:after",function(){for(var t=0;t'),this.documentHolder.cmpEl.append(e.parentEl));var i=this.getApplication().getController("FormulaDialog").getDescription(Common.Utils.InternalSettings.get("sse-settings-func-locale")),n=(i&&i[t]?this.api.asc_getFormulaLocaleName(t)+i[t].a:"").replace(/[,;]/g,this.api.asc_getFunctionArgumentSeparator());if(e.ref&&e.ref.isVisible()&&e.text!=n&&(e.ref.hide(),e.ref=void 0,e.text="",e.isHidden=!0),!n)return;e.ref&&e.ref.isVisible()||(e.text=n,e.ref=new Common.UI.Tooltip({owner:e.parentEl,html:!0,title:n,cls:"auto-tooltip"}),e.ref.show([-1e4,-1e4]),e.isHidden=!1);var s=[this.documentHolder.cmpEl.offset().left-$(window).scrollLeft(),this.documentHolder.cmpEl.offset().top-$(window).scrollTop()],o=this.api.asc_getActiveCellCoord(),a=[o.asc_getX()+s[0]-3,o.asc_getY()+s[1]-e.ref.getBSTip().$tip.height()-5],l=e.ref.getBSTip().$tip.width();a[0]+l>this.tooltips.coauth.bodyWidth&&(a[0]=this.tooltips.coauth.bodyWidth-l),e.ref.getBSTip().$tip.css({top:a[1]+"px",left:a[0]+"px"})}else!e.isHidden&&e.ref&&(e.ref.hide(),e.ref=void 0,e.text="",e.isHidden=!0)},onInputMessage:function(t,e){var i=this.tooltips.input_msg;if(e){i.parentEl||(i.parentEl=$('
'),this.documentHolder.cmpEl.append(i.parentEl));var n=t?""+Common.Utils.String.htmlEncode(t||"")+"
":"";n+=Common.Utils.String.htmlEncode(e||""),i.ref&&i.ref.isVisible()&&i.text!=n&&(i.ref.hide(),i.ref=void 0,i.text="",i.isHidden=!0),i.ref&&i.ref.isVisible()||(i.text=n,i.ref=new Common.UI.Tooltip({owner:i.parentEl,html:!0,title:n}),i.ref.show([-1e4,-1e4]),i.isHidden=!1);var s=[this.documentHolder.cmpEl.offset().left-$(window).scrollLeft(),this.documentHolder.cmpEl.offset().top-$(window).scrollTop()],o=this.api.asc_getActiveCellCoord(),a=[o.asc_getX()+s[0]-3,o.asc_getY()+s[1]-i.ref.getBSTip().$tip.height()-5],l=i.ref.getBSTip().$tip.width();a[0]+l>this.tooltips.coauth.bodyWidth&&(a[0]=this.tooltips.coauth.bodyWidth-l),i.ref.getBSTip().$tip.css({top:a[1]+"px",left:a[0]+"px","z-index":900})}else!i.isHidden&&i.ref&&(i.ref.hide(),i.ref=void 0,i.text="",i.isHidden=!0)},onShowSpecialPasteOptions:function(t){var e=this,i=e.documentHolder,n=t.asc_getCellCoord(),s=i.cmpEl.find("#special-paste-container"),o=t.asc_getOptions(),a=!!t.asc_getContainTables();if(o){if(s.length<1&&(e._arrSpecialPaste=[],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.paste]=[e.txtPaste,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyFormula]=[e.txtPasteFormulas,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaNumberFormat]=[e.txtPasteFormulaNumFormat,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaAllFormatting]=[e.txtPasteKeepSourceFormat,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaWithoutBorders]=[e.txtPasteBorders,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaColumnWidth]=[e.txtPasteColWidths,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.mergeConditionalFormating]=[e.txtPasteMerge,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.transpose]=[e.txtPasteTranspose,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyValues]=[e.txtPasteValues,1],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.valueNumberFormat]=[e.txtPasteValNumFormat,1],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.valueAllFormating]=[e.txtPasteValFormat,1],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyFormating]=[e.txtPasteFormat,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.link]=[e.txtPasteLink,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.picture]=[e.txtPastePicture,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.linkedPicture]=[e.txtPasteLinkPicture,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.sourceformatting]=[e.txtPasteSourceFormat,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.destinationFormatting]=[e.txtPasteDestFormat,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.keepTextOnly]=[e.txtKeepTextOnly,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.useTextImport]=[e.txtUseTextImport,3],s=$('
'),i.cmpEl.append(s),e.btnSpecialPaste=new Common.UI.Button({parentEl:$("#id-document-holder-btn-special-paste"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-paste",menu:new Common.UI.Menu({items:[]})})),o.length>0){for(var l=e.btnSpecialPaste.menu,r=0;r0&&(l.addItem(new Common.UI.MenuItem({caption:"--"})),d=!1),_.each(c[r],function(t,e){l.addItem(t),d=!0});if(l.items.length>0&&l.items[0].setChecked(!0,!0),e._state.lastSpecPasteChecked=l.items.length>0?l.items[0]:null,h&&(l.addItem(new Common.UI.MenuItem({caption:"--"})),l.addItem(h)),l.items.length>0&&t.asc_getShowPasteSpecial()){l.addItem(new Common.UI.MenuItem({caption:"--"}));var p=new Common.UI.MenuItem({caption:e.textPasteSpecial,value:"special"}).on("click",function(t,i){new SSE.Views.SpecialPasteDialog({props:o,isTable:a,handler:function(t,i){"ok"==t&&(e._state.lastSpecPasteChecked&&e._state.lastSpecPasteChecked.setChecked(!1,!0),e._state.lastSpecPasteChecked=i&&e._arrSpecialPaste[i.asc_getProps()]?e._arrSpecialPaste[i.asc_getProps()][2]:null,e._state.lastSpecPasteChecked&&e._state.lastSpecPasteChecked.setChecked(!0,!0),e&&e.api&&e.api.asc_SpecialPaste(i))}}).show(),setTimeout(function(){l.hide()},100)});l.addItem(p)}}if(n[0].asc_getX()<0||n[0].asc_getY()<0)return void(s.is(":visible")&&s.hide());var m=n[0],u=n[1],g=e.tooltips.coauth.bodyWidth-e.tooltips.coauth.XY[0]-e.tooltips.coauth.rightMenuWidth-15,b=e.tooltips.coauth.apiHeight-15,f=[],C=[31,20],v=m.asc_getX()+m.asc_getWidth()+3+C[0],y=m.asc_getY()+m.asc_getHeight()+3+C[1];v>g?(f[0]=void 0!==u?u.asc_getX():g-C[0]-3,y>b&&(f[0]-=C[0]+3),f[0]<0&&(f[0]=g-3-C[0])):f[0]=v-C[0],f[1]=y>b?b-3-C[1]:y-C[1],s.css({left:f[0],top:f[1]}),s.show()}},onHideSpecialPasteOptions:function(){var t=this.documentHolder.cmpEl.find("#special-paste-container");t.is(":visible")&&t.hide()},onToggleAutoCorrectOptions:function(t){if(!t){var e=this.documentHolder.cmpEl.find("#autocorrect-paste-container");return void(e.is(":visible")&&e.hide())}var i=this,n=i.documentHolder,s=t.asc_getCellCoord(),e=n.cmpEl.find("#autocorrect-paste-container"),o=t.asc_getOptions();if(e.length<1&&(i._arrAutoCorrectPaste=[],i._arrAutoCorrectPaste[Asc.c_oAscAutoCorrectOptions.UndoTableAutoExpansion]={caption:i.txtUndoExpansion,icon:"menu__icon btn-undo"},i._arrAutoCorrectPaste[Asc.c_oAscAutoCorrectOptions.RedoTableAutoExpansion]={caption:i.txtRedoExpansion,icon:"menu__icon btn-redo"},e=$('
'),n.cmpEl.append(e),i.btnAutoCorrectPaste=new Common.UI.Button({parentEl:$("#id-document-holder-btn-autocorrect-paste"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-autocorrect",menu:new Common.UI.Menu({cls:"shifted-right",items:[]})}),i.btnAutoCorrectPaste.menu.on("show:after",_.bind(i.onAutoCorrectOpenAfter,i))),o.length>0){for(var a=i.btnAutoCorrectPaste.menu,l=0;lc||m>h||s.asc_getX()<0||s.asc_getY()<0?e.is(":visible")&&e.hide():(e.css({left:p-d[0],top:m-d[1]}),e.show())},onCellsRange:function(t){this.rangeSelectionMode=t!=Asc.c_oAscSelectionDialogType.None},onApiEditCell:function(t){this.isEditFormula=t==Asc.c_oAscCellEditorState.editFormula,this.isEditCell=t!=Asc.c_oAscCellEditorState.editEnd},onLockDefNameManager:function(t){this.namedrange_locked=t==Asc.c_oAscDefinedNameReason.LockDefNameManager},onChangeCropState:function(t){this.documentHolder.menuImgCrop.menu.items[0].setChecked(t,!0)},initEquationMenu:function(){if(this._currentMathObj){var t,e=this,i=e._currentMathObj.get_Type(),n=e._currentMathObj,s=[];switch(i){case Asc.c_oAscMathInterfaceType.Accent:t=new Common.UI.MenuItem({caption:e.txtRemoveAccentChar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"remove_AccentCharacter"}}),s.push(t);break;case Asc.c_oAscMathInterfaceType.BorderBox:t=new Common.UI.MenuItem({caption:e.txtBorderProps,equation:!0,disabled:e._currentParaObjDisabled,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[{caption:n.get_HideTop()?e.txtAddTop:e.txtHideTop,equationProps:{type:i,callback:"put_HideTop",value:!n.get_HideTop()}},{caption:n.get_HideBottom()?e.txtAddBottom:e.txtHideBottom,equationProps:{type:i,callback:"put_HideBottom",value:!n.get_HideBottom()}},{caption:n.get_HideLeft()?e.txtAddLeft:e.txtHideLeft,equationProps:{type:i,callback:"put_HideLeft",value:!n.get_HideLeft()}},{caption:n.get_HideRight()?e.txtAddRight:e.txtHideRight,equationProps:{type:i,callback:"put_HideRight",value:!n.get_HideRight()}},{caption:n.get_HideHor()?e.txtAddHor:e.txtHideHor,equationProps:{type:i,callback:"put_HideHor",value:!n.get_HideHor()}},{caption:n.get_HideVer()?e.txtAddVer:e.txtHideVer,equationProps:{type:i,callback:"put_HideVer",value:!n.get_HideVer()}},{caption:n.get_HideTopLTR()?e.txtAddLT:e.txtHideLT,equationProps:{type:i,callback:"put_HideTopLTR",value:!n.get_HideTopLTR()}},{caption:n.get_HideTopRTL()?e.txtAddLB:e.txtHideLB,equationProps:{type:i,callback:"put_HideTopRTL",value:!n.get_HideTopRTL()}}]})}),s.push(t);break;case Asc.c_oAscMathInterfaceType.Bar:t=new Common.UI.MenuItem({caption:e.txtRemoveBar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"remove_Bar"}}),s.push(t),t=new Common.UI.MenuItem({caption:n.get_Pos()==Asc.c_oAscMathInterfaceBarPos.Top?e.txtUnderbar:e.txtOverbar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_Pos",value:n.get_Pos()==Asc.c_oAscMathInterfaceBarPos.Top?Asc.c_oAscMathInterfaceBarPos.Bottom:Asc.c_oAscMathInterfaceBarPos.Top}}),s.push(t);break;case Asc.c_oAscMathInterfaceType.Script:var o=n.get_ScriptType();o==Asc.c_oAscMathInterfaceScript.PreSubSup?(t=new Common.UI.MenuItem({caption:e.txtScriptsAfter,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.SubSup}}),s.push(t),t=new Common.UI.MenuItem({caption:e.txtRemScripts,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.None}}),s.push(t)):(o==Asc.c_oAscMathInterfaceScript.SubSup&&(t=new Common.UI.MenuItem({caption:e.txtScriptsBefore,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.PreSubSup}}),s.push(t)),o!=Asc.c_oAscMathInterfaceScript.SubSup&&o!=Asc.c_oAscMathInterfaceScript.Sub||(t=new Common.UI.MenuItem({caption:e.txtRemSubscript,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_ScriptType",value:o==Asc.c_oAscMathInterfaceScript.SubSup?Asc.c_oAscMathInterfaceScript.Sup:Asc.c_oAscMathInterfaceScript.None}}),s.push(t)),o!=Asc.c_oAscMathInterfaceScript.SubSup&&o!=Asc.c_oAscMathInterfaceScript.Sup||(t=new Common.UI.MenuItem({caption:e.txtRemSuperscript,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_ScriptType",value:o==Asc.c_oAscMathInterfaceScript.SubSup?Asc.c_oAscMathInterfaceScript.Sub:Asc.c_oAscMathInterfaceScript.None}}),s.push(t)));break;case Asc.c_oAscMathInterfaceType.Fraction:var a=n.get_FractionType();a!=Asc.c_oAscMathInterfaceFraction.Skewed&&a!=Asc.c_oAscMathInterfaceFraction.Linear||(t=new Common.UI.MenuItem({caption:e.txtFractionStacked,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Bar}}),s.push(t)),a!=Asc.c_oAscMathInterfaceFraction.Bar&&a!=Asc.c_oAscMathInterfaceFraction.Linear||(t=new Common.UI.MenuItem({caption:e.txtFractionSkewed,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Skewed}}),s.push(t)),a!=Asc.c_oAscMathInterfaceFraction.Bar&&a!=Asc.c_oAscMathInterfaceFraction.Skewed||(t=new Common.UI.MenuItem({caption:e.txtFractionLinear,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Linear}}),s.push(t)),a!=Asc.c_oAscMathInterfaceFraction.Bar&&a!=Asc.c_oAscMathInterfaceFraction.NoBar||(t=new Common.UI.MenuItem({caption:a==Asc.c_oAscMathInterfaceFraction.Bar?e.txtRemFractionBar:e.txtAddFractionBar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_FractionType",value:a==Asc.c_oAscMathInterfaceFraction.Bar?Asc.c_oAscMathInterfaceFraction.NoBar:Asc.c_oAscMathInterfaceFraction.Bar}}),s.push(t));break;case Asc.c_oAscMathInterfaceType.Limit:t=new Common.UI.MenuItem({caption:n.get_Pos()==Asc.c_oAscMathInterfaceLimitPos.Top?e.txtLimitUnder:e.txtLimitOver,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_Pos",value:n.get_Pos()==Asc.c_oAscMathInterfaceLimitPos.Top?Asc.c_oAscMathInterfaceLimitPos.Bottom:Asc.c_oAscMathInterfaceLimitPos.Top}}),s.push(t),t=new Common.UI.MenuItem({caption:e.txtRemLimit,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_Pos",value:Asc.c_oAscMathInterfaceLimitPos.None}}),s.push(t);break;case Asc.c_oAscMathInterfaceType.Matrix:t=new Common.UI.MenuItem({caption:n.get_HidePlaceholder()?e.txtShowPlaceholder:e.txtHidePlaceholder,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HidePlaceholder",value:!n.get_HidePlaceholder()}}),s.push(t),t=new Common.UI.MenuItem({caption:e.insertText,equation:!0,disabled:e._currentParaObjDisabled,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[{caption:e.insertRowAboveText,equationProps:{type:i,callback:"insert_MatrixRow",value:!0}},{caption:e.insertRowBelowText,equationProps:{type:i,callback:"insert_MatrixRow",value:!1}},{caption:e.insertColumnLeftText,equationProps:{type:i,callback:"insert_MatrixColumn",value:!0}},{caption:e.insertColumnRightText,equationProps:{type:i,callback:"insert_MatrixColumn",value:!1}}]})}),s.push(t),t=new Common.UI.MenuItem({caption:e.deleteText,equation:!0,disabled:e._currentParaObjDisabled,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[{ caption:e.deleteRowText,equationProps:{type:i,callback:"delete_MatrixRow"}},{caption:e.deleteColumnText,equationProps:{type:i,callback:"delete_MatrixColumn"}}]})}),s.push(t),t=new Common.UI.MenuItem({caption:e.txtMatrixAlign,equation:!0,disabled:e._currentParaObjDisabled,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[{caption:e.txtTop,checkable:!0,checked:n.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Top,equationProps:{type:i,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Top}},{caption:e.centerText,checkable:!0,checked:n.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Center,equationProps:{type:i,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Center}},{caption:e.txtBottom,checkable:!0,checked:n.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Bottom,equationProps:{type:i,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Bottom}}]})}),s.push(t),t=new Common.UI.MenuItem({caption:e.txtColumnAlign,equation:!0,disabled:e._currentParaObjDisabled,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[{caption:e.leftText,checkable:!0,checked:n.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Left,equationProps:{type:i,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Left}},{caption:e.centerText,checkable:!0,checked:n.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Center,equationProps:{type:i,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Center}},{caption:e.rightText,checkable:!0,checked:n.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Right,equationProps:{type:i,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Right}}]})}),s.push(t);break;case Asc.c_oAscMathInterfaceType.EqArray:t=new Common.UI.MenuItem({caption:e.txtInsertEqBefore,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"insert_Equation",value:!0}}),s.push(t),t=new Common.UI.MenuItem({caption:e.txtInsertEqAfter,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"insert_Equation",value:!1}}),s.push(t),t=new Common.UI.MenuItem({caption:e.txtDeleteEq,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"delete_Equation"}}),s.push(t),t=new Common.UI.MenuItem({caption:e.alignmentText,equation:!0,disabled:e._currentParaObjDisabled,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[{caption:e.txtTop,checkable:!0,checked:n.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Top,equationProps:{type:i,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Top}},{caption:e.centerText,checkable:!0,checked:n.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Center,equationProps:{type:i,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Center}},{caption:e.txtBottom,checkable:!0,checked:n.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Bottom,equationProps:{type:i,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Bottom}}]})}),s.push(t);break;case Asc.c_oAscMathInterfaceType.LargeOperator:t=new Common.UI.MenuItem({caption:e.txtLimitChange,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_LimitLocation",value:n.get_LimitLocation()==Asc.c_oAscMathInterfaceNaryLimitLocation.UndOvr?Asc.c_oAscMathInterfaceNaryLimitLocation.SubSup:Asc.c_oAscMathInterfaceNaryLimitLocation.UndOvr}}),s.push(t),void 0!==n.get_HideUpper()&&(t=new Common.UI.MenuItem({caption:n.get_HideUpper()?e.txtShowTopLimit:e.txtHideTopLimit,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HideUpper",value:!n.get_HideUpper()}}),s.push(t)),void 0!==n.get_HideLower()&&(t=new Common.UI.MenuItem({caption:n.get_HideLower()?e.txtShowBottomLimit:e.txtHideBottomLimit,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HideLower",value:!n.get_HideLower()}}),s.push(t));break;case Asc.c_oAscMathInterfaceType.Delimiter:t=new Common.UI.MenuItem({caption:e.txtInsertArgBefore,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"insert_DelimiterArgument",value:!0}}),s.push(t),t=new Common.UI.MenuItem({caption:e.txtInsertArgAfter,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"insert_DelimiterArgument",value:!1}}),s.push(t),n.can_DeleteArgument()&&(t=new Common.UI.MenuItem({caption:e.txtDeleteArg,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"delete_DelimiterArgument"}}),s.push(t)),t=new Common.UI.MenuItem({caption:n.has_Separators()?e.txtDeleteCharsAndSeparators:e.txtDeleteChars,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"remove_DelimiterCharacters"}}),s.push(t),t=new Common.UI.MenuItem({caption:n.get_HideOpeningBracket()?e.txtShowOpenBracket:e.txtHideOpenBracket,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HideOpeningBracket",value:!n.get_HideOpeningBracket()}}),s.push(t),t=new Common.UI.MenuItem({caption:n.get_HideClosingBracket()?e.txtShowCloseBracket:e.txtHideCloseBracket,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HideClosingBracket",value:!n.get_HideClosingBracket()}}),s.push(t),t=new Common.UI.MenuItem({caption:e.txtStretchBrackets,equation:!0,disabled:e._currentParaObjDisabled,checkable:!0,checked:n.get_StretchBrackets(),equationProps:{type:i,callback:"put_StretchBrackets",value:!n.get_StretchBrackets()}}),s.push(t),t=new Common.UI.MenuItem({caption:e.txtMatchBrackets,equation:!0,disabled:!n.get_StretchBrackets()||e._currentParaObjDisabled,checkable:!0,checked:n.get_StretchBrackets()&&n.get_MatchBrackets(),equationProps:{type:i,callback:"put_MatchBrackets",value:!n.get_MatchBrackets()}}),s.push(t);break;case Asc.c_oAscMathInterfaceType.GroupChar:n.can_ChangePos()&&(t=new Common.UI.MenuItem({caption:n.get_Pos()==Asc.c_oAscMathInterfaceGroupCharPos.Top?e.txtGroupCharUnder:e.txtGroupCharOver,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_Pos",value:n.get_Pos()==Asc.c_oAscMathInterfaceGroupCharPos.Top?Asc.c_oAscMathInterfaceGroupCharPos.Bottom:Asc.c_oAscMathInterfaceGroupCharPos.Top}}),s.push(t),t=new Common.UI.MenuItem({caption:e.txtDeleteGroupChar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_Pos",value:Asc.c_oAscMathInterfaceGroupCharPos.None}}),s.push(t));break;case Asc.c_oAscMathInterfaceType.Radical:void 0!==n.get_HideDegree()&&(t=new Common.UI.MenuItem({caption:n.get_HideDegree()?e.txtShowDegree:e.txtHideDegree,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HideDegree",value:!n.get_HideDegree()}}),s.push(t)),t=new Common.UI.MenuItem({caption:e.txtDeleteRadical,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"remove_Radical"}}),s.push(t)}return n.can_IncreaseArgumentSize()&&(t=new Common.UI.MenuItem({caption:e.txtIncreaseArg,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"increase_ArgumentSize"}}),s.push(t)),n.can_DecreaseArgumentSize()&&(t=new Common.UI.MenuItem({caption:e.txtDecreaseArg,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"decrease_ArgumentSize"}}),s.push(t)),n.can_InsertManualBreak()&&(t=new Common.UI.MenuItem({caption:e.txtInsertBreak,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"insert_ManualBreak"}}),s.push(t)),n.can_DeleteManualBreak()&&(t=new Common.UI.MenuItem({caption:e.txtDeleteBreak,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"delete_ManualBreak"}}),s.push(t)),n.can_AlignToCharacter()&&(t=new Common.UI.MenuItem({caption:e.txtAlignToChar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"align_ToCharacter"}}),s.push(t)),s}},addEquationMenu:function(t){var e=this;e.clearEquationMenu(t);var i=e.documentHolder.textInShapeMenu,n=e.initEquationMenu();return n.length>0&&_.each(n,function(n,s){n.menu?_.each(n.menu.items,function(t){t.on("click",_.bind(e.equationCallback,e,t.options.equationProps))}):n.on("click",_.bind(e.equationCallback,e,n.options.equationProps)),i.insertItem(t,n),t++}),n.length},clearEquationMenu:function(t){for(var e=this,i=e.documentHolder.textInShapeMenu,n=t;n')}),e.paraBulletsPicker.on("item:click",_.bind(this.onSelectBullets,this)),i&&e.paraBulletsPicker.selectRecord(i.rec,!0)},onSignatureClick:function(t){var e=t.cmpEl.attr("data-value");switch(t.value){case 0:Common.NotificationCenter.trigger("protect:sign",e);break;case 1:this.api.asc_ViewCertificate(e);break;case 2:Common.NotificationCenter.trigger("protect:signature","visible",this._isDisabled,e);break;case 3:this.api.asc_RemoveSignature(e)}},onOriginalSizeClick:function(t){if(this.api){var e=this.api.asc_getOriginalImageSize(),i=e.asc_getImageWidth(),n=e.asc_getImageHeight(),s=new Asc.asc_CImgProperty;s.asc_putWidth(i),s.asc_putHeight(n),s.put_ResetCrop(!0),this.api.asc_setGraphicObjectProps(s),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Set Image Original Size")}},onImgReplace:function(t,e){var i=this;this.api&&("file"==e.value?setTimeout(function(){i.api&&i.api.asc_changeImageFromFile(),Common.NotificationCenter.trigger("edit:complete",i.documentHolder)},10):"storage"==e.value?Common.NotificationCenter.trigger("storage:image-load","change"):new Common.Views.ImageFromUrlDialog({handler:function(t,e){if("ok"==t&&i.api){var n=e.replace(/ /g,"");if(!_.isEmpty(n)){var s=new Asc.asc_CImgProperty;s.asc_putImageUrl(n),i.api.asc_setGraphicObjectProps(s)}}Common.NotificationCenter.trigger("edit:complete",i.documentHolder)}}).show())},onNumberFormatSelect:function(t,e){void 0!==e.value&&"advanced"!==e.value&&this.api&&this.api.asc_setCellFormat(e.options.format),Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},onCustomNumberFormat:function(t){var e=this,i=e.api.asc_getLocale();!i&&(i=e.permissions.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(e.permissions.lang)):1033),new SSE.Views.FormatSettingsDialog({api:e.api,handler:function(t,i){i&&e.api.asc_setCellFormat(i.format),Common.NotificationCenter.trigger("edit:complete",e.documentHolder)},props:{format:t.options.numformat,formatInfo:t.options.numformatinfo,langId:i}}).show(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},onNumberFormatOpenAfter:function(t){if(this.api){var e=this,i=e.api.asc_getLocale();if(!i&&(i=e.permissions.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(e.permissions.lang)):1033),this._state.langId!==i){this._state.langId=i;var n=new Asc.asc_CFormatCellsInfo;n.asc_setType(Asc.c_oAscNumFormatType.None),n.asc_setSymbol(this._state.langId);for(var s=this.api.asc_getFormatCells(n),o=0;oOnly text values from the column can be selected for replacement.",txtExpandSort:"The data next to the selection will not be sorted. Do you want to expand the selection to include the adjacent data or continue with sorting the currently selected cells only?",txtExpand:"Expand and sort",txtSorting:"Sorting",txtSortSelected:"Sort selected",txtPaste:"Paste",txtPasteFormulas:"Formulas",txtPasteFormulaNumFormat:"Formulas & number formats",txtPasteKeepSourceFormat:"Formulas & formatting",txtPasteBorders:"All except borders",txtPasteColWidths:"Formulas & column widths",txtPasteMerge:"Merge conditional formatting",txtPasteTranspose:"Transpose",txtPasteValues:"Values",txtPasteValNumFormat:"Values & number formats",txtPasteValFormat:"Values & formatting",txtPasteFormat:"Paste only formatting",txtPasteLink:"Paste Link",txtPastePicture:"Picture",txtPasteLinkPicture:"Linked Picture",txtPasteSourceFormat:"Source formatting",txtPasteDestFormat:"Destination formatting",txtKeepTextOnly:"Keep text only",txtUseTextImport:"Use text import wizard",txtUndoExpansion:"Undo table autoexpansion",txtRedoExpansion:"Redo table autoexpansion",txtAnd:"and",txtOr:"or",txtEquals:"Equals",txtNotEquals:"Does not equal",txtGreater:"Greater than",txtGreaterEquals:"Greater than or equal to",txtLess:"Less than",txtLessEquals:"Less than or equal to",txtAboveAve:"Above average",txtBelowAve:"Below average",txtBegins:"Begins with",txtNotBegins:"Does not begin with",txtEnds:"Ends with",txtNotEnds:"Does not end with",txtContains:"Contains",txtNotContains:"Does not contain",txtFilterTop:"Top",txtFilterBottom:"Bottom",txtItems:"items",txtPercent:"percent",txtEqualsToCellColor:"Equals to cell color",txtEqualsToFontColor:"Equals to font color",txtAll:"(All)",txtBlanks:"(Blanks)",txtColumn:"Column",txtImportWizard:"Text Import Wizard",textPasteSpecial:"Paste special",textStopExpand:"Stop automatically expanding tables",textAutoCorrectSettings:"AutoCorrect options"},SSE.Controllers.DocumentHolder||{}))}),define("text!spreadsheeteditor/main/app/template/CellEditor.template",[],function(){return'
\r\n \r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n'}),define("spreadsheeteditor/main/app/view/CellEditor",["text!spreadsheeteditor/main/app/template/CellEditor.template","common/main/lib/component/BaseView"],function(t){"use strict";SSE.Views.CellEditor=Common.UI.BaseView.extend(_.extend({template:_.template(t),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t)},render:function(){$(this.el).html(this.template()),this.btnNamedRanges=new Common.UI.Button({parentEl:$("#ce-cell-name-menu"),menu:new Common.UI.Menu({style:"min-width: 70px;max-width:400px;",maxHeight:250,items:[{caption:this.textManager,value:"manager"},{caption:"--"}]})}),this.btnNamedRanges.setVisible(!1),this.btnNamedRanges.menu.setOffset(-81),this.$cellname=$("#ce-cell-name",this.el),this.$btnexpand=$("#ce-btn-expand",this.el),this.$btnfunc=$("#ce-func-label",this.el);var t=this;return this.$cellname.on("focus",function(e){var i=t.$cellname[0];i.selectionStart=0,i.selectionEnd=i.value.length,i.scrollLeft=i.scrollWidth}),this.$btnfunc.addClass("disabled"),this.$btnfunc.tooltip({title:this.tipFormula,placement:"cursor"}),this},updateCellInfo:function(t){t&&this.$cellname.val("string"==typeof t?t:t.asc_getName())},cellNameDisabled:function(t){t?this.$cellname.attr("disabled","disabled"):this.$cellname.removeAttr("disabled"),this.btnNamedRanges.setDisabled(t)},tipFormula:"Insert Function",textManager:"Manager"},SSE.Views.CellEditor||{}))}),define("text!spreadsheeteditor/main/app/template/NameManagerDlg.template",[],function(){return'
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n \r\n \r\n \r\n \r\n
\r\n
\r\n
'}),define("spreadsheeteditor/main/app/view/NameManagerDlg",["text!spreadsheeteditor/main/app/template/NameManagerDlg.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/ComboBox","common/main/lib/component/ListView","common/main/lib/component/InputField"],function(t){"use strict";SSE.Views=SSE.Views||{},SSE.Views.NameManagerDlg=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{alias:"NameManagerDlg",contentWidth:525,height:353,buttons:null},initialize:function(e){_.extend(this.options,{title:this.txtTitle,template:['
','
'+_.template(t)({scope:this})+"
","
",'
','"].join("")},e),this.api=e.api,this.handler=e.handler,this.sheets=e.sheets||[],this.sheetNames=e.sheetNames||[],this.ranges=e.ranges||[],this.props=e.props,this.sort=e.sort||{type:"name",direction:1},this.locked=e.locked||!1,this.userTooltip=!0,this.currentNamedRange=void 0,this.rangesStore=new Common.UI.DataViewStore,this.wrapEvents={onRefreshDefNameList:_.bind(this.onRefreshDefNameList,this),onLockDefNameManager:_.bind(this.onLockDefNameManager,this)},Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this;this.cmbFilter=new Common.UI.ComboBox({el:$("#name-manager-combo-filter"),menuStyle:"min-width: 100%;",editable:!1,cls:"input-group-nr",data:[{value:0,displayValue:this.textFilterAll},{value:1,displayValue:this.textFilterDefNames},{value:2,displayValue:this.textFilterTableNames},{value:3,displayValue:this.textFilterSheet},{value:4,displayValue:this.textFilterWorkbook}],takeFocusOnClose:!0}).on("selected",function(e,i){t.refreshRangeList(null,0)}),this.cmbFilter.setValue(0),this.rangeList=new Common.UI.ListView({el:$("#name-manager-range-list",this.$window),store:new Common.UI.DataViewStore,simpleAddMode:!0,emptyText:this.textEmpty,template:_.template(['
'].join("")),itemTemplate:_.template(['
','
">
','
<%= name %>
','
<%= scopeName %>
','
<%= range %>
',"<% if (lock) { %>",'
<%=lockuser%>
',"<% } %>","
"].join("")),tabindex:1}),this.rangeList.store.comparator=function(e,i){var n=e.get(t.sort.type).toLowerCase(),s=i.get(t.sort.type).toLowerCase();return n==s?0:n0?this.textnoNames:this.textEmpty)}var l=this,r=this.rangeList.store,c=this.rangesStore.models,h=this.cmbFilter.getValue(),d=h<3?2==h:-1,p=h>2?4==h:-1;if(h>0&&(c=this.rangesStore.filter(function(t){return-1!==d?d===t.get("isTable"):-1!==p&&p===(null===t.get("scope"))})),r.reset(c,{silent:!1}),h=r.length,this.btnEditRange.setDisabled(!h),this.btnDeleteRange.setDisabled(!h),h>0){if(void 0!==e&&null!==e||(e=0),_.isNumber(e))e>h-1&&(e=h-1),this.rangeList.selectByIndex(e),setTimeout(function(){l.rangeList.scrollToRecord(r.at(e))},50);else if(e){var m=r.findWhere({name:e.asc_getName(!0),scope:e.asc_getScope()});m&&(this.rangeList.selectRecord(m),setTimeout(function(){l.rangeList.scrollToRecord(m)},50))}!0===this.userTooltip&&this.rangeList.cmpEl.find(".lock-user").length>0&&this.rangeList.cmpEl.on("mouseover",_.bind(l.onMouseOverLock,l)).on("mouseout",_.bind(l.onMouseOutLock,l))}_.delay(function(){l.rangeList.scroller.update({alwaysVisibleY:!0})},100,this)},onMouseOverLock:function(t,e,i){if(!0===this.userTooltip&&$(t.target).hasClass("lock-user")){var n=this,s=$(t.target).tooltip({title:this.tipIsLocked,trigger:"manual"}).data("bs.tooltip");this.userTooltip=s.tip(),this.userTooltip.css("z-index",parseInt(this.$window.css("z-index"))+10),s.show(),setTimeout(function(){n.userTipHide()},5e3)}},userTipHide:function(){"object"==typeof this.userTooltip&&(this.userTooltip.remove(),this.userTooltip=void 0,this.rangeList.cmpEl.off("mouseover").off("mouseout"))},onMouseOutLock:function(t,e,i){"object"==typeof this.userTooltip&&this.userTipHide()},onEditRange:function(t){if(this.locked)return void Common.NotificationCenter.trigger("namedrange:locked");var e=this,i=e.$window.offset(),n=this.rangeList.getSelectedRec(),s=(_.indexOf(this.rangeList.store.models,n),t&&n?new Asc.asc_CDefName(n.get("name"),n.get("range"),n.get("scope"),n.get("type"),void 0,void 0,void 0,!0):null),o=new SSE.Views.NamedRangeEditDlg({api:e.api,sheets:this.sheets,props:t?s:this.props,isEdit:t,handler:function(i,n){"ok"==i&&n&&(t?(e.currentNamedRange=n,e.api.asc_editDefinedNames(s,n)):(e.cmbFilter.setValue(0),e.currentNamedRange=n,e.api.asc_setDefinedNames(n)))}}).on("close",function(){e.show()});e.hide(),o.show(i.left+65,i.top+77)},onDeleteRange:function(){var t=this.rangeList.getSelectedRec();t&&(this.currentNamedRange=_.indexOf(this.rangeList.store.models,t),this.api.asc_delDefinedNames(new Asc.asc_CDefName(t.get("name"),t.get("range"),t.get("scope"),t.get("type"),void 0,void 0,void 0,!0)))},getSettings:function(){return this.sort},onPrimary:function(){return!0},onDlgBtnClick:function(t){this.handler&&this.handler.call(this,t.currentTarget.attributes.result.value),this.close()},onSortNames:function(t){t!==this.sort.type?(this.sort={type:t,direction:1},this.spanSortName.toggleClass("hidden"),this.spanSortScope.toggleClass("hidden")):this.sort.direction=-this.sort.direction;var e="name"==t?this.spanSortName:this.spanSortScope;this.sort.direction>0?e.removeClass("sort-desc"):e.addClass("sort-desc"),this.rangeList.store.sort(),this.rangeList.onResetItems(),this.rangeList.scroller.update({alwaysVisibleY:!0})},getUserName:function(t){var e=SSE.getCollection("Common.Collections.Users");if(e){var i=e.findUser(t);if(i)return Common.Utils.UserInfoParser.getParsedName(i.get("username"))}return this.guestText}, onSelectRangeItem:function(t,e,i){if(i){this.userTipHide();var n={};if(_.isFunction(i.toJSON)){if(!i.get("selected"))return;n=i.toJSON(),this.currentNamedRange=_.indexOf(this.rangeList.store.models,i),this.btnEditRange.setDisabled(n.lock),this.btnDeleteRange.setDisabled(n.lock||n.isTable||n.isSlicer)}}},hide:function(){this.userTipHide(),Common.UI.Window.prototype.hide.call(this)},close:function(){this.userTipHide(),this.api.asc_unregisterCallback("asc_onLockDefNameManager",this.wrapEvents.onLockDefNameManager),this.api.asc_unregisterCallback("asc_onRefreshDefNameList",this.wrapEvents.onRefreshDefNameList),Common.UI.Window.prototype.close.call(this)},onKeyDown:function(t,e,i){i.keyCode!=Common.UI.Keys.DELETE||this.btnDeleteRange.isDisabled()||this.onDeleteRange()},onDblClickItem:function(t,e,i){this.btnEditRange.isDisabled()||this.onEditRange(!0)},onLockDefNameManager:function(t){this.locked=t==Asc.c_oAscDefinedNameReason.LockDefNameManager},txtTitle:"Name Manager",closeButtonText:"Close",textDataRange:"Data Range",textNew:"New",textEdit:"Edit",textDelete:"Delete",textRanges:"Named Ranges",textScope:"Scope",textFilter:"Filter",textEmpty:"No named ranges have been created yet.
Create at least one named range and it will appear in this field.",textnoNames:"No named ranges matching your filter could be found.",textFilterAll:"All",textFilterDefNames:"Defined names",textFilterTableNames:"Table names",textFilterSheet:"Names Scoped to Sheet",textFilterWorkbook:"Names Scoped to Workbook",textWorkbook:"Workbook",guestText:"Guest",tipIsLocked:"This element is being edited by another user."},SSE.Views.NameManagerDlg||{}))}),define("spreadsheeteditor/main/app/controller/CellEditor",["core","spreadsheeteditor/main/app/view/CellEditor","spreadsheeteditor/main/app/view/NameManagerDlg"],function(t){"use strict";SSE.Controllers.CellEditor=Backbone.Controller.extend({views:["CellEditor"],events:function(){return{"keyup input#ce-cell-name":_.bind(this.onCellName,this),"keyup textarea#ce-cell-content":_.bind(this.onKeyupCellEditor,this),"blur textarea#ce-cell-content":_.bind(this.onBlurCellEditor,this),"click button#ce-btn-expand":_.bind(this.expandEditorField,this),"click button#ce-func-label":_.bind(this.onInsertFunction,this)}},initialize:function(){this.addListeners({CellEditor:{},Viewport:{"layout:resizedrag":_.bind(this.onLayoutResize,this)},"Common.Views.Header":{"formulabar:hide":function(t){this.editor.setVisible(!t),Common.localStorage.setBool("sse-hidden-formula",t),Common.NotificationCenter.trigger("layout:changed","celleditor",t?"hidden":"showed")}.bind(this)}})},setApi:function(t){return this.api=t,this.api.isCEditorFocused=!1,this.api.asc_registerCallback("asc_onSelectionNameChanged",_.bind(this.onApiCellSelection,this)),this.api.asc_registerCallback("asc_onEditCell",_.bind(this.onApiEditCell,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onApiDisconnect,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onApiDisconnect,this)),Common.NotificationCenter.on("cells:range",_.bind(this.onCellsRange,this)),this.api.asc_registerCallback("asc_onLockDefNameManager",_.bind(this.onLockDefNameManager,this)),this.api.asc_registerCallback("asc_onInputKeyDown",_.bind(this.onInputKeyDown,this)),this},setMode:function(t){this.mode=t,this.editor.$btnfunc[this.mode.isEdit?"removeClass":"addClass"]("disabled"),this.editor.btnNamedRanges.setVisible(this.mode.isEdit&&!this.mode.isEditDiagram&&!this.mode.isEditMailMerge),this.mode.isEdit&&this.api.asc_registerCallback("asc_onSelectionChanged",_.bind(this.onApiSelectionChanged,this))},onInputKeyDown:function(t){if(Common.UI.Keys.UP===t.keyCode||Common.UI.Keys.DOWN===t.keyCode||Common.UI.Keys.TAB===t.keyCode||Common.UI.Keys.RETURN===t.keyCode||Common.UI.Keys.ESC===t.keyCode||Common.UI.Keys.LEFT===t.keyCode||Common.UI.Keys.RIGHT===t.keyCode){var e=$("#menu-formula-selection");e.hasClass("open")&&e.find(".dropdown-menu").trigger("keydown",t)}},onLaunch:function(){this.editor=this.getView("CellEditor"),this.bindViewEvents(this.editor,this.events),this.editor.$el.parent().find(".after").css({zIndex:"4"});var t=Common.localStorage.getItem("sse-celleditor-height");this.editor.keep_height=null!==t&&parseInt(t)>0?parseInt(t):74,Common.localStorage.getBool("sse-celleditor-expand")&&(this.editor.$el.height(this.editor.keep_height),this.onLayoutResize(void 0,"cell:edit")),this.editor.btnNamedRanges.menu.on("item:click",_.bind(this.onNamedRangesMenu,this)).on("show:before",_.bind(this.onNameBeforeShow,this)),this.namedrange_locked=!1},onApiEditCell:function(t){this.viewmode||(t==Asc.c_oAscCellEditorState.editStart?(this.api.isCellEdited=!0,this.editor.cellNameDisabled(!0)):t==Asc.c_oAscCellEditorState.editInCell?this.api.isCEditorFocused="clear":t==Asc.c_oAscCellEditorState.editEnd&&(this.api.isCellEdited=!1,this.api.isCEditorFocused=!1,this.editor.cellNameDisabled(!1)),this.editor.$btnfunc.toggleClass("disabled",t==Asc.c_oAscCellEditorState.editText))},onApiCellSelection:function(t){this.editor.updateCellInfo(t)},onApiSelectionChanged:function(t){if(!this.viewmode){var e=t.asc_getSelectionType(),i=!this.mode.isEditMailMerge&&!this.mode.isEditDiagram&&(!0===t.asc_getLocked()||!0===t.asc_getLockedTable()||!0===t.asc_getLockedPivotTable()),n=e==Asc.c_oAscSelectionType.RangeChartText,s=e==Asc.c_oAscSelectionType.RangeChart,o=e==Asc.c_oAscSelectionType.RangeShapeText,a=e==Asc.c_oAscSelectionType.RangeShape,l=e==Asc.c_oAscSelectionType.RangeImage||e==Asc.c_oAscSelectionType.RangeSlicer,r=o||a||n||s;this.editor.$btnfunc.toggleClass("disabled",l||r||i)}},onApiDisconnect:function(){this.mode.isEdit=!1;var t=this.getApplication().getController("FormulaDialog");t&&t.hideDialog(),this.mode.isEdit||($("#ce-func-label",this.editor.el).addClass("disabled"),this.editor.btnNamedRanges.setVisible(!1))},onCellsRange:function(t){this.editor.cellNameDisabled(t!=Asc.c_oAscSelectionDialogType.None),this.editor.$btnfunc.toggleClass("disabled",t!=Asc.c_oAscSelectionDialogType.None)},onLayoutResize:function(t,e){"cell:edit"==e&&(this.editor.$el.height()>19?(this.editor.$btnexpand.hasClass("btn-collapse")||this.editor.$btnexpand.addClass("btn-collapse"),t&&Common.localStorage.setItem("sse-celleditor-height",this.editor.$el.height()),t&&Common.localStorage.setBool("sse-celleditor-expand",!0)):(this.editor.$btnexpand.removeClass("btn-collapse"),t&&Common.localStorage.setBool("sse-celleditor-expand",!1)))},onCellName:function(t){if(t.keyCode==Common.UI.Keys.RETURN){var e=this.editor.$cellname.val();e&&e.length&&this.api.asc_findCell(e),Common.NotificationCenter.trigger("edit:complete",this.editor)}},onBlurCellEditor:function(){"clear"==this.api.isCEditorFocused?this.api.isCEditorFocused=void 0:this.api.isCellEdited&&(this.api.isCEditorFocused=!0)},onKeyupCellEditor:function(t){t.keyCode!=Common.UI.Keys.RETURN||t.altKey||(this.api.isCEditorFocused="clear")},expandEditorField:function(){this.editor.$el.height()>19?(this.editor.keep_height=this.editor.$el.height(),this.editor.$el.height(19),this.editor.$btnexpand.removeClass("btn-collapse"),Common.localStorage.setBool("sse-celleditor-expand",!1)):(this.editor.$el.height(this.editor.keep_height),this.editor.$btnexpand.addClass("btn-collapse"),Common.localStorage.setBool("sse-celleditor-expand",!0)),Common.NotificationCenter.trigger("layout:changed","celleditor"),Common.NotificationCenter.trigger("edit:complete",this.editor,{restorefocus:!0})},onInsertFunction:function(){if(!this.viewmode&&this.mode.isEdit&&!this.editor.$btnfunc.hasClass("disabled")){var t=this.getApplication().getController("FormulaDialog");t&&($("#ce-func-label",this.editor.el).blur(),t.showDialog())}},onNamedRangesMenu:function(t,e){var i=this;if("manager"==e.options.value){for(var n=this.api.asc_getWorksheetsCount(),s=-1,o=[],a=[];++s2)},onLockDefNameManager:function(t){this.namedrange_locked=t==Asc.c_oAscDefinedNameReason.LockDefNameManager},disableEditing:function(t){this.editor.$btnfunc[t?"addClass":"removeClass"]("disabled"),this.editor.btnNamedRanges.setVisible(!t)},setPreviewMode:function(t){this.viewmode!==t&&(this.viewmode=t,this.editor.$btnfunc[t?"addClass":"removeClass"]("disabled"),this.editor.cellNameDisabled(t))}})}),define("common/main/lib/view/ImageFromUrlDialog",["common/main/lib/component/Window"],function(){"use strict";Common.Views.ImageFromUrlDialog=Common.UI.Window.extend(_.extend({options:{width:330,header:!1,cls:"modal-dlg",buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,t||{}),this.template=['
','
',"","
",'
',"
"].join(""),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this;t.inputUrl=new Common.UI.InputField({el:$("#id-dlg-url"),allowBlank:!1,blankError:t.txtEmpty,style:"width: 100%;",validateOnBlur:!1,validation:function(e){return!!/((^https?)|(^ftp)):\/\/.+/i.test(e)||t.txtNotUrl}}),this.getChild().find(".btn").on("click",_.bind(this.onBtnClick,this))},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;_.delay(function(){t.getChild("input").focus()},100)},onPrimary:function(t){return this._handleInput("ok"),!1},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},_handleInput:function(t){if(this.options.handler){if("ok"==t&&!0!==this.inputUrl.checkValidate())return void this.inputUrl.cmpEl.find("input").focus();this.options.handler.call(this,t,this.inputUrl.getValue())}this.close()},textUrl:"Paste an image URL:",txtEmpty:"This field is required",txtNotUrl:'This field should be a URL in the format "http://www.example.com"'},Common.Views.ImageFromUrlDialog||{}))}),void 0===Common)var Common={};if(define("common/main/lib/component/LoadMask",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.LoadMask=Common.UI.BaseView.extend(function(){return{options:{cls:"",style:"",title:"Loading...",owner:document.body},template:_.template(['"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.template=this.options.template||this.template,this.title=this.options.title,this.ownerEl=this.options.owner instanceof Common.UI.BaseView?$(this.options.owner.el):$(this.options.owner),this.loaderEl=$(this.template({id:this.id,cls:this.options.cls,style:this.options.style,title:this.title})),this.maskeEl=$('
'),this.timerId=0},render:function(){return this},show:function(){var t=this.ownerEl,e=this.loaderEl,i=this.maskeEl;if(t.ismasked)return this;t.ismasked=!0;var n=this;return n.title!=n.options.title&&(n.options.title=n.title,$(".asc-loadmask-title",e).html(n.title)),n.timerId=setTimeout(function(){t.append(i),t.append(e),t&&0==t.closest(".asc-window.modal").length&&Common.util.Shortcuts.suspendEvents()},500),this},hide:function(){var t=this.ownerEl;this.timerId&&(clearTimeout(this.timerId),this.timerId=0),t&&t.ismasked&&(0!=t.closest(".asc-window.modal").length||Common.Utils.ModalWindow.isVisible()||Common.util.Shortcuts.resumeEvents(),this.maskeEl&&this.maskeEl.remove(),this.loaderEl&&this.loaderEl.remove()),delete t.ismasked},setTitle:function(t){this.title=t,this.ownerEl&&this.ownerEl.ismasked&&this.loaderEl&&$(".asc-loadmask-title",this.loaderEl).html(t)},isVisible:function(){return!!this.ownerEl.ismasked},updatePosition:function(){var t=this.ownerEl,e=this.loaderEl;t&&t.ismasked&&e&&(e.css({top:Math.round(t.height()/2-(e.height()+parseInt(e.css("padding-top"))+parseInt(e.css("padding-bottom")))/2)+"px",left:Math.round(t.width()/2-(e.width()+parseInt(e.css("padding-left"))+parseInt(e.css("padding-right")))/2)+"px"}),e.css({visibility:"visible"}))}}}())}),define("common/main/lib/view/SelectFileDlg",["common/main/lib/component/Window","common/main/lib/component/LoadMask"],function(){"use strict";Common.Views.SelectFileDlg=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{title:this.textTitle,width:1024,height:621,header:!0},t),this.template=['
'].join(""),e.tpl=_.template(this.template)(e),this.fileChoiceUrl=t.fileChoiceUrl||"",Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find("> .body").css({height:"auto",overflow:"hidden"});var t=document.createElement("iframe");t.width="100%",t.height=585,t.align="top",t.frameBorder=0,t.scrolling="no",t.onload=_.bind(this._onLoad,this),$("#id-select-file-placeholder").append(t),this.loadMask=new Common.UI.LoadMask({owner:$("#id-select-file-placeholder")}),this.loadMask.setTitle(this.textLoading),this.loadMask.show(),t.src=this.fileChoiceUrl;var e=this;this._eventfunc=function(t){e._onWindowMessage(t)},this._bindWindowEvents.call(this),this.on("close",function(t){e._unbindWindowEvents()})},_bindWindowEvents:function(){window.addEventListener?window.addEventListener("message",this._eventfunc,!1):window.attachEvent&&window.attachEvent("onmessage",this._eventfunc)},_unbindWindowEvents:function(){window.removeEventListener?window.removeEventListener("message",this._eventfunc):window.detachEvent&&window.detachEvent("onmessage",this._eventfunc)},_onWindowMessage:function(t){if(t&&window.JSON)try{this._onMessage.call(this,window.JSON.parse(t.data))}catch(t){}},_onMessage:function(t){if(t&&"onlyoffice"==t.Referer&&void 0!==t.file){Common.NotificationCenter.trigger("window:close",this);var e=this;setTimeout(function(){_.isEmpty(t.file)||e.trigger("selectfile",e,t.file)},50)}},_onLoad:function(){this.loadMask&&this.loadMask.hide()},textTitle:"Select Data Source",textLoading:"Loading"},Common.Views.SelectFileDlg||{}))}),define("common/main/lib/view/OptionsDialog",["common/main/lib/component/Window","common/main/lib/component/RadioBox"],function(){"use strict";Common.Views.OptionsDialog=Common.UI.Window.extend(_.extend({options:{width:214,header:!0,style:"min-width: 214px;",cls:"modal-dlg",items:[],buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,t||{}),this.template=['
','<% if (typeof label !== "undefined" && label !=="") { %>','',"<% } %>","<% _.each(items, function(item, index) { %>","<% if (!item.id) item.id = Common.UI.getId(); %>",'
',"<% }) %>","
"].join(""),this.options.tpl=_.template(this.template)(this.options),this.radio=[],Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this,e=t.getChild(),i=this.options.items,n=!0,s=-1;if(i){for(var o=0;o=0&&this.radio[s].setValue(!0)}e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this))},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,this,t),this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},getSettings:function(){return this.currentCell},onPrimary:function(){return this._handleInput("ok"),!1}},Common.Views.OptionsDialog||{}))}),void 0===Common)var Common={};if(void 0===Common.define&&(Common.define={}),define("common/main/lib/util/define",[],function(){"use strict";Common.define.c_oAscMathMainType={Symbol:0,Fraction:1,Script:2,Radical:3,Integral:4,LargeOperator:5,Bracket:6,Function:7,Accent:8,LimitLog:9,Operator:10,Matrix:11},Common.define.c_oAscMathType={Symbol_pm:0,Symbol_infinity:1,Symbol_equals:2,Symbol_neq:3,Symbol_about:4,Symbol_times:5,Symbol_div:6,Symbol_factorial:7,Symbol_propto:8,Symbol_less:9,Symbol_ll:10,Symbol_greater:11,Symbol_gg:12,Symbol_leq:13,Symbol_geq:14,Symbol_mp:15,Symbol_cong:16,Symbol_approx:17,Symbol_equiv:18,Symbol_forall:19,Symbol_additional:20,Symbol_partial:21,Symbol_sqrt:22,Symbol_cbrt:23,Symbol_qdrt:24,Symbol_cup:25,Symbol_cap:26,Symbol_emptyset:27,Symbol_percent:28,Symbol_degree:29,Symbol_fahrenheit:30,Symbol_celsius:31,Symbol_inc:32,Symbol_nabla:33,Symbol_exists:34,Symbol_notexists:35,Symbol_in:36,Symbol_ni:37,Symbol_leftarrow:38,Symbol_uparrow:39,Symbol_rightarrow:40,Symbol_downarrow:41,Symbol_leftrightarrow:42,Symbol_therefore:43,Symbol_plus:44,Symbol_minus:45,Symbol_not:46,Symbol_ast:47,Symbol_bullet:48,Symbol_vdots:49,Symbol_cdots:50,Symbol_rddots:51,Symbol_ddots:52,Symbol_aleph:53,Symbol_beth:54,Symbol_QED:55,Symbol_alpha:65536,Symbol_beta:65537,Symbol_gamma:65538,Symbol_delta:65539,Symbol_varepsilon:65540,Symbol_epsilon:65541,Symbol_zeta:65542,Symbol_eta:65543,Symbol_theta:65544,Symbol_vartheta:65545,Symbol_iota:65546,Symbol_kappa:65547,Symbol_lambda:65548,Symbol_mu:65549,Symbol_nu:65550,Symbol_xsi:65551,Symbol_o:65552,Symbol_pi:65553,Symbol_varpi:65554,Symbol_rho:65555,Symbol_varrho:65556,Symbol_sigma:65557,Symbol_varsigma:65558,Symbol_tau:65559,Symbol_upsilon:65560,Symbol_varphi:65561,Symbol_phi:65562,Symbol_chi:65563,Symbol_psi:65564,Symbol_omega:65565,Symbol_Alpha:131072,Symbol_Beta:131073,Symbol_Gamma:131074,Symbol_Delta:131075,Symbol_Epsilon:131076,Symbol_Zeta:131077,Symbol_Eta:131078,Symbol_Theta:131079,Symbol_Iota:131080,Symbol_Kappa:131081,Symbol_Lambda:131082,Symbol_Mu:131083,Symbol_Nu:131084,Symbol_Xsi:131085,Symbol_O:131086,Symbol_Pi:131087,Symbol_Rho:131088,Symbol_Sigma:131089,Symbol_Tau:131090,Symbol_Upsilon:131091,Symbol_Phi:131092,Symbol_Chi:131093,Symbol_Psi:131094,Symbol_Omega:131095,FractionVertical:16777216,FractionDiagonal:16777217,FractionHorizontal:16777218,FractionSmall:16777219,FractionDifferential_1:16842752,FractionDifferential_2:16842753,FractionDifferential_3:16842754,FractionDifferential_4:16842755,FractionPi_2:16842756,ScriptSup:33554432,ScriptSub:33554433,ScriptSubSup:33554434,ScriptSubSupLeft:33554435,ScriptCustom_1:33619968,ScriptCustom_2:33619969,ScriptCustom_3:33619970,ScriptCustom_4:33619971,RadicalSqrt:50331648,RadicalRoot_n:50331649,RadicalRoot_2:50331650,RadicalRoot_3:50331651,RadicalCustom_1:50397184,RadicalCustom_2:50397185,Integral:67108864,IntegralSubSup:67108865,IntegralCenterSubSup:67108866,IntegralDouble:67108867,IntegralDoubleSubSup:67108868,IntegralDoubleCenterSubSup:67108869,IntegralTriple:67108870,IntegralTripleSubSup:67108871,IntegralTripleCenterSubSup:67108872,IntegralOriented:67174400,IntegralOrientedSubSup:67174401,IntegralOrientedCenterSubSup:67174402,IntegralOrientedDouble:67174403,IntegralOrientedDoubleSubSup:67174404,IntegralOrientedDoubleCenterSubSup:67174405,IntegralOrientedTriple:67174406,IntegralOrientedTripleSubSup:67174407,IntegralOrientedTripleCenterSubSup:67174408,Integral_dx:67239936,Integral_dy:67239937,Integral_dtheta:67239938,LargeOperator_Sum:83886080,LargeOperator_Sum_CenterSubSup:83886081,LargeOperator_Sum_SubSup:83886082,LargeOperator_Sum_CenterSub:83886083,LargeOperator_Sum_Sub:83886084,LargeOperator_Prod:83951616,LargeOperator_Prod_CenterSubSup:83951617,LargeOperator_Prod_SubSup:83951618,LargeOperator_Prod_CenterSub:83951619,LargeOperator_Prod_Sub:83951620,LargeOperator_CoProd:83951621,LargeOperator_CoProd_CenterSubSup:83951622,LargeOperator_CoProd_SubSup:83951623,LargeOperator_CoProd_CenterSub:83951624,LargeOperator_CoProd_Sub:83951625,LargeOperator_Union:84017152,LargeOperator_Union_CenterSubSup:84017153,LargeOperator_Union_SubSup:84017154,LargeOperator_Union_CenterSub:84017155,LargeOperator_Union_Sub:84017156,LargeOperator_Intersection:84017157,LargeOperator_Intersection_CenterSubSup:84017158,LargeOperator_Intersection_SubSup:84017159,LargeOperator_Intersection_CenterSub:84017160,LargeOperator_Intersection_Sub:84017161,LargeOperator_Disjunction:84082688,LargeOperator_Disjunction_CenterSubSup:84082689,LargeOperator_Disjunction_SubSup:84082690,LargeOperator_Disjunction_CenterSub:84082691,LargeOperator_Disjunction_Sub:84082692,LargeOperator_Conjunction:84082693,LargeOperator_Conjunction_CenterSubSup:84082694,LargeOperator_Conjunction_SubSup:84082695,LargeOperator_Conjunction_CenterSub:84082696,LargeOperator_Conjunction_Sub:84082697,LargeOperator_Custom_1:84148224,LargeOperator_Custom_2:84148225,LargeOperator_Custom_3:84148226,LargeOperator_Custom_4:84148227,LargeOperator_Custom_5:84148228,Bracket_Round:100663296,Bracket_Square:100663297,Bracket_Curve:100663298,Bracket_Angle:100663299,Bracket_LowLim:100663300,Bracket_UppLim:100663301,Bracket_Line:100663302,Bracket_LineDouble:100663303,Bracket_Square_OpenOpen:100663304,Bracket_Square_CloseClose:100663305,Bracket_Square_CloseOpen:100663306,Bracket_SquareDouble:100663307,Bracket_Round_Delimiter_2:100728832,Bracket_Curve_Delimiter_2:100728833,Bracket_Angle_Delimiter_2:100728834,Bracket_Angle_Delimiter_3:100728835,Bracket_Round_OpenNone:100794368,Bracket_Round_NoneOpen:100794369,Bracket_Square_OpenNone:100794370,Bracket_Square_NoneOpen:100794371,Bracket_Curve_OpenNone:100794372,Bracket_Curve_NoneOpen:100794373,Bracket_Angle_OpenNone:100794374,Bracket_Angle_NoneOpen:100794375,Bracket_LowLim_OpenNone:100794376,Bracket_LowLim_NoneNone:100794377,Bracket_UppLim_OpenNone:100794378,Bracket_UppLim_NoneOpen:100794379,Bracket_Line_OpenNone:100794380,Bracket_Line_NoneOpen:100794381,Bracket_LineDouble_OpenNone:100794382,Bracket_LineDouble_NoneOpen:100794383,Bracket_SquareDouble_OpenNone:100794384,Bracket_SquareDouble_NoneOpen:100794385,Bracket_Custom_1:100859904,Bracket_Custom_2:100859905,Bracket_Custom_3:100859906,Bracket_Custom_4:100859907,Bracket_Custom_5:100925440,Bracket_Custom_6:100925441,Bracket_Custom_7:100925442,Function_Sin:117440512,Function_Cos:117440513,Function_Tan:117440514,Function_Csc:117440515,Function_Sec:117440516,Function_Cot:117440517,Function_1_Sin:117506048,Function_1_Cos:117506049,Function_1_Tan:117506050,Function_1_Csc:117506051,Function_1_Sec:117506052,Function_1_Cot:117506053,Function_Sinh:117571584,Function_Cosh:117571585,Function_Tanh:117571586,Function_Csch:117571587,Function_Sech:117571588,Function_Coth:117571589,Function_1_Sinh:117637120,Function_1_Cosh:117637121,Function_1_Tanh:117637122,Function_1_Csch:117637123,Function_1_Sech:117637124,Function_1_Coth:117637125,Function_Custom_1:117702656,Function_Custom_2:117702657,Function_Custom_3:117702658,Accent_Dot:134217728,Accent_DDot:134217729,Accent_DDDot:134217730,Accent_Hat:134217731,Accent_Check:134217732,Accent_Accent:134217733,Accent_Grave:134217734,Accent_Smile:134217735,Accent_Tilde:134217736,Accent_Bar:134217737,Accent_DoubleBar:134217738,Accent_CurveBracketTop:134217739,Accent_CurveBracketBot:134217740,Accent_GroupTop:134217741,Accent_GroupBot:134217742,Accent_ArrowL:134217743,Accent_ArrowR:134217744,Accent_ArrowD:134217745,Accent_HarpoonL:134217746,Accent_HarpoonR:134217747,Accent_BorderBox:134283264,Accent_BorderBoxCustom:134283265,Accent_BarTop:134348800,Accent_BarBot:134348801,Accent_Custom_1:134414336,Accent_Custom_2:134414337,Accent_Custom_3:134414338,LimitLog_LogBase:150994944,LimitLog_Log:150994945,LimitLog_Lim:150994946,LimitLog_Min:150994947,LimitLog_Max:150994948,LimitLog_Ln:150994949,LimitLog_Custom_1:151060480,LimitLog_Custom_2:151060481,Operator_ColonEquals:167772160,Operator_EqualsEquals:167772161,Operator_PlusEquals:167772162,Operator_MinusEquals:167772163,Operator_Definition:167772164,Operator_UnitOfMeasure:167772165,Operator_DeltaEquals:167772166,Operator_ArrowL_Top:167837696,Operator_ArrowR_Top:167837697,Operator_ArrowL_Bot:167837698,Operator_ArrowR_Bot:167837699,Operator_DoubleArrowL_Top:167837700,Operator_DoubleArrowR_Top:167837701,Operator_DoubleArrowL_Bot:167837702,Operator_DoubleArrowR_Bot:167837703,Operator_ArrowD_Top:167837704,Operator_ArrowD_Bot:167837705,Operator_DoubleArrowD_Top:167837706,Operator_DoubleArrowD_Bot:167837707,Operator_Custom_1:167903232,Operator_Custom_2:167903233,Matrix_1_2:184549376,Matrix_2_1:184549377,Matrix_1_3:184549378,Matrix_3_1:184549379,Matrix_2_2:184549380,Matrix_2_3:184549381,Matrix_3_2:184549382,Matrix_3_3:184549383,Matrix_Dots_Center:184614912,Matrix_Dots_Baseline:184614913,Matrix_Dots_Vertical:184614914,Matrix_Dots_Diagonal:184614915,Matrix_Identity_2:184680448,Matrix_Identity_2_NoZeros:184680449,Matrix_Identity_3:184680450,Matrix_Identity_3_NoZeros:184680451,Matrix_2_2_RoundBracket:184745984,Matrix_2_2_SquareBracket:184745985,Matrix_2_2_LineBracket:184745986,Matrix_2_2_DLineBracket:184745987,Matrix_Flat_Round:184811520,Matrix_Flat_Square:184811521},Common.define.chartData=_.extend(new function(){return{textLine:"Line",textColumn:"Column",textBar:"Bar",textArea:"Area",textPie:"Pie",textPoint:"XY (Scatter)",textStock:"Stock",textSurface:"Surface",textCharts:"Charts",textSparks:"Sparklines",textLineSpark:"Line",textColumnSpark:"Column",textWinLossSpark:"Win/Loss",getChartGroupData:function(t){return[{id:"menu-chart-group-bar",caption:this.textColumn,headername:t?this.textCharts:void 0},{id:"menu-chart-group-line",caption:this.textLine},{id:"menu-chart-group-pie",caption:this.textPie},{id:"menu-chart-group-hbar",caption:this.textBar},{id:"menu-chart-group-area",caption:this.textArea,inline:!0},{id:"menu-chart-group-scatter",caption:this.textPoint,inline:!0},{id:"menu-chart-group-stock",caption:this.textStock,inline:!0}]},getChartData:function(){return[{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal,iconCls:"column-normal"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStacked,iconCls:"column-stack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStackedPer,iconCls:"column-pstack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal3d,iconCls:"column-3d-normal"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStacked3d,iconCls:"column-3d-stack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStackedPer3d,iconCls:"column-3d-pstack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal3dPerspective,iconCls:"column-3d-normal-per"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineNormal,iconCls:"line-normal"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineStacked,iconCls:"line-stack"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineStackedPer,iconCls:"line-pstack"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.line3d,iconCls:"line-3d"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.pie,iconCls:"pie-normal"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.doughnut,iconCls:"pie-doughnut"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.pie3d,iconCls:"pie-3d-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarNormal,iconCls:"bar-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStacked,iconCls:"bar-stack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStackedPer,iconCls:"bar-pstack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarNormal3d,iconCls:"bar-3d-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStacked3d,iconCls:"bar-3d-stack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStackedPer3d,iconCls:"bar-3d-pstack"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaNormal,iconCls:"area-normal"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaStacked,iconCls:"area-stack"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaStackedPer,iconCls:"area-pstack"},{group:"menu-chart-group-scatter",type:Asc.c_oAscChartTypeSettings.scatter,iconCls:"point-normal"},{group:"menu-chart-group-stock",type:Asc.c_oAscChartTypeSettings.stock,iconCls:"stock-normal"}]},getSparkGroupData:function(t){return[{id:"menu-chart-group-sparkcolumn",inline:!0,headername:t?this.textSparks:void 0},{id:"menu-chart-group-sparkline",inline:!0},{id:"menu-chart-group-sparkwin",inline:!0}]},getSparkData:function(){return[{group:"menu-chart-group-sparkcolumn",type:Asc.c_oAscSparklineType.Column,allowSelected:!0,iconCls:"spark-column",tip:this.textColumnSpark},{group:"menu-chart-group-sparkline",type:Asc.c_oAscSparklineType.Line,allowSelected:!0,iconCls:"spark-line",tip:this.textLineSpark},{group:"menu-chart-group-sparkwin",type:Asc.c_oAscSparklineType.Stacked,allowSelected:!0,iconCls:"spark-win",tip:this.textWinLossSpark}]}}},Common.define.chartData||{})}),define("text!spreadsheeteditor/main/app/template/Toolbar.template",[],function(){ diff --git a/www/common/outer/async-store.js b/www/common/outer/async-store.js index 130926e6a..cd8887a15 100644 --- a/www/common/outer/async-store.js +++ b/www/common/outer/async-store.js @@ -26,9 +26,9 @@ define([ '/bower_components/chainpad-crypto/crypto.js', '/bower_components/chainpad/chainpad.dist.js', - '/bower_components/chainpad-netflux/chainpad-netflux.js', - '/bower_components/chainpad-listmap/chainpad-listmap.js', - '/bower_components/netflux-websocket/netflux-client.js', + 'chainpad-netflux', + 'chainpad-listmap', + 'netflux-client', '/bower_components/nthen/index.js', '/bower_components/saferphore/index.js', ], function (ApiConfig, Sortify, UserObject, ProxyManager, Migrate, Hash, Util, Constants, Feedback, diff --git a/www/common/outer/cache-store.js b/www/common/outer/cache-store.js index 93bc0d0c6..17fea6b16 100644 --- a/www/common/outer/cache-store.js +++ b/www/common/outer/cache-store.js @@ -97,7 +97,7 @@ define([ var checkCheckpoints = function (array) { if (!Array.isArray(array)) { return; } // Keep the last 100 messages - if (array.length > 100) { // XXX 4.10.0 + if (array.length > 100) { // FIXME this behaviour is only valid for chainpad-style documents array.splice(0, array.length - 100); } // Remove every message before the first checkpoint diff --git a/www/common/outer/calendar.js b/www/common/outer/calendar.js index bea22db6b..a0b990e89 100644 --- a/www/common/outer/calendar.js +++ b/www/common/outer/calendar.js @@ -6,7 +6,7 @@ define([ '/common/outer/cache-store.js', '/customize/messages.js', '/bower_components/nthen/index.js', - '/bower_components/chainpad-listmap/chainpad-listmap.js', + 'chainpad-listmap', '/bower_components/chainpad-crypto/crypto.js', '/bower_components/chainpad/chainpad.dist.js', ], function (Util, Hash, Constants, Realtime, Cache, Messages, nThen, Listmap, Crypto, ChainPad) { diff --git a/www/common/outer/cursor.js b/www/common/outer/cursor.js index 95b2b34c6..b1a5e7cd0 100644 --- a/www/common/outer/cursor.js +++ b/www/common/outer/cursor.js @@ -187,6 +187,7 @@ define([ data.color = Util.find(proxy, ['settings', 'general', 'cursor', 'color']); data.name = proxy[Constants.displayNameKey] || ctx.store.noDriveName || Messages.anonymous; data.avatar = Util.find(proxy, ['profile', 'avatar']); + data.uid = Util.find(proxy, ['uid']) || ctx.store.noDriveUid; c.cursor = data; sendMyCursor(ctx, client); cb(); diff --git a/www/common/outer/mailbox.js b/www/common/outer/mailbox.js index a7269c6e5..dbe95e84d 100644 --- a/www/common/outer/mailbox.js +++ b/www/common/outer/mailbox.js @@ -7,7 +7,7 @@ define([ '/common/common-messaging.js', '/common/notify.js', '/common/outer/mailbox-handlers.js', - '/bower_components/chainpad-netflux/chainpad-netflux.js', + 'chainpad-netflux', '/bower_components/chainpad-crypto/crypto.js', ], function (Config, BCast, Util, Hash, Realtime, Messaging, Notify, Handlers, CpNetflux, Crypto) { var Mailbox = {}; diff --git a/www/common/outer/profile.js b/www/common/outer/profile.js index 733b2b4c4..7cba963c7 100644 --- a/www/common/outer/profile.js +++ b/www/common/outer/profile.js @@ -3,7 +3,7 @@ define([ '/common/common-hash.js', '/common/common-constants.js', '/common/common-realtime.js', - '/bower_components/chainpad-listmap/chainpad-listmap.js', + 'chainpad-listmap', '/bower_components/chainpad-crypto/crypto.js', '/bower_components/chainpad/chainpad.dist.js', ], function (Util, Hash, Constants, Realtime, Listmap, Crypto, ChainPad) { diff --git a/www/common/outer/roster.js b/www/common/outer/roster.js index e395891b7..6aa80e5d8 100644 --- a/www/common/outer/roster.js +++ b/www/common/outer/roster.js @@ -918,7 +918,7 @@ var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto, Feedback) define([ '/common/common-util.js', '/common/common-hash.js', - '/bower_components/chainpad-netflux/chainpad-netflux.js', + 'chainpad-netflux', 'json.sortify', '/bower_components/nthen/index.js', '/bower_components/chainpad-crypto/crypto.js', diff --git a/www/common/outer/sharedfolder.js b/www/common/outer/sharedfolder.js index 6735330b4..4579492ba 100644 --- a/www/common/outer/sharedfolder.js +++ b/www/common/outer/sharedfolder.js @@ -6,7 +6,7 @@ define([ '/bower_components/nthen/index.js', '/bower_components/chainpad-crypto/crypto.js', - '/bower_components/chainpad-listmap/chainpad-listmap.js', + 'chainpad-listmap', '/bower_components/chainpad/chainpad.dist.js', ], function (Hash, Util, UserObject, Cache, nThen, Crypto, Listmap, ChainPad) { diff --git a/www/common/outer/team.js b/www/common/outer/team.js index 94f91c807..32ce35f3b 100644 --- a/www/common/outer/team.js +++ b/www/common/outer/team.js @@ -14,9 +14,9 @@ define([ '/common/cryptget.js', '/common/outer/cache-store.js', - '/bower_components/chainpad-listmap/chainpad-listmap.js', + 'chainpad-listmap', '/bower_components/chainpad-crypto/crypto.js', - '/bower_components/chainpad-netflux/chainpad-netflux.js', + 'chainpad-netflux', '/bower_components/chainpad/chainpad.dist.js', '/bower_components/nthen/index.js', '/bower_components/saferphore/index.js', diff --git a/www/common/requireconfig.js b/www/common/requireconfig.js index 4e3baf857..7ed772575 100644 --- a/www/common/requireconfig.js +++ b/www/common/requireconfig.js @@ -16,6 +16,9 @@ define([ cm: '/bower_components/codemirror', 'tui-code-snippet': '/lib/calendar/tui-code-snippet.min', 'tui-date-picker': '/lib/calendar/date-picker', + 'netflux-client': '/bower_components/netflux-websocket/netflux-client', + 'chainpad-netflux': '/bower_components/chainpad-netflux/chainpad-netflux', + 'chainpad-listmap': '/bower_components/chainpad-listmap/chainpad-listmap', }, map: { '*': { diff --git a/www/common/sframe-common-file.js b/www/common/sframe-common-file.js index a6b097876..a1e27911f 100644 --- a/www/common/sframe-common-file.js +++ b/www/common/sframe-common-file.js @@ -11,10 +11,12 @@ define([ '/common/hyperscript.js', '/customize/messages.js', '/customize/pages.js', + '/bower_components/nthen/index.js', + '/common/media-tag.js', '/bower_components/file-saver/FileSaver.min.js', '/bower_components/tweetnacl/nacl-fast.min.js', -], function ($, ApiConfig, FileCrypto, MakeBackup, Thumb, UI, UIElements, Util, Hash, h, Messages, Pages) { +], function ($, ApiConfig, FileCrypto, MakeBackup, Thumb, UI, UIElements, Util, Hash, h, Messages, Pages, nThen, MT) { var Nacl = window.nacl; var module = {}; @@ -312,7 +314,8 @@ define([ }); return manualStore; }; - var fileUploadModal = function (defaultFileName, cb) { + + var fileUploadModal = function (defaultFileName, cb, preview) { var parsedName = /^(\.?.+?)(\.[^.]+)?$/.exec(defaultFileName) || []; var ext = parsedName[2] || ""; @@ -321,9 +324,14 @@ define([ // Ask for name, password and owner var content = h('div', [ h('h4', Messages.upload_modal_title), + (preview? h('div#cp-upload-preview-container', preview): undefined), UIElements.setHTML(h('label', {for: 'cp-upload-name'}), Messages._getKey('upload_modal_filename', [ext])), h('input#cp-upload-name', {type: 'text', placeholder: defaultFileName, value: defaultFileName}), + + h('label', {for: 'cp-upload-alt'}, Messages.upload_addOptionalAlt), + h('input#cp-upload-alt', {type: 'text', placeholder: Messages.upload_modal_alt}), + h('label', {for: 'cp-upload-password'}, Messages.addOptionalPassword), UI.passwordInput({id: 'cp-upload-password'}), h('span', { @@ -335,7 +343,8 @@ define([ manualStore ]); - $(content).find('#cp-upload-owned').on('change', function () { + var $content = $(content); + $content.find('#cp-upload-owned').on('change', function () { var val = Util.isChecked($(content).find('#cp-upload-owned')); if (val) { $(content).find('#cp-upload-store').prop('checked', true).prop('disabled', true); @@ -348,8 +357,9 @@ define([ if (!yes) { return void cb(); } // Get the values - var newName = $(content).find('#cp-upload-name').val(); - var password = $(content).find('#cp-upload-password').val() || undefined; + var newName = $content.find('#cp-upload-name').val(); + var password = $content.find('#cp-upload-password').val() || undefined; + var alt = $content.find('#cp-upload-alt').val() || undefined; var owned = Util.isChecked($(content).find('#cp-upload-owned')); var forceSave = owned || Util.isChecked($(content).find('#cp-upload-store')); @@ -366,7 +376,8 @@ define([ name: newName, password: password, owned: owned, - forceSave: forceSave + forceSave: forceSave, + alt: alt, }); }); }; @@ -437,6 +448,8 @@ define([ } var thumb; + var preview; + var alt; var file_arraybuffer; var name = file.name; var password; @@ -447,6 +460,7 @@ define([ var metadata = { name: name, type: type, + alt: alt, }; if (thumb) { metadata.thumbnail = thumb; } queue.push({ @@ -486,8 +500,9 @@ define([ password = obj.password; owned = obj.owned; forceSave = obj.forceSave; + alt = obj.alt; finish(); - }); + }, preview); } }; @@ -495,11 +510,20 @@ define([ if (e) { console.error(e); } file_arraybuffer = buffer; if (!Thumb.isSupportedType(file)) { return getName(); } - // make a resized thumbnail from the image.. - Thumb.fromBlob(file, function (e, thumb64) { - if (e) { console.error(e); } - if (!thumb64) { return getName(); } - thumb = thumb64; + nThen(function (w) { + // make a resized thumbnail from the image.. + Thumb.fromBlob(file, w(function (e, thumb64) { + if (e) { console.error(e); } + if (!thumb64) { return; } + thumb = thumb64; + })); + MT.preview(buffer, { + type: file.type, + }, void 0, w(function (err, el) { + if (err) { return void console.error(err); } + preview = el; + })); + }).nThen(function () { getName(); }); }); diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index 3faefe0bb..21344cd3f 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -623,6 +623,7 @@ define([ prefersDriveRedirect: Utils.LocalStore.getDriveRedirectPreference(), isPresent: parsed.hashData && parsed.hashData.present, isEmbed: parsed.hashData && parsed.hashData.embed, + canEdit: hashes && hashes.editHash, oldVersionHash: parsed.hashData && parsed.hashData.version < 2, // password isHistoryVersion: parsed.hashData && parsed.hashData.versionHash, notifications: notifs, @@ -1792,6 +1793,22 @@ define([ }); }); + sframeChan.on('Q_COPY_VIEW_URL', function (data, cb) { + require(['/common/clipboard.js'], function (Clipboard) { + var url = window.location.origin + + Utils.Hash.hashToHref(hashes.viewHash, 'form'); + var success = Clipboard.copy(url); + cb(success); + }); + }); + sframeChan.on('EV_OPEN_VIEW_URL', function () { + var url = Utils.Hash.hashToHref(hashes.viewHash, 'form'); + var a = window.open(url); + if (!a) { + sframeChan.event('EV_POPUP_BLOCKED'); + } + }); + if (cfg.messaging) { sframeChan.on('Q_CHAT_OPENPADCHAT', function (data, cb) { Cryptpad.universal.execCommand({ diff --git a/www/common/sframe-common.js b/www/common/sframe-common.js index 6a7e3effd..b7efd9f4f 100644 --- a/www/common/sframe-common.js +++ b/www/common/sframe-common.js @@ -235,9 +235,6 @@ define([ }; }; - funcs.getAuthorId = function () { - }; - var authorUid = function(existing) { if (!Array.isArray(existing)) { existing = []; } var n; @@ -249,11 +246,25 @@ define([ if (existing.indexOf(n) !== -1) { n = 0; } return n; }; - funcs.getAuthorId = function(authors, curve) { + funcs.getAuthorId = function(authors, curve, tokenId) { var existing = Object.keys(authors || {}).map(Number); - if (!funcs.isLoggedIn()) { return authorUid(existing); } - var uid; + var loggedIn = funcs.isLoggedIn(); + if (!loggedIn && !tokenId) { return authorUid(existing); } + if (!loggedIn) { + existing.some(function (id) { + var author = authors[id]; + if (!author || author.uid !== tokenId) { return; } + uid = Number(id); + return true; + }); + return uid || authorUid(existing); + } + // TODO this should check for a matching curvePublic / uid if: + // 1. you are logged in OR + // 2. you have a token + // so that users that register recognize comments from before + // they registered as their own (same uid) existing.some(function(id) { var author = authors[id] || {}; if (author.curvePublic !== curve) { return; } @@ -921,9 +932,10 @@ define([ }); ctx.sframeChan.on('EV_WORKER_TIMEOUT', function () { - UI.errorLoadingScreen(Messages.timeoutError, false, function () { // XXX mobile users can't necessarily hit 'ESC' as this message suggests. provice a click option - funcs.gotoURL(''); - }); + var message = UI.setHTML(h('span'), Messages.timeoutError); + var cb = Util.once(function () { funcs.gotoURL(''); }); + $(message).find('em').on('touchend', cb); + UI.errorLoadingScreen(message, false, cb); }); ctx.sframeChan.on('EV_CHROME_68', function () { diff --git a/www/common/toolbar.js b/www/common/toolbar.js index ccc1c5e78..8931c57f5 100644 --- a/www/common/toolbar.js +++ b/www/common/toolbar.js @@ -65,7 +65,9 @@ MessengerUI, Messages, Pages) { if (!config.$container) { return; } var $container = config.$container; - var isEmbed = Bar.isEmbed = config.metadataMgr.getPrivateData().isEmbed; + var priv = config.metadataMgr.getPrivateData(); + var isEmbed = Bar.isEmbed = priv.isEmbed || + (priv.app === 'form' && priv.readOnly && !priv.form_auditorHash); if (isEmbed) { $container.hide(); } @@ -249,6 +251,7 @@ MessengerUI, Messages, Pages) { var friendRequests = Common.getFriendRequests(); // Friend requests received editUsersNames.forEach(function (data) { var name = data.name || Messages.anonymous; + var safeName = Util.fixHTML(name); var $span = $('', {'class': 'cp-avatar'}); if (data.color && showColors) { $span.css('border-color', data.color); @@ -323,7 +326,7 @@ MessengerUI, Messages, Pages) { $('