How do I perform the mouse slider in react using react-router-dom?

This is my app.js

import React from "react";
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
import "./App.css";
import Home from "./Home";
import Navbar from "./Navbar";
import Works from "./Works";

function App() {
  return (
    <>
      <Router>
        <Routes>
          <Route path="/" element={<Home />} />
          <Route path="/works" element={<Works />} />
        </Routes>
      </Router>
    </>
  );
}

export default App;

This is my Home.js

import React, { useEffect, useState } from "react";
import "./App.css";
import ClimbingBoxLoader from "react-spinners/ClimbingBoxLoader";
import "./mainpage.css";
import cloud1 from "./images/cloud1.svg";
import cloud02 from "./images/cloud02.svg";
import cloud2 from "./images/cloud2.svg";
import moon from "./images/moon.svg";
import cloud3 from "./images/cloud3.svg";
import cloud01 from "./images/cloud01.svg";
import { useNavigate } from "react-router-dom";
import {
  MouseParallaxChild,
  MouseParallaxContainer,
} from "react-parallax-mouse";
import Navbar from "./Navbar";

function Home() {
  let navigate = useNavigate();
  const [loading, setloading] = useState(false);
  useEffect(() => {
    setloading(true);
    setTimeout(() => {
      setloading(false);
    }, 1000);
  }, []);

  return (
    <MouseParallaxContainer className="App">
      {loading ? (
        <ClimbingBoxLoader size={20} color={"#F37A24"} loading={loading} />
      ) : (
        <MouseParallaxContainer
          className="main-page"
          containerStyles={{
            width: "100%",
            overflow: "none",
          }}
        >
          <Navbar />
          <h1 className="heading">SASWATA</h1>
          <h1 className="heading2">GHOSH</h1>
          <span className="bar1"></span>
          <span className="bar2"></span>
          <p className="para">web developer</p>
          <p className="scrolldown">SCROLL DOWN</p>
          <span className="verticaline"></span>
          <MouseParallaxContainer
            className="moon"
            containerStyles={{
              width: "100%",
              overflow: "none",
            }}
          >
            <MouseParallaxChild
              className="moon_text"
              factorX={0.01}
              factorY={0.01}
            >
              <p>PORTFOLIO</p>
            </MouseParallaxChild>
            <MouseParallaxChild
              className="moon_img"
              factorX={0.03}
              factorY={0.05}
            >
              <img src={moon} alt="" />
            </MouseParallaxChild>
            <MouseParallaxChild
              className="cloud01"
              factorX={0.04}
              factorY={0.06}
            >
              <img src={cloud01} alt="" />
            </MouseParallaxChild>
            <MouseParallaxChild
              className="cloud02"
              factorX={0.03}
              factorY={0.05}
            >
              <img src={cloud02} alt="" />
            </MouseParallaxChild>
            <MouseParallaxChild
              className="cloud_front1"
              factorX={0.04}
              factorY={0.07}
            >
              <img src={cloud1} alt="cloud1" />
            </MouseParallaxChild>
            <MouseParallaxChild
              className="cloud3"
              factorX={0.03}
              factorY={0.05}
            >
              <img src={cloud3} alt="" />
            </MouseParallaxChild>
            <MouseParallaxChild
              className="cloud2"
              factorX={0.06}
              factorY={0.05}
            >
              <img src={cloud2} alt="cloud2" />
            </MouseParallaxChild>
          </MouseParallaxContainer>
          <div className="nav-left">
            <span className="span1"></span>
            <span className="span2"></span>
            <span className="span3"></span>
            <span className="span4"></span>
          </div>
        </MouseParallaxContainer>
      )}
    </MouseParallaxContainer>
  );
}

export default Home;

This is my Works.js

import React, { useEffect, useState } from "react";
import "./App.css";
import ClimbingBoxLoader from "react-spinners/ClimbingBoxLoader";
import "./Works.css";
import cloud02 from "./images/cloud02.svg";
import works from "./images/LandingPage.png";
import { useNavigate } from "react-router-dom";
import cloud01 from "./images/cloud01.svg";
import {
  MouseParallaxChild,
  MouseParallaxContainer,
} from "react-parallax-mouse";
import Navbar from "./Navbar";

function Home() {
  let navigate = useNavigate();
  const [loading, setloading] = useState(false);
  useEffect(() => {
    setloading(true);
    setTimeout(() => {
      setloading(false);
    }, 1000);
  }, []);

  return (
    <MouseParallaxContainer className="App">
      <MouseParallaxContainer
        className="main-page"
        containerStyles={{
          width: "100%",
          overflow: "none",
        }}
      >
        <Navbar />

        <h1 className="heading">
          Web Sec<span className="name-span">urity</span>
        </h1>
        <h1 className="heading2">Project</h1>
        <span className="bar1"></span>
        <span className="bar2"></span>
        <p className="para">website</p>

        <MouseParallaxContainer
          className="moon"
          containerStyles={{
            width: "100%",
            overflow: "none",
          }}
        >
          <MouseParallaxChild className="cloud01" factorX={0.04} factorY={0.06}>
            <img src={cloud01} alt="" />
          </MouseParallaxChild>
          <img className="works-img" src={works} alt="" />
        </MouseParallaxContainer>
        <div className="nav-left">
          <span className="span11"></span>
          <span className="span12"></span>
          <span className="span13"></span>
          <span className="span14"></span>
        </div>
        <div className="page-number">
          <p>01</p>
        </div>
      </MouseParallaxContainer>
    </MouseParallaxContainer>
  );
}

export default Home;

I want to perform mouse slide such that it lands on new page on mouse scroll.
This is the website I am referring.(https://kuon.space/).
It is done using HTML and jquery but I am trying it with React.js and CSS. I hope you can help me. I have tried almost all libraries and couldn’t help myself.

Multiple Values on Checkbox?

I am currently trying to make a “”””calculator”””” for an RP Server, anyways, I need to calculate a sentence and a fine using values on checkboxes.
I already did the sentence, and I would like to make the fine similar to it, but I know I can’t use more than 1 value on each input. What is the best way to get it done?

Sentence Code >

let checkedValue = 0;
let inputElements = document.getElementsByClassName('check');
for(let i=0; i < inputElements.length; ++i){
    const element = inputElements[i]

    if(element.checked){
      checkedValue = checkedValue + parseInt(element.value)
    }
}

How to create a session in axios

I am trying to log in to a website using forms data payload. It requires a _csrf token which is uniquely generated every time the login page opens up. I was trying to get to the login page to take the _csrf id then post the payload in the very same session.

My python code was able to do it with requests.session() but I am having trouble with axios.

My python code

login = {'_csrf': 0, 'email': '[email protected]', 'password': "password"}
with requests.Session() as s:
    url = "https://example.com/login.html"
    res = s.get(url, headers={'User-Agent': 'Mozilla/5.0'})
    soupy = soup(res.content, 'html.parser')
    _csrf = soupy.find('meta', attrs={'name': "csrf-token"})['content']
    login['_csrf'] = _csrf
    res = s.post(url, data=login, headers={'User-Agent': 'Mozilla/5.0'}

My Node.js Code

var url = "https://example.com/login.html";
let response = await axios.get(url,{
    headers:{
       'User-Agent': 'Mozilla/5.0'
    }
})
.then(function(response){
    let soup = cheerio.load(response.data, null, false);
    var _csrf = soup('meta[name="csrf-token"]').attr('content');
    var login = {'_csrf': _csrf, 'email': '[email protected]', 'password': "password"};
    response = axios.post(url,{
        headers:{
            'User-Agent': 'Mozilla/5.0'
        },
        data: login,
    }).catch((e)=> {console.log(e)});
    console.log(response.data);
});

but it doesn’t work as I get a _csrf mismatch error. What can I do to get axios work in a session?

How can I improve this paginated do while async await GET request in Javascript (NodeJS)?

I am learning JavaScript (Node.js – using the Pipedream platform). I have been writing scripts to help automate some little tasks in my day to day work.

I am creating one that generates a report on recent interactions with clients.

As part of this I am using axios to get “engagements” from the Hubspot API (basically a list of identifiers I will use in later requests).

The API returns paginated responses. I have encountered pagination previously and understand the principle behind it, but have never written a script to handle it. This is my first.

It works. But I feel it could be improved. Below I’ve commented how I’ve approached it.

The endpoint returns up to 100 values ‘per page’ along with a "hasMore":true flag and an "offset":987654321 value which can be passed as a query parameter in subsequent requests (if hasMore === true).

Example API response:

{"results":[1234,1235,1236],"hasMore":true,"offset":987654321}

My code:

import axios from 'axios';
//function to get each page of data
async function getAssoc(req){
      const options = {
        method: 'GET',
        url: `https://api.hubapi.com/${req}`,
        headers: {
          Authorization: `Bearer ${auths}`,
        },
      };
      return await axios(options);
}
//declare array in which to store all 'associations'
const assocs = [];
//store the ID that I get in an earlier step
const id = vid;
//declare variable in which to temporarily store each request response data
var resp;
//declare query parameter value, initially blank, but will be assigned a value upon subsequent iterations of do while
var offset = '';
do {
  //make request and store response in resp variable
  resp = await getAssoc(`crm-associations/v1/associations/${id}/HUBSPOT_DEFINED/9?offset=${offset}`);
  //push the results into my 'assocs' (associations) array
  resp.data.results.forEach(element => assocs.push(element));
  //store offset value for use in next iteration's request
  offset = resp.data.offset;
} while (resp.data.hasMore); //hasMore will be false when there's no more records to request

return assocs;

I feel it could be improved because:

  1. The DO WHILE loop, I believe, is making sequential requests. Is parallel a better/faster/more efficient option?
  2. I’m re-assigning new values to vars instead of using consts which seems simple and intuitive in my beginner’s mind, but I don’t understand a better way in this instance.
  3. I would welcome any feedback or suggestions on how I can improve this for my own learning.

Thank you in advance for your time and any assistance you can offer.

What is your review on IKIGAI?

The rather exotic sounding name of this book, ikigai, as the authors explain, is relatively straightforward. “This Japanese concept, which translates roughly as “the happiness of always being busy,” is, “like logotherapy, but it goes a step beyond.”helps people find their purpose in life.”Part of my ikigai is to be a nice person and not think disparagingly of anyone. And I am not here. This book was an interesting read for me, and may be a revelational read for you. I make no judgment on that. I just give you my experience as a reader.This book would, in my opinion, make an excellent gift for anyone in your life that might need a little boost or is otherwise hard to buy for. There is absolutely nothing here that could meet with controversy or resistance. It is decidedly upbeat throughout.And that is saying a lot of good things about any book. Read more…….

You can buy this book with exclusive offer here.

I’m making a circle follow the cursor but want it to fadeout when the mouse stops

Im making a circle follow the cursor using jquery which works fine but i was wondering if there was a way so that the circle fades out whenever the mouse stops.

I have tried using mouseout funtion of jquery and making the opacity 0 but it would just stop the circle in between whenever the mouse stops which is obvious but is there some other method to achieve this ?

My jquery code –

 var mouseX = 0, mouseY = 0;
   var xp = 0, yp = 0;
        
  $(document).mousemove(function(e){
    
    $("#circlecc").css({opacity: 1})
     
    mouseX = e.pageX - 12;
    mouseY = e.pageY - 12;
    
  });

  setInterval(function(){

    xp += ((mouseX - xp)/6);
    yp += ((mouseY - yp)/6);
    $("#circlecc").css({left: xp +'px', top: yp +'px'});
    
  }, 20);

Also while moving the cursor below the site or beyond the site the circle goes beyond the site too and adds a scroll bar, is there a way to avoid that

The Website

How to Make A second API call based on the value gotten from the first. with React and useEffect hooks

Im trying to make a call to the first APi that contains a payload of different CATEGORIES and then use that to make a second call to another API that contains different category items from each CATEGORY from the first. I am new to react and don’t quite know how to make the logic work. This is my idea below. Category items are displayed based on the selected CATEGORIES. I am confused on how to use the value from the first to make the second call.

const [catalog,setCatalog] = useState([]);
const [catalogItems,setCatalogItems]= useState([]);

useEffect(() => {

    const fetchData = async () => {

      await fetchMarketingCategories()

     .then((result)=>{

        setCatalog(result);

          console.log("result",result);
         
     })

     .then(async (categoryId)=>{
         
          const {items = []} = await getAdvisorMarketingCatalog(categoryId)

          setCatalogItems(items);
     })
     

    };
    fetchData();

    
    });
  }, []);

Format image to correctly pass through model.predict()

I created this model for image classification; however, when I try to pass the image path through model.predict(), I receive this error:

ValueError: Error when checking model : the Array of Tensors that you are passing to your model is not the size the the model expected. Expected to see 1 Tensor(s), but instead got 9 Tensors(s).

Is there any way to decrease the number of tensors going through the function, or correctly format the image in tensors to pass through and return a prediction?

I’ve looked everywhere, and other questions similar to this didn’t cover my use case in node.js. Any help or nudge in the right direction is welcome 🙂

Below is my model.json file, the model I created for image classification.
index.js is what I run through node.js to supposedly give a prediction.

model.json

{"modelTopology":{"class_name":"Sequential","config":[{"class_name":"Flatten","config":{"name":"flatten_Flatten1","trainable":true,"batch_input_shape":[null,7,7,256],"dtype":"float32"}},{"class_name":"Dense","config":{"units":100,"activation":"relu","use_bias":true,"kernel_initializer":{"class_name":"VarianceScaling","config":{"scale":1,"mode":null,"distribution":null,"seed":null}},"bias_initializer":{"class_name":"Zeros","config":{}},"kernel_regularizer":null,"bias_regularizer":null,"activity_regularizer":null,"kernel_constraint":null,"bias_constraint":null,"name":"dense_Dense1","trainable":true}},{"class_name":"Dense","config":{"units":3,"activation":"softmax","use_bias":false,"kernel_initializer":{"class_name":"VarianceScaling","config":{"scale":1,"mode":null,"distribution":null,"seed":null}},"bias_initializer":{"class_name":"Zeros","config":{}},"kernel_regularizer":null,"bias_regularizer":null,"activity_regularizer":null,"kernel_constraint":null,"bias_constraint":null,"name":"dense_Dense2","trainable":true}}],"keras_version":"tfjs-layers 0.7.0","backend":"tensor_flow.js"},"weightsManifest":[{"paths":["./ml-classifier-1-2-3.weights.bin"],"weights":[{"name":"dense_Dense1/kernel","shape":[12544,100],"dtype":"float32"},{"name":"dense_Dense1/bias","shape":[100],"dtype":"float32"},{"name":"dense_Dense2/kernel","shape":[100,3],"dtype":"float32"}]}]}

index.js

var tf = require('@tensorflow/tfjs-node');

const image = `./1-1.png`

const main = async () => {
  const model = await tf.loadLayersModel('file:///retake/savedmodels/model.json');
  model.summary();

  const prediction = model.predict(image);
  prediction.print();
}
main()

this.setState is not a function – ReactJS

So I’m quite the React Beginner and I’m having the error “this.setState is not a function”.
I’ve tried binding my function, startInterval, but that hasn’t worked.
I’ve tried add ‘this’ to my calling of the function and that hasn’t worked either. I’ve tried everything I’ve seen so far but to no success.

Any help would be appriciated!

export class Timer extends React.Component {
    constructor(props) {
        super(props)
        this.state = { 
            timeS: 0,
            timeM: 0
        }
        this.startInterval = this.startInterval.bind(this);
    }

    startInterval = () => {
        // Set Target Time in miliseconds
        let targetTime = this.props.timeM * 60000 + this.props.timeS *1000; 
        // Move timer each second
        let elapsedTime = 0
        this.intervalID = setInterval(function() {
            let currentTime = targetTime - elapsedTime;
            this.setState({timeM: Math.floor(currentTime/60000), timeS: Math.floor(currentTime/1000)});
            elapsedTime = elapsedTime + 1000;
        }, 1000)
    }
}

How to use a separte js file in Laravel Blade Html?

How to use a js file outside Laravel Blade html?

Besides my layouts file, I have a single file welcome.blade.php for the html and it requires a fair amount of scripts. To improve neatness, I wanted to move the <scripts> from the bottom of welcome.blade.php into a separated .js file.

See below for current code, mainly a test to get things working.

welcome.blade.php

@extends('layouts')

@section('content')
  <div>
    Body Content
  </div>
@endsection

// Script added to the bottom of welcome.blade
// How to move into a separated file, like in resources/js/welcome.js 
// <script src='/js/welcome.js'></script> doesn't work
<script>
  alert('js works');
</script>

Even when I create a new welcome.js script inside the resources/js folder, linking via src or assets doesn’t work.

I don’t want to put it in the app.js (default laravel install folder structure), because then it’ll load in for EVERY page, instead of just welcome.js.

I’ve tried using stack, but the file doesn’t exist when using asset. However, it does work when writing the script itself into the push block. But then that’s not using a separate .js file anyway…

layouts.blade.php

<body>
...
@stack('scripts')
</body>
</html>

welcome.blade.php

...
@push('scripts')
  // Works when directly writing the script here
  // Trying to use `<script src="{{ asset('js/welcome.js' }}"></script>` fails
  // No js/welcome.js found. 
  <script>
    alert('js works');
  </script>
@endpush

How can I use a separate .js file inside a Laravel Blade HTML Template?

Edit

Did I actually need to make the welcome.js script public in webpack mix? It seems to work now after adding the additional .js line.

See answer.

Versions: Laravel 8

Javascript for-loop to populate a table

Can’t seem to wrap my head around the task given to me. I have a HTML file and an external JS file. The JS file has an array and needs a for-loop to populate a table with but I can’t seem to get the for-loop to to do anything. Best I can manage is getting the table headers to show.

What’s wrong with my for-loop and why won’t it populate the table?

I appreciate any help!

function buildCitiesList() {
  const cityListJSON = {
    cities: [
      {
        name: "Adelaide",
        state: "SA",
        text: "Lovely city on the Torrens River",
        avgrainfall: 547,
        sunnydays: 224,
      },
      {
        name: "Brisbane",
        state: "QLD",
        text: "Capital city of Queensland",
        avgrainfall: 1080,
        sunnydays: 261,
      },
      {
        name: "Canberra",
        state: "ACT",
        text: "Where the federal politicians are!",
        avgrainfall: 602,
        sunnydays: 246,
      },
      {
        name: "Darwin",
        state: "NT",
        text: "Crazy and funny folks, up north!",
        avgrainfall: 1812,
        sunnydays: 239,
      },
      {
        name: "Hobart",
        state: "TAS",
        text: "Beautiful but very chilly winters...",
        avgrainfall: 569,
        sunnydays: 193,
      },
      {
        name: "Melbourne",
        state: "VIC",
        text: "City with four seasons in one day",
        avgrainfall: 518,
        sunnydays: 185,
      },
      {
        name: "Perth",
        state: "WA",
        text: "A long drive but worth it!",
        avgrainfall: 734,
        sunnydays: 265,
      },
      {
        name: "Sydney",
        state: "NSW",
        text: "Prettiest harbour in the world!",
        avgrainfall: 1042,
        sunnydays: 236,
      },
    ],
  };

  mytable =
    "<table class='table'>" +
    "<tr><th>#</th><th>City</th><th>State</th><th>Comment</th><th>Avg Rainfall</th><th>Sunny Days</th><th>Best Activity</th></tr>";

  for (i = 0; i < 8; i++) {
    mytable +=
      "<tr><td>" +
      i +
      "</td><td>" +
      cities[i].name +
      "</td><td>" +
      cities[i].state +
      "</td><td>" +
      cities[i].text +
      "</td><td>" +
      cities[i].avgrainfall +
      "</td><td>" +
      cities[i].sunnydays +
      "</td></tr>";
  }
  mytable += "</table>";
  document.getElementById("table").outerHTML = mytable;
}
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Task 6.3C</title>
    <meta name="author" content="" />
    <meta name="description" content="Conditions and Functions" />
    <meta charset="utf-8" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1, shrink-to-fit=no"
    />
    <!-- Latest compiled and minified CSS -->
    <link
      rel="stylesheet"
      href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"
      integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk"
      crossorigin="anonymous"
    />
    <script src="citiesJSON.js"></script>
  </head>

  <body>
    <div class="container-fluid">

      <h1>Australian Capital Cities & Information</h1>
      <p>
        Click the button below to build and display a list of Australian Cities
        along with some interesting information.
      </p>
<main>
  <!--TO UPDATE-->
  <div id="table"></div>
  
      <input
        class="btn btn-primary"
        type="button"
        onclick="buildCitiesList()"
        value="Display Capital Cities"
      />
      </div>


</main>
    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script
      src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
      integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
      crossorigin="anonymous"
    ></script>
    <script
      src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"
      integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
      crossorigin="anonymous"
    ></script>
    <script
      src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"
      integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI"
      crossorigin="anonymous"
    ></script>
  </body>
</html>

Tailwind CSS Grid Spacing Messed Up

I am trying to make a blog website with two columns for the posts. The first column displays one large-format post while the second displays 3 small-format posts (pictured below). However, when i do this to small-format posts seem to respect the spacing of the large-format post, even though they are in different columns. Here is a picture:

enter image description here

As you can see, I want the posts on the right side to be spaced evenly, but the second post starts at the end of the large-format post on the first column.

Here is my code:

import React, { useEffect, useState } from 'react'
import client from '../client'
import BlockContent from '@sanity/block-content-to-react'
import { Link } from 'react-router-dom'

function Main() {
    const [posts, setPosts] = useState([])

    useEffect(() => {
        client.fetch(
            `*[_type == "post"] {
                title,
                slug,
                body,
                author,
                mainImage {
                    asset -> {
                        _id,
                        url
                    },
                    alt
                },
                publishedAt
            }`
        ).then((data) => setPosts(data))
         .catch(console.error)
    }, [])

    return (
        <div className='grid lg:grid-cols-3 md:grid-cols-2 gap-8 m-4 '>
            {posts.slice(0, 1).map((p, i) => (
                <Link to = {`/blog/${p.slug.current}`} className=''>
                    <article key = {p.slug.current} className=''>
                        <img src = {p.mainImage.asset.url} alt = {p.title} className='' />
                        <div>
                            <p className='font-bold text-xl text-secondary'>{p.title}</p>
                            <p className='text-sm'>By Brandon Pyle | {new Date(p.publishedAt).toLocaleDateString()}</p>
                        </div>
                    </article>
                </Link>
            ))}
            {posts.slice(1, 4).map((p, i) => (
                <Link to = {`/blog/${p.slug.current}`} className='col-start-2 h-16'>
                    <article key = {p.slug.current} className='flex'>
                        <img src = {p.mainImage.asset.url} alt = {p.title} className='w-auto h-auto max-h-[80px]' />
                        <div>
                            <p className='font-bold text-xl text-secondary'>{p.title}</p>
                            <p className='text-sm'>By Brandon Pyle | {new Date(p.publishedAt).toLocaleDateString()}</p>
                        </div>
                    </article>
                </Link>
            ))}
        </div>
    )
}

export default Main

Please let me know if you have any ideas on how to fix this issue! Thanks.

SlateJS apply bold to regex match

I am trying to apply bold to **text** in slatejs editor and so far my attempts have been unsuccessful.
I came across this answer which seems to be a possible solution to the problem.

However, after modifying that answer it still refused to apply bold.

I tried adding match: n => Text.isText(n) and that made the whole paragraph bold.

Expected result:
**text** => **text**

Actual result:
**text** => **text**

How may I modify this to work as expected?

const withMarkdown = editor => {
    const { normalizeNode } = editor;

    editor.normalizeNode = entry => {
        const [node, path] = entry;

        if (!Text.isText(node)) {
            return normalizeNode([node, path]);
        }

        const boldMatch = node.text.match(/([*]{2})(.+?)([*]{2})/);
        if (!boldMatch) {
            return normalizeNode([node, path]);
        }

        let [searchMatch, asteriskMatch] = boldMatch;
        const { index: startIndex } = boldMatch;
        const endIndex = startIndex + searchMatch.length;

        /* does not apply bold */
        Transforms.setNodes(editor, { bold: true }, {
            at: {
                anchor: { path, offset: startIndex },
                focus: { path, offset: endIndex },
            }
        })

        normalizeNode([node, path]);
    }

    return editor;
}