├── .babelrc ├── .github └── FUNDING.yml ├── .gitignore ├── Gruntfile.js ├── LICENSE ├── NEW_RELEASE_STEPS.md ├── README.md ├── demo.html ├── dist ├── dist.css ├── dist.js └── sn-codemirror-search │ ├── dialog │ ├── dialog.css │ └── dialog.js │ ├── package.json │ ├── search.js │ └── searchcursor.js ├── index.html ├── local_ext.json ├── package.json ├── src ├── editor.js ├── indent_text.js ├── main.js └── main.scss └── vendor └── mark-selection.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ "@babel/preset-env"], 3 | } 4 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: MaxLap 2 | ko_fi: maxlap 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | 3 | dist/lib.js 4 | dist/app.js 5 | dist/app.js.map 6 | dist/dist.css.map 7 | dist/dist.js.map 8 | dist/app.css 9 | dist/app.css.map 10 | 11 | .DS_Store 12 | 13 | .sass-cache 14 | 15 | .idea 16 | -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt) { 2 | 3 | grunt.initConfig({ 4 | 5 | watch: { 6 | js: { 7 | files: ['src/**/*.js'], 8 | tasks: ['concat:app', 'babel', 'browserify', 'concat:lib', 'concat:dist'], 9 | options: { 10 | spawn: false, 11 | }, 12 | }, 13 | css: { 14 | files: ['src/main.scss'], 15 | tasks: ['sass', 'concat:css'], 16 | options: { 17 | spawn: false, 18 | }, 19 | } 20 | }, 21 | 22 | sass: { 23 | dist: { 24 | options: { 25 | style: 'expanded', 26 | sourcemap: 'none' 27 | }, 28 | files: { 29 | 'dist/app.css': 'src/main.scss' 30 | } 31 | } 32 | }, 33 | 34 | babel: { 35 | options: { 36 | sourceMap: true, 37 | presets: ['@babel/preset-env'] 38 | }, 39 | app: { 40 | files: { 41 | 'dist/app.js': ['dist/app.js'] 42 | } 43 | } 44 | }, 45 | 46 | browserify: { 47 | dist: { 48 | files: { 49 | 'dist/app.js': 'dist/app.js' 50 | } 51 | } 52 | }, 53 | 54 | concat: { 55 | options: { 56 | separator: ';', 57 | }, 58 | 59 | app: { 60 | src: [ 61 | 'src/**/*.js', 62 | ], 63 | dest: 'dist/app.js', 64 | }, 65 | 66 | lib: { 67 | src: [ 68 | 'node_modules/codemirror/lib/codemirror.js', 69 | 'node_modules/sn-components-api/dist/dist.js', 70 | 'vendor/mark-selection.js' 71 | ], 72 | dest: 'dist/lib.js', 73 | }, 74 | 75 | dist: { 76 | src: ['dist/lib.js', 'dist/app.js'], 77 | dest: 'dist/dist.js', 78 | }, 79 | 80 | css: { 81 | options: { 82 | separator: '', 83 | }, 84 | src: ['node_modules/codemirror/lib/codemirror.css', 'node_modules/sn-stylekit/dist/stylekit.css', 'dist/app.css'], 85 | dest: 'dist/dist.css', 86 | } 87 | }, 88 | copy: { 89 | main: { 90 | files: [ 91 | {expand: true, cwd: 'node_modules/', src: ['sn-codemirror-search/**'], dest: 'dist/'}, 92 | ], 93 | }, 94 | }, 95 | }); 96 | 97 | grunt.loadNpmTasks('grunt-newer'); 98 | grunt.loadNpmTasks('grunt-contrib-watch'); 99 | grunt.loadNpmTasks('grunt-babel'); 100 | grunt.loadNpmTasks('grunt-browserify'); 101 | grunt.loadNpmTasks('grunt-contrib-concat'); 102 | grunt.loadNpmTasks('grunt-contrib-sass'); 103 | grunt.loadNpmTasks('grunt-contrib-copy'); 104 | 105 | grunt.registerTask('default', ['concat:app', 'babel', 'browserify', 'concat:lib', 'concat:dist', 'sass', 'concat:css', 'copy']); 106 | }; 107 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | -------------------------------------------------------------------------------- /NEW_RELEASE_STEPS.md: -------------------------------------------------------------------------------- 1 | * Update version in package.json. Commit & push 2 | * On github, release the new version 3 | * In standard notes's extension file: 4 | * Update the "version" 5 | * Update the "download_url" with new archive's (from github) path 6 | * Update the "url" with the new commit ref 7 | * Update the private post to release 8 | * Update the current_release branch with content of master: 9 | `git checkout current_release; git reset --hard master; git push; git checkout master` 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### Standard Notes Indent Editor 2 | 3 | This is a text editor for the encrypted note taking app https://standardnotes.org/. 4 | 5 | A simple text editor that makes it easy to write and read nested notes. 6 | 7 | Online demo with explanations: https://maxlap.github.io/standard-notes-indent-editor/demo.html 8 | 9 | The [demo](https://maxlap.github.io/standard-notes-indent-editor/demo.html) shows everything nicely, but compared to a basic text editor: 10 | 11 | * Press `Tab` to indent the line (or selected lines) with 2 spaces (even if in the middle of the line). 12 | * Press `Shift` + `Tab` removes 2 spaces from the beginning of line (or selected lines). 13 | * `Enter` creates a new line with the same indentation as the current line. 14 | * Empty lines are smaller than a normal line, giving you more control over spacing. 15 | * Lines can wrap. 16 | * When lines wrap, they will align with the same indentation as the first line. 17 | * Stars (*), dashes (-), greater than (>) and plus (+) are considered part of indentation. This means: 18 | * Lines wrap until after those characters too. 19 | * Pressing `Enter` copies the *->+ along with the spaces. 20 | * Indentation uses a fixed-width font, so it always align nicely. 21 | * Numbered lists (lines starting with 1. then 2.) are also considered indentation, and numbers will auto-increment on "Enter". 22 | * Lines that wrap are shown as paragraph of around 50 characters wide. This keeps them from being super large and hard to read 23 | * Lines that wrap are slightly closer together vertically. 24 | * Lines starting with a number sign (#) are headers, shown as bold and bigger text. 25 | * Things that look like web addresses are highlighted, and can be ctrl+clicked to open in a new tab. 26 | * You can use backticks (\`) to put code in a line, this will look similar to Markdown, but the backticks are not hidden: `` `code` `` 27 | * Text between triple backticks \``` (they must be at the end of lines) is shown as a blocks of code. Again, this will look similar to Markdown, but without the box: 28 | ```` 29 | ``` 30 | function hello() { 31 | console.log('hello world') 32 | } 33 | ``` 34 | ```` 35 | * Pressing `Ctrl` + `D` duplicates the selection or the current line if no selection. 36 | * Pressing `Ctrl` + `Shift` + `Up` and `Ctrl` + `Shift` + `Down` will move the selected lines up and down. 37 | 38 | ### How to install 39 | 40 | In Standard Notes (either browser or desktop), click Extension, then Import Extension, paste this link: `https://listed.to/p/eUPdNELfEu`, press Enter. 41 | 42 | You should then be able to select the Indent Editor in your list of editors. 43 | 44 | ### The goals 45 | 46 | * A simple text editor that makes it easy to write and read nested notes. 47 | * Be your main text & notes editor 48 | 49 | This means: 50 | * Grouping things help: natural indentation, lists and vertical spacing handling 51 | * Splitting lines is troublesome: long lines wrap nicely. 52 | * What you see come from the text: no formatting buttons or commands. 53 | * See your text: Every character is displayed, nothing is hidden. 54 | * Not locked in: The text will look fine in any other editor, you wouldn't lose anything. 55 | 56 | ### Supporting the editor 57 | 58 | If you enjoy the editor, please consider hitting the sponsor button at the top of the page to encourage my work. 59 | 60 | ### Basic of how to dev: 61 | 62 | Clone the repo. 63 | 64 | Install the dependencies: 65 | 66 | npm install 67 | 68 | To run the server to try out the editor: 69 | 70 | python3 -m http.server 8080 71 | 72 | To update dist/ files which are sent as editor, run: 73 | 74 | grunt 75 | 76 | You can use the demo to just try out the editor: 77 | 78 | http://localhost:8080/demo.html 79 | 80 | To refresh your editor with the modified version, the way that always work is to open the Chrome console, then right-click the refresh icon and do a "Empty cache and hard reload". Other ways of doing hard refreshes may work, but the cache clearing has sometimes been necessary for me. 81 | 82 | You can also try it in StandardNotes (but it's more painful to do so): 83 | 84 | Import the local test extension if you didn't already. Do it from the desktop app because otherwise, it's a http call within a https one which is refused by your browser. This is the link to the extension: 85 | 86 | http://localhost:8080/local_ext.json 87 | 88 | Once the app is imported, you can test it from: 89 | * the browser app: It's possible it wont work until you allow Mixed Content in the page page. Search online for how to enable it for your browser. 90 | * the desktop app. I have no idea how often the desktop will refresh the extensions, so that may be painful except as last validation. 91 | 92 | -------------------------------------------------------------------------------- /demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Indent Editor demo 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 149 | 152 | 205 |
206 | 207 | 208 | -------------------------------------------------------------------------------- /dist/dist.css: -------------------------------------------------------------------------------- 1 | /* BASICS */ 2 | 3 | .CodeMirror { 4 | /* Set height, width, borders, and global font properties here */ 5 | font-family: monospace; 6 | height: 300px; 7 | color: black; 8 | direction: ltr; 9 | } 10 | 11 | /* PADDING */ 12 | 13 | .CodeMirror-lines { 14 | padding: 4px 0; /* Vertical padding around content */ 15 | } 16 | .CodeMirror pre.CodeMirror-line, 17 | .CodeMirror pre.CodeMirror-line-like { 18 | padding: 0 4px; /* Horizontal padding of content */ 19 | } 20 | 21 | .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { 22 | background-color: white; /* The little square between H and V scrollbars */ 23 | } 24 | 25 | /* GUTTER */ 26 | 27 | .CodeMirror-gutters { 28 | border-right: 1px solid #ddd; 29 | background-color: #f7f7f7; 30 | white-space: nowrap; 31 | } 32 | .CodeMirror-linenumbers {} 33 | .CodeMirror-linenumber { 34 | padding: 0 3px 0 5px; 35 | min-width: 20px; 36 | text-align: right; 37 | color: #999; 38 | white-space: nowrap; 39 | } 40 | 41 | .CodeMirror-guttermarker { color: black; } 42 | .CodeMirror-guttermarker-subtle { color: #999; } 43 | 44 | /* CURSOR */ 45 | 46 | .CodeMirror-cursor { 47 | border-left: 1px solid black; 48 | border-right: none; 49 | width: 0; 50 | } 51 | /* Shown when moving in bi-directional text */ 52 | .CodeMirror div.CodeMirror-secondarycursor { 53 | border-left: 1px solid silver; 54 | } 55 | .cm-fat-cursor .CodeMirror-cursor { 56 | width: auto; 57 | border: 0 !important; 58 | background: #7e7; 59 | } 60 | .cm-fat-cursor div.CodeMirror-cursors { 61 | z-index: 1; 62 | } 63 | .cm-fat-cursor-mark { 64 | background-color: rgba(20, 255, 20, 0.5); 65 | -webkit-animation: blink 1.06s steps(1) infinite; 66 | -moz-animation: blink 1.06s steps(1) infinite; 67 | animation: blink 1.06s steps(1) infinite; 68 | } 69 | .cm-animate-fat-cursor { 70 | width: auto; 71 | border: 0; 72 | -webkit-animation: blink 1.06s steps(1) infinite; 73 | -moz-animation: blink 1.06s steps(1) infinite; 74 | animation: blink 1.06s steps(1) infinite; 75 | background-color: #7e7; 76 | } 77 | @-moz-keyframes blink { 78 | 0% {} 79 | 50% { background-color: transparent; } 80 | 100% {} 81 | } 82 | @-webkit-keyframes blink { 83 | 0% {} 84 | 50% { background-color: transparent; } 85 | 100% {} 86 | } 87 | @keyframes blink { 88 | 0% {} 89 | 50% { background-color: transparent; } 90 | 100% {} 91 | } 92 | 93 | /* Can style cursor different in overwrite (non-insert) mode */ 94 | .CodeMirror-overwrite .CodeMirror-cursor {} 95 | 96 | .cm-tab { display: inline-block; text-decoration: inherit; } 97 | 98 | .CodeMirror-rulers { 99 | position: absolute; 100 | left: 0; right: 0; top: -50px; bottom: 0; 101 | overflow: hidden; 102 | } 103 | .CodeMirror-ruler { 104 | border-left: 1px solid #ccc; 105 | top: 0; bottom: 0; 106 | position: absolute; 107 | } 108 | 109 | /* DEFAULT THEME */ 110 | 111 | .cm-s-default .cm-header {color: blue;} 112 | .cm-s-default .cm-quote {color: #090;} 113 | .cm-negative {color: #d44;} 114 | .cm-positive {color: #292;} 115 | .cm-header, .cm-strong {font-weight: bold;} 116 | .cm-em {font-style: italic;} 117 | .cm-link {text-decoration: underline;} 118 | .cm-strikethrough {text-decoration: line-through;} 119 | 120 | .cm-s-default .cm-keyword {color: #708;} 121 | .cm-s-default .cm-atom {color: #219;} 122 | .cm-s-default .cm-number {color: #164;} 123 | .cm-s-default .cm-def {color: #00f;} 124 | .cm-s-default .cm-variable, 125 | .cm-s-default .cm-punctuation, 126 | .cm-s-default .cm-property, 127 | .cm-s-default .cm-operator {} 128 | .cm-s-default .cm-variable-2 {color: #05a;} 129 | .cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;} 130 | .cm-s-default .cm-comment {color: #a50;} 131 | .cm-s-default .cm-string {color: #a11;} 132 | .cm-s-default .cm-string-2 {color: #f50;} 133 | .cm-s-default .cm-meta {color: #555;} 134 | .cm-s-default .cm-qualifier {color: #555;} 135 | .cm-s-default .cm-builtin {color: #30a;} 136 | .cm-s-default .cm-bracket {color: #997;} 137 | .cm-s-default .cm-tag {color: #170;} 138 | .cm-s-default .cm-attribute {color: #00c;} 139 | .cm-s-default .cm-hr {color: #999;} 140 | .cm-s-default .cm-link {color: #00c;} 141 | 142 | .cm-s-default .cm-error {color: #f00;} 143 | .cm-invalidchar {color: #f00;} 144 | 145 | .CodeMirror-composing { border-bottom: 2px solid; } 146 | 147 | /* Default styles for common addons */ 148 | 149 | div.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;} 150 | div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;} 151 | .CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); } 152 | .CodeMirror-activeline-background {background: #e8f2ff;} 153 | 154 | /* STOP */ 155 | 156 | /* The rest of this file contains styles related to the mechanics of 157 | the editor. You probably shouldn't touch them. */ 158 | 159 | .CodeMirror { 160 | position: relative; 161 | overflow: hidden; 162 | background: white; 163 | } 164 | 165 | .CodeMirror-scroll { 166 | overflow: scroll !important; /* Things will break if this is overridden */ 167 | /* 30px is the magic margin used to hide the element's real scrollbars */ 168 | /* See overflow: hidden in .CodeMirror */ 169 | margin-bottom: -30px; margin-right: -30px; 170 | padding-bottom: 30px; 171 | height: 100%; 172 | outline: none; /* Prevent dragging from highlighting the element */ 173 | position: relative; 174 | } 175 | .CodeMirror-sizer { 176 | position: relative; 177 | border-right: 30px solid transparent; 178 | } 179 | 180 | /* The fake, visible scrollbars. Used to force redraw during scrolling 181 | before actual scrolling happens, thus preventing shaking and 182 | flickering artifacts. */ 183 | .CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { 184 | position: absolute; 185 | z-index: 6; 186 | display: none; 187 | } 188 | .CodeMirror-vscrollbar { 189 | right: 0; top: 0; 190 | overflow-x: hidden; 191 | overflow-y: scroll; 192 | } 193 | .CodeMirror-hscrollbar { 194 | bottom: 0; left: 0; 195 | overflow-y: hidden; 196 | overflow-x: scroll; 197 | } 198 | .CodeMirror-scrollbar-filler { 199 | right: 0; bottom: 0; 200 | } 201 | .CodeMirror-gutter-filler { 202 | left: 0; bottom: 0; 203 | } 204 | 205 | .CodeMirror-gutters { 206 | position: absolute; left: 0; top: 0; 207 | min-height: 100%; 208 | z-index: 3; 209 | } 210 | .CodeMirror-gutter { 211 | white-space: normal; 212 | height: 100%; 213 | display: inline-block; 214 | vertical-align: top; 215 | margin-bottom: -30px; 216 | } 217 | .CodeMirror-gutter-wrapper { 218 | position: absolute; 219 | z-index: 4; 220 | background: none !important; 221 | border: none !important; 222 | } 223 | .CodeMirror-gutter-background { 224 | position: absolute; 225 | top: 0; bottom: 0; 226 | z-index: 4; 227 | } 228 | .CodeMirror-gutter-elt { 229 | position: absolute; 230 | cursor: default; 231 | z-index: 4; 232 | } 233 | .CodeMirror-gutter-wrapper ::selection { background-color: transparent } 234 | .CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent } 235 | 236 | .CodeMirror-lines { 237 | cursor: text; 238 | min-height: 1px; /* prevents collapsing before first draw */ 239 | } 240 | .CodeMirror pre.CodeMirror-line, 241 | .CodeMirror pre.CodeMirror-line-like { 242 | /* Reset some styles that the rest of the page might have set */ 243 | -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0; 244 | border-width: 0; 245 | background: transparent; 246 | font-family: inherit; 247 | font-size: inherit; 248 | margin: 0; 249 | white-space: pre; 250 | word-wrap: normal; 251 | line-height: inherit; 252 | color: inherit; 253 | z-index: 2; 254 | position: relative; 255 | overflow: visible; 256 | -webkit-tap-highlight-color: transparent; 257 | -webkit-font-variant-ligatures: contextual; 258 | font-variant-ligatures: contextual; 259 | } 260 | .CodeMirror-wrap pre.CodeMirror-line, 261 | .CodeMirror-wrap pre.CodeMirror-line-like { 262 | word-wrap: break-word; 263 | white-space: pre-wrap; 264 | word-break: normal; 265 | } 266 | 267 | .CodeMirror-linebackground { 268 | position: absolute; 269 | left: 0; right: 0; top: 0; bottom: 0; 270 | z-index: 0; 271 | } 272 | 273 | .CodeMirror-linewidget { 274 | position: relative; 275 | z-index: 2; 276 | padding: 0.1px; /* Force widget margins to stay inside of the container */ 277 | } 278 | 279 | .CodeMirror-widget {} 280 | 281 | .CodeMirror-rtl pre { direction: rtl; } 282 | 283 | .CodeMirror-code { 284 | outline: none; 285 | } 286 | 287 | /* Force content-box sizing for the elements where we expect it */ 288 | .CodeMirror-scroll, 289 | .CodeMirror-sizer, 290 | .CodeMirror-gutter, 291 | .CodeMirror-gutters, 292 | .CodeMirror-linenumber { 293 | -moz-box-sizing: content-box; 294 | box-sizing: content-box; 295 | } 296 | 297 | .CodeMirror-measure { 298 | position: absolute; 299 | width: 100%; 300 | height: 0; 301 | overflow: hidden; 302 | visibility: hidden; 303 | } 304 | 305 | .CodeMirror-cursor { 306 | position: absolute; 307 | pointer-events: none; 308 | } 309 | .CodeMirror-measure pre { position: static; } 310 | 311 | div.CodeMirror-cursors { 312 | visibility: hidden; 313 | position: relative; 314 | z-index: 3; 315 | } 316 | div.CodeMirror-dragcursors { 317 | visibility: visible; 318 | } 319 | 320 | .CodeMirror-focused div.CodeMirror-cursors { 321 | visibility: visible; 322 | } 323 | 324 | .CodeMirror-selected { background: #d9d9d9; } 325 | .CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; } 326 | .CodeMirror-crosshair { cursor: crosshair; } 327 | .CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; } 328 | .CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; } 329 | 330 | .cm-searching { 331 | background-color: #ffa; 332 | background-color: rgba(255, 255, 0, .4); 333 | } 334 | 335 | /* Used to force a border model for a node */ 336 | .cm-force-border { padding-right: .1px; } 337 | 338 | @media print { 339 | /* Hide the cursor when printing */ 340 | .CodeMirror div.CodeMirror-cursors { 341 | visibility: hidden; 342 | } 343 | } 344 | 345 | /* See issue #2901 */ 346 | .cm-tab-wrap-hack:after { content: ''; } 347 | 348 | /* Help users use markselection to safely style text background */ 349 | span.CodeMirror-selectedtext { background: none; } 350 | :root{--sn-stylekit-base-font-size: 13px;--sn-stylekit-font-size-p: 1.0rem;--sn-stylekit-font-size-editor: 1.21rem;--sn-stylekit-font-size-h6: 0.8rem;--sn-stylekit-font-size-h5: 0.9rem;--sn-stylekit-font-size-h4: 1.0rem;--sn-stylekit-font-size-h3: 1.1rem;--sn-stylekit-font-size-h2: 1.2rem;--sn-stylekit-font-size-h1: 1.3rem;--sn-stylekit-neutral-color: #989898;--sn-stylekit-neutral-contrast-color: white;--sn-stylekit-info-color: #086DD6;--sn-stylekit-info-contrast-color: white;--sn-stylekit-success-color: #2B9612;--sn-stylekit-success-contrast-color: white;--sn-stylekit-warning-color: #f6a200;--sn-stylekit-warning-contrast-color: white;--sn-stylekit-danger-color: #F80324;--sn-stylekit-danger-contrast-color: white;--sn-stylekit-shadow-color: #C8C8C8;--sn-stylekit-background-color: white;--sn-stylekit-border-color: #e3e3e3;--sn-stylekit-foreground-color: black;--sn-stylekit-contrast-background-color: #F6F6F6;--sn-stylekit-contrast-foreground-color: #2e2e2e;--sn-stylekit-contrast-border-color: #e3e3e3;--sn-stylekit-secondary-background-color: #F6F6F6;--sn-stylekit-secondary-foreground-color: #2e2e2e;--sn-stylekit-secondary-border-color: #e3e3e3;--sn-stylekit-secondary-contrast-background-color: #e3e3e3;--sn-stylekit-secondary-contrast-foreground-color: #2e2e2e;--sn-styleki--secondary-contrast-border-color: #a2a2a2;--sn-stylekit-editor-background-color: var(--sn-stylekit-background-color);--sn-stylekit-editor-foreground-color: var(--sn-stylekit-foreground-color);--sn-stylekit-paragraph-text-color: #454545;--sn-stylekit-input-placeholder-color: rgb(168, 168, 168);--sn-stylekit-input-border-color: #e3e3e3;--sn-stylekit-scrollbar-thumb-color: #dfdfdf;--sn-stylekit-scrollbar-track-border-color: #E7E7E7;--sn-stylekit-general-border-radius: 2px;--sn-stylekit-monospace-font: "Ubuntu Mono", courier, monospace;--sn-stylekit-sans-serif-font: -apple-system, BlinkMacSystemFont, 351 | "Segoe UI", "Roboto", "Oxygen", 352 | "Ubuntu", "Cantarell", "Fira Sans", 353 | "Droid Sans", "Helvetica Neue", sans-serif}.sn-component{font-family:var(--sn-stylekit-sans-serif-font);-webkit-font-smoothing:antialiased;color:var(--sn-stylekit-foreground-color)}.sn-component .sk-panel{box-shadow:0px 2px 5px var(--sn-stylekit-shadow-color);background-color:var(--sn-stylekit-background-color);border:1px solid var(--sn-stylekit-border-color);border-radius:var(--sn-stylekit-general-border-radius);display:flex;flex-direction:column;overflow:auto;flex-grow:1}.sn-component .sk-panel a:hover{text-decoration:underline}.sn-component .sk-panel.static{box-shadow:none;border:none;border-radius:0}.sn-component .sk-panel .sk-panel-header{flex-shrink:0;display:flex;justify-content:space-between;padding:1.1rem 2rem;border-bottom:1px solid var(--sn-stylekit-contrast-border-color);background-color:var(--sn-stylekit-contrast-background-color);color:var(--sn-stylekit-contrast-foreground-color);align-items:center}.sn-component .sk-panel .sk-panel-header .sk-panel-header-title{font-size:var(--sn-stylekit-font-size-h1);font-weight:500}.sn-component .sk-panel .sk-panel-header .close-button{font-weight:bold}.sn-component .sk-panel .sk-footer,.sn-component .sk-panel .sk-panel-footer{padding:1rem 2rem;border-top:1px solid var(--sn-stylekit-border-color);box-sizing:border-box}.sn-component .sk-panel .sk-footer.extra-padding,.sn-component .sk-panel .sk-panel-footer.extra-padding{padding:2rem 2rem}.sn-component .sk-panel .sk-footer .left,.sn-component .sk-panel .sk-panel-footer .left{text-align:left;display:block}.sn-component .sk-panel .sk-footer .right,.sn-component .sk-panel .sk-panel-footer .right{text-align:right;display:block}.sn-component .sk-panel .sk-panel-content{padding:1.6rem 2rem;padding-bottom:0;flex-grow:1;overflow:scroll;height:100%;overflow-y:auto !important;overflow-x:auto !important}.sn-component .sk-panel .sk-panel-content .sk-p,.sn-component .sk-panel .sk-panel-content .sk-li{color:var(--sn-stylekit-paragraph-text-color);line-height:1.3}.sn-component .sk-panel-section{padding-bottom:1.6rem;display:flex;flex-direction:column}.sn-component .sk-panel-section.sk-panel-hero{text-align:center}.sn-component .sk-panel-section .sk-p:last-child{margin-bottom:0}.sn-component .sk-panel-section:not(:last-child){margin-bottom:1.5rem;border-bottom:1px solid var(--sn-stylekit-border-color)}.sn-component .sk-panel-section:not(:last-child).no-border{border-bottom:none}.sn-component .sk-panel-section:last-child{margin-bottom:0.5rem}.sn-component .sk-panel-section.no-bottom-pad{padding-bottom:0;margin-bottom:0}.sn-component .sk-panel-section .sk-panel-section-title{margin-bottom:0.5rem;font-weight:bold;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-panel-section .sk-panel-section-outer-title{border-bottom:1px solid var(--sn-stylekit-border-color);padding-bottom:0.9rem;margin-top:2.1rem;margin-bottom:15px;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-panel-section .sk-panel-section-subtitle{font-size:var(--sn-stylekit-font-size-h5);margin-bottom:2px}.sn-component .sk-panel-section .sk-panel-section-subtitle.subtle{font-weight:normal;opacity:0.6}.sn-component .sk-panel-section .text-content .sk-p{margin-bottom:1rem}.sn-component .sk-panel-section .text-content p:first-child{margin-top:0.3rem}.sn-component .sk-panel-row{display:flex;justify-content:space-between;align-items:center;padding-top:0.4rem}.sn-component .sk-panel-row.centered{justify-content:center}.sn-component .sk-panel-row.justify-right{justify-content:flex-end}.sn-component .sk-panel-row.justify-left{justify-content:flex-start}.sn-component .sk-panel-row.align-top{align-items:flex-start}.sn-component .sk-panel-row .sk-panel-column.stretch{width:100%}.sn-component .sk-panel-row.default-padding,.sn-component .sk-panel-row:not(:last-child){padding-bottom:0.4rem}.sn-component .sk-panel-row.condensed{padding-top:0.2rem;padding-bottom:0.2rem}.sn-component .sk-panel-row .sk-p{margin:0;padding:0}.sn-component .vertical-rule{background-color:var(--sn-stylekit-border-color);height:1.5rem;width:1px}.sn-component .sk-panel-form{width:100%}.sn-component .sk-panel-form.half{width:50%}.sn-component .sk-panel-form .form-submit{margin-top:0.15rem}.sn-component .right-aligned{justify-content:flex-end;text-align:right}.sn-component .sk-menu-panel{background-color:var(--sn-stylekit-background-color);border:1px solid var(--sn-stylekit-contrast-border-color);border-radius:var(--sn-stylekit-general-border-radius);overflow:scroll;user-select:none;overflow-y:auto !important;overflow-x:auto !important}.sn-component .sk-menu-panel .sk-menu-panel-header{padding:0.8rem 1rem;border-bottom:1px solid var(--sn-stylekit-contrast-border-color);background-color:var(--sn-stylekit-contrast-background-color);color:var(--sn-stylekit-contrast-foreground-color);display:flex;justify-content:space-between;align-items:center}.sn-component .sk-menu-panel .sk-menu-panel-header-title{font-weight:bold;font-size:var(--sn-stylekit-font-size-h4)}.sn-component .sk-menu-panel .sk-menu-panel-header-subtitle{margin-top:0.2rem;opacity:0.6}.sn-component .sk-menu-panel .sk-menu-panel-row{padding:1rem 1rem;cursor:pointer;display:flex;flex-direction:row;justify-content:space-between;border-bottom:1px solid var(--sn-stylekit-border-color)}.sn-component .sk-menu-panel .sk-menu-panel-row:hover{background-color:var(--sn-stylekit-contrast-background-color);color:var(--sn-stylekit-contrast-foreground-color);border-color:var(--sn-stylekit-contrast-border-color)}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column{display:flex;justify-content:center;flex-direction:column}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column:not(:first-child){padding-left:1.0rem;padding-right:0.15rem}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column.stretch{width:100%}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column .sk-menu-panel-subrows{margin-top:1rem}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column .sk-menu-panel-row,.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column .sk-menu-panel-subrow{border:1px solid var(--sn-stylekit-contrast-border-color);margin-top:-1px}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column .sk-menu-panel-row:hover,.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column .sk-menu-panel-subrow:hover{background-color:var(--sn-stylekit-background-color)}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-menu-panel-column .left{display:flex}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-button .sk-label,.sn-component .sk-menu-panel .sk-menu-panel-row .sk-box .sk-label,.sn-component .sk-menu-panel .sk-menu-panel-row .sk-button .sk-panel-section .sk-panel-section-subtitle,.sn-component .sk-panel-section .sk-menu-panel .sk-menu-panel-row .sk-button .sk-panel-section-subtitle,.sn-component .sk-menu-panel .sk-menu-panel-row .sk-box .sk-panel-section .sk-panel-section-subtitle,.sn-component .sk-panel-section .sk-menu-panel .sk-menu-panel-row .sk-box .sk-panel-section-subtitle{font-size:var(--sn-stylekit-font-size-h6);font-weight:normal}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-label,.sn-component .sk-menu-panel .sk-menu-panel-row .sk-panel-section .sk-panel-section-subtitle,.sn-component .sk-panel-section .sk-menu-panel .sk-menu-panel-row .sk-panel-section-subtitle{font-size:var(--sn-stylekit-font-size-p);font-weight:bold}.sn-component .sk-menu-panel .sk-menu-panel-row .sk-sublabel{font-size:var(--sn-stylekit-font-size-h5);margin-top:0.2rem;opacity:0.6}.sn-component .red{color:var(--sn-stylekit-danger-color)}.sn-component .tinted{color:var(--sn-stylekit-info-color)}.sn-component .selectable{user-select:text !important;-ms-user-select:text !important;-moz-user-select:text !important;-webkit-user-select:text !important}.sn-component .sk-h1,.sn-component .sk-h2,.sn-component .sk-h3,.sn-component .sk-h4,.sn-component .sk-h5{margin:0;padding:0;font-weight:normal}.sn-component .sk-h1{font-weight:500;font-size:var(--sn-stylekit-font-size-h1);line-height:1.9rem}.sn-component .sk-h2{font-size:var(--sn-stylekit-font-size-h2);line-height:1.8rem}.sn-component .sk-h3{font-size:var(--sn-stylekit-font-size-h3);line-height:1.7rem}.sn-component .sk-h4{font-size:var(--sn-stylekit-font-size-p);line-height:1.4rem}.sn-component .sk-h5{font-size:var(--sn-stylekit-font-size-h5)}.sn-component .sk-bold{font-weight:bold}.sn-component .sk-font-small{font-size:var(--sn-stylekit-font-size-h5)}.sn-component .sk-font-normal{font-size:var(--sn-stylekit-font-size-p)}.sn-component .sk-font-large{font-size:var(--sn-stylekit-font-size-h3)}.sn-component a.sk-a{cursor:pointer;user-select:none}.sn-component a.sk-a.disabled{color:var(--sn-stylekit-neutral-color);opacity:0.6}.sn-component a.sk-a.boxed{border-radius:var(--sn-stylekit-general-border-radius);padding:0.3rem 0.4rem}.sn-component a.sk-a.boxed:hover{text-decoration:none}.sn-component a.sk-a.boxed.neutral{background-color:var(--sn-stylekit-neutral-color);color:var(--sn-stylekit-neutral-contrast-color)}.sn-component a.sk-a.boxed.info{background-color:var(--sn-stylekit-info-color);color:var(--sn-stylekit-info-contrast-color)}.sn-component a.sk-a.boxed.warning{background-color:var(--sn-stylekit-warning-color);color:var(--sn-stylekit-warning-contrast-color)}.sn-component a.sk-a.boxed.danger{background-color:var(--sn-stylekit-danger-color);color:var(--sn-stylekit-danger-contrast-color)}.sn-component a.sk-a.boxed.success{background-color:var(--sn-stylekit-success-color);color:var(--sn-stylekit-success-contrast-color)}.sn-component .wrap{word-wrap:break-word}.sn-component *.sk-base{color:var(--sn-stylekit-foreground-color)}.sn-component *.contrast{color:var(--sn-stylekit-contrast-foreground-color)}.sn-component *.neutral{color:var(--sn-stylekit-neutral-color)}.sn-component *.info{color:var(--sn-stylekit-info-color)}.sn-component *.info-contrast{color:var(--sn-stylekit-info-contrast-color)}.sn-component *.warning{color:var(--sn-stylekit-warning-color)}.sn-component *.danger{color:var(--sn-stylekit-danger-color)}.sn-component *.success{color:var(--sn-stylekit-success-color)}.sn-component *.info-i{color:var(--sn-stylekit-info-color) !important}.sn-component *.warning-i{color:var(--sn-stylekit-warning-color) !important}.sn-component *.danger-i{color:var(--sn-stylekit-danger-color) !important}.sn-component *.success-i{color:var(--sn-stylekit-success-color) !important}.sn-component *.clear{background-color:transparent;border:none}.sn-component .center-text{text-align:center !important;justify-content:center !important}.sn-component p.sk-p{margin:0.5rem 0}.sn-component input.sk-input{box-sizing:border-box;padding:0.7rem 0.8rem;margin:0.30rem 0;border:none;font-size:var(--sn-stylekit-font-size-h3);width:100%;outline:0;resize:none}.sn-component input.sk-input.clear{color:var(--sn-stylekit-foreground-color);background-color:transparent;border:none}.sn-component input.sk-input.no-border{border:none}.sn-component .sk-label,.sn-component .sk-panel-section .sk-panel-section-subtitle{font-weight:bold}.sn-component .sk-label.no-bold,.sn-component .sk-panel-section .no-bold.sk-panel-section-subtitle{font-weight:normal}.sn-component label.sk-label,.sn-component .sk-panel-section label.sk-panel-section-subtitle{margin:0.7rem 0;display:block}.sn-component label.sk-label input[type='checkbox'],.sn-component .sk-panel-section label.sk-panel-section-subtitle input[type='checkbox'],.sn-component input[type='radio']{width:auto;margin-right:0.45rem;vertical-align:middle}.sn-component .sk-horizontal-group>*,.sn-component .sk-input-group>*{display:inline-block;vertical-align:middle}.sn-component .sk-horizontal-group>*:not(:first-child),.sn-component .sk-input-group>*:not(:first-child){margin-left:0.9rem}.sn-component .sk-border-bottom{border-bottom:1px solid var(--sn-stylekit-border-color)}.sn-component .sk-checkbox-group{padding-top:0.5rem;padding-bottom:0.3rem}.sn-component ::placeholder{color:var(--sn-stylekit-input-placeholder-color)}.sn-component :-ms-input-placeholder{color:var(--sn-stylekit-input-placeholder-color)}.sn-component ::-ms-input-placeholder{color:var(--sn-stylekit-input-placeholder-color)}.sn-component .sk-button-group.stretch{display:flex;width:100%}.sn-component .sk-button-group.stretch .sk-button,.sn-component .sk-button-group.stretch .sk-box{display:block;flex-grow:1;text-align:center}.sn-component .sk-button-group .sk-button,.sn-component .sk-button-group .sk-box{display:inline-block;vertical-align:middle}.sn-component .sk-button-group .sk-button:not(:last-child),.sn-component .sk-button-group .sk-box:not(:last-child){margin-right:5px}.sn-component .sk-button-group .sk-button:not(:last-child).featured,.sn-component .sk-button-group .sk-box:not(:last-child).featured{margin-right:8px}.sn-component .sk-segmented-buttons{display:flex;flex-direction:row}.sn-component .sk-segmented-buttons .sk-button,.sn-component .sk-segmented-buttons .sk-box{border-radius:0;white-space:nowrap;margin:0;margin-left:0 !important;margin-right:0 !important}.sn-component .sk-segmented-buttons .sk-button:not(:last-child),.sn-component .sk-segmented-buttons .sk-box:not(:last-child){border-right:none;border-radius:0}.sn-component .sk-segmented-buttons .sk-button:first-child,.sn-component .sk-segmented-buttons .sk-box:first-child{border-top-left-radius:var(--sn-stylekit-general-border-radius);border-bottom-left-radius:var(--sn-stylekit-general-border-radius);border-right:none;border-top-right-radius:0;border-bottom-right-radius:0}.sn-component .sk-segmented-buttons .sk-button:last-child,.sn-component .sk-segmented-buttons .sk-box:last-child{border-top-right-radius:var(--sn-stylekit-general-border-radius);border-bottom-right-radius:var(--sn-stylekit-general-border-radius);border-left:none;border-top-left-radius:0;border-bottom-left-radius:0}.sn-component .sk-box-group .sk-box{display:inline-block}.sn-component .sk-box-group .sk-box:not(:last-child){margin-right:5px}.sn-component .sk-a.button{text-decoration:none}.sn-component .sk-button,.sn-component .sk-box{display:table;padding:0.5rem 0.7rem;font-size:var(--sn-stylekit-font-size-h5);cursor:pointer;text-align:center;user-select:none}.sn-component .sk-button.no-hover-border:after,.sn-component .no-hover-border.sk-box:after{color:transparent !important}.sn-component .sk-button.wide,.sn-component .wide.sk-box{padding:0.3rem 1.7rem}.sn-component .sk-button>.sk-label,.sn-component .sk-box>.sk-label,.sn-component .sk-panel-section .sk-button>.sk-panel-section-subtitle,.sn-component .sk-panel-section .sk-box>.sk-panel-section-subtitle{font-weight:bold;display:block;text-align:center}.sn-component .sk-button.big,.sn-component .big.sk-box{font-size:var(--sn-stylekit-font-size-h3);padding:0.7rem 2.5rem}.sn-component .sk-box{padding:2.5rem 1.5rem}.sn-component .sk-button.sk-base,.sn-component .sk-base.sk-box,.sn-component .sk-box.sk-base,.sn-component .sk-circle.sk-base{color:var(--sn-stylekit-foreground-color);position:relative;background-color:var(--sn-stylekit-background-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-background-color)}.sn-component .sk-button.sk-base *,.sn-component .sk-base.sk-box *,.sn-component .sk-box.sk-base *,.sn-component .sk-circle.sk-base *{position:relative}.sn-component .sk-button.sk-base:before,.sn-component .sk-base.sk-box:before,.sn-component .sk-box.sk-base:before,.sn-component .sk-circle.sk-base:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-background-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-button.sk-base:after,.sn-component .sk-base.sk-box:after,.sn-component .sk-box.sk-base:after,.sn-component .sk-circle.sk-base:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-background-color)}.sn-component .sk-button.sk-base:hover:before,.sn-component .sk-base.sk-box:hover:before,.sn-component .sk-box.sk-base:hover:before,.sn-component .sk-circle.sk-base:hover:before{filter:brightness(130%)}.sn-component .sk-button.sk-base.no-bg,.sn-component .sk-base.no-bg.sk-box,.sn-component .sk-box.sk-base.no-bg,.sn-component .sk-circle.sk-base.no-bg{background-color:transparent}.sn-component .sk-button.sk-base.no-bg:before,.sn-component .sk-base.no-bg.sk-box:before,.sn-component .sk-box.sk-base.no-bg:before,.sn-component .sk-circle.sk-base.no-bg:before{content:none}.sn-component .sk-button.sk-base.featured,.sn-component .sk-base.featured.sk-box,.sn-component .sk-box.sk-base.featured,.sn-component .sk-circle.sk-base.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-button.sk-base.featured:before,.sn-component .sk-base.featured.sk-box:before,.sn-component .sk-box.sk-base.featured:before,.sn-component .sk-circle.sk-base.featured:before{opacity:1.0}.sn-component .sk-button.contrast,.sn-component .contrast.sk-box,.sn-component .sk-box.contrast,.sn-component .sk-circle.contrast{color:var(--sn-stylekit-contrast-foreground-color);position:relative;background-color:var(--sn-stylekit-contrast-background-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-contrast-background-color)}.sn-component .sk-button.contrast *,.sn-component .contrast.sk-box *,.sn-component .sk-box.contrast *,.sn-component .sk-circle.contrast *{position:relative}.sn-component .sk-button.contrast:before,.sn-component .contrast.sk-box:before,.sn-component .sk-box.contrast:before,.sn-component .sk-circle.contrast:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-contrast-background-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-button.contrast:after,.sn-component .contrast.sk-box:after,.sn-component .sk-box.contrast:after,.sn-component .sk-circle.contrast:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-contrast-background-color)}.sn-component .sk-button.contrast:hover:before,.sn-component .contrast.sk-box:hover:before,.sn-component .sk-box.contrast:hover:before,.sn-component .sk-circle.contrast:hover:before{filter:brightness(130%)}.sn-component .sk-button.contrast.no-bg,.sn-component .contrast.no-bg.sk-box,.sn-component .sk-box.contrast.no-bg,.sn-component .sk-circle.contrast.no-bg{background-color:transparent}.sn-component .sk-button.contrast.no-bg:before,.sn-component .contrast.no-bg.sk-box:before,.sn-component .sk-box.contrast.no-bg:before,.sn-component .sk-circle.contrast.no-bg:before{content:none}.sn-component .sk-button.contrast.featured,.sn-component .contrast.featured.sk-box,.sn-component .sk-box.contrast.featured,.sn-component .sk-circle.contrast.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-button.contrast.featured:before,.sn-component .contrast.featured.sk-box:before,.sn-component .sk-box.contrast.featured:before,.sn-component .sk-circle.contrast.featured:before{opacity:1.0}.sn-component .sk-button.sk-secondary,.sn-component .sk-secondary.sk-box,.sn-component .sk-box.sk-secondary,.sn-component .sk-circle.sk-secondary{color:var(--sn-stylekit-secondary-foreground-color);position:relative;background-color:var(--sn-stylekit-secondary-background-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-secondary-background-color)}.sn-component .sk-button.sk-secondary *,.sn-component .sk-secondary.sk-box *,.sn-component .sk-box.sk-secondary *,.sn-component .sk-circle.sk-secondary *{position:relative}.sn-component .sk-button.sk-secondary:before,.sn-component .sk-secondary.sk-box:before,.sn-component .sk-box.sk-secondary:before,.sn-component .sk-circle.sk-secondary:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-secondary-background-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-button.sk-secondary:after,.sn-component .sk-secondary.sk-box:after,.sn-component .sk-box.sk-secondary:after,.sn-component .sk-circle.sk-secondary:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-secondary-background-color)}.sn-component .sk-button.sk-secondary:hover:before,.sn-component .sk-secondary.sk-box:hover:before,.sn-component .sk-box.sk-secondary:hover:before,.sn-component .sk-circle.sk-secondary:hover:before{filter:brightness(130%)}.sn-component .sk-button.sk-secondary.no-bg,.sn-component .sk-secondary.no-bg.sk-box,.sn-component .sk-box.sk-secondary.no-bg,.sn-component .sk-circle.sk-secondary.no-bg{background-color:transparent}.sn-component .sk-button.sk-secondary.no-bg:before,.sn-component .sk-secondary.no-bg.sk-box:before,.sn-component .sk-box.sk-secondary.no-bg:before,.sn-component .sk-circle.sk-secondary.no-bg:before{content:none}.sn-component .sk-button.sk-secondary.featured,.sn-component .sk-secondary.featured.sk-box,.sn-component .sk-box.sk-secondary.featured,.sn-component .sk-circle.sk-secondary.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-button.sk-secondary.featured:before,.sn-component .sk-secondary.featured.sk-box:before,.sn-component .sk-box.sk-secondary.featured:before,.sn-component .sk-circle.sk-secondary.featured:before{opacity:1.0}.sn-component .sk-button.sk-secondary-contrast,.sn-component .sk-secondary-contrast.sk-box,.sn-component .sk-box.sk-secondary-contrast,.sn-component .sk-circle.sk-secondary-contrast{color:var(--sn-stylekit-secondary-contrast-foreground-color);position:relative;background-color:var(--sn-stylekit-secondary-contrast-background-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-secondary-contrast-background-color)}.sn-component .sk-button.sk-secondary-contrast *,.sn-component .sk-secondary-contrast.sk-box *,.sn-component .sk-box.sk-secondary-contrast *,.sn-component .sk-circle.sk-secondary-contrast *{position:relative}.sn-component .sk-button.sk-secondary-contrast:before,.sn-component .sk-secondary-contrast.sk-box:before,.sn-component .sk-box.sk-secondary-contrast:before,.sn-component .sk-circle.sk-secondary-contrast:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-secondary-contrast-background-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-button.sk-secondary-contrast:after,.sn-component .sk-secondary-contrast.sk-box:after,.sn-component .sk-box.sk-secondary-contrast:after,.sn-component .sk-circle.sk-secondary-contrast:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-secondary-contrast-background-color)}.sn-component .sk-button.sk-secondary-contrast:hover:before,.sn-component .sk-secondary-contrast.sk-box:hover:before,.sn-component .sk-box.sk-secondary-contrast:hover:before,.sn-component .sk-circle.sk-secondary-contrast:hover:before{filter:brightness(130%)}.sn-component .sk-button.sk-secondary-contrast.no-bg,.sn-component .sk-secondary-contrast.no-bg.sk-box,.sn-component .sk-box.sk-secondary-contrast.no-bg,.sn-component .sk-circle.sk-secondary-contrast.no-bg{background-color:transparent}.sn-component .sk-button.sk-secondary-contrast.no-bg:before,.sn-component .sk-secondary-contrast.no-bg.sk-box:before,.sn-component .sk-box.sk-secondary-contrast.no-bg:before,.sn-component .sk-circle.sk-secondary-contrast.no-bg:before{content:none}.sn-component .sk-button.sk-secondary-contrast.featured,.sn-component .sk-secondary-contrast.featured.sk-box,.sn-component .sk-box.sk-secondary-contrast.featured,.sn-component .sk-circle.sk-secondary-contrast.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-button.sk-secondary-contrast.featured:before,.sn-component .sk-secondary-contrast.featured.sk-box:before,.sn-component .sk-box.sk-secondary-contrast.featured:before,.sn-component .sk-circle.sk-secondary-contrast.featured:before{opacity:1.0}.sn-component .sk-button.neutral,.sn-component .neutral.sk-box,.sn-component .sk-box.neutral,.sn-component .sk-circle.neutral{color:var(--sn-stylekit-neutral-contrast-color);position:relative;background-color:var(--sn-stylekit-neutral-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-neutral-color)}.sn-component .sk-button.neutral *,.sn-component .neutral.sk-box *,.sn-component .sk-box.neutral *,.sn-component .sk-circle.neutral *{position:relative}.sn-component .sk-button.neutral:before,.sn-component .neutral.sk-box:before,.sn-component .sk-box.neutral:before,.sn-component .sk-circle.neutral:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-neutral-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-button.neutral:after,.sn-component .neutral.sk-box:after,.sn-component .sk-box.neutral:after,.sn-component .sk-circle.neutral:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-neutral-color)}.sn-component .sk-button.neutral:hover:before,.sn-component .neutral.sk-box:hover:before,.sn-component .sk-box.neutral:hover:before,.sn-component .sk-circle.neutral:hover:before{filter:brightness(130%)}.sn-component .sk-button.neutral.no-bg,.sn-component .neutral.no-bg.sk-box,.sn-component .sk-box.neutral.no-bg,.sn-component .sk-circle.neutral.no-bg{background-color:transparent}.sn-component .sk-button.neutral.no-bg:before,.sn-component .neutral.no-bg.sk-box:before,.sn-component .sk-box.neutral.no-bg:before,.sn-component .sk-circle.neutral.no-bg:before{content:none}.sn-component .sk-button.neutral.featured,.sn-component .neutral.featured.sk-box,.sn-component .sk-box.neutral.featured,.sn-component .sk-circle.neutral.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-button.neutral.featured:before,.sn-component .neutral.featured.sk-box:before,.sn-component .sk-box.neutral.featured:before,.sn-component .sk-circle.neutral.featured:before{opacity:1.0}.sn-component .sk-button.info,.sn-component .info.sk-box,.sn-component .sk-box.info,.sn-component .sk-circle.info{color:var(--sn-stylekit-info-contrast-color);position:relative;background-color:var(--sn-stylekit-info-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-info-color)}.sn-component .sk-button.info *,.sn-component .info.sk-box *,.sn-component .sk-box.info *,.sn-component .sk-circle.info *{position:relative}.sn-component .sk-button.info:before,.sn-component .info.sk-box:before,.sn-component .sk-box.info:before,.sn-component .sk-circle.info:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-info-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-button.info:after,.sn-component .info.sk-box:after,.sn-component .sk-box.info:after,.sn-component .sk-circle.info:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-info-color)}.sn-component .sk-button.info:hover:before,.sn-component .info.sk-box:hover:before,.sn-component .sk-box.info:hover:before,.sn-component .sk-circle.info:hover:before{filter:brightness(130%)}.sn-component .sk-button.info.no-bg,.sn-component .info.no-bg.sk-box,.sn-component .sk-box.info.no-bg,.sn-component .sk-circle.info.no-bg{background-color:transparent}.sn-component .sk-button.info.no-bg:before,.sn-component .info.no-bg.sk-box:before,.sn-component .sk-box.info.no-bg:before,.sn-component .sk-circle.info.no-bg:before{content:none}.sn-component .sk-button.info.featured,.sn-component .info.featured.sk-box,.sn-component .sk-box.info.featured,.sn-component .sk-circle.info.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-button.info.featured:before,.sn-component .info.featured.sk-box:before,.sn-component .sk-box.info.featured:before,.sn-component .sk-circle.info.featured:before{opacity:1.0}.sn-component .sk-button.warning,.sn-component .warning.sk-box,.sn-component .sk-box.warning,.sn-component .sk-circle.warning{color:var(--sn-stylekit-warning-contrast-color);position:relative;background-color:var(--sn-stylekit-warning-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-warning-color)}.sn-component .sk-button.warning *,.sn-component .warning.sk-box *,.sn-component .sk-box.warning *,.sn-component .sk-circle.warning *{position:relative}.sn-component .sk-button.warning:before,.sn-component .warning.sk-box:before,.sn-component .sk-box.warning:before,.sn-component .sk-circle.warning:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-warning-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-button.warning:after,.sn-component .warning.sk-box:after,.sn-component .sk-box.warning:after,.sn-component .sk-circle.warning:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-warning-color)}.sn-component .sk-button.warning:hover:before,.sn-component .warning.sk-box:hover:before,.sn-component .sk-box.warning:hover:before,.sn-component .sk-circle.warning:hover:before{filter:brightness(130%)}.sn-component .sk-button.warning.no-bg,.sn-component .warning.no-bg.sk-box,.sn-component .sk-box.warning.no-bg,.sn-component .sk-circle.warning.no-bg{background-color:transparent}.sn-component .sk-button.warning.no-bg:before,.sn-component .warning.no-bg.sk-box:before,.sn-component .sk-box.warning.no-bg:before,.sn-component .sk-circle.warning.no-bg:before{content:none}.sn-component .sk-button.warning.featured,.sn-component .warning.featured.sk-box,.sn-component .sk-box.warning.featured,.sn-component .sk-circle.warning.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-button.warning.featured:before,.sn-component .warning.featured.sk-box:before,.sn-component .sk-box.warning.featured:before,.sn-component .sk-circle.warning.featured:before{opacity:1.0}.sn-component .sk-button.danger,.sn-component .danger.sk-box,.sn-component .sk-box.danger,.sn-component .sk-circle.danger{color:var(--sn-stylekit-danger-contrast-color);position:relative;background-color:var(--sn-stylekit-danger-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-danger-color)}.sn-component .sk-button.danger *,.sn-component .danger.sk-box *,.sn-component .sk-box.danger *,.sn-component .sk-circle.danger *{position:relative}.sn-component .sk-button.danger:before,.sn-component .danger.sk-box:before,.sn-component .sk-box.danger:before,.sn-component .sk-circle.danger:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-danger-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-button.danger:after,.sn-component .danger.sk-box:after,.sn-component .sk-box.danger:after,.sn-component .sk-circle.danger:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-danger-color)}.sn-component .sk-button.danger:hover:before,.sn-component .danger.sk-box:hover:before,.sn-component .sk-box.danger:hover:before,.sn-component .sk-circle.danger:hover:before{filter:brightness(130%)}.sn-component .sk-button.danger.no-bg,.sn-component .danger.no-bg.sk-box,.sn-component .sk-box.danger.no-bg,.sn-component .sk-circle.danger.no-bg{background-color:transparent}.sn-component .sk-button.danger.no-bg:before,.sn-component .danger.no-bg.sk-box:before,.sn-component .sk-box.danger.no-bg:before,.sn-component .sk-circle.danger.no-bg:before{content:none}.sn-component .sk-button.danger.featured,.sn-component .danger.featured.sk-box,.sn-component .sk-box.danger.featured,.sn-component .sk-circle.danger.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-button.danger.featured:before,.sn-component .danger.featured.sk-box:before,.sn-component .sk-box.danger.featured:before,.sn-component .sk-circle.danger.featured:before{opacity:1.0}.sn-component .sk-button.success,.sn-component .success.sk-box,.sn-component .sk-box.success,.sn-component .sk-circle.success{color:var(--sn-stylekit-success-contrast-color);position:relative;background-color:var(--sn-stylekit-success-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-success-color)}.sn-component .sk-button.success *,.sn-component .success.sk-box *,.sn-component .sk-box.success *,.sn-component .sk-circle.success *{position:relative}.sn-component .sk-button.success:before,.sn-component .success.sk-box:before,.sn-component .sk-box.success:before,.sn-component .sk-circle.success:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-success-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-button.success:after,.sn-component .success.sk-box:after,.sn-component .sk-box.success:after,.sn-component .sk-circle.success:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-success-color)}.sn-component .sk-button.success:hover:before,.sn-component .success.sk-box:hover:before,.sn-component .sk-box.success:hover:before,.sn-component .sk-circle.success:hover:before{filter:brightness(130%)}.sn-component .sk-button.success.no-bg,.sn-component .success.no-bg.sk-box,.sn-component .sk-box.success.no-bg,.sn-component .sk-circle.success.no-bg{background-color:transparent}.sn-component .sk-button.success.no-bg:before,.sn-component .success.no-bg.sk-box:before,.sn-component .sk-box.success.no-bg:before,.sn-component .sk-circle.success.no-bg:before{content:none}.sn-component .sk-button.success.featured,.sn-component .success.featured.sk-box,.sn-component .sk-box.success.featured,.sn-component .sk-circle.success.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-button.success.featured:before,.sn-component .success.featured.sk-box:before,.sn-component .sk-box.success.featured:before,.sn-component .sk-circle.success.featured:before{opacity:1.0}.sn-component .sk-notification.contrast,.sn-component .sk-input.contrast{color:var(--sn-stylekit-contrast-foreground-color);position:relative;background-color:var(--sn-stylekit-contrast-background-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-contrast-border-color);border:1px solid var(--sn-stylekit-contrast-border-color)}.sn-component .sk-notification.contrast *,.sn-component .sk-input.contrast *{position:relative}.sn-component .sk-notification.contrast:before,.sn-component .sk-input.contrast:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-contrast-background-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-notification.contrast:after,.sn-component .sk-input.contrast:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;color:var(--sn-stylekit-contrast-border-color);border-color:var(--sn-stylekit-contrast-border-color)}.sn-component .sk-notification.contrast.no-bg,.sn-component .sk-input.contrast.no-bg{background-color:transparent}.sn-component .sk-notification.contrast.no-bg:before,.sn-component .sk-input.contrast.no-bg:before{content:none}.sn-component .sk-notification.contrast.featured,.sn-component .sk-input.contrast.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-notification.contrast.featured:before,.sn-component .sk-input.contrast.featured:before{opacity:1.0}.sn-component .sk-notification.sk-secondary,.sn-component .sk-input.sk-secondary{color:var(--sn-stylekit-secondary-foreground-color);position:relative;background-color:var(--sn-stylekit-secondary-background-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-secondary-border-color);border:1px solid var(--sn-stylekit-secondary-border-color)}.sn-component .sk-notification.sk-secondary *,.sn-component .sk-input.sk-secondary *{position:relative}.sn-component .sk-notification.sk-secondary:before,.sn-component .sk-input.sk-secondary:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-secondary-background-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-notification.sk-secondary:after,.sn-component .sk-input.sk-secondary:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;color:var(--sn-stylekit-secondary-border-color);border-color:var(--sn-stylekit-secondary-border-color)}.sn-component .sk-notification.sk-secondary.no-bg,.sn-component .sk-input.sk-secondary.no-bg{background-color:transparent}.sn-component .sk-notification.sk-secondary.no-bg:before,.sn-component .sk-input.sk-secondary.no-bg:before{content:none}.sn-component .sk-notification.sk-secondary.featured,.sn-component .sk-input.sk-secondary.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-notification.sk-secondary.featured:before,.sn-component .sk-input.sk-secondary.featured:before{opacity:1.0}.sn-component .sk-notification.sk-secondary-contrast,.sn-component .sk-input.sk-secondary-contrast{color:var(--sn-stylekit-secondary-contrast-foreground-color);position:relative;background-color:var(--sn-stylekit-secondary-contrast-background-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-secondary-contrast-border-color);border:1px solid var(--sn-stylekit-secondary-contrast-border-color)}.sn-component .sk-notification.sk-secondary-contrast *,.sn-component .sk-input.sk-secondary-contrast *{position:relative}.sn-component .sk-notification.sk-secondary-contrast:before,.sn-component .sk-input.sk-secondary-contrast:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-secondary-contrast-background-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-notification.sk-secondary-contrast:after,.sn-component .sk-input.sk-secondary-contrast:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;color:var(--sn-stylekit-secondary-contrast-border-color);border-color:var(--sn-stylekit-secondary-contrast-border-color)}.sn-component .sk-notification.sk-secondary-contrast.no-bg,.sn-component .sk-input.sk-secondary-contrast.no-bg{background-color:transparent}.sn-component .sk-notification.sk-secondary-contrast.no-bg:before,.sn-component .sk-input.sk-secondary-contrast.no-bg:before{content:none}.sn-component .sk-notification.sk-secondary-contrast.featured,.sn-component .sk-input.sk-secondary-contrast.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-notification.sk-secondary-contrast.featured:before,.sn-component .sk-input.sk-secondary-contrast.featured:before{opacity:1.0}.sn-component .sk-notification.sk-base,.sn-component .sk-input.sk-base{color:var(--sn-stylekit-foreground-color);position:relative;background-color:var(--sn-stylekit-background-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-border-color);border:1px solid var(--sn-stylekit-border-color)}.sn-component .sk-notification.sk-base *,.sn-component .sk-input.sk-base *{position:relative}.sn-component .sk-notification.sk-base:before,.sn-component .sk-input.sk-base:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-background-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-notification.sk-base:after,.sn-component .sk-input.sk-base:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;color:var(--sn-stylekit-border-color);border-color:var(--sn-stylekit-border-color)}.sn-component .sk-notification.sk-base.no-bg,.sn-component .sk-input.sk-base.no-bg{background-color:transparent}.sn-component .sk-notification.sk-base.no-bg:before,.sn-component .sk-input.sk-base.no-bg:before{content:none}.sn-component .sk-notification.sk-base.featured,.sn-component .sk-input.sk-base.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-notification.sk-base.featured:before,.sn-component .sk-input.sk-base.featured:before{opacity:1.0}.sn-component .sk-notification.neutral,.sn-component .sk-input.neutral{color:var(--sn-stylekit-neutral-contrast-color);position:relative;background-color:var(--sn-stylekit-neutral-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-neutral-color)}.sn-component .sk-notification.neutral *,.sn-component .sk-input.neutral *{position:relative}.sn-component .sk-notification.neutral:before,.sn-component .sk-input.neutral:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-neutral-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-notification.neutral:after,.sn-component .sk-input.neutral:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-neutral-color)}.sn-component .sk-notification.neutral.no-bg,.sn-component .sk-input.neutral.no-bg{background-color:transparent}.sn-component .sk-notification.neutral.no-bg:before,.sn-component .sk-input.neutral.no-bg:before{content:none}.sn-component .sk-notification.neutral.featured,.sn-component .sk-input.neutral.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-notification.neutral.featured:before,.sn-component .sk-input.neutral.featured:before{opacity:1.0}.sn-component .sk-notification.info,.sn-component .sk-input.info{color:var(--sn-stylekit-info-contrast-color);position:relative;background-color:var(--sn-stylekit-info-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-info-color)}.sn-component .sk-notification.info *,.sn-component .sk-input.info *{position:relative}.sn-component .sk-notification.info:before,.sn-component .sk-input.info:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-info-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-notification.info:after,.sn-component .sk-input.info:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-info-color)}.sn-component .sk-notification.info.no-bg,.sn-component .sk-input.info.no-bg{background-color:transparent}.sn-component .sk-notification.info.no-bg:before,.sn-component .sk-input.info.no-bg:before{content:none}.sn-component .sk-notification.info.featured,.sn-component .sk-input.info.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-notification.info.featured:before,.sn-component .sk-input.info.featured:before{opacity:1.0}.sn-component .sk-notification.warning,.sn-component .sk-input.warning{color:var(--sn-stylekit-warning-contrast-color);position:relative;background-color:var(--sn-stylekit-warning-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-warning-color)}.sn-component .sk-notification.warning *,.sn-component .sk-input.warning *{position:relative}.sn-component .sk-notification.warning:before,.sn-component .sk-input.warning:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-warning-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-notification.warning:after,.sn-component .sk-input.warning:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-warning-color)}.sn-component .sk-notification.warning.no-bg,.sn-component .sk-input.warning.no-bg{background-color:transparent}.sn-component .sk-notification.warning.no-bg:before,.sn-component .sk-input.warning.no-bg:before{content:none}.sn-component .sk-notification.warning.featured,.sn-component .sk-input.warning.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-notification.warning.featured:before,.sn-component .sk-input.warning.featured:before{opacity:1.0}.sn-component .sk-notification.danger,.sn-component .sk-input.danger{color:var(--sn-stylekit-danger-contrast-color);position:relative;background-color:var(--sn-stylekit-danger-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-danger-color)}.sn-component .sk-notification.danger *,.sn-component .sk-input.danger *{position:relative}.sn-component .sk-notification.danger:before,.sn-component .sk-input.danger:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-danger-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-notification.danger:after,.sn-component .sk-input.danger:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-danger-color)}.sn-component .sk-notification.danger.no-bg,.sn-component .sk-input.danger.no-bg{background-color:transparent}.sn-component .sk-notification.danger.no-bg:before,.sn-component .sk-input.danger.no-bg:before{content:none}.sn-component .sk-notification.danger.featured,.sn-component .sk-input.danger.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-notification.danger.featured:before,.sn-component .sk-input.danger.featured:before{opacity:1.0}.sn-component .sk-notification.success,.sn-component .sk-input.success{color:var(--sn-stylekit-success-contrast-color);position:relative;background-color:var(--sn-stylekit-success-color);overflow:hidden;border-radius:var(--sn-stylekit-general-border-radius);border-color:var(--sn-stylekit-success-color)}.sn-component .sk-notification.success *,.sn-component .sk-input.success *{position:relative}.sn-component .sk-notification.success:before,.sn-component .sk-input.success:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sn-stylekit-success-color);opacity:1.0;border-radius:var(--sn-stylekit-general-border-radius)}.sn-component .sk-notification.success:after,.sn-component .sk-input.success:after{content:'';display:block;height:100%;position:absolute;top:0;left:0;width:100%;border-radius:var(--sn-stylekit-general-border-radius);pointer-events:none;box-shadow:inset 0 0 0 1px;color:var(--sn-stylekit-success-color)}.sn-component .sk-notification.success.no-bg,.sn-component .sk-input.success.no-bg{background-color:transparent}.sn-component .sk-notification.success.no-bg:before,.sn-component .sk-input.success.no-bg:before{content:none}.sn-component .sk-notification.success.featured,.sn-component .sk-input.success.featured{border:none;padding:0.75rem 1.25rem;font-size:var(--sn-stylekit-font-size-h3)}.sn-component .sk-notification.success.featured:before,.sn-component .sk-input.success.featured:before{opacity:1.0}.sn-component .sk-notification{padding:1.1rem 1rem;margin:1.4rem 0;text-align:left;cursor:default}.sn-component .sk-notification.one-line{padding:0rem 0.4rem}.sn-component .sk-notification.stretch{width:100%}.sn-component .sk-notification.dashed{border-style:dashed;border-width:2px}.sn-component .sk-notification.dashed:after{box-shadow:none}.sn-component .sk-notification .sk-notification-title{font-size:var(--sn-stylekit-font-size-h1);font-weight:bold;line-height:1.9rem}.sn-component .sk-notification .sk-notification-text{line-height:1.5rem;font-size:var(--sn-stylekit-font-size-p);text-align:left;font-weight:normal}.sn-component .sk-circle{border:1px solid;cursor:pointer;border-color:var(--sn-stylekit-contrast-foreground-color);background-color:var(--sn-stylekit-contrast-background-color);padding:0;border-radius:50% !important;flex-shrink:0}.sn-component .sk-circle:before{border-radius:50% !important}.sn-component .sk-circle:after{border-radius:50% !important}.sn-component .sk-circle.small{width:11px;height:11px}.sn-component .sk-spinner{border:1px solid var(--sn-stylekit-neutral-color);border-radius:50%;animation:rotate 0.8s infinite linear;border-right-color:transparent}.sn-component .sk-spinner.small{width:12px;height:12px}.sn-component .sk-spinner.info-contrast{border-color:var(--sn-stylekit-info-contrast-color);border-right-color:transparent}.sn-component .sk-spinner.info{border-color:var(--sn-stylekit-info-color);border-right-color:transparent}.sn-component .sk-spinner.warning{border-color:var(--sn-stylekit-warning-color);border-right-color:transparent}.sn-component .sk-spinner.danger{border-color:var(--sn-stylekit-danger-color);border-right-color:transparent}.sn-component .sk-spinner.success{border-color:var(--sn-stylekit-success-color);border-right-color:transparent}@keyframes rotate{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.sn-component .sk-app-bar{display:flex;width:100%;height:2rem;padding:0.0rem 0.8rem;background-color:var(--sn-stylekit-contrast-background-color);color:var(--sn-stylekit-contrast-foreground-color);justify-content:space-between;align-items:center;border:1px solid var(--sn-stylekit-contrast-border-color);user-select:none}.sn-component .sk-app-bar.no-edges{border-left:0;border-right:0}.sn-component .sk-app-bar.no-bottom-edge{border-bottom:0}.sn-component .sk-app-bar .left,.sn-component .sk-app-bar .right{display:flex;height:100%}.sn-component .sk-app-bar .sk-app-bar-item{flex-grow:1;cursor:pointer;display:flex;align-items:center;justify-content:center}.sn-component .sk-app-bar .sk-app-bar-item:not(:first-child){margin-left:1rem}.sn-component .sk-app-bar .sk-app-bar-item.border{border-left:1px solid var(--sn-stylekit-contrast-border-color)}.sn-component .sk-app-bar .sk-app-bar-item>.sk-app-bar-item-column{height:100%;display:flex;align-items:center}.sn-component .sk-app-bar .sk-app-bar-item>.sk-app-bar-item-column:not(:first-child){margin-left:0.5rem}.sn-component .sk-app-bar .sk-app-bar-item>.sk-app-bar-item-column.underline{border-bottom:2px solid var(--sn-stylekit-info-color)}.sn-component .sk-app-bar .sk-app-bar-item.no-pointer{cursor:default}.sn-component .sk-app-bar .sk-app-bar-item:hover>.sk-label:not(.subtle),.sn-component .sk-app-bar .sk-panel-section .sk-app-bar-item:hover>.sk-panel-section-subtitle:not(.subtle),.sn-component .sk-panel-section .sk-app-bar .sk-app-bar-item:hover>.sk-panel-section-subtitle:not(.subtle),.sn-component .sk-app-bar .sk-app-bar-item:hover>.sk-sublabel:not(.subtle),.sn-component .sk-app-bar .sk-app-bar-item:hover>.sk-app-bar-item-column>.sk-label:not(.subtle),.sn-component .sk-app-bar .sk-panel-section .sk-app-bar-item:hover>.sk-app-bar-item-column>.sk-panel-section-subtitle:not(.subtle),.sn-component .sk-panel-section .sk-app-bar .sk-app-bar-item:hover>.sk-app-bar-item-column>.sk-panel-section-subtitle:not(.subtle),.sn-component .sk-app-bar .sk-app-bar-item:hover>.sk-app-bar-item-column>.sk-sublabel:not(.subtle){color:var(--sn-stylekit-info-color)}.sn-component .sk-app-bar .sk-app-bar-item>.sk-label,.sn-component .sk-app-bar .sk-panel-section .sk-app-bar-item>.sk-panel-section-subtitle,.sn-component .sk-panel-section .sk-app-bar .sk-app-bar-item>.sk-panel-section-subtitle,.sn-component .sk-app-bar .sk-app-bar-item>.sk-app-bar-item-column>.sk-label,.sn-component .sk-app-bar .sk-panel-section .sk-app-bar-item>.sk-app-bar-item-column>.sk-panel-section-subtitle,.sn-component .sk-panel-section .sk-app-bar .sk-app-bar-item>.sk-app-bar-item-column>.sk-panel-section-subtitle{font-weight:bold;font-size:var(--sn-stylekit-font-size-h5);white-space:nowrap}.sn-component .sk-app-bar .sk-app-bar-item>.sk-sublabel,.sn-component .sk-app-bar .sk-app-bar-item>.sk-app-bar-item-column>.sk-sublabel{font-size:var(--sn-stylekit-font-size-h5);font-weight:normal;white-space:nowrap}.sn-component .sk-app-bar .sk-app-bar-item .subtle{font-weight:normal;opacity:0.6}.sn-component .sk-panel-table{display:flex;flex-wrap:wrap;padding-left:1px;padding-top:1px}.sn-component .sk-panel-table .sk-panel-table-item{flex:45%;flex-flow:wrap;border:1px solid var(--sn-stylekit-border-color);padding:1rem;margin-left:-1px;margin-top:-1px;display:flex;flex-direction:column;justify-content:space-between}.sn-component .sk-panel-table .sk-panel-table-item img{max-width:100%;margin-bottom:1rem}.sn-component .sk-panel-table .sk-panel-table-item .sk-panel-table-item-content{display:flex;flex-direction:row}.sn-component .sk-panel-table .sk-panel-table-item .sk-panel-table-item-column{align-items:center}.sn-component .sk-panel-table .sk-panel-table-item .sk-panel-table-item-column.stretch{width:100%}.sn-component .sk-panel-table .sk-panel-table-item .sk-panel-table-item-column:not(:first-child){padding-left:0.75rem}.sn-component .sk-panel-table .sk-panel-table-item .sk-panel-table-item-column.quarter{flex-basis:25%}.sn-component .sk-panel-table .sk-panel-table-item .sk-panel-table-item-column.three-quarters{flex-basis:75%}.sn-component .sk-panel-table .sk-panel-table-item .sk-panel-table-item-footer{margin-top:1.25rem}.sn-component .sk-panel-table .sk-panel-table-item.no-border{border:none}.sn-component .sk-modal{position:fixed;margin-left:auto;margin-right:auto;left:0;right:0;top:0;bottom:0;z-index:10000;width:100vw;height:100vh;background-color:transparent;color:var(--sn-stylekit-contrast-foreground-color);display:flex;align-items:center;justify-content:center}.sn-component .sk-modal .sn-component{height:100%}.sn-component .sk-modal .sn-component .sk-panel{height:100%}.sn-component .sk-modal.auto-height>.sk-modal-content{height:auto !important}.sn-component .sk-modal.large>.sk-modal-content{width:900px;height:600px}.sn-component .sk-modal.medium>.sk-modal-content{width:700px;height:500px}.sn-component .sk-modal.small>.sk-modal-content{width:700px;height:344px}.sn-component .sk-modal .sk-modal-background{position:absolute;z-index:-1;width:100%;height:100%;background-color:var(--sn-stylekit-contrast-background-color);opacity:0.7}.sn-component .sk-modal>.sk-modal-content{overflow-y:auto;width:auto;padding:0;padding-bottom:0;min-width:300px;-webkit-box-shadow:0px 2px 35px 0px rgba(0,0,0,0.19);-moz-box-shadow:0px 2px 35px 0px rgba(0,0,0,0.19);box-shadow:0px 2px 35px 0px rgba(0,0,0,0.19)}.sn-component.no-select{user-select:none}input,textarea,[contenteditable]{caret-color:var(--sn-stylekit-editor-foreground-color)}.windows-web ::-webkit-scrollbar,.windows-desktop ::-webkit-scrollbar,.linux-web ::-webkit-scrollbar,.linux-desktop ::-webkit-scrollbar{width:17px;height:18px;border-left:0.5px solid var(--sn-stylekit-scrollbar-track-border-color-color)}.windows-web ::-webkit-scrollbar-thumb,.windows-desktop ::-webkit-scrollbar-thumb,.linux-web ::-webkit-scrollbar-thumb,.linux-desktop ::-webkit-scrollbar-thumb{border:4px solid rgba(0,0,0,0);background-clip:padding-box;-webkit-border-radius:10px;background-color:var(--sn-stylekit-scrollbar-thumb-color);-webkit-box-shadow:inset -1px -1px 0px rgba(0,0,0,0.05),inset 1px 1px 0px rgba(0,0,0,0.05)}.windows-web ::-webkit-scrollbar-button,.windows-desktop ::-webkit-scrollbar-button,.linux-web ::-webkit-scrollbar-button,.linux-desktop ::-webkit-scrollbar-button{width:0;height:0;display:none}.windows-web ::-webkit-scrollbar-corner,.windows-desktop ::-webkit-scrollbar-corner,.linux-web ::-webkit-scrollbar-corner,.linux-desktop ::-webkit-scrollbar-corner{background-color:transparent} 354 | body, html { 355 | font-family: var(--sn-stylekit-sans-serif-font); 356 | font-size: var(--sn-stylekit-base-font-size); 357 | height: 100%; 358 | margin: 0; 359 | background-color: transparent; 360 | } 361 | 362 | * { 363 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0); 364 | } 365 | 366 | #wrapper { 367 | display: flex; 368 | flex-direction: column; 369 | position: relative; 370 | height: 100%; 371 | overflow: hidden; 372 | } 373 | 374 | .CodeMirror-scroll { 375 | padding: 8px; 376 | } 377 | 378 | .CodeMirror { 379 | background-color: var(--sn-stylekit-editor-background-color) !important; 380 | color: var(--sn-stylekit-editor-foreground-color) !important; 381 | border: 0 !important; 382 | font-family: var(--sn-stylekit-sans-serif-font); 383 | -webkit-overflow-scrolling: touch; 384 | flex: 1 1 auto; 385 | width: 100%; 386 | height: 100%; 387 | resize: none; 388 | font-size: var(--sn-stylekit-font-size-editor); 389 | padding: 0; 390 | } 391 | .CodeMirror .cm-comment { 392 | background: var(--sn-stylekit-contrast-background-color); 393 | color: var(--sn-stylekit-info-color); 394 | font-family: var(--sn-stylekit-monospace-font) !important; 395 | font-size: 95%; 396 | } 397 | .CodeMirror .cm-comment.CodeMirror-selectedtext { 398 | color: var(--sn-stylekit-info-contrast-color) !important; 399 | background: var(--sn-stylekit-info-color) !important; 400 | } 401 | .CodeMirror .cm-link { 402 | color: var(--sn-stylekit-info-color) !important; 403 | } 404 | .CodeMirror .cm-link.CodeMirror-selectedtext { 405 | color: var(--sn-stylekit-info-contrast-color) !important; 406 | background: var(--sn-stylekit-info-color) !important; 407 | } 408 | .CodeMirror .CodeMirror-linenumber { 409 | color: gray !important; 410 | } 411 | 412 | .CodeMirror-cursor { 413 | border-color: var(--sn-stylekit-editor-foreground-color); 414 | } 415 | 416 | .CodeMirror-gutters { 417 | background-color: var(--sn-stylekit-background-color) !important; 418 | color: var(--sn-stylekit-editor-foreground-color) !important; 419 | border-color: var(--sn-stylekit-border-color) !important; 420 | } 421 | 422 | .cm-header-1 { 423 | font-weight: bold; 424 | font-size: 135%; 425 | } 426 | 427 | .cfg-color-headers .cm-header-1 { 428 | color: var(--sn-stylekit-info-color); 429 | } 430 | 431 | .cm-formatting-header-1 { 432 | opacity: 0.3; 433 | font-size: 90%; 434 | } 435 | .cm-formatting-header-1::after { 436 | content: ''; 437 | font-size: 150%; 438 | } 439 | 440 | .cm-header-2 { 441 | font-weight: bold; 442 | font-size: 120%; 443 | } 444 | 445 | .cfg-color-headers .cm-header-2 { 446 | color: var(--sn-stylekit-info-color); 447 | } 448 | 449 | .cm-formatting-header-2 { 450 | opacity: 0.3; 451 | font-size: 90%; 452 | } 453 | .cm-formatting-header-2::after { 454 | content: ''; 455 | font-size: 133.3333333333%; 456 | } 457 | 458 | .cm-header-3 { 459 | font-weight: bold; 460 | font-size: 100%; 461 | } 462 | 463 | .cfg-color-headers .cm-header-3 { 464 | color: var(--sn-stylekit-info-color); 465 | } 466 | 467 | .cm-formatting-header-3 { 468 | opacity: 0.3; 469 | font-size: 90%; 470 | } 471 | .cm-formatting-header-3::after { 472 | content: ''; 473 | font-size: 111.1111111111%; 474 | } 475 | 476 | .cm-header-4 { 477 | font-weight: bold; 478 | font-size: 100%; 479 | } 480 | 481 | .cfg-color-headers .cm-header-4 { 482 | color: var(--sn-stylekit-info-color); 483 | } 484 | 485 | .cm-formatting-header-4 { 486 | opacity: 0.3; 487 | font-size: 90%; 488 | } 489 | .cm-formatting-header-4::after { 490 | content: ''; 491 | font-size: 111.1111111111%; 492 | } 493 | 494 | .colored-like-header { 495 | color: var(--sn-stylekit-info-color); 496 | } 497 | 498 | .CodeMirror .blank-line { 499 | line-height: 0.4em !important; 500 | } 501 | 502 | .CodeMirror { 503 | font-size: 16px; 504 | } 505 | 506 | .CodeMirror pre.CodeMirror-line { 507 | padding: 2px 0; 508 | line-height: 1.2; 509 | } 510 | 511 | .CodeMirror pre.comment-block-line { 512 | padding: 0; 513 | line-height: normal; 514 | font-family: var(--sn-stylekit-monospace-font) !important; 515 | } 516 | 517 | .cm-leadingspace { 518 | font-family: var(--sn-stylekit-monospace-font); 519 | line-height: 0.1; 520 | } 521 | 522 | .cm-tab { 523 | text-indent: 0; 524 | padding: 0; 525 | } 526 | 527 | .cm-line-is-wrapped { 528 | max-width: 50em; 529 | } 530 | 531 | .cm-line-is-wrapped.comment-block-line { 532 | max-width: initial; 533 | } 534 | 535 | .CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { 536 | background: var(--sn-stylekit-info-color); 537 | color: var(--sn-stylekit-info-contrast-color); 538 | } 539 | 540 | .CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { 541 | background: var(--sn-stylekit-info-color); 542 | color: var(--sn-stylekit-info-contrast-color); 543 | } 544 | 545 | .CodeMirror-selected { 546 | background: var(--sn-stylekit-info-color) !important; 547 | } 548 | 549 | .CodeMirror-selectedtext { 550 | color: var(--sn-stylekit-info-contrast-color) !important; 551 | background: var(--sn-stylekit-info-color) !important; 552 | } 553 | 554 | .CodeMirror.use-monospace-everywhere { 555 | font-family: var(--sn-stylekit-monospace-font); 556 | } 557 | 558 | .CodeMirror.remove-longer-lines .CodeMirror-lines { 559 | max-width: 50em; 560 | } 561 | 562 | #config-panel { 563 | color: var(--sn-stylekit-editor-foreground-color) !important; 564 | } 565 | 566 | #config-panel a { 567 | color: var(--sn-stylekit-info-color) !important; 568 | } 569 | -------------------------------------------------------------------------------- /dist/sn-codemirror-search/dialog/dialog.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-dialog { 2 | position: absolute; 3 | left: 0; right: 0; 4 | background: var(--sn-stylekit-contrast-background-color); 5 | z-index: 15; 6 | padding: .3em .8em; 7 | overflow: hidden; 8 | color: inherit; 9 | } 10 | 11 | .CodeMirror-dialog-top { 12 | border-bottom: 1px solid var(--sn-stylekit-border-color); 13 | top: 0; 14 | } 15 | 16 | .CodeMirror-dialog-bottom { 17 | border-top: 1px solid var(--sn-stylekit-border-color); 18 | bottom: 0; 19 | } 20 | 21 | .CodeMirror-search-label { 22 | font-size: var(--sn-stylekit-base-font-size); 23 | font-weight: bold; 24 | } 25 | 26 | .CodeMirror-search-hint { 27 | font-size: var(--sn-stylekit-base-font-size); 28 | display: none; 29 | } 30 | 31 | .CodeMirror-search-field { 32 | width: 65% !important; 33 | } 34 | 35 | .CodeMirror-dialog input { 36 | border: none; 37 | outline: none; 38 | background: transparent; 39 | color: var(--sn-stylekit-contrast-foreground-color); 40 | font-size: var(--sn-stylekit-base-font-size); 41 | font-family: monospace; 42 | } 43 | 44 | .CodeMirror-dialog button { 45 | font-size: 70%; 46 | } 47 | -------------------------------------------------------------------------------- /dist/sn-codemirror-search/dialog/dialog.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | // Open simple dialogs on top of an editor. Relies on dialog.css. 5 | 6 | (function(mod) { 7 | if (typeof exports == "object" && typeof module == "object") // CommonJS 8 | mod(require("../../lib/codemirror")); 9 | else if (typeof define == "function" && define.amd) // AMD 10 | define(["../../lib/codemirror"], mod); 11 | else // Plain browser env 12 | mod(CodeMirror); 13 | })(function(CodeMirror) { 14 | function dialogDiv(cm, template, bottom) { 15 | var wrap = cm.getWrapperElement(); 16 | var dialog; 17 | dialog = wrap.appendChild(document.createElement("div")); 18 | if (bottom) 19 | dialog.className = "CodeMirror-dialog CodeMirror-dialog-bottom"; 20 | else 21 | dialog.className = "CodeMirror-dialog CodeMirror-dialog-top"; 22 | 23 | if (typeof template == "string") { 24 | dialog.innerHTML = template; 25 | } else { // Assuming it's a detached DOM element. 26 | dialog.appendChild(template); 27 | } 28 | CodeMirror.addClass(wrap, 'dialog-opened'); 29 | return dialog; 30 | } 31 | 32 | function closeNotification(cm, newVal) { 33 | if (cm.state.currentNotificationClose) 34 | cm.state.currentNotificationClose(); 35 | cm.state.currentNotificationClose = newVal; 36 | } 37 | 38 | CodeMirror.defineExtension("openDialog", function(template, callback, options) { 39 | if (!options) options = {}; 40 | 41 | closeNotification(this, null); 42 | 43 | var dialog = dialogDiv(this, template, options.bottom); 44 | var closed = false, me = this; 45 | function close(newVal) { 46 | if (typeof newVal == 'string') { 47 | inp.value = newVal; 48 | } else { 49 | if (closed) return; 50 | closed = true; 51 | CodeMirror.rmClass(dialog.parentNode, 'dialog-opened'); 52 | dialog.parentNode.removeChild(dialog); 53 | me.focus(); 54 | 55 | if (options.onClose) options.onClose(dialog); 56 | } 57 | } 58 | 59 | var inp = dialog.getElementsByTagName("input")[0], button; 60 | if (inp) { 61 | inp.focus(); 62 | 63 | if (options.value) { 64 | inp.value = options.value; 65 | if (options.selectValueOnOpen !== false) { 66 | inp.select(); 67 | } 68 | } 69 | 70 | if (options.onInput) 71 | CodeMirror.on(inp, "input", function(e) { options.onInput(e, inp.value, close);}); 72 | if (options.onKeyUp) 73 | CodeMirror.on(inp, "keyup", function(e) {options.onKeyUp(e, inp.value, close);}); 74 | 75 | CodeMirror.on(inp, "keydown", function(e) { 76 | if (options && options.onKeyDown && options.onKeyDown(e, inp.value, close)) { return; } 77 | if (e.keyCode == 27 || (options.closeOnEnter !== false && e.keyCode == 13)) { 78 | inp.blur(); 79 | CodeMirror.e_stop(e); 80 | close(); 81 | } 82 | if (e.keyCode == 13) callback(inp.value, e); 83 | }); 84 | 85 | if (options.closeOnBlur !== false) CodeMirror.on(inp, "blur", close); 86 | } else if (button = dialog.getElementsByTagName("button")[0]) { 87 | CodeMirror.on(button, "click", function() { 88 | close(); 89 | me.focus(); 90 | }); 91 | 92 | if (options.closeOnBlur !== false) CodeMirror.on(button, "blur", close); 93 | 94 | button.focus(); 95 | } 96 | return close; 97 | }); 98 | 99 | CodeMirror.defineExtension("openConfirm", function(template, callbacks, options) { 100 | closeNotification(this, null); 101 | var dialog = dialogDiv(this, template, options && options.bottom); 102 | var buttons = dialog.getElementsByTagName("button"); 103 | var closed = false, me = this, blurring = 1; 104 | function close() { 105 | if (closed) return; 106 | closed = true; 107 | CodeMirror.rmClass(dialog.parentNode, 'dialog-opened'); 108 | dialog.parentNode.removeChild(dialog); 109 | me.focus(); 110 | } 111 | buttons[0].focus(); 112 | for (var i = 0; i < buttons.length; ++i) { 113 | var b = buttons[i]; 114 | (function(callback) { 115 | CodeMirror.on(b, "click", function(e) { 116 | CodeMirror.e_preventDefault(e); 117 | close(); 118 | if (callback) callback(me); 119 | }); 120 | })(callbacks[i]); 121 | CodeMirror.on(b, "blur", function() { 122 | --blurring; 123 | setTimeout(function() { if (blurring <= 0) close(); }, 200); 124 | }); 125 | CodeMirror.on(b, "focus", function() { ++blurring; }); 126 | } 127 | }); 128 | 129 | /* 130 | * openNotification 131 | * Opens a notification, that can be closed with an optional timer 132 | * (default 5000ms timer) and always closes on click. 133 | * 134 | * If a notification is opened while another is opened, it will close the 135 | * currently opened one and open the new one immediately. 136 | */ 137 | CodeMirror.defineExtension("openNotification", function(template, options) { 138 | closeNotification(this, close); 139 | var dialog = dialogDiv(this, template, options && options.bottom); 140 | var closed = false, doneTimer; 141 | var duration = options && typeof options.duration !== "undefined" ? options.duration : 5000; 142 | 143 | function close() { 144 | if (closed) return; 145 | closed = true; 146 | clearTimeout(doneTimer); 147 | CodeMirror.rmClass(dialog.parentNode, 'dialog-opened'); 148 | dialog.parentNode.removeChild(dialog); 149 | } 150 | 151 | CodeMirror.on(dialog, 'click', function(e) { 152 | CodeMirror.e_preventDefault(e); 153 | close(); 154 | }); 155 | 156 | if (duration) 157 | doneTimer = setTimeout(close, duration); 158 | 159 | return close; 160 | }); 161 | }); 162 | -------------------------------------------------------------------------------- /dist/sn-codemirror-search/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "sn-codemirror-search@1.0.0", 3 | "_id": "sn-codemirror-search@1.0.0", 4 | "_inBundle": false, 5 | "_integrity": "sha512-T8WAFgdhChF91ZHX2ELGy48kzulMgzwTWA5p1QqMHOZDbgi23i3XWflNzcwPdKw8Px0DIRwpJ6ffQfcft0LMbQ==", 6 | "_location": "/sn-codemirror-search", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "version", 10 | "registry": true, 11 | "raw": "sn-codemirror-search@1.0.0", 12 | "name": "sn-codemirror-search", 13 | "escapedName": "sn-codemirror-search", 14 | "rawSpec": "1.0.0", 15 | "saveSpec": null, 16 | "fetchSpec": "1.0.0" 17 | }, 18 | "_requiredBy": [ 19 | "/" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/sn-codemirror-search/-/sn-codemirror-search-1.0.0.tgz", 22 | "_shasum": "13c06b2cead6a3670eabdbffadd69d839ea53c3f", 23 | "_spec": "sn-codemirror-search@1.0.0", 24 | "_where": "/home/max/projects/standard-notes-indent-text", 25 | "author": "", 26 | "bugs": { 27 | "url": "https://github.com/mobitar/CodeMirror-search/issues" 28 | }, 29 | "bundleDependencies": false, 30 | "deprecated": false, 31 | "description": "", 32 | "homepage": "https://github.com/mobitar/CodeMirror-search#readme", 33 | "main": "search.js", 34 | "name": "sn-codemirror-search", 35 | "repository": { 36 | "type": "git", 37 | "url": "git+https://github.com/mobitar/CodeMirror-search.git" 38 | }, 39 | "scripts": { 40 | "test": "echo \"Error: no test specified\" && exit 1" 41 | }, 42 | "version": "1.0.0" 43 | } 44 | -------------------------------------------------------------------------------- /dist/sn-codemirror-search/search.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | // Define search commands. Depends on dialog.js or another 5 | // implementation of the openDialog method. 6 | 7 | // Replace works a little oddly -- it will do the replace on the next 8 | // Ctrl-G (or whatever is bound to findNext) press. You prevent a 9 | // replace by making sure the match is no longer selected when hitting 10 | // Ctrl-G. 11 | 12 | (function(mod) { 13 | if (typeof exports == "object" && typeof module == "object") // CommonJS 14 | mod(require("../../lib/codemirror"), require("./searchcursor"), require("../dialog/dialog")); 15 | else if (typeof define == "function" && define.amd) // AMD 16 | define(["../../lib/codemirror", "./searchcursor", "../dialog/dialog"], mod); 17 | else // Plain browser env 18 | mod(CodeMirror); 19 | })(function(CodeMirror) { 20 | "use strict"; 21 | 22 | function searchOverlay(query, caseInsensitive) { 23 | if (typeof query == "string") 24 | query = new RegExp(query.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), caseInsensitive ? "gi" : "g"); 25 | else if (!query.global) 26 | query = new RegExp(query.source, query.ignoreCase ? "gi" : "g"); 27 | 28 | return {token: function(stream) { 29 | query.lastIndex = stream.pos; 30 | var match = query.exec(stream.string); 31 | if (match && match.index == stream.pos) { 32 | stream.pos += match[0].length || 1; 33 | return "searching"; 34 | } else if (match) { 35 | stream.pos = match.index; 36 | } else { 37 | stream.skipToEnd(); 38 | } 39 | }}; 40 | } 41 | 42 | function SearchState() { 43 | this.posFrom = this.posTo = this.lastQuery = this.query = null; 44 | this.overlay = null; 45 | } 46 | 47 | function getSearchState(cm) { 48 | return cm.state.search || (cm.state.search = new SearchState()); 49 | } 50 | 51 | function queryCaseInsensitive(query) { 52 | return typeof query == "string" && query == query.toLowerCase(); 53 | } 54 | 55 | function getSearchCursor(cm, query, pos) { 56 | // Heuristic: if the query string is all lowercase, do a case insensitive search. 57 | return cm.getSearchCursor(query, pos, {caseFold: queryCaseInsensitive(query), multiline: true}); 58 | } 59 | 60 | function persistentDialog(cm, text, deflt, onEnter, onKeyDown) { 61 | cm.openDialog(text, onEnter, { 62 | value: deflt, 63 | selectValueOnOpen: true, 64 | closeOnEnter: false, 65 | onClose: function() { clearSearch(cm); }, 66 | onKeyDown: onKeyDown 67 | }); 68 | } 69 | 70 | function dialog(cm, text, shortText, deflt, f) { 71 | if (cm.openDialog) cm.openDialog(text, f, {value: deflt, selectValueOnOpen: true}); 72 | else f(prompt(shortText, deflt)); 73 | } 74 | 75 | function confirmDialog(cm, text, shortText, fs) { 76 | if (cm.openConfirm) cm.openConfirm(text, fs); 77 | else if (confirm(shortText)) fs[0](); 78 | } 79 | 80 | function parseString(string) { 81 | return string.replace(/\\(.)/g, function(_, ch) { 82 | if (ch == "n") return "\n" 83 | if (ch == "r") return "\r" 84 | return ch 85 | }) 86 | } 87 | 88 | function parseQuery(query) { 89 | var isRE = query.match(/^\/(.*)\/([a-z]*)$/); 90 | if (isRE) { 91 | try { query = new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i"); } 92 | catch(e) {} // Not a regular expression after all, do a string search 93 | } else { 94 | query = parseString(query) 95 | } 96 | if (typeof query == "string" ? query == "" : query.test("")) 97 | query = /x^/; 98 | return query; 99 | } 100 | 101 | function startSearch(cm, state, query) { 102 | state.queryText = query; 103 | state.query = parseQuery(query); 104 | cm.removeOverlay(state.overlay, queryCaseInsensitive(state.query)); 105 | state.overlay = searchOverlay(state.query, queryCaseInsensitive(state.query)); 106 | cm.addOverlay(state.overlay); 107 | if (cm.showMatchesOnScrollbar) { 108 | if (state.annotate) { state.annotate.clear(); state.annotate = null; } 109 | state.annotate = cm.showMatchesOnScrollbar(state.query, queryCaseInsensitive(state.query)); 110 | } 111 | } 112 | 113 | function doSearch(cm, rev, persistent, immediate) { 114 | var state = getSearchState(cm); 115 | if (state.query) return findNext(cm, rev); 116 | var q = cm.getSelection() || state.lastQuery; 117 | if (q instanceof RegExp && q.source == "x^") q = null 118 | if (persistent && cm.openDialog) { 119 | var hiding = null 120 | var searchNext = function(query, event) { 121 | CodeMirror.e_stop(event); 122 | if (!query) return; 123 | if (query != state.queryText) { 124 | startSearch(cm, state, query); 125 | state.posFrom = state.posTo = cm.getCursor(); 126 | } 127 | if (hiding) hiding.style.opacity = 1 128 | findNext(cm, event.shiftKey, function(_, to) { 129 | var dialog 130 | if (to.line < 3 && document.querySelector && 131 | (dialog = cm.display.wrapper.querySelector(".CodeMirror-dialog")) && 132 | dialog.getBoundingClientRect().bottom - 4 > cm.cursorCoords(to, "window").top) 133 | (hiding = dialog).style.opacity = .4 134 | }) 135 | }; 136 | persistentDialog(cm, getQueryDialog(cm), q, searchNext, function(event, query) { 137 | var keyName = CodeMirror.keyName(event) 138 | var extra = cm.getOption('extraKeys'), cmd = (extra && extra[keyName]) || CodeMirror.keyMap[cm.getOption("keyMap")][keyName] 139 | if (cmd == "findNext" || cmd == "findPrev" || 140 | cmd == "findPersistentNext" || cmd == "findPersistentPrev") { 141 | CodeMirror.e_stop(event); 142 | startSearch(cm, getSearchState(cm), query); 143 | cm.execCommand(cmd); 144 | } else if (cmd == "find" || cmd == "findPersistent") { 145 | CodeMirror.e_stop(event); 146 | searchNext(query, event); 147 | } 148 | }); 149 | if (immediate && q) { 150 | startSearch(cm, state, q); 151 | findNext(cm, rev); 152 | } 153 | } else { 154 | dialog(cm, getQueryDialog(cm), "Search for:", q, function(query) { 155 | if (query && !state.query) cm.operation(function() { 156 | startSearch(cm, state, query); 157 | state.posFrom = state.posTo = cm.getCursor(); 158 | findNext(cm, rev); 159 | }); 160 | }); 161 | } 162 | } 163 | 164 | function findNext(cm, rev, callback) {cm.operation(function() { 165 | var state = getSearchState(cm); 166 | var cursor = getSearchCursor(cm, state.query, rev ? state.posFrom : state.posTo); 167 | if (!cursor.find(rev)) { 168 | cursor = getSearchCursor(cm, state.query, rev ? CodeMirror.Pos(cm.lastLine()) : CodeMirror.Pos(cm.firstLine(), 0)); 169 | if (!cursor.find(rev)) return; 170 | } 171 | cm.setSelection(cursor.from(), cursor.to()); 172 | cm.scrollIntoView({from: cursor.from(), to: cursor.to()}, 20); 173 | state.posFrom = cursor.from(); state.posTo = cursor.to(); 174 | if (callback) callback(cursor.from(), cursor.to()) 175 | });} 176 | 177 | function clearSearch(cm) {cm.operation(function() { 178 | var state = getSearchState(cm); 179 | state.lastQuery = state.query; 180 | if (!state.query) return; 181 | state.query = state.queryText = null; 182 | cm.removeOverlay(state.overlay); 183 | if (state.annotate) { state.annotate.clear(); state.annotate = null; } 184 | });} 185 | 186 | 187 | function getQueryDialog(cm) { 188 | return '' + cm.phrase("Search:") + ' ' + cm.phrase("(Use /re/ syntax for regexp search)") + ''; 189 | } 190 | function getReplaceQueryDialog(cm) { 191 | return ' ' + cm.phrase("(Use /re/ syntax for regexp search)") + ''; 192 | } 193 | function getReplacementQueryDialog(cm) { 194 | return '' + cm.phrase("With:") + ' '; 195 | } 196 | function getDoReplaceConfirm(cm) { 197 | return '' + cm.phrase("Replace?") + ' '; 198 | } 199 | 200 | function replaceAll(cm, query, text) { 201 | cm.operation(function() { 202 | for (var cursor = getSearchCursor(cm, query); cursor.findNext();) { 203 | if (typeof query != "string") { 204 | var match = cm.getRange(cursor.from(), cursor.to()).match(query); 205 | cursor.replace(text.replace(/\$(\d)/g, function(_, i) {return match[i];})); 206 | } else cursor.replace(text); 207 | } 208 | }); 209 | } 210 | 211 | function replace(cm, all) { 212 | if (cm.getOption("readOnly")) return; 213 | var query = cm.getSelection() || getSearchState(cm).lastQuery; 214 | var dialogText = '' + (all ? cm.phrase("Replace all:") : cm.phrase("Replace:")) + ''; 215 | dialog(cm, dialogText + getReplaceQueryDialog(cm), dialogText, query, function(query) { 216 | if (!query) return; 217 | query = parseQuery(query); 218 | dialog(cm, getReplacementQueryDialog(cm), cm.phrase("Replace with:"), "", function(text) { 219 | text = parseString(text) 220 | if (all) { 221 | replaceAll(cm, query, text) 222 | } else { 223 | clearSearch(cm); 224 | var cursor = getSearchCursor(cm, query, cm.getCursor("from")); 225 | var advance = function() { 226 | var start = cursor.from(), match; 227 | if (!(match = cursor.findNext())) { 228 | cursor = getSearchCursor(cm, query); 229 | if (!(match = cursor.findNext()) || 230 | (start && cursor.from().line == start.line && cursor.from().ch == start.ch)) return; 231 | } 232 | cm.setSelection(cursor.from(), cursor.to()); 233 | cm.scrollIntoView({from: cursor.from(), to: cursor.to()}); 234 | confirmDialog(cm, getDoReplaceConfirm(cm), cm.phrase("Replace?"), 235 | [function() {doReplace(match);}, advance, 236 | function() {replaceAll(cm, query, text)}]); 237 | }; 238 | var doReplace = function(match) { 239 | cursor.replace(typeof query == "string" ? text : 240 | text.replace(/\$(\d)/g, function(_, i) {return match[i];})); 241 | advance(); 242 | }; 243 | advance(); 244 | } 245 | }); 246 | }); 247 | } 248 | 249 | CodeMirror.commands.find = function(cm) {clearSearch(cm); doSearch(cm);}; 250 | CodeMirror.commands.findPersistent = function(cm) {clearSearch(cm); doSearch(cm, false, true);}; 251 | CodeMirror.commands.findPersistentNext = function(cm) {doSearch(cm, false, true, true);}; 252 | CodeMirror.commands.findPersistentPrev = function(cm) {doSearch(cm, true, true, true);}; 253 | CodeMirror.commands.findNext = doSearch; 254 | CodeMirror.commands.findPrev = function(cm) {doSearch(cm, true);}; 255 | CodeMirror.commands.clearSearch = clearSearch; 256 | CodeMirror.commands.replace = replace; 257 | CodeMirror.commands.replaceAll = function(cm) {replace(cm, true);}; 258 | }); 259 | -------------------------------------------------------------------------------- /dist/sn-codemirror-search/searchcursor.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")) 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod) 9 | else // Plain browser env 10 | mod(CodeMirror) 11 | })(function(CodeMirror) { 12 | "use strict" 13 | var Pos = CodeMirror.Pos 14 | 15 | function regexpFlags(regexp) { 16 | var flags = regexp.flags 17 | return flags != null ? flags : (regexp.ignoreCase ? "i" : "") 18 | + (regexp.global ? "g" : "") 19 | + (regexp.multiline ? "m" : "") 20 | } 21 | 22 | function ensureFlags(regexp, flags) { 23 | var current = regexpFlags(regexp), target = current 24 | for (var i = 0; i < flags.length; i++) if (target.indexOf(flags.charAt(i)) == -1) 25 | target += flags.charAt(i) 26 | return current == target ? regexp : new RegExp(regexp.source, target) 27 | } 28 | 29 | function maybeMultiline(regexp) { 30 | return /\\s|\\n|\n|\\W|\\D|\[\^/.test(regexp.source) 31 | } 32 | 33 | function searchRegexpForward(doc, regexp, start) { 34 | regexp = ensureFlags(regexp, "g") 35 | for (var line = start.line, ch = start.ch, last = doc.lastLine(); line <= last; line++, ch = 0) { 36 | regexp.lastIndex = ch 37 | var string = doc.getLine(line), match = regexp.exec(string) 38 | if (match) 39 | return {from: Pos(line, match.index), 40 | to: Pos(line, match.index + match[0].length), 41 | match: match} 42 | } 43 | } 44 | 45 | function searchRegexpForwardMultiline(doc, regexp, start) { 46 | if (!maybeMultiline(regexp)) return searchRegexpForward(doc, regexp, start) 47 | 48 | regexp = ensureFlags(regexp, "gm") 49 | var string, chunk = 1 50 | for (var line = start.line, last = doc.lastLine(); line <= last;) { 51 | // This grows the search buffer in exponentially-sized chunks 52 | // between matches, so that nearby matches are fast and don't 53 | // require concatenating the whole document (in case we're 54 | // searching for something that has tons of matches), but at the 55 | // same time, the amount of retries is limited. 56 | for (var i = 0; i < chunk; i++) { 57 | if (line > last) break 58 | var curLine = doc.getLine(line++) 59 | string = string == null ? curLine : string + "\n" + curLine 60 | } 61 | chunk = chunk * 2 62 | regexp.lastIndex = start.ch 63 | var match = regexp.exec(string) 64 | if (match) { 65 | var before = string.slice(0, match.index).split("\n"), inside = match[0].split("\n") 66 | var startLine = start.line + before.length - 1, startCh = before[before.length - 1].length 67 | return {from: Pos(startLine, startCh), 68 | to: Pos(startLine + inside.length - 1, 69 | inside.length == 1 ? startCh + inside[0].length : inside[inside.length - 1].length), 70 | match: match} 71 | } 72 | } 73 | } 74 | 75 | function lastMatchIn(string, regexp) { 76 | var cutOff = 0, match 77 | for (;;) { 78 | regexp.lastIndex = cutOff 79 | var newMatch = regexp.exec(string) 80 | if (!newMatch) return match 81 | match = newMatch 82 | cutOff = match.index + (match[0].length || 1) 83 | if (cutOff == string.length) return match 84 | } 85 | } 86 | 87 | function searchRegexpBackward(doc, regexp, start) { 88 | regexp = ensureFlags(regexp, "g") 89 | for (var line = start.line, ch = start.ch, first = doc.firstLine(); line >= first; line--, ch = -1) { 90 | var string = doc.getLine(line) 91 | if (ch > -1) string = string.slice(0, ch) 92 | var match = lastMatchIn(string, regexp) 93 | if (match) 94 | return {from: Pos(line, match.index), 95 | to: Pos(line, match.index + match[0].length), 96 | match: match} 97 | } 98 | } 99 | 100 | function searchRegexpBackwardMultiline(doc, regexp, start) { 101 | regexp = ensureFlags(regexp, "gm") 102 | var string, chunk = 1 103 | for (var line = start.line, first = doc.firstLine(); line >= first;) { 104 | for (var i = 0; i < chunk; i++) { 105 | var curLine = doc.getLine(line--) 106 | string = string == null ? curLine.slice(0, start.ch) : curLine + "\n" + string 107 | } 108 | chunk *= 2 109 | 110 | var match = lastMatchIn(string, regexp) 111 | if (match) { 112 | var before = string.slice(0, match.index).split("\n"), inside = match[0].split("\n") 113 | var startLine = line + before.length, startCh = before[before.length - 1].length 114 | return {from: Pos(startLine, startCh), 115 | to: Pos(startLine + inside.length - 1, 116 | inside.length == 1 ? startCh + inside[0].length : inside[inside.length - 1].length), 117 | match: match} 118 | } 119 | } 120 | } 121 | 122 | var doFold, noFold 123 | if (String.prototype.normalize) { 124 | doFold = function(str) { return str.normalize("NFD").toLowerCase() } 125 | noFold = function(str) { return str.normalize("NFD") } 126 | } else { 127 | doFold = function(str) { return str.toLowerCase() } 128 | noFold = function(str) { return str } 129 | } 130 | 131 | // Maps a position in a case-folded line back to a position in the original line 132 | // (compensating for codepoints increasing in number during folding) 133 | function adjustPos(orig, folded, pos, foldFunc) { 134 | if (orig.length == folded.length) return pos 135 | for (var min = 0, max = pos + Math.max(0, orig.length - folded.length);;) { 136 | if (min == max) return min 137 | var mid = (min + max) >> 1 138 | var len = foldFunc(orig.slice(0, mid)).length 139 | if (len == pos) return mid 140 | else if (len > pos) max = mid 141 | else min = mid + 1 142 | } 143 | } 144 | 145 | function searchStringForward(doc, query, start, caseFold) { 146 | // Empty string would match anything and never progress, so we 147 | // define it to match nothing instead. 148 | if (!query.length) return null 149 | var fold = caseFold ? doFold : noFold 150 | var lines = fold(query).split(/\r|\n\r?/) 151 | 152 | search: for (var line = start.line, ch = start.ch, last = doc.lastLine() + 1 - lines.length; line <= last; line++, ch = 0) { 153 | var orig = doc.getLine(line).slice(ch), string = fold(orig) 154 | if (lines.length == 1) { 155 | var found = string.indexOf(lines[0]) 156 | if (found == -1) continue search 157 | var start = adjustPos(orig, string, found, fold) + ch 158 | return {from: Pos(line, adjustPos(orig, string, found, fold) + ch), 159 | to: Pos(line, adjustPos(orig, string, found + lines[0].length, fold) + ch)} 160 | } else { 161 | var cutFrom = string.length - lines[0].length 162 | if (string.slice(cutFrom) != lines[0]) continue search 163 | for (var i = 1; i < lines.length - 1; i++) 164 | if (fold(doc.getLine(line + i)) != lines[i]) continue search 165 | var end = doc.getLine(line + lines.length - 1), endString = fold(end), lastLine = lines[lines.length - 1] 166 | if (endString.slice(0, lastLine.length) != lastLine) continue search 167 | return {from: Pos(line, adjustPos(orig, string, cutFrom, fold) + ch), 168 | to: Pos(line + lines.length - 1, adjustPos(end, endString, lastLine.length, fold))} 169 | } 170 | } 171 | } 172 | 173 | function searchStringBackward(doc, query, start, caseFold) { 174 | if (!query.length) return null 175 | var fold = caseFold ? doFold : noFold 176 | var lines = fold(query).split(/\r|\n\r?/) 177 | 178 | search: for (var line = start.line, ch = start.ch, first = doc.firstLine() - 1 + lines.length; line >= first; line--, ch = -1) { 179 | var orig = doc.getLine(line) 180 | if (ch > -1) orig = orig.slice(0, ch) 181 | var string = fold(orig) 182 | if (lines.length == 1) { 183 | var found = string.lastIndexOf(lines[0]) 184 | if (found == -1) continue search 185 | return {from: Pos(line, adjustPos(orig, string, found, fold)), 186 | to: Pos(line, adjustPos(orig, string, found + lines[0].length, fold))} 187 | } else { 188 | var lastLine = lines[lines.length - 1] 189 | if (string.slice(0, lastLine.length) != lastLine) continue search 190 | for (var i = 1, start = line - lines.length + 1; i < lines.length - 1; i++) 191 | if (fold(doc.getLine(start + i)) != lines[i]) continue search 192 | var top = doc.getLine(line + 1 - lines.length), topString = fold(top) 193 | if (topString.slice(topString.length - lines[0].length) != lines[0]) continue search 194 | return {from: Pos(line + 1 - lines.length, adjustPos(top, topString, top.length - lines[0].length, fold)), 195 | to: Pos(line, adjustPos(orig, string, lastLine.length, fold))} 196 | } 197 | } 198 | } 199 | 200 | function SearchCursor(doc, query, pos, options) { 201 | this.atOccurrence = false 202 | this.doc = doc 203 | pos = pos ? doc.clipPos(pos) : Pos(0, 0) 204 | this.pos = {from: pos, to: pos} 205 | 206 | var caseFold 207 | if (typeof options == "object") { 208 | caseFold = options.caseFold 209 | } else { // Backwards compat for when caseFold was the 4th argument 210 | caseFold = options 211 | options = null 212 | } 213 | 214 | if (typeof query == "string") { 215 | if (caseFold == null) caseFold = false 216 | this.matches = function(reverse, pos) { 217 | return (reverse ? searchStringBackward : searchStringForward)(doc, query, pos, caseFold) 218 | } 219 | } else { 220 | query = ensureFlags(query, "gm") 221 | if (!options || options.multiline !== false) 222 | this.matches = function(reverse, pos) { 223 | return (reverse ? searchRegexpBackwardMultiline : searchRegexpForwardMultiline)(doc, query, pos) 224 | } 225 | else 226 | this.matches = function(reverse, pos) { 227 | return (reverse ? searchRegexpBackward : searchRegexpForward)(doc, query, pos) 228 | } 229 | } 230 | } 231 | 232 | SearchCursor.prototype = { 233 | findNext: function() {return this.find(false)}, 234 | findPrevious: function() {return this.find(true)}, 235 | 236 | find: function(reverse) { 237 | var result = this.matches(reverse, this.doc.clipPos(reverse ? this.pos.from : this.pos.to)) 238 | 239 | // Implements weird auto-growing behavior on null-matches for 240 | // backwards-compatiblity with the vim code (unfortunately) 241 | while (result && CodeMirror.cmpPos(result.from, result.to) == 0) { 242 | if (reverse) { 243 | if (result.from.ch) result.from = Pos(result.from.line, result.from.ch - 1) 244 | else if (result.from.line == this.doc.firstLine()) result = null 245 | else result = this.matches(reverse, this.doc.clipPos(Pos(result.from.line - 1))) 246 | } else { 247 | if (result.to.ch < this.doc.getLine(result.to.line).length) result.to = Pos(result.to.line, result.to.ch + 1) 248 | else if (result.to.line == this.doc.lastLine()) result = null 249 | else result = this.matches(reverse, Pos(result.to.line + 1, 0)) 250 | } 251 | } 252 | 253 | if (result) { 254 | this.pos = result 255 | this.atOccurrence = true 256 | return this.pos.match || true 257 | } else { 258 | var end = Pos(reverse ? this.doc.firstLine() : this.doc.lastLine() + 1, 0) 259 | this.pos = {from: end, to: end} 260 | return this.atOccurrence = false 261 | } 262 | }, 263 | 264 | from: function() {if (this.atOccurrence) return this.pos.from}, 265 | to: function() {if (this.atOccurrence) return this.pos.to}, 266 | 267 | replace: function(newText, origin) { 268 | if (!this.atOccurrence) return 269 | var lines = CodeMirror.splitLines(newText) 270 | this.doc.replaceRange(lines, this.pos.from, this.pos.to, origin) 271 | this.pos.to = Pos(this.pos.from.line + lines.length - 1, 272 | lines[lines.length - 1].length + (lines.length == 1 ? this.pos.from.ch : 0)) 273 | } 274 | } 275 | 276 | CodeMirror.defineExtension("getSearchCursor", function(query, pos, caseFold) { 277 | return new SearchCursor(this.doc, query, pos, caseFold) 278 | }) 279 | CodeMirror.defineDocExtension("getSearchCursor", function(query, pos, caseFold) { 280 | return new SearchCursor(this, query, pos, caseFold) 281 | }) 282 | 283 | CodeMirror.defineExtension("selectMatches", function(query, caseFold) { 284 | var ranges = [] 285 | var cur = this.getSearchCursor(query, this.getCursor("from"), caseFold) 286 | while (cur.findNext()) { 287 | if (CodeMirror.cmpPos(cur.to(), this.getCursor("to")) > 0) break 288 | ranges.push({anchor: cur.from(), head: cur.to()}) 289 | } 290 | if (ranges.length) 291 | this.setSelections(ranges, 0) 292 | }) 293 | }); 294 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 25 | 73 |
74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /local_ext.json: -------------------------------------------------------------------------------- 1 | { 2 | "identifier": "dev.maxlap.indent_editor_local_test", 3 | "name": "Indent Editor local test", 4 | "content_type": "SN|Component", 5 | "area": "editor-editor", 6 | "version": "1.0.0", 7 | "url": "http://0.0.0.0:8080" 8 | } 9 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "standard-notes-indent-editor", 3 | "version": "1.6.0", 4 | "description": "", 5 | "main": "dist/dist.js", 6 | "author": "Maxime Lapointe ", 7 | "dependencies": { 8 | "sn-codemirror-search": "1.0.0", 9 | "linkify-it": "^2.2.0" 10 | }, 11 | "resolutions": { 12 | "**/**/node-gyp": "5.0.0" 13 | }, 14 | "devDependencies": { 15 | "@babel/core": "^7.7.4", 16 | "@babel/preset-env": "^7.7.4", 17 | "babel-cli": "^6.26.0", 18 | "codemirror": "^5.49.2", 19 | "grunt": "^1.0.4", 20 | "grunt-babel": "^8.0.0", 21 | "grunt-browserify": "^5.3.0", 22 | "grunt-contrib-concat": "^1.0.1", 23 | "grunt-contrib-copy": "^1.0.0", 24 | "grunt-contrib-sass": "^1.0.0", 25 | "grunt-contrib-watch": "^1.1.0", 26 | "grunt-newer": "^1.3.0", 27 | "sn-components-api": "1.2.8", 28 | "sn-stylekit": "2.0.19" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/editor.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This file handles part of the editor which is related to: 3 | * * wrapping the text in a special way 4 | * * keyboard shortcuts and click actions 5 | */ 6 | 7 | function IndentEditor(target_textarea, indent_editor_options) { 8 | var editor; 9 | var self = this; 10 | indent_editor_options = indent_editor_options || {}; 11 | 12 | this.measureLineElement = function(elt) { 13 | var wrappingSpan = elt.firstElementChild; 14 | 15 | var finalSpan = document.createElement('span'); 16 | elt.appendChild(finalSpan); 17 | 18 | var measure = editor.display.lineMeasure; 19 | for (let count = measure.childNodes.length; count > 0; --count) 20 | measure.removeChild(measure.firstChild); 21 | measure.appendChild(elt); 22 | 23 | var indentWidth = 0; 24 | var leadingSpaceRects = []; 25 | for (var i = 0; i < wrappingSpan.childNodes.length; i++) { 26 | var span = wrappingSpan.childNodes[i]; 27 | var wrappedClassName = ' ' + span.className + ' '; 28 | if (wrappedClassName.indexOf(' cm-leadingspace ') > -1 || 29 | wrappedClassName.indexOf(' cm-comment-block-indentation ') > -1) { 30 | leadingSpaceRects.push(span.getBoundingClientRect()); 31 | } else { 32 | break; 33 | } 34 | } 35 | 36 | if (leadingSpaceRects.length) { 37 | indentWidth = (leadingSpaceRects[leadingSpaceRects.length - 1].right - leadingSpaceRects[0].left); 38 | } 39 | 40 | var textMustWrap = wrappingSpan.offsetTop < finalSpan.offsetTop; 41 | 42 | measure.removeChild(elt); 43 | elt.removeChild(finalSpan); 44 | 45 | return {indentWidth: indentWidth, textMustWrap: textMustWrap} 46 | } 47 | 48 | this.selectionsToLineRanges = function(sels) { 49 | var lineRanges = []; 50 | for (var i = 0; i < sels.length; i++) { 51 | var anchor = sels[i].anchor; 52 | var head = sels[i].head; 53 | var startLine, endLine; 54 | if (anchor.line < head.line) { 55 | startLine = anchor.line; 56 | endLine = head.line; 57 | } else { 58 | startLine = head.line; 59 | endLine = anchor.line; 60 | } 61 | 62 | var lastPair = lineRanges[lineRanges.length - 1]; 63 | if (lastPair && lastPair[1] + 1 >= startLine) { 64 | // The last pair ends on the line before this selection. We just group them together 65 | lastPair[1] = endLine; 66 | } else { 67 | lineRanges.push([startLine, endLine]) 68 | } 69 | } 70 | return lineRanges; 71 | } 72 | 73 | this.duplicate = function(cm) { 74 | var sels = cm.listSelections(); 75 | for (var i = sels.length - 1; i >= 0; i--) { 76 | var anchor = sels[i].anchor; 77 | var head = sels[i].head; 78 | 79 | if (anchor.line == head.line && anchor.ch == head.ch) { 80 | // Nothing hightlighted, so copy whole line 81 | var line = anchor.line; 82 | var lineContent = cm.doc.getLine(line); 83 | cm.replaceRange(lineContent + cm.doc.lineSeparator(), {line: line, ch: 0}, {line: line, ch: 0}, "+input"); 84 | } else { 85 | // If something is highlighted, only copy that 86 | var start, end; 87 | if (anchor.line < head.line || anchor.line == head.line && anchor.ch < head.ch) { 88 | start = anchor; 89 | end = head; 90 | } else { 91 | start = head; 92 | end = anchor; 93 | } 94 | var content = cm.doc.getRange(start, end); 95 | cm.replaceRange(content, start, start, "+input"); 96 | } 97 | } 98 | } 99 | 100 | this.moveSelectedLinesUp = function(cm) { 101 | var sels = cm.listSelections(); 102 | var lineRanges = this.selectionsToLineRanges(sels); 103 | var nbSelsTouchingFirstLine = 0; 104 | 105 | if (lineRanges[0][0] == 0) { 106 | var lastLineTouchingFirstLine = lineRanges[0][1]; 107 | 108 | for (var i = 0; i < sels.length; i++) { 109 | var anchor = sels[i].anchor; 110 | var head = sels[i].head; 111 | if (anchor.line <= lastLineTouchingFirstLine || head.line <= lastLineTouchingFirstLine) { 112 | nbSelsTouchingFirstLine += 1; 113 | } else { 114 | break; 115 | } 116 | } 117 | } 118 | 119 | for (var i = 0; i < lineRanges.length; i++) { 120 | var lineRange = lineRanges[i]; 121 | var startLine = lineRange[0]; 122 | var endLine = lineRange[1]; 123 | 124 | if (startLine == 0) { 125 | // This contains the first line of the file. Nothing to do! 126 | continue; 127 | } 128 | 129 | var prevLineContent = cm.doc.getLine(startLine - 1); 130 | var chOfEndLine = cm.doc.getLine(endLine).length; 131 | cm.replaceRange(cm.doc.lineSeparator() + prevLineContent, {line: endLine, ch: chOfEndLine}, {line: endLine, ch: chOfEndLine}, "+input"); 132 | cm.replaceRange('', {line: startLine - 1, ch: 0}, {line: startLine, ch: 0}, "+input"); 133 | } 134 | 135 | var newSels = [] 136 | for (var i = 0; i < nbSelsTouchingFirstLine; i++) { 137 | newSels.push(sels[i]); 138 | } 139 | for (var i = nbSelsTouchingFirstLine; i < sels.length; i++) { 140 | var anchor = sels[i].anchor; 141 | var head = sels[i].head; 142 | newSels.push({anchor: {line: anchor.line - 1, ch: anchor.ch}, head: {line: head.line - 1, ch: head.ch}}); 143 | } 144 | cm.doc.setSelections(newSels); 145 | } 146 | 147 | this.moveSelectedLinesDown = function(cm) { 148 | var sels = cm.listSelections(); 149 | var lineRanges = this.selectionsToLineRanges(sels); 150 | var nbSelsTouchingLastLine = 0; 151 | var lastLineNumber = cm.doc.lastLine(); 152 | 153 | if (lineRanges[lineRanges.length - 1][1] == lastLineNumber) { 154 | var firstLineTouchingLastLine = lineRanges[lineRanges.length - 1][0]; 155 | 156 | for (var i = sels.length - 1; i >= 0; i--) { 157 | var anchor = sels[i].anchor; 158 | var head = sels[i].head; 159 | if (anchor.line >= firstLineTouchingLastLine || head.line >= firstLineTouchingLastLine) { 160 | nbSelsTouchingLastLine += 1; 161 | } else { 162 | break; 163 | } 164 | } 165 | } 166 | 167 | for (var i = 0; i < lineRanges.length; i++) { 168 | var lineRange = lineRanges[i]; 169 | var startLine = lineRange[0]; 170 | var endLine = lineRange[1]; 171 | 172 | if (endLine == lastLineNumber) { 173 | // This contains the last line of the file. Nothing to do! 174 | continue; 175 | } 176 | 177 | var nextLineContent = cm.doc.getLine(endLine + 1); 178 | cm.replaceRange('', {line: endLine, ch: cm.doc.getLine(endLine).length}, 179 | {line: endLine + 1, ch: cm.doc.getLine(endLine + 1).length}, "+input"); 180 | cm.replaceRange(nextLineContent + cm.doc.lineSeparator(), {line: startLine, ch: 0}, {line: startLine, ch: 0}, "+input"); 181 | } 182 | 183 | var newSels = []; 184 | var nbLineRangetochange = sels.length - nbSelsTouchingLastLine; 185 | 186 | for (var i = 0; i < nbLineRangetochange; i++) { 187 | var anchor = sels[i].anchor; 188 | var head = sels[i].head; 189 | newSels.push({anchor: {line: anchor.line + 1, ch: anchor.ch}, head: {line: head.line + 1, ch: head.ch}}); 190 | } 191 | for (var i = nbLineRangetochange; i < sels.length; i++) { 192 | newSels.push(sels[i]); 193 | } 194 | cm.doc.setSelections(newSels); 195 | } 196 | 197 | this.setupEditor = function(target_textarea) { 198 | this.editor = editor = CodeMirror.fromTextArea(target_textarea, { 199 | mode: "indent_text", 200 | lineWrapping: true, 201 | tabSize: 2, 202 | indentUnit: 2, 203 | extraKeys: {"Alt-F": "findPersistent", 204 | Tab: 'indentMore', 205 | 'Shift-Tab': 'indentLess', 206 | "Enter": (cm) => { 207 | var sels = cm.listSelections(); 208 | var tokens = []; 209 | for (var i = sels.length - 1; i >= 0; i--) { 210 | tokens.push(cm.getTokenAt(sels[i].anchor, true)); 211 | cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, "+input"); 212 | } 213 | 214 | var new_indentation; 215 | sels = cm.listSelections(); 216 | for (var i = 0; i < sels.length; i++) { 217 | var state = tokens[i].state; 218 | var prev_line = cm.doc.getLine(sels[i].anchor.line - 1); 219 | if (state.inCodeBlock) { 220 | if (state.codeBlockHasReadText) { 221 | new_indentation = /^\s*/.exec(prev_line)[0]; 222 | } else { 223 | new_indentation = /^[-*+>\s]*/.exec(prev_line)[0]; 224 | new_indentation = new_indentation.replace(/[-*+>]/g, ' '); 225 | } 226 | } else { 227 | // Need a space after the dot, or to reach the end of the line 228 | var digits = /^\s*(\d+)\.($|\s+)/.exec(prev_line); 229 | if (digits) { 230 | prev_line = prev_line.replace(/\d+/, parseInt(digits,10) + 1); 231 | } 232 | new_indentation = /^\s*(\d+)\.\s+|[-*+>\s]*/.exec(prev_line)[0]; 233 | } 234 | cm.replaceRange(new_indentation, sels[i].anchor, sels[i].head, "+input"); 235 | } 236 | cm.scrollIntoView(); 237 | }, 238 | "Home": "goLineLeftSmart", 239 | "End": "goLineRight", 240 | "Ctrl-D": this.duplicate.bind(this), 241 | "Cmd-D": this.duplicate.bind(this), 242 | // Shift has to be first for some reason... 243 | "Shift-Ctrl-Up": this.moveSelectedLinesUp.bind(this), 244 | "Shift-Cmd-Up": this.moveSelectedLinesUp.bind(this), 245 | "Shift-Ctrl-Down": this.moveSelectedLinesDown.bind(this), 246 | "Shift-Cmd-Down": this.moveSelectedLinesDown.bind(this), 247 | } 248 | }); 249 | // only use CodeMirror markselection when not in contenteditable 250 | editor.setOption("styleSelectedText", editor.getOption('inputStyle') != 'contenteditable'); 251 | 252 | editor.setSize("100%", "100%"); 253 | 254 | editor.on('mousedown', function(cm, e) { 255 | if (e.ctrlKey || e.metaKey) { 256 | if ((' ' + e.target.className + ' ').includes(' cm-link ')) { 257 | // We don't want to add an extra cursor in in the editor when ctrl-clicking a link 258 | e.preventDefault(); 259 | } 260 | } 261 | }); 262 | 263 | editor.getWrapperElement().addEventListener('click', function(e) { 264 | if (e.ctrlKey || e.metaKey) { 265 | if ((' ' + e.target.className + ' ').includes(' cm-link ')) { 266 | var address = e.target.textContent; 267 | 268 | if (!/^https?:\/\//.test(address)) { 269 | address = "http://" + address; 270 | } 271 | 272 | var userAgent = navigator.userAgent.toLowerCase(); 273 | if (userAgent.indexOf(' electron/') > -1) { 274 | // Desktop (Electron) 275 | window.open(address); 276 | } else if (typeof navigator != 'undefined' && navigator.product == 'ReactNative') { 277 | // Android / iOS 278 | window.open(address); 279 | } else { 280 | // Browser. This is a old browser compatible way of making sure the target cannot 281 | var newWin = window.open(undefined, '_blank'); // Reset the opener link 282 | 283 | newWin.opener = null; // Now load the correct url 284 | 285 | newWin.location = address; 286 | } 287 | e.preventDefault(); 288 | } 289 | } 290 | }); 291 | 292 | // This is the base padding in the css if I remember well 293 | var basePadding = 4; 294 | editor.on("renderLine", function(cm, line, elt) { 295 | var measures = self.measureLineElement(elt); 296 | var indentationWidth = measures.indentWidth; 297 | 298 | var scrollInfo = cm.getScrollInfo(); 299 | var maxOff = scrollInfo.width - 150; 300 | if (maxOff < 30) { 301 | maxOff = 30; 302 | } 303 | 304 | var wrapOffset = indentationWidth; 305 | if (wrapOffset > maxOff) { 306 | wrapOffset = maxOff; 307 | } 308 | 309 | if (measures.textMustWrap) { 310 | elt.className += " cm-line-is-wrapped"; 311 | } 312 | // Making the lines after the first have just the right indentation using padding. 313 | // And making the first line back to where it would be by removing that padding. 314 | elt.style.textIndent = "-" + wrapOffset + "px"; 315 | elt.style.paddingLeft = (basePadding + wrapOffset) + "px"; 316 | }); 317 | 318 | this.setAllowLongerLinesNoRefresh(!!indent_editor_options.allow_longer_lines) 319 | this.setColorHeaders(!!indent_editor_options.color_headers) 320 | this.setMonospaceNoRefresh(!!indent_editor_options.monospace) 321 | 322 | editor.refresh(); 323 | 324 | // Need to do refresh on the codemirror instance when there is resizing 325 | // This is necessary for to fix the max wrapping width in hte edge cases that it is necessary... 326 | var resize_timeout_handle; 327 | window.addEventListener('resize', function() { 328 | // We don't want to refresh instantly, to avoid making things too slow. So we only do it once it has 329 | // been 1s without resize 330 | clearTimeout(resize_timeout_handle); 331 | resize_timeout_handle = setTimeout(function() { editor.refresh(); }, 1000) 332 | }); 333 | } 334 | 335 | this.setAllowLongerLinesNoRefresh = function(true_false) { 336 | indent_editor_options.allow_longer_lines = true_false; 337 | if (true_false) { 338 | this.editor.getWrapperElement().classList.remove("remove-longer-lines"); 339 | } else { 340 | this.editor.getWrapperElement().classList.add("remove-longer-lines"); 341 | } 342 | } 343 | 344 | this.setAllowLongerLines = function(true_false) { 345 | this.setAllowLongerLinesNoRefresh(true_false); 346 | this.editor.refresh(); 347 | } 348 | 349 | this.setColorHeaders = function(true_false) { 350 | indent_editor_options.color_headers = true_false; 351 | if (true_false) { 352 | this.editor.getWrapperElement().classList.add("cfg-color-headers"); 353 | } else { 354 | this.editor.getWrapperElement().classList.remove("cfg-color-headers"); 355 | } 356 | } 357 | 358 | this.setMonospaceNoRefresh = function(true_false) { 359 | indent_editor_options.monospace = true_false; 360 | if (true_false) { 361 | this.editor.getWrapperElement().classList.add("use-monospace-everywhere"); 362 | } else { 363 | this.editor.getWrapperElement().classList.remove("use-monospace-everywhere"); 364 | } 365 | } 366 | 367 | this.setMonospace = function(true_false) { 368 | this.setMonospaceNoRefresh(true_false); 369 | this.editor.refresh(); 370 | } 371 | 372 | 373 | this.setupEditor(target_textarea) 374 | }; 375 | -------------------------------------------------------------------------------- /src/indent_text.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This file handles part of the editor which is related to parsing the text and applying markup 3 | */ 4 | 5 | (function(CodeMirror) { 6 | "use strict"; 7 | 8 | CodeMirror.defineMode("indent_text", function(cmCfg, modeCfg) { 9 | var linkify = require('linkify-it')({'ftp:': null, '//': null}, {fuzzyEmail: false}); 10 | 11 | // We only care about few things in the middle of text: 12 | // * backticks 13 | // * urls 14 | // This stops only for things that could look like urls and backticks 15 | var fastReadRegex = new RegExp('.*?(?:`|https?://|\\.(?:' + linkify.re.src_tlds + ')\\b)'); 16 | /* Does a match(), but returns the matched string or ''. Expects a regex without groups. */ 17 | function matchRegexToString(stream, regex, consume) { 18 | var match = stream.match(regex, consume); 19 | return match ? match[0] : ''; 20 | } 21 | 22 | function matchIntoLeadingSpacesForCodeBlock(stream, state, max) { 23 | var regex_src; 24 | if (max <= 0) { 25 | state.leadingSpaceContent = ''; 26 | return ''; 27 | } 28 | regex_src = "^\\s{1," + state.codeBlockLeadingSpaceWidth + "}"; 29 | return matchIntoLeadingSpace(stream, state, new RegExp(regex_src)); 30 | } 31 | 32 | function matchIntoLeadingSpace(stream, state, regex) { 33 | var leadingSpace = matchRegexToString(stream, regex, true); 34 | state.leadingSpaceContent = leadingSpace; 35 | return leadingSpace; 36 | } 37 | 38 | function tokenInCodeBlock(stream, state) { 39 | if (stream.sol()) { 40 | var leadingSpace = matchIntoLeadingSpacesForCodeBlock(stream, state, state.codeBlockLeadingSpaceWidth); 41 | if (!state.codeBlockHasReadText && !stream.match(/^\s*$/, false)) { 42 | state.codeBlockHasReadText = true; 43 | state.codeBlockLeadingSpaceWidth = leadingSpace.length; 44 | } 45 | if (leadingSpace) { 46 | return "leadingspace line-comment-block-line"; 47 | } 48 | } 49 | 50 | if (stream.match(/^.*```\s*$/, true)) { 51 | state.inCodeBlock = false; 52 | } else if (stream.match(/^\s+/, true)) { 53 | return 'comment line-comment-block-line comment-block-indentation'; 54 | } else { 55 | stream.skipToEnd(); 56 | } 57 | return 'comment line-comment-block-line'; 58 | } 59 | 60 | var mode = { 61 | startState: function() { 62 | return { 63 | foundBacktick: false, 64 | leadingSpaceContent: null, 65 | sawTextBeforeOnLine: false, 66 | inCodeBlock: false, 67 | codeBlockLeadingSpaceWidth: null, 68 | codeBlockHasReadText: false, 69 | headerLevel: 0, 70 | stackOflinksOnLine: null, 71 | foundLink: false, 72 | }; 73 | }, 74 | token: function(stream, state) { 75 | if (state.inCodeBlock) { 76 | return tokenInCodeBlock(stream, state); 77 | } 78 | 79 | if (stream.sol()) { 80 | if (!state.foundLink) { 81 | state.stackOflinksOnLine = null; 82 | } 83 | state.sawTextBeforeOnLine = false; 84 | state.headerLevel = 0; 85 | var leadingSpace = matchIntoLeadingSpace(stream, state, /^(\s*\d+\.($|\s+)|[-*+>\s]+)/); 86 | if (leadingSpace) { 87 | if (stream.eol() && /^\s*$/.test(leadingSpace)) { 88 | return "leadingspace line-blank-line"; 89 | } else { 90 | state.prevTokenOfLineWasLeadingSpace = true; 91 | return "leadingspace"; 92 | } 93 | } 94 | } 95 | 96 | var classesAnyToken = ''; 97 | 98 | if (state.headerLevel > 0) { 99 | classesAnyToken += ' header-' + state.headerLevel; 100 | } 101 | 102 | if (state.foundBacktick) { 103 | state.foundBacktick = false; 104 | if (stream.match(/^```\S*\s*$/, true)) { 105 | state.inCodeBlock = true; 106 | state.codeBlockHasReadText = false; 107 | state.codeBlockLeadingSpaceWidth = state.leadingSpaceContent.length; 108 | if (state.sawTextBeforeOnLine) { 109 | return 'comment' + classesAnyToken; 110 | } else { 111 | return 'comment line-comment-block-line' + classesAnyToken; 112 | } 113 | } 114 | if (stream.match(/^`[^`]+`/, true)) { 115 | return 'comment' + classesAnyToken; 116 | } else { 117 | stream.eat('`'); 118 | return classesAnyToken; 119 | } 120 | } 121 | 122 | if (state.foundLink) { 123 | state.foundLink = false; 124 | var linkInfos = state.stackOflinksOnLine.pop(); 125 | stream.pos = linkInfos.lastIndex; 126 | return 'link' + classesAnyToken; 127 | } 128 | 129 | if (!state.sawTextBeforeOnLine) { 130 | var signs = matchRegexToString(stream, /#+/, true); 131 | if (signs) { 132 | // We got the start of a header! 133 | state.headerLevel = signs.length; 134 | if (state.headerLevel < 1) { 135 | state.headerLevel = 1; 136 | } else if (state.headerLevel > 4) { 137 | state.headerLevel = 4; 138 | } 139 | return 'formatting-header-' + state.headerLevel; 140 | } 141 | } 142 | 143 | var toInvestigate = stream.match(fastReadRegex, true); 144 | if (toInvestigate) { 145 | toInvestigate = toInvestigate[0]; 146 | state.sawTextBeforeOnLine = true; 147 | if (toInvestigate[toInvestigate.length - 1] == '`') { 148 | stream.backUp(1); 149 | state.foundBacktick = true; 150 | } else { 151 | if (!state.stackOflinksOnLine) { 152 | var fullStringFromTokenStart = stream.string.slice(stream.start); 153 | var foundLinks = linkify.match(fullStringFromTokenStart) || []; 154 | 155 | for (var i = 0; i < foundLinks.length; i++) { 156 | var match = foundLinks[i]; 157 | match.index += stream.start; 158 | match.lastIndex += stream.start; 159 | } 160 | state.stackOflinksOnLine = foundLinks.reverse(); 161 | } 162 | 163 | var stackOflinksOnLine = state.stackOflinksOnLine; 164 | var linkToConsider; 165 | while ((linkToConsider = stackOflinksOnLine[stackOflinksOnLine.length - 1]) 166 | && linkToConsider.index < stream.start) { 167 | // We are now father than that. Possibly because a link was inside backticks. 168 | stackOflinksOnLine.pop(); 169 | } 170 | 171 | if (linkToConsider && linkToConsider.index < stream.pos) { 172 | stream.pos = linkToConsider.index; 173 | state.foundLink = true; 174 | } 175 | } 176 | } else { 177 | stream.skipToEnd(); 178 | } 179 | 180 | return classesAnyToken; 181 | }, 182 | 183 | blankLine: function(state) { 184 | if (state.inCodeBlock) { 185 | return 'line-comment-block-line'; 186 | } else { 187 | return 'line-blank-line'; 188 | } 189 | } 190 | }; 191 | return mode; 192 | }, "xml"); 193 | })(CodeMirror); 194 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This file handles the Standard Notes related stuff and config stuff: 3 | * * loading up the editor 4 | * * saving the node 5 | * * changing and saving settings 6 | */ 7 | document.addEventListener("DOMContentLoaded", function(event) { 8 | 9 | var componentManager; 10 | var workingNote; 11 | var lastValue, lastUUID; 12 | var editor, indent_editor; 13 | var ignoreTextChange = false; 14 | var initialLoad = true; 15 | var clientData = {monospace: 'default'} 16 | 17 | function loadComponentManager() { 18 | var permissions = [{name: "stream-context-item"}]; 19 | componentManager = new ComponentManager(permissions, function(){ 20 | // on ready 21 | var platform = componentManager.platform; 22 | if (platform) { 23 | document.body.classList.add(platform); 24 | } 25 | }); 26 | 27 | componentManager.streamContextItem((note) => { 28 | onReceivedNote(note); 29 | }); 30 | } 31 | 32 | function save() { 33 | if(workingNote) { 34 | // Be sure to capture this object as a variable, as this.note may be reassigned in `streamContextItem`, so by the time 35 | // you modify it in the presave block, it may not be the same object anymore, so the presave values will not be applied to 36 | // the right object, and it will save incorrectly. 37 | let note = workingNote; 38 | 39 | componentManager.saveItemWithPresave(note, () => { 40 | lastValue = editor.getValue(); 41 | note.content.text = lastValue; 42 | note.clientData = clientData; 43 | 44 | // clear previews 45 | note.content.preview_plain = null; 46 | note.content.preview_html = null; 47 | }); 48 | } 49 | } 50 | 51 | function onReceivedNote(note) { 52 | if(note.uuid !== lastUUID) { 53 | // Note changed, reset last values 54 | lastValue = null; 55 | initialLoad = true; 56 | lastUUID = note.uuid; 57 | } 58 | 59 | workingNote = note; 60 | 61 | // Only update UI on non-metadata updates. 62 | if(note.isMetadataUpdate) { 63 | return; 64 | } 65 | 66 | clientData = note.clientData; 67 | 68 | if(editor) { 69 | if(clientData) { 70 | indent_editor.setAllowLongerLinesNoRefresh(finalOptionAllowLongerLines()); 71 | indent_editor.setColorHeaders(finalOptionColorHeaders()); 72 | indent_editor.setMonospaceNoRefresh(finalOptionMonospace()); 73 | } 74 | 75 | if(note.content.text !== lastValue) { 76 | ignoreTextChange = true; 77 | editor.getDoc().setValue(workingNote.content.text); 78 | ignoreTextChange = false; 79 | } 80 | 81 | if(initialLoad) { 82 | initialLoad = false; 83 | editor.getDoc().clearHistory(); 84 | } 85 | } 86 | } 87 | 88 | 89 | function loadEditor() { 90 | indent_editor = new IndentEditor(document.getElementById("code"), finalOptions()); 91 | editor = indent_editor.editor; 92 | window.editor = editor; 93 | 94 | editor.on("change", function(){ 95 | if(ignoreTextChange) {return;} 96 | save(); 97 | }); 98 | } 99 | 100 | function finalOptions() { 101 | return { 102 | allow_longer_lines: finalOptionAllowLongerLines(), 103 | color_headers: finalOptionColorHeaders(), 104 | monospace: finalOptionMonospace(), 105 | } 106 | } 107 | 108 | function finalOptionAllowLongerLines() { 109 | return finalOption('allow_longer_lines', ['yes', 'no']) 110 | } 111 | 112 | function finalOptionColorHeaders() { 113 | return finalOption('color_headers', ['yes', 'no']) 114 | } 115 | 116 | function finalOptionMonospace() { 117 | return finalOption('monospace', ['no', 'yes']) 118 | } 119 | 120 | // the first valid_values is used as default value 121 | function finalOption(option_name, valid_values) { 122 | var value = clientData[option_name]; 123 | if (!valid_values.includes(value)) { 124 | value = chosenDefault(option_name, valid_values); 125 | } 126 | return yesNoToBool(value) 127 | } 128 | 129 | 130 | function chosenDefault(option_name, valid_values) { 131 | if (componentManager && componentManager.componentData) { 132 | var value = componentManager.componentDataValueForKey(option_name + "_default"); 133 | if (valid_values.includes(value)) { 134 | return value; 135 | } else { 136 | return valid_values[0]; 137 | } 138 | } else { 139 | return valid_values[0]; 140 | } 141 | } 142 | 143 | function yesNoToBool(value) { 144 | if (value == 'yes') { 145 | return true; 146 | } else if (value == 'no') { 147 | return false; 148 | } else { 149 | throw 'Expected yes or no'; 150 | } 151 | } 152 | 153 | window.displayConfigPanel = function() { 154 | if (componentManager && componentManager.componentData && componentManager.componentDataValueForKey("monospace_default") == 'yes') { 155 | document.querySelectorAll('[name="monospace_default"][value="yes"]')[0].checked = true; 156 | } else { 157 | // default is no 158 | document.querySelectorAll('[name="monospace_default"][value="no"]')[0].checked = true; 159 | } 160 | 161 | if (clientData.monospace == 'yes') { 162 | document.querySelectorAll('[name="monospace"][value="yes"]')[0].checked = true; 163 | } else if (clientData.monospace == 'no') { 164 | document.querySelectorAll('[name="monospace"][value="no"]')[0].checked = true; 165 | } else { 166 | document.querySelectorAll('[name="monospace"][value="default"]')[0].checked = true; 167 | } 168 | 169 | if (componentManager && componentManager.componentData && componentManager.componentDataValueForKey("allow_longer_lines_default") == 'no') { 170 | document.querySelectorAll('[name="allow_longer_lines_default"][value="no"]')[0].checked = true; 171 | } else { 172 | // default is yes 173 | document.querySelectorAll('[name="allow_longer_lines_default"][value="yes"]')[0].checked = true; 174 | } 175 | 176 | if (clientData.allow_longer_lines == 'yes') { 177 | document.querySelectorAll('[name="allow_longer_lines"][value="yes"]')[0].checked = true; 178 | } else if (clientData.allow_longer_lines == 'no') { 179 | document.querySelectorAll('[name="allow_longer_lines"][value="no"]')[0].checked = true; 180 | } else { 181 | document.querySelectorAll('[name="allow_longer_lines"][value="default"]')[0].checked = true; 182 | } 183 | 184 | if (componentManager && componentManager.componentData && componentManager.componentDataValueForKey("color_headers_default") == 'no') { 185 | document.querySelectorAll('[name="color_headers_default"][value="no"]')[0].checked = true; 186 | } else { 187 | // default is yes 188 | document.querySelectorAll('[name="color_headers_default"][value="yes"]')[0].checked = true; 189 | } 190 | 191 | if (clientData.color_headers == 'yes') { 192 | document.querySelectorAll('[name="color_headers"][value="yes"]')[0].checked = true; 193 | } else if (clientData.color_headers == 'no') { 194 | document.querySelectorAll('[name="color_headers"][value="no"]')[0].checked = true; 195 | } else { 196 | document.querySelectorAll('[name="color_headers"][value="default"]')[0].checked = true; 197 | } 198 | 199 | document.getElementById('config-panel').style.display = 'block'; 200 | editor.getWrapperElement().style.display = 'none'; 201 | document.getElementById('config-panel-toggle').style.display = 'none'; 202 | } 203 | 204 | window.hideConfigPanel = function() { 205 | document.getElementById('config-panel').style.display = 'none'; 206 | editor.getWrapperElement().style.display = 'block'; 207 | document.getElementById('config-panel-toggle').style.display = 'inline'; 208 | } 209 | 210 | window.changeAllowLongerLinesConfig = function(new_value) { 211 | if (clientData) { 212 | clientData.allow_longer_lines = new_value; 213 | } 214 | indent_editor.setAllowLongerLines(finalOptionAllowLongerLines()); 215 | save(); 216 | } 217 | 218 | window.changeColorHeadersConfig = function(new_value) { 219 | if (clientData) { 220 | clientData.color_headers = new_value; 221 | } 222 | indent_editor.setColorHeaders(finalOptionColorHeaders()); 223 | save(); 224 | } 225 | 226 | window.changeMonospaceConfig = function(new_value) { 227 | if (clientData) { 228 | clientData.monospace = new_value; 229 | } 230 | indent_editor.setMonospace(finalOptionMonospace()); 231 | save(); 232 | } 233 | 234 | window.changeAllowLongerLinesDefaultConfig = function(new_value) { 235 | if (componentManager) { 236 | componentManager.setComponentDataValueForKey("allow_longer_lines_default", new_value); 237 | } 238 | indent_editor.setAllowLongerLines(finalOptionAllowLongerLines()); 239 | } 240 | 241 | window.changeColorHeadersDefaultConfig = function(new_value) { 242 | if (componentManager) { 243 | componentManager.setComponentDataValueForKey("color_headers_default", new_value); 244 | } 245 | indent_editor.setColorHeaders(finalOptionColorHeaders()); 246 | } 247 | 248 | window.changeMonospaceDefaultConfig = function(new_value) { 249 | if (componentManager) { 250 | componentManager.setComponentDataValueForKey("monospace_default", new_value); 251 | } 252 | indent_editor.setMonospace(finalOptionMonospace()); 253 | } 254 | 255 | loadEditor(); 256 | loadComponentManager(); 257 | }); 258 | -------------------------------------------------------------------------------- /src/main.scss: -------------------------------------------------------------------------------- 1 | $comment-font-family: var(--sn-stylekit-monospace-font) !important; 2 | 3 | body, html { 4 | font-family: var(--sn-stylekit-sans-serif-font); 5 | font-size: var(--sn-stylekit-base-font-size); 6 | height: 100%; 7 | margin: 0; 8 | background-color: transparent; 9 | } 10 | 11 | * { 12 | // To prevent gray flash when focusing input on mobile Safari 13 | -webkit-tap-highlight-color: rgba(0,0,0,0); 14 | } 15 | 16 | #wrapper { 17 | display: flex; 18 | flex-direction: column; 19 | position: relative; 20 | height: 100%; 21 | overflow: hidden; 22 | // padding-right: 20px; 23 | } 24 | 25 | .CodeMirror-scroll { 26 | padding: 8px; 27 | } 28 | 29 | .CodeMirror { 30 | background-color: var(--sn-stylekit-editor-background-color) !important; 31 | color: var(--sn-stylekit-editor-foreground-color) !important; 32 | border: 0 !important; 33 | font-family: var(--sn-stylekit-sans-serif-font); 34 | 35 | -webkit-overflow-scrolling: touch; 36 | 37 | flex: 1 1 auto; 38 | width: 100%; 39 | height: 100%; 40 | resize: none; 41 | font-size: var(--sn-stylekit-font-size-editor); 42 | padding: 0; 43 | 44 | .cm-comment { 45 | background: var(--sn-stylekit-contrast-background-color); 46 | color: var(--sn-stylekit-info-color); 47 | font-family: $comment-font-family; 48 | font-size: 95%; // font-family makes font look a bit big 49 | 50 | &.CodeMirror-selectedtext { 51 | color: var(--sn-stylekit-info-contrast-color) !important; 52 | background: var(--sn-stylekit-info-color) !important; 53 | } 54 | } 55 | 56 | .cm-link { 57 | color: var(--sn-stylekit-info-color) !important; 58 | 59 | &.CodeMirror-selectedtext { 60 | color: var(--sn-stylekit-info-contrast-color) !important; 61 | background: var(--sn-stylekit-info-color) !important; 62 | } 63 | } 64 | 65 | .CodeMirror-linenumber { 66 | color: gray !important; 67 | } 68 | } 69 | 70 | .CodeMirror-cursor { 71 | border-color: var(--sn-stylekit-editor-foreground-color); 72 | } 73 | 74 | .CodeMirror-gutters { 75 | background-color: var(--sn-stylekit-background-color) !important; 76 | color: var(--sn-stylekit-editor-foreground-color) !important; 77 | border-color: var(--sn-stylekit-border-color) !important; 78 | } 79 | 80 | 81 | @mixin make-cm-header($number, $font-size) { 82 | .cm-header-#{$number} { 83 | font-weight: bold; 84 | font-size: $font-size; 85 | } 86 | 87 | .cfg-color-headers .cm-header-#{$number} { 88 | color: var(--sn-stylekit-info-color); 89 | } 90 | 91 | .cm-formatting-header-#{$number} { 92 | opacity: 0.3; 93 | font-size: 90%; 94 | &::after { 95 | content: ''; 96 | font-size: ($font-size / 0.9); 97 | } 98 | } 99 | } 100 | 101 | @include make-cm-header(1, 135%); 102 | @include make-cm-header(2, 120%); 103 | @include make-cm-header(3, 100%); 104 | @include make-cm-header(4, 100%); 105 | 106 | .colored-like-header { 107 | color: var(--sn-stylekit-info-color); 108 | } 109 | 110 | .CodeMirror .blank-line { 111 | line-height: 0.4em !important; 112 | } 113 | 114 | .CodeMirror { 115 | font-size: 16px; 116 | } 117 | 118 | .CodeMirror pre.CodeMirror-line { 119 | padding: 2px 0; 120 | line-height: 1.2; 121 | } 122 | 123 | .CodeMirror pre.comment-block-line { 124 | padding: 0; 125 | line-height: normal; 126 | font-family: $comment-font-family; 127 | } 128 | 129 | .cm-leadingspace { 130 | font-family: var(--sn-stylekit-monospace-font); 131 | // that smaller line-height avoids the font-change moving text that is after up and down when it is applied/removed. 132 | line-height: 0.1; 133 | } 134 | 135 | .cm-tab { 136 | // Need those to keep the wrapping system, which use text-indent, from inheriting to the tabs and making them 0 width 137 | text-indent: 0; 138 | padding: 0; 139 | } 140 | 141 | .cm-line-is-wrapped { 142 | max-width: 50em; 143 | } 144 | 145 | .cm-line-is-wrapped.comment-block-line { 146 | max-width: initial; 147 | } 148 | 149 | // When using contenteditable inputStyle (default on mobile), this is the styling for selection 150 | .CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { 151 | background:var(--sn-stylekit-info-color); 152 | color:var(--sn-stylekit-info-contrast-color) 153 | } 154 | .CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { 155 | background:var(--sn-stylekit-info-color); 156 | color:var(--sn-stylekit-info-contrast-color) 157 | } 158 | 159 | // When using textarea inputStyle (default on non-mobile), this is the styling for selection 160 | .CodeMirror-selected { 161 | background: var(--sn-stylekit-info-color) !important; 162 | } 163 | 164 | .CodeMirror-selectedtext { 165 | color: var(--sn-stylekit-info-contrast-color) !important; 166 | background: var(--sn-stylekit-info-color) !important; 167 | } 168 | 169 | .CodeMirror.use-monospace-everywhere { 170 | font-family: var(--sn-stylekit-monospace-font); 171 | } 172 | 173 | .CodeMirror.remove-longer-lines .CodeMirror-lines { 174 | max-width: 50em; 175 | } 176 | 177 | #config-panel { 178 | color: var(--sn-stylekit-editor-foreground-color) !important; 179 | } 180 | 181 | #config-panel a { 182 | color: var(--sn-stylekit-info-color) !important 183 | } 184 | -------------------------------------------------------------------------------- /vendor/mark-selection.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | // Because sometimes you need to mark the selected *text*. 5 | // 6 | // Adds an option 'styleSelectedText' which, when enabled, gives 7 | // selected text the CSS class given as option value, or 8 | // "CodeMirror-selectedtext" when the value is not a string. 9 | 10 | (function(mod) { 11 | if (typeof exports == "object" && typeof module == "object") // CommonJS 12 | mod(require("../../lib/codemirror")); 13 | else if (typeof define == "function" && define.amd) // AMD 14 | define(["../../lib/codemirror"], mod); 15 | else // Plain browser env 16 | mod(CodeMirror); 17 | })(function(CodeMirror) { 18 | "use strict"; 19 | 20 | CodeMirror.defineOption("styleSelectedText", false, function(cm, val, old) { 21 | var prev = old && old != CodeMirror.Init; 22 | if (val && !prev) { 23 | cm.state.markedSelection = []; 24 | cm.state.markedSelectionStyle = typeof val == "string" ? val : "CodeMirror-selectedtext"; 25 | reset(cm); 26 | cm.on("cursorActivity", onCursorActivity); 27 | cm.on("change", onChange); 28 | } else if (!val && prev) { 29 | cm.off("cursorActivity", onCursorActivity); 30 | cm.off("change", onChange); 31 | clear(cm); 32 | cm.state.markedSelection = cm.state.markedSelectionStyle = null; 33 | } 34 | }); 35 | 36 | function onCursorActivity(cm) { 37 | if (cm.state.markedSelection) 38 | cm.operation(function() { update(cm); }); 39 | } 40 | 41 | function onChange(cm) { 42 | if (cm.state.markedSelection && cm.state.markedSelection.length) 43 | cm.operation(function() { clear(cm); }); 44 | } 45 | 46 | var CHUNK_SIZE = 8; 47 | var Pos = CodeMirror.Pos; 48 | var cmp = CodeMirror.cmpPos; 49 | 50 | function coverRange(cm, from, to, addAt) { 51 | if (cmp(from, to) == 0) return; 52 | var array = cm.state.markedSelection; 53 | var cls = cm.state.markedSelectionStyle; 54 | for (var line = from.line;;) { 55 | var start = line == from.line ? from : Pos(line, 0); 56 | var endLine = line + CHUNK_SIZE, atEnd = endLine >= to.line; 57 | var end = atEnd ? to : Pos(endLine, 0); 58 | var mark = cm.markText(start, end, {className: cls}); 59 | if (addAt == null) array.push(mark); 60 | else array.splice(addAt++, 0, mark); 61 | if (atEnd) break; 62 | line = endLine; 63 | } 64 | } 65 | 66 | function clear(cm) { 67 | var array = cm.state.markedSelection; 68 | for (var i = 0; i < array.length; ++i) array[i].clear(); 69 | array.length = 0; 70 | } 71 | 72 | function reset(cm) { 73 | clear(cm); 74 | var ranges = cm.listSelections(); 75 | for (var i = 0; i < ranges.length; i++) 76 | coverRange(cm, ranges[i].from(), ranges[i].to()); 77 | } 78 | 79 | function update(cm) { 80 | if (!cm.somethingSelected()) return clear(cm); 81 | if (cm.listSelections().length > 1) return reset(cm); 82 | 83 | var from = cm.getCursor("start"), to = cm.getCursor("end"); 84 | 85 | var array = cm.state.markedSelection; 86 | if (!array.length) return coverRange(cm, from, to); 87 | 88 | var coverStart = array[0].find(), coverEnd = array[array.length - 1].find(); 89 | if (!coverStart || !coverEnd || to.line - from.line <= CHUNK_SIZE || 90 | cmp(from, coverEnd.to) >= 0 || cmp(to, coverStart.from) <= 0) 91 | return reset(cm); 92 | 93 | while (cmp(from, coverStart.from) > 0) { 94 | array.shift().clear(); 95 | coverStart = array[0].find(); 96 | } 97 | if (cmp(from, coverStart.from) < 0) { 98 | if (coverStart.to.line - from.line < CHUNK_SIZE) { 99 | array.shift().clear(); 100 | coverRange(cm, from, coverStart.to, 0); 101 | } else { 102 | coverRange(cm, from, coverStart.from, 0); 103 | } 104 | } 105 | 106 | while (cmp(to, coverEnd.to) < 0) { 107 | array.pop().clear(); 108 | coverEnd = array[array.length - 1].find(); 109 | } 110 | if (cmp(to, coverEnd.to) > 0) { 111 | if (to.line - coverEnd.from.line < CHUNK_SIZE) { 112 | array.pop().clear(); 113 | coverRange(cm, coverEnd.from, to); 114 | } else { 115 | coverRange(cm, coverEnd.to, to); 116 | } 117 | } 118 | } 119 | }); 120 | --------------------------------------------------------------------------------