Article

Add Quran Verses Quickly to Summernote Editor with this Package !

Feb 07, 2025 1,258
Add Quran Verses Quickly to Summernote Editor with this Package !

This package allows you to insert Quranic verses into the Summernote editor effortlessly. You can search for a verse directly or select a Surah and then choose a specific verse. Here is the link to the package!

You can follow the example here to integrate it into your application.

Installation & Setup

1. Prepare the Summernote Editor

First, initialize the Summernote editor with the following code:


<head>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
    <!-- include summernote css/js -->
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/summernote.min.css" rel="stylesheet">
    <!-- we used font awesome to display the quran icon, you can use any other icon library and edit it -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css" integrity="sha512-Evv84Mr4kqVGRNSgIGL/F/aIDqQb7xQ2vcrdIwxfjThSH8CSR7PBEakCr51Ck+w+/U6swU2Im1vVX0SVk9ABhg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
<body>
<form>
            <textarea id="summernote" name="editordata"></textarea>
</form>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/summernote.min.js"></script>
</body>

2. Include the summernote-quran.js File

Next, add the summernote-quran.js script to your project

<script src="../summernote-quran.js"></script>

3. Prepare the Editor and Add the Plugin to the Toolbar

Now, integrate the plugin into the Summernote toolbar:

<script>
        $(document).ready(function () {
            $('#summernote').summernote({
                tabsize: 2,
                height: 400,
                toolbar: [
                    ['custom', ['quran']],
                    // other toolbar elements here, for example:
                    ['font', ['bold', 'underline', 'clear']],
                ],
                quran: {
                    icon: '<i class="fa-solid fa-book-quran"></i>',
                    tooltip: 'here to add quran'
                },
            });
        });
    </script>

4. Copy the Quran JSON Data

Make sure to copy assets/quran.json to your workspace. If you want to modify the file path, update the reference inside summernote-quran.js accordingly.

Conclusion

That's it! You now have the ability to add Quranic verses quickly and easily in the Summernote editor. Enjoy coding

Ahmet Yusuf
Ahmet Yusuf

As a full-stack developer with a master’s degree in Electrical and Computer Engineering, I’m deeply passionate about web design and development. I enjoy exploring new technologies and sharing insights into creating user-centered digital experiences in this exciting field.

Related Articles

You may also like

See all posts
What is WEP Standard and What are the Limitations of Using it? cover

What is WEP Standard and What are the Limitations of Using it?

WEP, Wired Equivalent Privacy, is an older security protocol that is specified in 802.11b Wi-Fi IEEE (...)

Read article
Useful Color Generators in SCSS cover

Useful Color Generators in SCSS

Writing color classes for your project could take a lot of your time. luckily, SCSS functions will m (...)

Read article
The Difference between 2G and 3G Services cover

The Difference between 2G and 3G Services

There are several differences between 2G Services and 3G Services, here is a list of some of them: (...)

Read article