├── .editorconfig ├── .gitignore ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── UPGRADING.md ├── composer.json ├── config └── nova-markdown.php ├── dist ├── js │ ├── field.js │ └── field.js.LICENSE.txt └── mix-manifest.json ├── nova.mix.js ├── package.json ├── resources └── js │ ├── components │ ├── DetailField.vue │ ├── FormField.vue │ └── IndexField.vue │ ├── field.js │ └── mixins │ └── markdown.js ├── screenshots ├── field-dark.png ├── field-mobile.png └── field.png ├── src ├── FieldServiceProvider.php └── Markdown.php ├── webpack.mix.js └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | indent_style = space 8 | indent_size = 4 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.{yml,yaml}] 15 | indent_size = 2 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # Mac OS X 4 | .DS_Store 5 | ._.* 6 | ._* 7 | 8 | # Ignore local editor 9 | .project 10 | .settings 11 | /.idea 12 | /.vscode 13 | *.swp 14 | tags 15 | nbproject/* 16 | 17 | # Windows 18 | Thumbs.db 19 | 20 | auth.json 21 | npm-debug.log 22 | yarn-error.log 23 | 24 | .env 25 | .env.backup 26 | phpunit.xml 27 | .phpunit.result.cache 28 | docker-compose.override.yml 29 | Homestead.json 30 | Homestead.yaml 31 | 32 | config/version.yml 33 | 34 | package-lock.json 35 | composer.phar 36 | composer.lock 37 | yarn.lock 38 | 39 | _ide_helper.php 40 | _ide_helper_models.php 41 | .phpstorm.meta.php 42 | lighthouse-audit* 43 | .nova 44 | 45 | /node_modules 46 | /vendor 47 | /packages 48 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Release Notes 2 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Contributions are **welcome** and will be fully **credited**. 4 | 5 | Please read and understand the contribution guide before creating an issue or pull request. 6 | 7 | ## Etiquette 8 | 9 | This project is open source, and as such, the maintainers give their free time to build and maintain the source code 10 | held within. They make the code freely available in the hope that it will be of use to other developers. It would be 11 | extremely unfair for them to suffer abuse or anger for their hard work. 12 | 13 | Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the 14 | world that developers are civilized and selfless people. 15 | 16 | It's the duty of the maintainer to ensure that all submissions to the project are of sufficient 17 | quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used. 18 | 19 | ## Viability 20 | 21 | When requesting or submitting new features, first consider whether it might be useful to others. Open 22 | source projects are used by many developers, who may have entirely different needs to your own. Think about 23 | whether or not your feature is likely to be used by other users of the project. 24 | 25 | ## Procedure 26 | 27 | Before filing an issue: 28 | 29 | - Attempt to replicate the problem, to ensure that it wasn't a coincidental incident. 30 | - Check to make sure your feature suggestion isn't already present within the project. 31 | - Check the pull requests tab to ensure that the bug doesn't have a fix in progress. 32 | - Check the pull requests tab to ensure that the feature isn't already in progress. 33 | 34 | Before submitting a pull request: 35 | 36 | - Check the codebase to ensure that your feature doesn't already exist. 37 | - Check the pull requests to ensure that another person hasn't already submitted the feature or fix. 38 | 39 | ## Requirements 40 | 41 | If the project maintainer has any additional requirements, you will find them listed here. 42 | 43 | - **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer). 44 | 45 | - **Add tests!** - Your patch won't be accepted if it doesn't have tests. 46 | 47 | - **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. 48 | 49 | - **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option. 50 | 51 | - **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. 52 | 53 | - **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting. 54 | 55 | **Happy coding**! 56 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Copyright (c) 2022 Artem Stepanenko 4 | 5 | > Permission is hereby granted, free of charge, to any person obtaining a copy 6 | > of this software and associated documentation files (the "Software"), to deal 7 | > in the Software without restriction, including without limitation the rights 8 | > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | > copies of the Software, and to permit persons to whom the Software is 10 | > furnished to do so, subject to the following conditions: 11 | > 12 | > The above copyright notice and this permission notice shall be included in 13 | > all copies or substantial portions of the Software. 14 | > 15 | > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | > THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Nova Markdown 2 | 3 | [![Latest Version on Packagist](https://img.shields.io/packagist/v/stepanenko3/nova-markdown.svg?style=flat-square)](https://packagist.org/packages/stepanenko3/nova-markdown) 4 | [![Total Downloads](https://img.shields.io/packagist/dt/stepanenko3/nova-markdown.svg?style=flat-square)](https://packagist.org/packages/stepanenko3/nova-markdown) 5 | [![License](https://poser.pugx.org/stepanenko3/nova-markdown/license)](https://packagist.org/packages/stepanenko3/nova-markdown) 6 | 7 | ![screenshot of field](screenshots/field.png) 8 | 9 | ## Description 10 | 11 | Extended Markdown Field for Laravel Nova based on native Nova field 12 | 13 | ## Features 14 | 15 | - Many toolbar actions 16 | - Status bar 17 | - Toolbar actions toggable 18 | - Customizable toolbar and status bar 19 | - Dark mode 20 | - Responsive 21 | - Full screen 22 | - Preview 23 | 24 | ## Requirements 25 | 26 | - `php: >=8.0` 27 | - `laravel/nova: ^4.0` 28 | 29 | ## Installation 30 | 31 | ```bash 32 | # Install the package 33 | composer require stepanenko3/nova-markdown 34 | ``` 35 | 36 | Publish the config file: 37 | 38 | ``` bash 39 | php artisan vendor:publish --provider="Stepanenko3\NovaMarkdown\FieldServiceProvider" --tag="config" 40 | ``` 41 | 42 | ## Usage 43 | 44 | Add the use declaration to your resource and use the fields: 45 | 46 | ```php 47 | use Stepanenko3\NovaMarkdown\Markdown; 48 | ... 49 | 50 | Markdown::make('Excerpt', 'excerpt') 51 | ->rules('required', 'max:1000') 52 | ->alwaysShow(), 53 | ``` 54 | 55 | ## Configuration 56 | 57 | All the configuration is managed from a single configuration file located in `config/nova-markdown.php` 58 | 59 | You can change the presence and order of the toolbar actions from the list 60 | 61 | ```php 62 | [ 63 | 'h1', 64 | 'h2', 65 | 'h3', 66 | // 'headingSmaller', 67 | // 'headingBigger', 68 | 'bold', 69 | 'italic', 70 | 'strikethrough', 71 | 'quote', 72 | 'unorderedList', 73 | 'orderedList', 74 | 'link', 75 | 'image', 76 | 'table', 77 | // 'horizontalRule', 78 | 'code', 79 | ] 80 | ``` 81 | 82 | And status bar 83 | 84 | ```php 85 | [ 86 | 'lines', // Show number of lines 87 | 'words', // Show number of words 88 | 'cursor', // Current cursor position line:word 89 | ] 90 | ``` 91 | 92 | ## Screenshots 93 | 94 | ![screenshot of field](screenshots/field-dark.png) 95 | ![screenshot of field](screenshots/field-mobile.png) 96 | 97 | ## Credits 98 | 99 | - [Artem Stepanenko](https://github.com/stepanenko3) 100 | 101 | ## Contributing 102 | 103 | Thank you for considering contributing to this package! Please create a pull request with your contributions with detailed explanation of the changes you are proposing. 104 | 105 | ## License 106 | 107 | This package is open-sourced software licensed under the [MIT license](LICENSE.md). 108 | -------------------------------------------------------------------------------- /UPGRADING.md: -------------------------------------------------------------------------------- 1 | # Upgrading 2 | 3 | ## To 1.0.0 4 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "stepanenko3/nova-markdown", 3 | "description": "Nova Markdown advanced field", 4 | "keywords": [ 5 | "laravel", 6 | "nova" 7 | ], 8 | "license": "MIT", 9 | "require": { 10 | "php": ">=8.0", 11 | "laravel/nova": "^4.0", 12 | "stepanenko3/nova-filemanager": "^6.0" 13 | }, 14 | "repositories": [ 15 | { 16 | "type": "composer", 17 | "url": "https://laravel-nova.site" 18 | } 19 | ], 20 | "autoload": { 21 | "psr-4": { 22 | "Stepanenko3\\NovaMarkdown\\": "src/" 23 | } 24 | }, 25 | "extra": { 26 | "laravel": { 27 | "providers": [ 28 | "Stepanenko3\\NovaMarkdown\\FieldServiceProvider" 29 | ] 30 | } 31 | }, 32 | "config": { 33 | "sort-packages": true 34 | }, 35 | "minimum-stability": "dev", 36 | "prefer-stable": true 37 | } 38 | -------------------------------------------------------------------------------- /config/nova-markdown.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'h1', 6 | 'h2', 7 | 'h3', 8 | 'headingSmaller', 9 | 'headingBigger', 10 | 'bold', 11 | 'italic', 12 | 'strikethrough', 13 | 'quote', 14 | 'unorderedList', 15 | 'orderedList', 16 | 'link', 17 | 'fileManager', 18 | 'quoteBlock', 19 | 'image', 20 | 'table', 21 | 'horizontalRule', 22 | 'code', 23 | ], 24 | 25 | 'statusbar' => ['lines', 'words', 'cursor'], 26 | ]; 27 | -------------------------------------------------------------------------------- /dist/js/field.js.LICENSE.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | * pinia v2.0.36 3 | * (c) 2023 Eduardo San Martin Morote 4 | * @license MIT 5 | */ 6 | 7 | /*! 8 | * Cropper.js v1.5.13 9 | * https://fengyuanchen.github.io/cropperjs 10 | * 11 | * Copyright 2015-present Chen Fengyuan 12 | * Released under the MIT license 13 | * 14 | * Date: 2022-11-20T05:30:46.114Z 15 | */ 16 | 17 | /*! 18 | * The buffer module from node.js, for the browser. 19 | * 20 | * @author Feross Aboukhadijeh 21 | * @license MIT 22 | */ 23 | 24 | /*! 25 | * vuex v4.1.0 26 | * (c) 2022 Evan You 27 | * @license MIT 28 | */ 29 | 30 | /*! https://mths.be/punycode v1.4.1 by @mathias */ 31 | 32 | /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ 33 | 34 | /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ 35 | 36 | /** 37 | * @license 38 | * Lodash 39 | * Copyright OpenJS Foundation and other contributors 40 | * Released under MIT license 41 | * Based on Underscore.js 1.8.3 42 | * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 43 | */ 44 | -------------------------------------------------------------------------------- /dist/mix-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "/js/field.js": "/js/field.js" 3 | } 4 | -------------------------------------------------------------------------------- /nova.mix.js: -------------------------------------------------------------------------------- 1 | const mix = require('laravel-mix') 2 | const webpack = require('webpack') 3 | const path = require('path') 4 | 5 | class NovaExtension { 6 | name() { 7 | return 'nova-extension' 8 | } 9 | 10 | register(name) { 11 | this.name = name 12 | } 13 | 14 | webpackPlugins() { 15 | return new webpack.ProvidePlugin({ 16 | _: 'lodash', 17 | Errors: 'form-backend-validation', 18 | }) 19 | } 20 | 21 | webpackConfig(webpackConfig) { 22 | webpackConfig.externals = { 23 | vue: 'Vue', 24 | } 25 | 26 | webpackConfig.resolve.alias = { 27 | ...(webpackConfig.resolve.alias || {}), 28 | 'laravel-nova': path.join( 29 | __dirname, 30 | 'vendor/laravel/nova/resources/js/mixins/packages.js' 31 | ), 32 | 'nova-file-manager': path.join( 33 | __dirname, 34 | 'vendor/stepanenko3/nova-filemanager/dist/js/package.js' 35 | ), 36 | } 37 | 38 | webpackConfig.output = { 39 | uniqueName: this.name, 40 | } 41 | } 42 | } 43 | 44 | mix.extend('nova', new NovaExtension()) 45 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "npm run development", 5 | "development": "mix", 6 | "watch": "mix watch", 7 | "watch-poll": "mix watch -- --watch-options-poll=1000", 8 | "hot": "mix watch --hot", 9 | "prod": "npm run production", 10 | "production": "mix --production", 11 | "nova:install": "npm --prefix='../../vendor/laravel/nova' ci" 12 | }, 13 | "devDependencies": { 14 | "@vue/compiler-sfc": "^3.2.22", 15 | "form-backend-validation": "^2.3.3", 16 | "laravel-mix": "^6.0.41", 17 | "lodash": "^4.17.21", 18 | "postcss": "^8.3.11", 19 | "vue-loader": "^16.8.3" 20 | }, 21 | "dependencies": { 22 | "codemirror": "^5.65.3", 23 | "markdown-it": "^12.3.2" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /resources/js/components/DetailField.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 26 | -------------------------------------------------------------------------------- /resources/js/components/FormField.vue: -------------------------------------------------------------------------------- 1 |