scribo 1.0.38 → 1.0.40
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/gem-push.yml +11 -0
- data/.gitignore +12 -0
- data/.reek.yml +8 -0
- data/.rubocop.yml +44 -0
- data/.rubocop_todo.yml +129 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +31 -0
- data/Gemfile.lock +397 -0
- data/README.md +5 -9
- data/TODO.md +32 -0
- data/app/assets/config/scribo_manifest.js +4 -2
- data/app/assets/images/scribo/.keep +0 -0
- data/app/assets/images/scribo/Unknown-1.svg +2 -0
- data/app/assets/images/scribo/file.svg +4 -0
- data/app/assets/images/scribo/file_icons.svg +1 -0
- data/app/assets/images/scribo/folder-open.svg +1 -0
- data/app/assets/images/scribo/folder.svg +1 -0
- data/app/assets/images/scribo/icons/3d.svg +1 -0
- data/app/assets/images/scribo/icons/actionscript.svg +3 -0
- data/app/assets/images/scribo/icons/android.svg +1 -0
- data/app/assets/images/scribo/icons/angular-component.svg +3 -0
- data/app/assets/images/scribo/icons/angular-directive.svg +3 -0
- data/app/assets/images/scribo/icons/angular-guard.svg +3 -0
- data/app/assets/images/scribo/icons/angular-pipe.svg +3 -0
- data/app/assets/images/scribo/icons/angular-resolver.svg +3 -0
- data/app/assets/images/scribo/icons/angular-service.svg +3 -0
- data/app/assets/images/scribo/icons/angular.svg +3 -0
- data/app/assets/images/scribo/icons/apiblueprint.svg +5 -0
- data/app/assets/images/scribo/icons/applescript.svg +3 -0
- data/app/assets/images/scribo/icons/appveyor.svg +5 -0
- data/app/assets/images/scribo/icons/arduino.svg +1 -0
- data/app/assets/images/scribo/icons/asciidoc.svg +1 -0
- data/app/assets/images/scribo/icons/assembly.svg +4 -0
- data/app/assets/images/scribo/icons/audio.svg +4 -0
- data/app/assets/images/scribo/icons/aurelia.svg +107 -0
- data/app/assets/images/scribo/icons/authors.svg +1 -0
- data/app/assets/images/scribo/icons/autohotkey.svg +3 -0
- data/app/assets/images/scribo/icons/autoit.svg +21 -0
- data/app/assets/images/scribo/icons/azure-pipelines.svg +1 -0
- data/app/assets/images/scribo/icons/azure.svg +1 -0
- data/app/assets/images/scribo/icons/babel.svg +1 -0
- data/app/assets/images/scribo/icons/ballerina.svg +1 -0
- data/app/assets/images/scribo/icons/bazel.svg +1 -0
- data/app/assets/images/scribo/icons/bitbucket.svg +1 -0
- data/app/assets/images/scribo/icons/bithound.svg +1 -0
- data/app/assets/images/scribo/icons/blink.svg +4 -0
- data/app/assets/images/scribo/icons/blink_light.svg +4 -0
- data/app/assets/images/scribo/icons/bower.svg +1 -0
- data/app/assets/images/scribo/icons/browserlist.svg +6 -0
- data/app/assets/images/scribo/icons/browserlist_light.svg +7 -0
- data/app/assets/images/scribo/icons/bucklescript.svg +3 -0
- data/app/assets/images/scribo/icons/buildkite.svg +1 -0
- data/app/assets/images/scribo/icons/c.svg +1 -0
- data/app/assets/images/scribo/icons/cabal.svg +8 -0
- data/app/assets/images/scribo/icons/cake.svg +1 -0
- data/app/assets/images/scribo/icons/certificate.svg +3 -0
- data/app/assets/images/scribo/icons/changelog.svg +1 -0
- data/app/assets/images/scribo/icons/circleci.svg +14 -0
- data/app/assets/images/scribo/icons/circleci_light.svg +14 -0
- data/app/assets/images/scribo/icons/clojure.svg +1 -0
- data/app/assets/images/scribo/icons/cloudfoundry.svg +24 -0
- data/app/assets/images/scribo/icons/cmake.svg +7 -0
- data/app/assets/images/scribo/icons/code-climate.svg +4 -0
- data/app/assets/images/scribo/icons/code-climate_light.svg +4 -0
- data/app/assets/images/scribo/icons/coffee.svg +3 -0
- data/app/assets/images/scribo/icons/coldfusion.svg +7 -0
- data/app/assets/images/scribo/icons/conduct.svg +4 -0
- data/app/assets/images/scribo/icons/console.svg +3 -0
- data/app/assets/images/scribo/icons/contributing.svg +4 -0
- data/app/assets/images/scribo/icons/cpp.svg +1 -0
- data/app/assets/images/scribo/icons/credits.svg +3 -0
- data/app/assets/images/scribo/icons/crystal.svg +4 -0
- data/app/assets/images/scribo/icons/crystal_light.svg +4 -0
- data/app/assets/images/scribo/icons/csharp.svg +3 -0
- data/app/assets/images/scribo/icons/css-map.svg +1 -0
- data/app/assets/images/scribo/icons/css.svg +3 -0
- data/app/assets/images/scribo/icons/cucumber.svg +4 -0
- data/app/assets/images/scribo/icons/cuda.svg +4 -0
- data/app/assets/images/scribo/icons/d.svg +1 -0
- data/app/assets/images/scribo/icons/dart.svg +9 -0
- data/app/assets/images/scribo/icons/database.svg +1 -0
- data/app/assets/images/scribo/icons/diff.svg +1 -0
- data/app/assets/images/scribo/icons/django.svg +1 -0
- data/app/assets/images/scribo/icons/docker.svg +4 -0
- data/app/assets/images/scribo/icons/document.svg +3 -0
- data/app/assets/images/scribo/icons/dotjs.svg +8 -0
- data/app/assets/images/scribo/icons/drone.svg +6 -0
- data/app/assets/images/scribo/icons/drone_light.svg +6 -0
- data/app/assets/images/scribo/icons/edge.svg +1 -0
- data/app/assets/images/scribo/icons/editorconfig.svg +9 -0
- data/app/assets/images/scribo/icons/ejs.svg +7 -0
- data/app/assets/images/scribo/icons/elixir.svg +1 -0
- data/app/assets/images/scribo/icons/elm.svg +1 -0
- data/app/assets/images/scribo/icons/email.svg +3 -0
- data/app/assets/images/scribo/icons/erlang.svg +5 -0
- data/app/assets/images/scribo/icons/eslint.svg +3 -0
- data/app/assets/images/scribo/icons/exe.svg +3 -0
- data/app/assets/images/scribo/icons/fastlane.svg +1 -0
- data/app/assets/images/scribo/icons/favicon.svg +3 -0
- data/app/assets/images/scribo/icons/file.svg +3 -0
- data/app/assets/images/scribo/icons/firebase.svg +9 -0
- data/app/assets/images/scribo/icons/flash.svg +12 -0
- data/app/assets/images/scribo/icons/flow.svg +7 -0
- data/app/assets/images/scribo/icons/folder-android-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-android.svg +1 -0
- data/app/assets/images/scribo/icons/folder-animation-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-animation.svg +1 -0
- data/app/assets/images/scribo/icons/folder-ansible-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-ansible.svg +1 -0
- data/app/assets/images/scribo/icons/folder-api-open.svg +4 -0
- data/app/assets/images/scribo/icons/folder-api.svg +4 -0
- data/app/assets/images/scribo/icons/folder-app-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-app.svg +1 -0
- data/app/assets/images/scribo/icons/folder-archive-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-archive.svg +1 -0
- data/app/assets/images/scribo/icons/folder-audio-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-audio.svg +2 -0
- data/app/assets/images/scribo/icons/folder-aurelia-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-aurelia.svg +2 -0
- data/app/assets/images/scribo/icons/folder-aws-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-aws.svg +2 -0
- data/app/assets/images/scribo/icons/folder-batch-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-batch.svg +1 -0
- data/app/assets/images/scribo/icons/folder-benchmark-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-benchmark.svg +1 -0
- data/app/assets/images/scribo/icons/folder-bower-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-bower.svg +2 -0
- data/app/assets/images/scribo/icons/folder-ci-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-ci.svg +1 -0
- data/app/assets/images/scribo/icons/folder-circleci-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-circleci.svg +1 -0
- data/app/assets/images/scribo/icons/folder-class-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-class.svg +1 -0
- data/app/assets/images/scribo/icons/folder-client-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-client.svg +1 -0
- data/app/assets/images/scribo/icons/folder-cluster-open.svg +8 -0
- data/app/assets/images/scribo/icons/folder-cluster.svg +8 -0
- data/app/assets/images/scribo/icons/folder-command-open.svg +4 -0
- data/app/assets/images/scribo/icons/folder-command.svg +4 -0
- data/app/assets/images/scribo/icons/folder-components-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-components.svg +2 -0
- data/app/assets/images/scribo/icons/folder-config-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-config.svg +2 -0
- data/app/assets/images/scribo/icons/folder-constant-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-constant.svg +1 -0
- data/app/assets/images/scribo/icons/folder-container-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-container.svg +1 -0
- data/app/assets/images/scribo/icons/folder-content-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-content.svg +1 -0
- data/app/assets/images/scribo/icons/folder-controller-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-controller.svg +1 -0
- data/app/assets/images/scribo/icons/folder-core-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-core.svg +1 -0
- data/app/assets/images/scribo/icons/folder-coverage-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-coverage.svg +1 -0
- data/app/assets/images/scribo/icons/folder-css-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-css.svg +2 -0
- data/app/assets/images/scribo/icons/folder-custom-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-custom.svg +1 -0
- data/app/assets/images/scribo/icons/folder-database-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-database.svg +2 -0
- data/app/assets/images/scribo/icons/folder-debug-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-debug.svg +1 -0
- data/app/assets/images/scribo/icons/folder-delta-open.svg +4 -0
- data/app/assets/images/scribo/icons/folder-delta.svg +4 -0
- data/app/assets/images/scribo/icons/folder-dist-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-dist.svg +2 -0
- data/app/assets/images/scribo/icons/folder-docker-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-docker.svg +5 -0
- data/app/assets/images/scribo/icons/folder-docs-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-docs.svg +2 -0
- data/app/assets/images/scribo/icons/folder-download-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-download.svg +1 -0
- data/app/assets/images/scribo/icons/folder-dump-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-dump.svg +1 -0
- data/app/assets/images/scribo/icons/folder-environment-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-environment.svg +1 -0
- data/app/assets/images/scribo/icons/folder-error-open.svg +7 -0
- data/app/assets/images/scribo/icons/folder-error.svg +8 -0
- data/app/assets/images/scribo/icons/folder-event-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-event.svg +1 -0
- data/app/assets/images/scribo/icons/folder-examples-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-examples.svg +1 -0
- data/app/assets/images/scribo/icons/folder-expo-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-expo.svg +4 -0
- data/app/assets/images/scribo/icons/folder-export-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-export.svg +5 -0
- data/app/assets/images/scribo/icons/folder-fastlane-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-fastlane.svg +1 -0
- data/app/assets/images/scribo/icons/folder-flow-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-flow.svg +1 -0
- data/app/assets/images/scribo/icons/folder-font-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-font.svg +1 -0
- data/app/assets/images/scribo/icons/folder-functions-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-functions.svg +1 -0
- data/app/assets/images/scribo/icons/folder-generator-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-generator.svg +1 -0
- data/app/assets/images/scribo/icons/folder-git-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-git.svg +1 -0
- data/app/assets/images/scribo/icons/folder-github-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-github.svg +2 -0
- data/app/assets/images/scribo/icons/folder-gitlab-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-gitlab.svg +2 -0
- data/app/assets/images/scribo/icons/folder-global-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-global.svg +2 -0
- data/app/assets/images/scribo/icons/folder-gradle-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-gradle.svg +2 -0
- data/app/assets/images/scribo/icons/folder-graphql-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-graphql.svg +1 -0
- data/app/assets/images/scribo/icons/folder-guard-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-guard.svg +1 -0
- data/app/assets/images/scribo/icons/folder-helper-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-helper.svg +1 -0
- data/app/assets/images/scribo/icons/folder-hook-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-hook.svg +1 -0
- data/app/assets/images/scribo/icons/folder-i18n-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-i18n.svg +2 -0
- data/app/assets/images/scribo/icons/folder-images-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-images.svg +2 -0
- data/app/assets/images/scribo/icons/folder-import-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-import.svg +1 -0
- data/app/assets/images/scribo/icons/folder-include-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-include.svg +2 -0
- data/app/assets/images/scribo/icons/folder-ios-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-ios.svg +1 -0
- data/app/assets/images/scribo/icons/folder-javascript-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-javascript.svg +2 -0
- data/app/assets/images/scribo/icons/folder-jinja-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-jinja-open_light.svg +2 -0
- data/app/assets/images/scribo/icons/folder-jinja.svg +2 -0
- data/app/assets/images/scribo/icons/folder-jinja_light.svg +2 -0
- data/app/assets/images/scribo/icons/folder-job-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-job.svg +1 -0
- data/app/assets/images/scribo/icons/folder-keys-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-keys.svg +1 -0
- data/app/assets/images/scribo/icons/folder-kubernetes-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-kubernetes.svg +5 -0
- data/app/assets/images/scribo/icons/folder-layout-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-layout.svg +1 -0
- data/app/assets/images/scribo/icons/folder-less-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-less.svg +1 -0
- data/app/assets/images/scribo/icons/folder-lib-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-lib.svg +2 -0
- data/app/assets/images/scribo/icons/folder-log-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-log.svg +2 -0
- data/app/assets/images/scribo/icons/folder-mail-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-mail.svg +1 -0
- data/app/assets/images/scribo/icons/folder-mappings-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-mappings.svg +1 -0
- data/app/assets/images/scribo/icons/folder-markdown-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-markdown.svg +2 -0
- data/app/assets/images/scribo/icons/folder-messages-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-messages.svg +1 -0
- data/app/assets/images/scribo/icons/folder-meta-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-meta.svg +1 -0
- data/app/assets/images/scribo/icons/folder-middleware-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-middleware.svg +1 -0
- data/app/assets/images/scribo/icons/folder-mock-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-mock.svg +1 -0
- data/app/assets/images/scribo/icons/folder-ngrx-actions-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-ngrx-actions.svg +2 -0
- data/app/assets/images/scribo/icons/folder-ngrx-effects-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-ngrx-effects.svg +2 -0
- data/app/assets/images/scribo/icons/folder-ngrx-entities-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-ngrx-entities.svg +2 -0
- data/app/assets/images/scribo/icons/folder-ngrx-reducer-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-ngrx-reducer.svg +2 -0
- data/app/assets/images/scribo/icons/folder-ngrx-state-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-ngrx-state.svg +1 -0
- data/app/assets/images/scribo/icons/folder-ngrx-store-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-ngrx-store.svg +1 -0
- data/app/assets/images/scribo/icons/folder-node-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-node.svg +1 -0
- data/app/assets/images/scribo/icons/folder-nuxt-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-nuxt.svg +1 -0
- data/app/assets/images/scribo/icons/folder-open.svg +11 -0
- data/app/assets/images/scribo/icons/folder-other-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-other.svg +1 -0
- data/app/assets/images/scribo/icons/folder-packages-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-packages.svg +1 -0
- data/app/assets/images/scribo/icons/folder-php-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-php.svg +2 -0
- data/app/assets/images/scribo/icons/folder-phpmailer-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-phpmailer.svg +2 -0
- data/app/assets/images/scribo/icons/folder-pipe-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-pipe.svg +1 -0
- data/app/assets/images/scribo/icons/folder-plugin-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-plugin.svg +1 -0
- data/app/assets/images/scribo/icons/folder-prisma-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-prisma.svg +1 -0
- data/app/assets/images/scribo/icons/folder-private-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-private.svg +1 -0
- data/app/assets/images/scribo/icons/folder-public-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-public.svg +2 -0
- data/app/assets/images/scribo/icons/folder-python-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-python.svg +1 -0
- data/app/assets/images/scribo/icons/folder-react-components-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-react-components.svg +2 -0
- data/app/assets/images/scribo/icons/folder-redux-actions-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-redux-actions.svg +1 -0
- data/app/assets/images/scribo/icons/folder-redux-reducer-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-redux-reducer.svg +2 -0
- data/app/assets/images/scribo/icons/folder-redux-store-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-redux-store.svg +2 -0
- data/app/assets/images/scribo/icons/folder-resource-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-resource.svg +2 -0
- data/app/assets/images/scribo/icons/folder-review-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-review.svg +1 -0
- data/app/assets/images/scribo/icons/folder-routes-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-routes.svg +1 -0
- data/app/assets/images/scribo/icons/folder-rules-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-rules.svg +1 -0
- data/app/assets/images/scribo/icons/folder-sass-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-sass.svg +1 -0
- data/app/assets/images/scribo/icons/folder-scripts-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-scripts.svg +2 -0
- data/app/assets/images/scribo/icons/folder-secure-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-secure.svg +1 -0
- data/app/assets/images/scribo/icons/folder-server-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-server.svg +1 -0
- data/app/assets/images/scribo/icons/folder-serverless-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-serverless.svg +1 -0
- data/app/assets/images/scribo/icons/folder-shared-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-shared.svg +1 -0
- data/app/assets/images/scribo/icons/folder-src-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-src.svg +2 -0
- data/app/assets/images/scribo/icons/folder-stack-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-stack.svg +1 -0
- data/app/assets/images/scribo/icons/folder-stylus-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-stylus.svg +1 -0
- data/app/assets/images/scribo/icons/folder-sublime-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-sublime.svg +2 -0
- data/app/assets/images/scribo/icons/folder-svg-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-svg.svg +1 -0
- data/app/assets/images/scribo/icons/folder-syntax-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-syntax.svg +1 -0
- data/app/assets/images/scribo/icons/folder-tasks-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-tasks.svg +1 -0
- data/app/assets/images/scribo/icons/folder-temp-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-temp.svg +2 -0
- data/app/assets/images/scribo/icons/folder-template-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-template.svg +1 -0
- data/app/assets/images/scribo/icons/folder-test-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-test.svg +1 -0
- data/app/assets/images/scribo/icons/folder-theme-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-theme.svg +2 -0
- data/app/assets/images/scribo/icons/folder-tools-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-tools.svg +1 -0
- data/app/assets/images/scribo/icons/folder-typescript-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-typescript.svg +1 -0
- data/app/assets/images/scribo/icons/folder-upload-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-upload.svg +1 -0
- data/app/assets/images/scribo/icons/folder-utils-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-utils.svg +1 -0
- data/app/assets/images/scribo/icons/folder-video-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-video.svg +2 -0
- data/app/assets/images/scribo/icons/folder-views-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-views.svg +1 -0
- data/app/assets/images/scribo/icons/folder-vm-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-vm.svg +1 -0
- data/app/assets/images/scribo/icons/folder-vscode-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-vscode.svg +2 -0
- data/app/assets/images/scribo/icons/folder-vue-directives-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-vue-directives.svg +1 -0
- data/app/assets/images/scribo/icons/folder-vue-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-vue.svg +1 -0
- data/app/assets/images/scribo/icons/folder-vuex-store-open.svg +1 -0
- data/app/assets/images/scribo/icons/folder-vuex-store.svg +1 -0
- data/app/assets/images/scribo/icons/folder-wakatime-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-wakatime.svg +2 -0
- data/app/assets/images/scribo/icons/folder-webpack-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-webpack.svg +2 -0
- data/app/assets/images/scribo/icons/folder-wordpress-open.svg +2 -0
- data/app/assets/images/scribo/icons/folder-wordpress.svg +1 -0
- data/app/assets/images/scribo/icons/folder.svg +11 -0
- data/app/assets/images/scribo/icons/font.svg +3 -0
- data/app/assets/images/scribo/icons/foxpro.svg +1 -0
- data/app/assets/images/scribo/icons/fsharp.svg +7 -0
- data/app/assets/images/scribo/icons/fusebox.svg +20 -0
- data/app/assets/images/scribo/icons/gatsby.svg +5 -0
- data/app/assets/images/scribo/icons/gemfile.svg +1 -0
- data/app/assets/images/scribo/icons/git.svg +4 -0
- data/app/assets/images/scribo/icons/gitlab.svg +43 -0
- data/app/assets/images/scribo/icons/gitpod.svg +1 -0
- data/app/assets/images/scribo/icons/go-mod.svg +8 -0
- data/app/assets/images/scribo/icons/go.svg +8 -0
- data/app/assets/images/scribo/icons/go_gopher.svg +25 -0
- data/app/assets/images/scribo/icons/godot-assets.svg +1 -0
- data/app/assets/images/scribo/icons/godot.svg +1 -0
- data/app/assets/images/scribo/icons/gradle.svg +3 -0
- data/app/assets/images/scribo/icons/graphcool.svg +6 -0
- data/app/assets/images/scribo/icons/graphql.svg +11 -0
- data/app/assets/images/scribo/icons/groovy.svg +3 -0
- data/app/assets/images/scribo/icons/grunt.svg +1 -0
- data/app/assets/images/scribo/icons/gulp.svg +3 -0
- data/app/assets/images/scribo/icons/h.svg +6 -0
- data/app/assets/images/scribo/icons/hack.svg +2 -0
- data/app/assets/images/scribo/icons/haml.svg +5 -0
- data/app/assets/images/scribo/icons/handlebars.svg +3 -0
- data/app/assets/images/scribo/icons/haskell.svg +8 -0
- data/app/assets/images/scribo/icons/haxe.svg +17 -0
- data/app/assets/images/scribo/icons/hcl.svg +1 -0
- data/app/assets/images/scribo/icons/hcl_light.svg +1 -0
- data/app/assets/images/scribo/icons/helm.svg +1 -0
- data/app/assets/images/scribo/icons/heroku.svg +1 -0
- data/app/assets/images/scribo/icons/hpp.svg +7 -0
- data/app/assets/images/scribo/icons/html.svg +3 -0
- data/app/assets/images/scribo/icons/http.svg +3 -0
- data/app/assets/images/scribo/icons/i18n.svg +1 -0
- data/app/assets/images/scribo/icons/image.svg +3 -0
- data/app/assets/images/scribo/icons/ionic.svg +1 -0
- data/app/assets/images/scribo/icons/istanbul.svg +1 -0
- data/app/assets/images/scribo/icons/java.svg +3 -0
- data/app/assets/images/scribo/icons/javascript-map.svg +6 -0
- data/app/assets/images/scribo/icons/javascript.svg +3 -0
- data/app/assets/images/scribo/icons/jenkins.svg +1 -0
- data/app/assets/images/scribo/icons/jest.svg +1 -0
- data/app/assets/images/scribo/icons/jinja.svg +17 -0
- data/app/assets/images/scribo/icons/jinja_light.svg +17 -0
- data/app/assets/images/scribo/icons/json.svg +1 -0
- data/app/assets/images/scribo/icons/julia.svg +9 -0
- data/app/assets/images/scribo/icons/jupyter.svg +1 -0
- data/app/assets/images/scribo/icons/karma.svg +8 -0
- data/app/assets/images/scribo/icons/key.svg +3 -0
- data/app/assets/images/scribo/icons/kivy.svg +9 -0
- data/app/assets/images/scribo/icons/kl.svg +8 -0
- data/app/assets/images/scribo/icons/kotlin.svg +14 -0
- data/app/assets/images/scribo/icons/laravel.svg +5 -0
- data/app/assets/images/scribo/icons/less.svg +1 -0
- data/app/assets/images/scribo/icons/lib.svg +3 -0
- data/app/assets/images/scribo/icons/livescript.svg +18 -0
- data/app/assets/images/scribo/icons/lock.svg +3 -0
- data/app/assets/images/scribo/icons/log.svg +4 -0
- data/app/assets/images/scribo/icons/lua.svg +7 -0
- data/app/assets/images/scribo/icons/makefile.svg +1 -0
- data/app/assets/images/scribo/icons/markdown.svg +3 -0
- data/app/assets/images/scribo/icons/markojs.svg +12 -0
- data/app/assets/images/scribo/icons/mathematica.svg +3 -0
- data/app/assets/images/scribo/icons/matlab.svg +8 -0
- data/app/assets/images/scribo/icons/mdx.svg +1 -0
- data/app/assets/images/scribo/icons/merlin.svg +5 -0
- data/app/assets/images/scribo/icons/mint.svg +1 -0
- data/app/assets/images/scribo/icons/mjml.svg +4 -0
- data/app/assets/images/scribo/icons/mocha.svg +2 -0
- data/app/assets/images/scribo/icons/moonscript.svg +1 -0
- data/app/assets/images/scribo/icons/mxml.svg +3 -0
- data/app/assets/images/scribo/icons/nest-controller.svg +8 -0
- data/app/assets/images/scribo/icons/nest-decorator.svg +8 -0
- data/app/assets/images/scribo/icons/nest-filter.svg +8 -0
- data/app/assets/images/scribo/icons/nest-gateway.svg +8 -0
- data/app/assets/images/scribo/icons/nest-guard.svg +8 -0
- data/app/assets/images/scribo/icons/nest-middleware.svg +8 -0
- data/app/assets/images/scribo/icons/nest-module.svg +8 -0
- data/app/assets/images/scribo/icons/nest-pipe.svg +8 -0
- data/app/assets/images/scribo/icons/nest-service.svg +8 -0
- data/app/assets/images/scribo/icons/nest.svg +8 -0
- data/app/assets/images/scribo/icons/netlify.svg +1 -0
- data/app/assets/images/scribo/icons/ngrx-actions.svg +4 -0
- data/app/assets/images/scribo/icons/ngrx-effects.svg +4 -0
- data/app/assets/images/scribo/icons/ngrx-entity.svg +4 -0
- data/app/assets/images/scribo/icons/ngrx-reducer.svg +4 -0
- data/app/assets/images/scribo/icons/ngrx-state.svg +4 -0
- data/app/assets/images/scribo/icons/nim.svg +1 -0
- data/app/assets/images/scribo/icons/nix.svg +6 -0
- data/app/assets/images/scribo/icons/nodejs.svg +3 -0
- data/app/assets/images/scribo/icons/nodejs_alt.svg +1 -0
- data/app/assets/images/scribo/icons/nodemon.svg +7 -0
- data/app/assets/images/scribo/icons/now.svg +1 -0
- data/app/assets/images/scribo/icons/now_light.svg +1 -0
- data/app/assets/images/scribo/icons/npm.svg +8 -0
- data/app/assets/images/scribo/icons/nunjucks.svg +3 -0
- data/app/assets/images/scribo/icons/nuxt.svg +1 -0
- data/app/assets/images/scribo/icons/ocaml.svg +1 -0
- data/app/assets/images/scribo/icons/pdf.svg +1 -0
- data/app/assets/images/scribo/icons/percy.svg +1 -0
- data/app/assets/images/scribo/icons/perl.svg +3 -0
- data/app/assets/images/scribo/icons/php.svg +1 -0
- data/app/assets/images/scribo/icons/php_elephant.svg +4 -0
- data/app/assets/images/scribo/icons/postcss.svg +9 -0
- data/app/assets/images/scribo/icons/powerpoint.svg +3 -0
- data/app/assets/images/scribo/icons/powershell.svg +1 -0
- data/app/assets/images/scribo/icons/prettier.svg +35 -0
- data/app/assets/images/scribo/icons/prisma.svg +1 -0
- data/app/assets/images/scribo/icons/processing.svg +5 -0
- data/app/assets/images/scribo/icons/processing_light.svg +5 -0
- data/app/assets/images/scribo/icons/protractor.svg +1 -0
- data/app/assets/images/scribo/icons/pug.svg +22 -0
- data/app/assets/images/scribo/icons/puppet.svg +13 -0
- data/app/assets/images/scribo/icons/purescript.svg +1 -0
- data/app/assets/images/scribo/icons/python-misc.svg +1 -0
- data/app/assets/images/scribo/icons/python.svg +8 -0
- data/app/assets/images/scribo/icons/r.svg +4 -0
- data/app/assets/images/scribo/icons/racket.svg +1 -0
- data/app/assets/images/scribo/icons/raml.svg +1 -0
- data/app/assets/images/scribo/icons/razor.svg +1 -0
- data/app/assets/images/scribo/icons/react.svg +3 -0
- data/app/assets/images/scribo/icons/react_ts.svg +1 -0
- data/app/assets/images/scribo/icons/readme.svg +3 -0
- data/app/assets/images/scribo/icons/reason.svg +3 -0
- data/app/assets/images/scribo/icons/red.svg +8 -0
- data/app/assets/images/scribo/icons/redux-action.svg +1 -0
- data/app/assets/images/scribo/icons/redux-reducer.svg +1 -0
- data/app/assets/images/scribo/icons/redux-store.svg +1 -0
- data/app/assets/images/scribo/icons/restql.svg +60 -0
- data/app/assets/images/scribo/icons/riot.svg +1 -0
- data/app/assets/images/scribo/icons/robot.svg +1 -0
- data/app/assets/images/scribo/icons/rollup.svg +50 -0
- data/app/assets/images/scribo/icons/routing.svg +3 -0
- data/app/assets/images/scribo/icons/ruby.svg +3 -0
- data/app/assets/images/scribo/icons/rust.svg +3 -0
- data/app/assets/images/scribo/icons/san.svg +1 -0
- data/app/assets/images/scribo/icons/sass.svg +1 -0
- data/app/assets/images/scribo/icons/sbt.svg +6 -0
- data/app/assets/images/scribo/icons/scala.svg +1 -0
- data/app/assets/images/scribo/icons/scheme.svg +1 -0
- data/app/assets/images/scribo/icons/semantic-release.svg +1 -0
- data/app/assets/images/scribo/icons/semantic-release_light.svg +1 -0
- data/app/assets/images/scribo/icons/sequelize.svg +31 -0
- data/app/assets/images/scribo/icons/settings.svg +3 -0
- data/app/assets/images/scribo/icons/shaderlab.svg +3 -0
- data/app/assets/images/scribo/icons/silverstripe.svg +1 -0
- data/app/assets/images/scribo/icons/slim.svg +4 -0
- data/app/assets/images/scribo/icons/smarty.svg +3 -0
- data/app/assets/images/scribo/icons/snyk.svg +23 -0
- data/app/assets/images/scribo/icons/solidity.svg +7 -0
- data/app/assets/images/scribo/icons/stencil.svg +1 -0
- data/app/assets/images/scribo/icons/stencil_light.svg +1 -0
- data/app/assets/images/scribo/icons/storybook.svg +1 -0
- data/app/assets/images/scribo/icons/stylelint.svg +12 -0
- data/app/assets/images/scribo/icons/stylelint_light.svg +12 -0
- data/app/assets/images/scribo/icons/stylus.svg +1 -0
- data/app/assets/images/scribo/icons/sublime.svg +1 -0
- data/app/assets/images/scribo/icons/svelte.svg +1 -0
- data/app/assets/images/scribo/icons/svg.svg +1 -0
- data/app/assets/images/scribo/icons/swc.svg +12 -0
- data/app/assets/images/scribo/icons/swift.svg +1 -0
- data/app/assets/images/scribo/icons/table.svg +3 -0
- data/app/assets/images/scribo/icons/tailwindcss.svg +1 -0
- data/app/assets/images/scribo/icons/terraform.svg +12 -0
- data/app/assets/images/scribo/icons/test-js.svg +1 -0
- data/app/assets/images/scribo/icons/test-jsx.svg +4 -0
- data/app/assets/images/scribo/icons/test-ts.svg +1 -0
- data/app/assets/images/scribo/icons/tex.svg +1 -0
- data/app/assets/images/scribo/icons/todo.svg +1 -0
- data/app/assets/images/scribo/icons/travis.svg +13 -0
- data/app/assets/images/scribo/icons/tune.svg +7 -0
- data/app/assets/images/scribo/icons/twig.svg +3 -0
- data/app/assets/images/scribo/icons/typescript-def.svg +6 -0
- data/app/assets/images/scribo/icons/typescript.svg +3 -0
- data/app/assets/images/scribo/icons/url.svg +3 -0
- data/app/assets/images/scribo/icons/vagrant.svg +1 -0
- data/app/assets/images/scribo/icons/velocity.svg +1 -0
- data/app/assets/images/scribo/icons/verilog.svg +3 -0
- data/app/assets/images/scribo/icons/vfl.svg +16 -0
- data/app/assets/images/scribo/icons/video.svg +4 -0
- data/app/assets/images/scribo/icons/vim.svg +1 -0
- data/app/assets/images/scribo/icons/virtual.svg +1 -0
- data/app/assets/images/scribo/icons/visualstudio.svg +4 -0
- data/app/assets/images/scribo/icons/vscode.svg +9 -0
- data/app/assets/images/scribo/icons/vue-config.svg +1 -0
- data/app/assets/images/scribo/icons/vue.svg +1 -0
- data/app/assets/images/scribo/icons/vuex-store.svg +1 -0
- data/app/assets/images/scribo/icons/wakatime.svg +21 -0
- data/app/assets/images/scribo/icons/wakatime_light.svg +21 -0
- data/app/assets/images/scribo/icons/wallaby.svg +1 -0
- data/app/assets/images/scribo/icons/watchman.svg +4 -0
- data/app/assets/images/scribo/icons/webassembly.svg +1 -0
- data/app/assets/images/scribo/icons/webhint.svg +5 -0
- data/app/assets/images/scribo/icons/webpack.svg +6 -0
- data/app/assets/images/scribo/icons/wepy.svg +1 -0
- data/app/assets/images/scribo/icons/wolframlanguage.svg +13 -0
- data/app/assets/images/scribo/icons/word.svg +3 -0
- data/app/assets/images/scribo/icons/xaml.svg +3 -0
- data/app/assets/images/scribo/icons/xml.svg +4 -0
- data/app/assets/images/scribo/icons/yaml.svg +1 -0
- data/app/assets/images/scribo/icons/yang.svg +1 -0
- data/app/assets/images/scribo/icons/yarn.svg +3 -0
- data/app/assets/images/scribo/icons/zip.svg +3 -0
- data/app/assets/stylesheets/scribo/application.css +108 -0
- data/app/assets/stylesheets/scribo/components/file-icons.css +158 -0
- data/app/assets/stylesheets/scribo/components/open-editors.css +83 -0
- data/app/assets/stylesheets/scribo/components/tree-view.css +312 -0
- data/app/javascript/scribo/application.js +2 -0
- data/app/javascript/scribo/controllers/application.js +12 -0
- data/app/javascript/scribo/controllers/image_editor_controller.js +72 -0
- data/app/javascript/scribo/controllers/index.js +4 -0
- data/app/javascript/scribo/controllers/open_editors_controller.js +291 -0
- data/app/javascript/scribo/controllers/text_editor_controller.js +39 -0
- data/app/javascript/scribo/controllers/tree_view_controller.js +378 -0
- data/app/javascript/scribo/controllers/upload_controller.js +81 -0
- data/app/views/scribo/admin/sites/contents/_form.html.slim +11 -12
- data/app/views/scribo/shared/_ide.html.slim +1 -1
- data/app/views/scribo/shared/_tree-view.html.slim +3 -3
- data/bin/importmap +4 -0
- data/bin/rails +14 -0
- data/bin/rake +29 -0
- data/bin/rubocop +29 -0
- data/cli/.gitignore +2 -0
- data/cli/scribo.cr +103 -0
- data/cli/shard.lock +6 -0
- data/cli/shard.yml +18 -0
- data/config/importmap.rb +8 -0
- data/docs/content.md +33 -0
- data/docs/editor.png +0 -0
- data/docs/features.md +71 -0
- data/docs/ide.md +17 -0
- data/docs/import_export.md +7 -0
- data/docs/liquid.md +59 -0
- data/favicon.ico +0 -0
- data/frontend/images/.DS_Store +0 -0
- data/icon.png +0 -0
- data/lib/generators/scribo/install_generator.rb +22 -0
- data/lib/generators/scribo/tailwind_config_generator.rb +24 -0
- data/lib/generators/scribo/templates/config/initializers/scribo.rb +16 -0
- data/lib/scribo/engine.rb +19 -8
- data/lib/scribo/version.rb +1 -1
- data/lib/tasks/scribo_tasks.rake +13 -0
- data/logo.svg +1 -0
- data/scribo.gemspec +54 -0
- data/vendor/javascript/@hotwired--stimulus.js +2 -0
- data/vendor/javascript/painterro.js +2 -0
- data/vendor/javascript/sortablejs.js +134 -0
- data/yarn.lock +6775 -0
- metadata +683 -15
- data/app/assets/javascripts/scribo/scribo.js +0 -1
- data/app/assets/stylesheets/scribo/scribo.css +0 -1
- data/lib/scribo/liquid/tags/editable_url_tag.rb +0 -19
@@ -0,0 +1,291 @@
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
2
|
+
|
3
|
+
export default class extends Controller {
|
4
|
+
static targets = ["tabs", "list", "contents"]
|
5
|
+
|
6
|
+
connect() {
|
7
|
+
this.editors = {}
|
8
|
+
this.editorActive = null
|
9
|
+
window.scriboEditors = this
|
10
|
+
|
11
|
+
document.addEventListener("content-editor.changed", (event) => {
|
12
|
+
let tab = this._tabForId(event.detail.contentId)
|
13
|
+
let content = this._contentForId(event.detail.contentId)
|
14
|
+
let item = this._itemForId(event.detail.contentId)
|
15
|
+
|
16
|
+
if (!tab || !content || !item) {
|
17
|
+
return
|
18
|
+
}
|
19
|
+
|
20
|
+
if (event.detail.dirty == true) {
|
21
|
+
tab.classList.add("editor-tab--dirty")
|
22
|
+
content.classList.add("dirty")
|
23
|
+
item.classList.add("dirty")
|
24
|
+
} else if (event.detail.dirty == false) {
|
25
|
+
tab.classList.remove("editor-tab--dirty")
|
26
|
+
content.classList.remove("dirty")
|
27
|
+
item.classList.remove("dirty")
|
28
|
+
} else if (event.detail.path) {
|
29
|
+
tab.querySelector(".name").innerText = event.detail.path
|
30
|
+
item.querySelector(".name").firstChild.data = event.detail.path
|
31
|
+
item.querySelector("small").innerText = event.detail.fullPath
|
32
|
+
}
|
33
|
+
})
|
34
|
+
|
35
|
+
document.addEventListener("keydown", (event) => {
|
36
|
+
if (event.key == "s" && event.metaKey == true && event.shiftKey == true) {
|
37
|
+
event.preventDefault()
|
38
|
+
event.stopPropagation()
|
39
|
+
event.cancelBubble = true
|
40
|
+
|
41
|
+
this.saveAll(event)
|
42
|
+
} else if (event.key == "s" && event.metaKey == true) {
|
43
|
+
event.preventDefault()
|
44
|
+
event.stopPropagation()
|
45
|
+
event.cancelBubble = true
|
46
|
+
|
47
|
+
if (this.editorActive) {
|
48
|
+
let elm = document.getElementById("content-editor-" + this.editorActive)
|
49
|
+
let controller = this._editorControllerForElement(elm)
|
50
|
+
controller.save()
|
51
|
+
}
|
52
|
+
}
|
53
|
+
})
|
54
|
+
|
55
|
+
let readme = document.getElementById("readme")
|
56
|
+
if (readme) {
|
57
|
+
let id = readme.getAttribute("data-id")
|
58
|
+
let url = readme.getAttribute("data-url")
|
59
|
+
let path = readme.getAttribute("data-path")
|
60
|
+
let full_path = readme.getAttribute("data-full-path")
|
61
|
+
|
62
|
+
window.scriboEditors.open(id, path, full_path, url, readme.innerHTML)
|
63
|
+
readme.remove()
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
open(id, name, path, url, data) {
|
68
|
+
if (id != "0" && id != "1") {
|
69
|
+
this.close(0)
|
70
|
+
}
|
71
|
+
|
72
|
+
let existingEditor = this.editors[id]
|
73
|
+
|
74
|
+
if (existingEditor) {
|
75
|
+
this._activateEditor(existingEditor.id)
|
76
|
+
} else {
|
77
|
+
this._createEditor(id, name, path, url, data)
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
close(id) {
|
82
|
+
let existingEditor = this.editors[id]
|
83
|
+
if (existingEditor) {
|
84
|
+
let tab = this._tabForId(id)
|
85
|
+
if (tab.classList.contains("editor-tab--dirty")) {
|
86
|
+
let result = confirm("You have unsaved changes, do you want close this editor?")
|
87
|
+
if (!result) {
|
88
|
+
return
|
89
|
+
}
|
90
|
+
}
|
91
|
+
this._removeEditor(id)
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
closeAll(event) {
|
96
|
+
this.tabsTarget.querySelectorAll(".editor-tab").forEach((element) => {
|
97
|
+
if (!element.classList.contains("editor-tab--dirty")) {
|
98
|
+
this._removeEditor(element.dataset.tab)
|
99
|
+
}
|
100
|
+
})
|
101
|
+
}
|
102
|
+
|
103
|
+
clickTabs(event) {
|
104
|
+
let close = event.target.closest(".close")
|
105
|
+
let tab = event.target.closest(".editor-tab")
|
106
|
+
|
107
|
+
if (tab) {
|
108
|
+
if (close) {
|
109
|
+
this.close(tab.dataset.tab)
|
110
|
+
} else {
|
111
|
+
this._activateEditor(tab.dataset.tab)
|
112
|
+
}
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
116
|
+
clickList(event) {
|
117
|
+
// TODO: Include close button and dirty indicator in list too
|
118
|
+
let tab = event.target.closest("li.editor")
|
119
|
+
if (tab) {
|
120
|
+
this._activateEditor(tab.dataset.tab)
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
save(event) {
|
125
|
+
event.stopPropagation()
|
126
|
+
let tab = event.target.closest("li.editor")
|
127
|
+
let contentId = tab.dataset.tab
|
128
|
+
|
129
|
+
let elm = document.getElementById("content-editor-" + contentId)
|
130
|
+
let controller = this._editorControllerForElement(elm)
|
131
|
+
controller.save()
|
132
|
+
}
|
133
|
+
|
134
|
+
saveAll(event) {
|
135
|
+
this.tabsTarget.querySelectorAll(".editor-tab").forEach((element) => {
|
136
|
+
if (element.classList.contains("editor-tab--dirty")) {
|
137
|
+
let elm = document.getElementById("content-editor-" + element.dataset.tab)
|
138
|
+
let controller = this._editorControllerForElement(elm)
|
139
|
+
controller.save()
|
140
|
+
}
|
141
|
+
})
|
142
|
+
}
|
143
|
+
|
144
|
+
_editorControllerForElement(elm) {
|
145
|
+
let result = this.application.getControllerForElementAndIdentifier(elm, "text-editor")
|
146
|
+
|
147
|
+
if (!result) {
|
148
|
+
result = this.application.getControllerForElementAndIdentifier(elm, "image-editor")
|
149
|
+
}
|
150
|
+
|
151
|
+
return result
|
152
|
+
}
|
153
|
+
|
154
|
+
_createEditor(id, name, path, url, data) {
|
155
|
+
this.editors[id] = { id: id, name: name, path: path, url: url, data: data }
|
156
|
+
this._createTab(id, name)
|
157
|
+
this._createListEntry(id, name, path)
|
158
|
+
this._createTabContent(id, url, data)
|
159
|
+
this._activateEditor(id)
|
160
|
+
}
|
161
|
+
|
162
|
+
_removeEditor(id) {
|
163
|
+
delete this.editors[id]
|
164
|
+
if (this.editorActive == id) {
|
165
|
+
// Can be null/undefined which is fine
|
166
|
+
this._activateEditor(Object.keys(this.editors)[0])
|
167
|
+
}
|
168
|
+
this._removeTab(id)
|
169
|
+
this._removeItem(id)
|
170
|
+
this._removeContent(id)
|
171
|
+
}
|
172
|
+
|
173
|
+
_activateEditor(id) {
|
174
|
+
this.editorActive = id
|
175
|
+
this._activateTabs()
|
176
|
+
this._activateContents()
|
177
|
+
}
|
178
|
+
|
179
|
+
_createTab(id, name) {
|
180
|
+
let tab = document.createElement("div")
|
181
|
+
tab.setAttribute("data-tab", id)
|
182
|
+
tab.setAttribute("class", "editor-tab")
|
183
|
+
|
184
|
+
let icon = document.createElement("i")
|
185
|
+
icon.setAttribute("class", "close fa fa-xmark")
|
186
|
+
|
187
|
+
let nameSpan = document.createElement("span")
|
188
|
+
nameSpan.setAttribute("class", "name")
|
189
|
+
nameSpan.setAttribute("data-path", name)
|
190
|
+
nameSpan.appendChild(document.createTextNode(name))
|
191
|
+
|
192
|
+
tab.appendChild(nameSpan)
|
193
|
+
tab.appendChild(icon)
|
194
|
+
|
195
|
+
this.tabsTarget.appendChild(tab)
|
196
|
+
}
|
197
|
+
|
198
|
+
_createListEntry(id, name, path) {
|
199
|
+
let entry = document.createElement("li")
|
200
|
+
entry.setAttribute("data-tab", id)
|
201
|
+
entry.setAttribute("class", "editor file")
|
202
|
+
|
203
|
+
let link = document.createElement("a")
|
204
|
+
link.setAttribute("class", "list-item")
|
205
|
+
|
206
|
+
let nameSpan = document.createElement("span")
|
207
|
+
nameSpan.setAttribute("class", "name")
|
208
|
+
nameSpan.setAttribute("data-path", path)
|
209
|
+
nameSpan.appendChild(document.createTextNode(name))
|
210
|
+
|
211
|
+
let nameSmall = document.createElement("small")
|
212
|
+
nameSmall.appendChild(document.createTextNode(path))
|
213
|
+
nameSpan.appendChild(nameSmall)
|
214
|
+
|
215
|
+
link.appendChild(nameSpan)
|
216
|
+
|
217
|
+
entry.appendChild(link)
|
218
|
+
|
219
|
+
let tools = document.createElement("span")
|
220
|
+
tools.setAttribute("class", "tools")
|
221
|
+
|
222
|
+
let saveIcon = document.createElement("i")
|
223
|
+
saveIcon.setAttribute("class", "close fal fa-floppy-disk")
|
224
|
+
saveIcon.setAttribute("data-action", "click->open-editors#save")
|
225
|
+
|
226
|
+
tools.appendChild(saveIcon)
|
227
|
+
|
228
|
+
link.appendChild(tools)
|
229
|
+
|
230
|
+
this.listTarget.appendChild(entry)
|
231
|
+
}
|
232
|
+
|
233
|
+
_createTabContent(id, url, data) {
|
234
|
+
let content = document.createElement("div")
|
235
|
+
content.setAttribute("data-tab", id)
|
236
|
+
content.setAttribute("class", "editor-content")
|
237
|
+
|
238
|
+
content.innerHTML = data
|
239
|
+
|
240
|
+
this.contentsTarget.appendChild(content)
|
241
|
+
}
|
242
|
+
|
243
|
+
_activateTabs() {
|
244
|
+
this.tabsTarget.querySelectorAll(".editor-tab").forEach((element) => {
|
245
|
+
element.classList.remove("editor-tab--active")
|
246
|
+
})
|
247
|
+
|
248
|
+
if (this.editorActive) {
|
249
|
+
let tab = this._tabForId(this.editorActive)
|
250
|
+
tab.classList.add("editor-tab--active")
|
251
|
+
}
|
252
|
+
}
|
253
|
+
|
254
|
+
_activateContents() {
|
255
|
+
this.contentsTarget.querySelectorAll(".editor-content").forEach((element) => {
|
256
|
+
element.classList.remove("editor-content--active")
|
257
|
+
})
|
258
|
+
|
259
|
+
if (this.editorActive) {
|
260
|
+
let tabContent = this._contentForId(this.editorActive)
|
261
|
+
tabContent.classList.add("editor-content--active")
|
262
|
+
}
|
263
|
+
}
|
264
|
+
|
265
|
+
_removeTab(id) {
|
266
|
+
let tab = this._tabForId(id)
|
267
|
+
tab.remove()
|
268
|
+
}
|
269
|
+
|
270
|
+
_removeItem(id) {
|
271
|
+
let item = this._itemForId(id)
|
272
|
+
item.remove()
|
273
|
+
}
|
274
|
+
|
275
|
+
_removeContent(id) {
|
276
|
+
let content = this._contentForId(id)
|
277
|
+
content.remove()
|
278
|
+
}
|
279
|
+
|
280
|
+
_tabForId(id) {
|
281
|
+
return this.tabsTarget.querySelector(".editor-tab[data-tab='" + id + "']")
|
282
|
+
}
|
283
|
+
|
284
|
+
_itemForId(id) {
|
285
|
+
return this.listTarget.querySelector(".editor[data-tab='" + id + "']")
|
286
|
+
}
|
287
|
+
|
288
|
+
_contentForId(id) {
|
289
|
+
return this.contentsTarget.querySelector(".editor-content[data-tab='" + id + "']")
|
290
|
+
}
|
291
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import EditorComponentController from "satis/components/editor/component_controller"
|
2
|
+
|
3
|
+
/***
|
4
|
+
* Text editor controller
|
5
|
+
*
|
6
|
+
* Control codemirror
|
7
|
+
*/
|
8
|
+
export default class extends EditorComponentController {
|
9
|
+
static targets = ["textarea"]
|
10
|
+
|
11
|
+
save() {
|
12
|
+
const self = this
|
13
|
+
|
14
|
+
const formData = new FormData()
|
15
|
+
formData.append("_method", "PATCH")
|
16
|
+
formData.append("content[data_with_frontmatter]", this.inputTarget.value)
|
17
|
+
|
18
|
+
fetch(self.data.get("save-url"), {
|
19
|
+
method: "POST",
|
20
|
+
headers: {
|
21
|
+
Accept: "application/json, text/javascript",
|
22
|
+
"X-CSRF-Token": document.querySelector("meta[name=csrf-token]").content,
|
23
|
+
},
|
24
|
+
body: formData,
|
25
|
+
}).then((response) => {
|
26
|
+
if (response.status == 200) {
|
27
|
+
let event = new CustomEvent("content-editor.changed", {
|
28
|
+
bubbles: true,
|
29
|
+
cancelable: true,
|
30
|
+
detail: {
|
31
|
+
contentId: self.data.get("content-id"),
|
32
|
+
dirty: false,
|
33
|
+
},
|
34
|
+
})
|
35
|
+
self.element.dispatchEvent(event)
|
36
|
+
}
|
37
|
+
})
|
38
|
+
}
|
39
|
+
}
|
@@ -0,0 +1,378 @@
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
2
|
+
import Sortable from "sortablejs"
|
3
|
+
|
4
|
+
/***
|
5
|
+
* Treeview controller
|
6
|
+
*
|
7
|
+
* Manages the tree view
|
8
|
+
*/
|
9
|
+
export default class extends Controller {
|
10
|
+
static targets = ["folderTemplate", "entryTemplate", "collapseExpand", "contentItems"]
|
11
|
+
|
12
|
+
connect() {
|
13
|
+
const self = this
|
14
|
+
|
15
|
+
self.element.addEventListener("click", (event) => {
|
16
|
+
event.stopPropagation()
|
17
|
+
let el = event.target.closest("li.entry")
|
18
|
+
if (!el) {
|
19
|
+
return
|
20
|
+
}
|
21
|
+
if (el && event.target.closest("li.entry").classList.contains("directory")) {
|
22
|
+
el.classList.toggle("open")
|
23
|
+
el.classList.toggle("closed")
|
24
|
+
|
25
|
+
self._updateCollapseExpandAll()
|
26
|
+
}
|
27
|
+
})
|
28
|
+
|
29
|
+
self.element.querySelectorAll("ul").forEach((el) => {
|
30
|
+
this._addSortable(el)
|
31
|
+
})
|
32
|
+
}
|
33
|
+
|
34
|
+
// Collapse or expand all folders
|
35
|
+
collapseExpandAll(event) {
|
36
|
+
const self = this
|
37
|
+
if (self.collapseExpandTarget.classList.contains("fa-square-plus")) {
|
38
|
+
self.element.querySelectorAll("li.directory").forEach((el) => {
|
39
|
+
el.classList.add("open")
|
40
|
+
el.classList.remove("closed")
|
41
|
+
})
|
42
|
+
} else {
|
43
|
+
self.element.querySelectorAll("li.directory").forEach((el) => {
|
44
|
+
el.classList.remove("open")
|
45
|
+
el.classList.add("closed")
|
46
|
+
})
|
47
|
+
}
|
48
|
+
self._updateCollapseExpandAll()
|
49
|
+
}
|
50
|
+
|
51
|
+
// Create content
|
52
|
+
create(event) {
|
53
|
+
const kind = event.target.closest("[data-action]").getAttribute("data-kind")
|
54
|
+
const url = event.target.closest("[data-action]").getAttribute("data-url")
|
55
|
+
|
56
|
+
let template = "entryTemplateTarget"
|
57
|
+
if (kind == "folder") {
|
58
|
+
template = "folderTemplateTarget"
|
59
|
+
}
|
60
|
+
|
61
|
+
const newContentNode = document.importNode(this[template].content, true)
|
62
|
+
|
63
|
+
const closestDirectory = event.target.closest("li.directory")
|
64
|
+
let newContentContainer = event.target.closest(".section").querySelector("ul")
|
65
|
+
if (closestDirectory) {
|
66
|
+
newContentContainer = closestDirectory.querySelector("ul")
|
67
|
+
}
|
68
|
+
newContentContainer.prepend(newContentNode)
|
69
|
+
|
70
|
+
const input = newContentContainer.querySelector("input")
|
71
|
+
input.setAttribute("data-kind", kind)
|
72
|
+
input.setAttribute("data-url", url)
|
73
|
+
input.focus()
|
74
|
+
input.setSelectionRange(0, input.value.length)
|
75
|
+
|
76
|
+
input.addEventListener(
|
77
|
+
"keyup",
|
78
|
+
function (event) {
|
79
|
+
this._createContent(event, newContentContainer)
|
80
|
+
}.bind(this)
|
81
|
+
)
|
82
|
+
input.addEventListener(
|
83
|
+
"blur",
|
84
|
+
function (event) {
|
85
|
+
this._cancelCreate(event, newContentContainer)
|
86
|
+
}.bind(this)
|
87
|
+
)
|
88
|
+
|
89
|
+
event.stopPropagation()
|
90
|
+
}
|
91
|
+
|
92
|
+
// Delete content
|
93
|
+
delete(event) {
|
94
|
+
const self = this
|
95
|
+
|
96
|
+
event.stopPropagation()
|
97
|
+
event.cancelBubble = true
|
98
|
+
|
99
|
+
const elm = event.target.closest("[data-action]")
|
100
|
+
|
101
|
+
let result = true
|
102
|
+
if (elm.getAttribute("data-confirm")) {
|
103
|
+
result = confirm(elm.getAttribute("data-confirm"))
|
104
|
+
}
|
105
|
+
if (!result) {
|
106
|
+
return
|
107
|
+
}
|
108
|
+
|
109
|
+
const formData = new FormData()
|
110
|
+
formData.append("_method", "DELETE")
|
111
|
+
fetch(elm.getAttribute("data-url"), {
|
112
|
+
method: "POST",
|
113
|
+
headers: {
|
114
|
+
"X-CSRF-Token": document.querySelector("meta[name=csrf-token]").content,
|
115
|
+
},
|
116
|
+
body: formData,
|
117
|
+
}).then((response) => {
|
118
|
+
if (response.status == 200) {
|
119
|
+
const node = elm.closest("li")
|
120
|
+
const contentId = node.getAttribute("data-content")
|
121
|
+
if (node.parentNode) {
|
122
|
+
window.scriboEditors.close(contentId)
|
123
|
+
node.parentNode.removeChild(node)
|
124
|
+
}
|
125
|
+
}
|
126
|
+
})
|
127
|
+
}
|
128
|
+
|
129
|
+
// Opens content in the editor pane
|
130
|
+
open(event) {
|
131
|
+
const self = this
|
132
|
+
const closestA = event.target.closest("a")
|
133
|
+
|
134
|
+
// Is a rename currently happening? If so abort
|
135
|
+
if (closestA.querySelector("input")) {
|
136
|
+
return
|
137
|
+
}
|
138
|
+
this.clicked = event
|
139
|
+
setTimeout(this._open.bind(this, event), 500)
|
140
|
+
event.stopPropagation()
|
141
|
+
event.preventDefault()
|
142
|
+
return false
|
143
|
+
}
|
144
|
+
|
145
|
+
// Rename content
|
146
|
+
rename(event) {
|
147
|
+
const self = this
|
148
|
+
this.clicked = null
|
149
|
+
const closestA = event.target.closest("a")
|
150
|
+
|
151
|
+
// Is a rename currently happening? If so abort
|
152
|
+
if (closestA.querySelector("input")) {
|
153
|
+
return
|
154
|
+
}
|
155
|
+
|
156
|
+
const input = document.createElement("input")
|
157
|
+
const nameSpan = closestA.firstChild
|
158
|
+
input.type = "text"
|
159
|
+
input.value = nameSpan.innerText
|
160
|
+
|
161
|
+
input.addEventListener("keyup", this._renameContent.bind(this))
|
162
|
+
input.addEventListener("blur", this._cancelRename.bind(this))
|
163
|
+
|
164
|
+
closestA.querySelector(".tools").style.display = "none"
|
165
|
+
nameSpan.innerText = ""
|
166
|
+
nameSpan.appendChild(input)
|
167
|
+
|
168
|
+
input.focus()
|
169
|
+
input.setSelectionRange(0, input.value.length)
|
170
|
+
|
171
|
+
event.stopPropagation()
|
172
|
+
event.preventDefault()
|
173
|
+
return false
|
174
|
+
}
|
175
|
+
|
176
|
+
disconnect() {}
|
177
|
+
|
178
|
+
// Private
|
179
|
+
|
180
|
+
_updateCollapseExpandAll() {
|
181
|
+
const self = this
|
182
|
+
if (!self.contentItemsTarget.querySelector("li.entry.directory.open")) {
|
183
|
+
// All are closed
|
184
|
+
self.collapseExpandTarget.classList.remove("fa-square-minus")
|
185
|
+
self.collapseExpandTarget.classList.add("fa-square-plus")
|
186
|
+
} else {
|
187
|
+
self.collapseExpandTarget.classList.add("fa-square-minus")
|
188
|
+
self.collapseExpandTarget.classList.remove("fa-square-plus")
|
189
|
+
}
|
190
|
+
}
|
191
|
+
|
192
|
+
_open(event) {
|
193
|
+
const self = this
|
194
|
+
|
195
|
+
if (this.clicked == null) {
|
196
|
+
return
|
197
|
+
}
|
198
|
+
|
199
|
+
this.clicked = null
|
200
|
+
event.stopPropagation()
|
201
|
+
const closestA = event.target.closest("a")
|
202
|
+
|
203
|
+
fetch(closestA.getAttribute("data-tree-view-url"), {
|
204
|
+
method: "GET",
|
205
|
+
headers: {
|
206
|
+
Accept: "application/json, text/javascript",
|
207
|
+
},
|
208
|
+
}).then((response) => {
|
209
|
+
response.json().then(function (data) {
|
210
|
+
window.scriboEditors.open(data.content.id, data.content.path, data.content.full_path, data.content.url, data.html)
|
211
|
+
self._selectEntry(closestA.closest("li.entry"))
|
212
|
+
})
|
213
|
+
})
|
214
|
+
}
|
215
|
+
|
216
|
+
_renameContent(event) {
|
217
|
+
const self = this
|
218
|
+
|
219
|
+
const node = event.target.closest("li")
|
220
|
+
const contentId = node.getAttribute("data-content")
|
221
|
+
|
222
|
+
const closestA = event.target.closest("a")
|
223
|
+
|
224
|
+
const input = closestA.querySelector("input")
|
225
|
+
const nameSpan = closestA.querySelector("span.name")
|
226
|
+
nameSpan.setAttribute("data-path", input.value)
|
227
|
+
|
228
|
+
const newName = input.value
|
229
|
+
if (event.key == "Enter") {
|
230
|
+
fetch(closestA.getAttribute("data-tree-view-rename-url"), {
|
231
|
+
method: "PUT",
|
232
|
+
headers: {
|
233
|
+
Accept: "application/json, text/javascript",
|
234
|
+
"Content-Type": "application/json",
|
235
|
+
"X-CSRF-Token": document.querySelector("meta[name=csrf-token]").content,
|
236
|
+
},
|
237
|
+
body: JSON.stringify({
|
238
|
+
to: newName,
|
239
|
+
}),
|
240
|
+
}).then((response) => {
|
241
|
+
response.json().then(function (data) {
|
242
|
+
let changeEvent = new CustomEvent("content-editor.changed", {
|
243
|
+
bubbles: true,
|
244
|
+
cancelable: true,
|
245
|
+
detail: {
|
246
|
+
contentId: data.content.id,
|
247
|
+
path: data.content.path,
|
248
|
+
fullPath: data.content.full_path,
|
249
|
+
},
|
250
|
+
})
|
251
|
+
self.element.dispatchEvent(changeEvent)
|
252
|
+
self._cancelRename(event)
|
253
|
+
})
|
254
|
+
})
|
255
|
+
} else if (event.key == "Escape") {
|
256
|
+
self._cancelRename(event)
|
257
|
+
}
|
258
|
+
}
|
259
|
+
|
260
|
+
_cancelRename(event) {
|
261
|
+
const closestA = event.target.closest("a")
|
262
|
+
const nameSpan = closestA.firstChild
|
263
|
+
const input = nameSpan.querySelector("input")
|
264
|
+
closestA.querySelector(".tools").style.display = ""
|
265
|
+
|
266
|
+
const name = input.value
|
267
|
+
nameSpan.removeChild(input)
|
268
|
+
nameSpan.innerText = name
|
269
|
+
}
|
270
|
+
|
271
|
+
_createContent(event, newContentContainer) {
|
272
|
+
const self = this
|
273
|
+
|
274
|
+
const input = newContentContainer.querySelector("input")
|
275
|
+
const nameSpan = newContentContainer.querySelector("span.name")
|
276
|
+
nameSpan.setAttribute("data-path", input.value)
|
277
|
+
|
278
|
+
if (event.key == "Enter") {
|
279
|
+
const parent = newContentContainer.getAttribute("data-parent")
|
280
|
+
|
281
|
+
fetch(input.getAttribute("data-url"), {
|
282
|
+
method: "POST",
|
283
|
+
headers: {
|
284
|
+
Accept: "application/json, text/javascript",
|
285
|
+
"Content-Type": "application/json",
|
286
|
+
"X-CSRF-Token": document.querySelector("meta[name=csrf-token]").content,
|
287
|
+
},
|
288
|
+
body: JSON.stringify({
|
289
|
+
parent: parent,
|
290
|
+
kind: input.getAttribute("data-kind"),
|
291
|
+
path: input.value,
|
292
|
+
}),
|
293
|
+
}).then((response) => {
|
294
|
+
if (response.status == 200) {
|
295
|
+
response.json().then(function (data) {
|
296
|
+
self._cancelCreate(event, newContentContainer)
|
297
|
+
newContentContainer.insertAdjacentHTML("afterbegin", data.itemHtml)
|
298
|
+
if (data.content.kind != "folder") {
|
299
|
+
// document.querySelector(".editor-pane").innerHTML = data.html
|
300
|
+
self._selectEntry(newContentContainer.querySelector("li." + (data.content.kind == "folder" ? "folder" : "file")))
|
301
|
+
window.scriboEditors.open(data.content.id, data.content.path, data.content.full_path, data.content.url, data.html)
|
302
|
+
} else {
|
303
|
+
// A folder
|
304
|
+
let folderUl = newContentContainer.querySelector(`[data-content="${data.content.id}"] ul`)
|
305
|
+
self._addSortable(folderUl)
|
306
|
+
}
|
307
|
+
})
|
308
|
+
}
|
309
|
+
})
|
310
|
+
} else if (event.key == "Escape") {
|
311
|
+
self._cancelCreate(event, newContentContainer)
|
312
|
+
}
|
313
|
+
}
|
314
|
+
|
315
|
+
_cancelCreate(event, newContentContainer) {
|
316
|
+
newContentContainer.removeChild(newContentContainer.firstChild)
|
317
|
+
}
|
318
|
+
|
319
|
+
_selectEntry(element) {
|
320
|
+
const treeView = document.querySelector(".tree-view")
|
321
|
+
const lastSelected = treeView.querySelector("li.entry.selected")
|
322
|
+
if (lastSelected) {
|
323
|
+
lastSelected.classList.remove("selected")
|
324
|
+
}
|
325
|
+
|
326
|
+
element.classList.add("selected")
|
327
|
+
}
|
328
|
+
|
329
|
+
_addSortable(el) {
|
330
|
+
const self = this
|
331
|
+
new Sortable(el, {
|
332
|
+
group: "nested",
|
333
|
+
animation: 150,
|
334
|
+
fallbackOnBody: true,
|
335
|
+
swapThreshold: 0.65,
|
336
|
+
onEnd: (evt) => {
|
337
|
+
const contentId = evt.item.getAttribute("data-content")
|
338
|
+
const parentId = evt.to.getAttribute("data-parent")
|
339
|
+
fetch(self.data.get("update-url"), {
|
340
|
+
method: "PUT",
|
341
|
+
headers: {
|
342
|
+
Accept: "application/json, text/javascript",
|
343
|
+
"Content-Type": "application/json",
|
344
|
+
"X-CSRF-Token": document.querySelector("meta[name=csrf-token]").content,
|
345
|
+
},
|
346
|
+
body: JSON.stringify({
|
347
|
+
id: contentId,
|
348
|
+
to: parentId,
|
349
|
+
index: evt.newIndex,
|
350
|
+
}),
|
351
|
+
}).then((response) => {
|
352
|
+
response.json().then(function (data) {
|
353
|
+
let changeEvent = new CustomEvent("content-editor.changed", {
|
354
|
+
bubbles: true,
|
355
|
+
cancelable: true,
|
356
|
+
detail: {
|
357
|
+
contentId: data.content.id,
|
358
|
+
path: data.content.path,
|
359
|
+
fullPath: data.content.full_path,
|
360
|
+
},
|
361
|
+
})
|
362
|
+
self.element.dispatchEvent(changeEvent)
|
363
|
+
})
|
364
|
+
})
|
365
|
+
},
|
366
|
+
onMove: function (evt) {
|
367
|
+
const parentId = evt.to.getAttribute("data-parent")
|
368
|
+
if (parentId) {
|
369
|
+
const file = document.querySelector('[data-content="' + parentId + '"]').classList.contains("file")
|
370
|
+
if (file) {
|
371
|
+
evt.preventDefault()
|
372
|
+
return false
|
373
|
+
}
|
374
|
+
}
|
375
|
+
},
|
376
|
+
})
|
377
|
+
}
|
378
|
+
}
|