ReactDOMServer’s renderToString method throwing error : clearProviders is not a function

We are using server side rendering with GraalVM. Application is throwing below error

org.graalvm.polyglot.PolyglotException: TypeError: <this>.clearProviders is not a function
        at <js>.b.destroy(propertysrp.js:1566)
        at <js>.renderToString(propertysrp.js:1566)

I have checked in React source repository on github, and i have found that in ReactPartialRenderer.js file the function clearProviders is defined on line number 821, we are using webpack to bundle the JS, function calling of clearProviders is coming from destroy() method from line number 757, both are mentioned in the same file then why the definition of clearProviders is missing in bundled JS

here is bundled file snippet where clearProviders function calling is mentioned , but actual definition is missing in whole file, in what scenario this thing happens, it was working fine , we did not made any changes to react versioning, we just rebuild the application after some minor changes and error appeared

,t.version="16.14.0"},function(e,t,r){
/** @license React v16.14.0
 * react-dom-server.browser.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var n=r(110),o=r(0);function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var a=((r="function"==typeof Symbol&&Symbol.for)&&Symbol.for("react.portal"),r?Symbol.for("react.fragment"):60107);r&&Symbol.for("react.strict_mode"),r&&Symbol.for("react.profiler"),r&&Symbol.for("react.provider"),r&&Symbol.for("react.context"),r&&Symbol.for("react.concurrent_mode"),r&&Symbol.for("react.forward_ref"),r&&Symbol.for("react.suspense"),r&&Symbol.for("react.suspense_list"),r&&Symbol.for("react.memo"),r&&Symbol.for("react.lazy"),r&&Symbol.for("react.block"),r&&Symbol.for("react.fundamental"),r&&Symbol.for("react.scope");for(var c=((r=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED).hasOwnProperty("ReactCurrentDispatcher")||(r.ReactCurrentDispatcher={current:null}),r.hasOwnProperty("ReactCurrentBatchConfig")||(r.ReactCurrentBatchConfig={suspense:null}),{}),l=new Uint16Array(16),u=0;u<15;u++)l[u]=u+1;l[15]=0,Object.prototype.hasOwnProperty,"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){e[0]})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){e.toLowerCase()})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){e.toLowerCase()})),["checked","multiple","muted","selected"].forEach((function(e){})),["capture","download"].forEach((function(e){})),["cols","rows","size","span"].forEach((function(e){})),["rowSpan","start"].forEach((function(e){e.toLowerCase()}));var s=/[-:]([a-z])/g;function f(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){e.replace(s,f)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){e.replace(s,f)})),["xml:base","xml:lang","xml:space"].forEach((function(e){e.replace(s,f)})),["tabIndex","crossOrigin"].forEach((function(e){e.toLowerCase()})),["src","href","action","formAction"].forEach((function(e){e.toLowerCase()})),Object.is;var p=(n({menuitem:!0},m={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}),{animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0}),d=["Webkit","ms","Moz","O"],y=(Object.keys(p).forEach((function(e){d.forEach((function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),p[t]=p[e]}))})),o.Children.toArray);r.ReactCurrentDispatcher,Object.prototype.hasOwnProperty,g.prototype.destroy=function(){var e;this.exhausted||(this.exhausted=!0,this.clearProviders(),e=this.threadID,l[e]=l[0],l[0]=e)};var h=g,m={renderToString:function(e){e=new h(e,!1);try{return e.read(1/0)}finally{e.destroy()}},renderToStaticMarkup:function(e){e=new h(e,!0);try{return e.read(1/0)}finally{e.destroy()}},renderToNodeStream:function(){throw Error(i(207))},renderToStaticNodeStream:function(){throw Error(i(208))},version:"16.14.0"};function g(e,t){if(e={type:null,domNamespace:"http://www.w3.org/1999/xhtml",children:e=o.isValidElement(e)&&(e.type!==a||(e=e.props.children,o.isValidElement(e)))?[e]:y(e),childIndex:0,context:c,footer:""},0===(r=l[0])){var r,n=l,u=2*(r=n.length);if(!(u<=65536))throw Error(i(304));var s=new Uint16Array(u);for(s.set(n),(l=s)[0]=r+1,n=r;n<u-1;n++)l[n]=n+1;l[u-1]=0}else l[0]=l[r];this.threadID=r,this.stack=[e],this.exhausted=!1,this.currentSelectValue=null,this.previousWasTextNode=!1,this.makeStaticMarkup=t,this.suspenseDepth=0,this.contextIndex=-1,this.contextStack=[],this.contextValueStack=[]}e.exports=m.default||m},function(e,t,r){

here is the webpack configuration

function serverComponentEntry (componentName) {
  return {
    devtool: 'source-map',
    mode: 'development',
    entry: `./react-src/${componentName}/${componentName}-server.js`,

    
    output: {
      filename: `${componentName}.js`,
      path: path.resolve(__dirname, OUTPUT_PATH + '/' + TARGET_SERVER)
     
    },
    plugins: [
      new CleanWebpackPlugin([TARGET_SERVER], {
        root: BASE_PATH + '/' + OUTPUT_PATH
      }),
      new UglifyJsPlugin(),
      new webpack.DefinePlugin({
        'process.env': {
          NODE_ENV: JSON.stringify('release')
        }
      }),
      new DotenvCmdWebpack({filePath: ENV_FILE_PATH, env: "constant"})
      
    ],
    module: {
      rules: [
        {
          test: /.js$/,
          exclude: /node_modules/,
          use: 'babel-loader'
        },
        {
          test: /.svg$/,
          loader: 'null-loader'
        },
        {
          test: /.(ttf|eot|woff2?)$/,
          loader: 'null-loader'
        }
      ]
    }
  }
}
const markup = ReactDOMServer.renderToString(
            <StaticRouter> 
          <Provider store={store1}>
            <App/>
          </Provider>
        </StaticRouter> 
    );

in our package.json these are the version we are using for react and react-dom

"react-dom": "16.14.0",
"react": "16.14.0",

How can I make interactive text in Tiptap editor?

What I need is for the editor to mark specific words (for example underline it with a unique color), and make it interactive – clicking on the specific word would open a floating menu.

So what I have in mind is to create a listener that notices when specific words are written, then wrap the rendered word with custom HTML with a onClick that opens the menu.
However, when I want to save that document with getHtml(), I need to filter out all my custom HTML.

Would this work? Is it possible to do with tiptap’s API?

FYI, I have never used tiptap so I’m not familiar with its API. I would appreciate if you could suggest which API functions I would need to use.

Also, if you know of another editor that would be easier to use for this purpose I would appreciate it.

Node js web app Auction how become more secure?

I want to become my web app more secure so with database and other things like this. this is my code:
Client:

document.addEventListener('DOMContentLoaded', () => {
    const app = document.getElementById('app');

    const renderLogin = () => {
        app.innerHTML = `<h2>Login</h2><form id="login-form">
            <input type="text" id="usernamelog" placeholder="Username" required>
            <input type="password" id="passwordlog" placeholder="Password" required>
            <button type="submit">Login</button>
            <button type="button" id="gotoregister">Register</button>
        </form>`;

        document.getElementById('login-form').addEventListener('submit', async (e) => {
            e.preventDefault();
            const username = document.getElementById('usernamelog').value;
            const password = document.getElementById('passwordlog').value;
            try {
                const res = await axios.post('/login', { username, password });
                localStorage.setItem('user', JSON.stringify(res.data));
                alert('User logged in successfully');
                renderArticles();
            } catch (err) {
                console.error(err);
                alert('Error during login');
            }
        });

        document.getElementById('gotoregister').addEventListener('click', renderRegister);
    };

    const renderRegister = () => {
        app.innerHTML = `<h2>Register</h2>
        <form id="register-form">
            <input type="text" id="username" placeholder="Username" required>
            <input type="password" id="password" placeholder="Password" required>
            <button type="submit">Register</button>
            <button type="button" id="gotologin">Login</button>
        </form>`;

        document.getElementById('register-form').addEventListener('submit', async (e) => {
            e.preventDefault();
            const username = document.getElementById('username').value;
            const password = document.getElementById('password').value;
            try {
                await axios.post('/register', { username, password });
                alert('User registered successfully');
                renderLogin();
            } catch (err) {
                console.error(err);
                alert('Error during registering');
            }
        });

        document.getElementById('gotologin').addEventListener('click', renderLogin);
    };

    const renderArticles = async () => {
        const user = JSON.parse(localStorage.getItem('user'));
        if (!user) {
            renderLogin();
            return;
        }

        const socket = io();
        const res = await axios.get('/articles');
        const articles = res.data;
        app.innerHTML = `
        <header>
            <h1>Online Auction Platform</h1>
            <a href="javascript:void(0);" id="create-article">Create Article</a>
            <a href="javascript:void(0);" id="logout">Logout</a>
        </header>
        <ul id="articles-list">
        ${articles.map(article => `
            <li>
                <a href="javascript:void(0);" onclick="renderArticleDetail(${article.id})">${article.title}</a>
            </li>
        `).join('')}
        </ul>`;

        document.getElementById('logout').addEventListener('click', () => {
            localStorage.removeItem('user');
            renderLogin();
        });

        document.getElementById('create-article').addEventListener('click', renderCreateArticle);
    };

    const renderCreateArticle = () => {
        app.innerHTML = `<h2>Create Article</h2>
        <form id="create-article-form">
            <input type="text" id="title" placeholder="Title" required>
            <textarea id="description" placeholder="Description" required></textarea>
            <button type="submit">Create</button>
            <button type="button" id="go-back">Back</button>
        </form>`;

        document.getElementById('create-article-form').addEventListener('submit', async (e) => {
            e.preventDefault();
            const title = document.getElementById('title').value;
            const description = document.getElementById('description').value;
            try {
                await axios.post('/articles', { title, description });
                alert('Article created successfully');
                renderArticles();
            } catch (err) {
                console.error(err);
                alert("Error during creating article");
            }
        });

        document.getElementById('go-back').addEventListener('click', renderArticles);
    };

    window.renderArticleDetail = async (articleId) => {
        const user = JSON.parse(localStorage.getItem('user'));
        if (!user) {
            renderLogin();
            return;
        }

        const socket = io();
        socket.emit('join', articleId);

        const res = await axios.get(`/articles/${articleId}`);
        if (res.status === 410) {
            alert('Auction has expired');
            renderArticles();
            return;
        }

        const article = res.data;
        app.innerHTML = `
        <h2>${article.title}</h2>
        <p>${article.description}</p>
        <h3>Bids</h3>
        <ul id="bids-list">
        ${article.bids.map(bid => `
            <li>${bid.username}: $${bid.amount}</li>
        `).join('')}
        </ul>
        <form id="bid-form">
            <input type="number" id="bid-amount" placeholder="Bid amount" required>
            <button type="submit">Place Bid</button>
        </form>
        <ul id="chat-messages"></ul>
        <form id="chat-form">
            <input type="text" id="chat-message" placeholder="Message" required>
            <button type="submit">Send</button>
        </form>
        <button type="button" id="go-back">Back</button>`;

        document.getElementById('bid-form').addEventListener('submit', (e) => {
            e.preventDefault();
            const amount = document.getElementById('bid-amount').value;
            socket.emit('bid', { articleId, username: user.username, amount });
        });

        document.getElementById('chat-form').addEventListener('submit', (e) => {
            e.preventDefault();
            const message = document.getElementById('chat-message').value;
            socket.emit('chat', { articleId, username: user.username, message });
        });

        document.getElementById('go-back').addEventListener('click', renderArticles);

        socket.on('newBid', (bid) => {
            const bidsList = document.getElementById('bids-list');
            const newBid = document.createElement('li');
            newBid.textContent = `${bid.username}: $${bid.amount}`;
            bidsList.appendChild(newBid);
        });

        socket.on('chat', (chatMessage) => {
            const chatMessages = document.getElementById('chat-messages');
            const newMessage = document.createElement('li');
            newMessage.textContent = `${chatMessage.username}: ${chatMessage.message}`;
            chatMessages.appendChild(newMessage);
        });

        socket.on('auctionExpired', () => {
            alert('Auction has expired');
            renderArticles();
        });
    };

    const user = JSON.parse(localStorage.getItem('user'));
    if (user) {
        renderArticles();
    } else {
        renderLogin();
    }
});

Server:

const express = require ('express');
const http = require ('http');
const socketIo = require ('socket.io');

const app = express(); 
const server = http.createServer(app);
const io = socketIo(server);

const users = [];
const articles = [];

app.use(express.json());
app.use(express.static("www"));
io.on('connection',(socket)=>{
    console.log ('A user connected');
    socket.on('join',(articleId)=>{
        socket.join(articleId);
        const article = articles.find(a=> a.id === articleId);
        socket.emit('loadBids',article.bids);
    });
    socket.on('bid',(data)=>{
        const {articleId, username, amount} = data;
        const article = articles.find (a=> a.id === articleId);
        if(article){
            article.bids.push({username, amount, timestamp: new Date()});
            io.to(articleId).emit('newBid', {username, amount});

        }
    });
    socket.on('chat',(data)=>{
        const {articleId, username, message } = data;
        io.to(articleId).emit('chat',{username, message});
        
    });
    socket.on('disconnect',()=>{
        console.log('User Disconnected');
    });

});

//routes
app.post('/register',(req,res)=>{
    const {username, password} = req.body;
    if(users.some(u=>u.username === username)){
        return res.status(400).send('Username already exists');

    }
    const user = {id: users.length + 1, username, password};

    users.push(user);
    res.status(201).send('User registered');

});
app.post('/login',(req,res)=>{
    const {username, password} = req.body;
    const user = users.find (u=> u.username === username && u.password === password);
    if(!user) return res.status(400).send('invalid credentials');
    res.json({id: user.id,username : user.username});
});
app.get('/articles', (req,res)=>{
    res.json(articles);
});
app.post('/articles',(req,res)=>{
    const {title, description} = req.body;
    const newArticle = {id: articles.length +1, title, description, bids: [], createdAt: new Date(), endsAt: new Date(Date.now() + 3600 * 1000)};
    articles.push(newArticle);
    res.status(201).json(newArticle);
});
app.get('/articles/:id', (req,res)=>{
    const article = articles.find(a=> a.id === parseInt(req.params.id));
    if(!article) return res.status(404).send('Article not found');
    res.json(article);
});
const PORT = process.env.PORT || 3000;
server.listen(PORT, ()=>{
    console.log('Server is running on port' + PORT);
})

File Html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Online aste</title>
    <link rel="stylesheet" href="assets/css/styles.css">
</head>
<body>
    <div id="app">
        
    </div>
    
    <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
    <script src="/socket.io/socket.io.js"></script>

    <script src="assets/js/main.js"></script>
</body>
</html>

And Styles.css:

/* public/styles.css */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
  }
  
  header {
    background-color: #f8f9fa;
    padding: 10px;
    text-align: center;
  }
  
  #app {
    padding: 20px;
  }
  
  form {
    margin-bottom: 20px;
  }
  
  input, textarea, button {
    display: block;
    margin: 10px 0;
    padding: 10px;
    font-size: 16px;
  }
  
  button {
    background-color: #007bff;
    color: white;
    border: none;
    cursor: pointer;
  }
  
  button:hover {
    background-color: #0056b3;
  }
  
  ul {
    list-style-type: none;
    padding: 0;
  }
  
  li {
    margin: 5px 0;
  }
  

I hope that you can help me, thanks a lot

I’m working on a web application using Node.js, Express, and Socket.IO. Currently, I’m storing user data in an array, but I’d like to switch to using a MySQL database for better security and scalability. Can someone provide a step-by-step guide or example code on how to integrate MySQL for user registration and login?

Content Download speed is too slow on Digital Ocean Droplet using Nginx for reverse proxy

I have a node server (Cube JS: https://github.com/cube-js/cube) deployed on Digital Ocean Droplet served through PM2,Using Nginx for reverse proxy.

Tested on 15mb network

Content download speed goes as low as 20kb per second sometimes.

Normally I get 150kb to 200kb speed.

I have a suspicion that compression might be throttling the speed. But my dataset dataset has more than 50k rows I cannot go without it.

Why do I get some down times on this? is this normal on digital ocean droplet?

How can I improve this speed?

Will upgrading droplet help?

My Droplet Configuration is as follows:
Droplet Configuration

Nginx Configuration:

user www-data; worker_processes auto; pid /run/nginx.pid; include
/etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 768;
    # multi_accept on; }

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # SSL Settings
    ##

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;

    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 8;
    gzip_buffers 64 2k;
    gzip_http_version 1.1;
    gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss
text/javascript;




    ##
    # Virtual Host Configs
    ##



    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*; }

How to append data in CKEditor5

I’m trying to add some data "<div title="" + parts[0]+ "" id="" + parts[1]+ "" class="galleryPlaceholder"><p>&nbsp;</p></div><p></p>" with a custom plugin button in ckeditor5. What I want to achieve is to add the data where the cursor is, then move the cursor to the end of immitted data (the last <p>).

Is it possible?
my code so far is:

    this.listenTo( this.gallerySelect, 'execute', evt => {
        const whole = evt.source.val;
        
        let parts = whole.split(' ');
        editor.data.set("<div title="" + parts[0] + "" id="" + parts[1] + "" class="galleryPlaceholder"><p>&nbsp;</p></div><p></p>");
    } );

but this code replaces the existing content, I haven’t find yet a function fitting my needings in CKEditor5 docs.

How to append List to FormData in JQuery?

I get model’s values from view with this codeblock and this part is OK.

    var data = new FormData();

    var datas = $(this).serializeArray();
    for (var i = 0; i < datas.length; i++) {
        data.append(datas[i].name, datas[i].value);
    }

In addition I want to add a list to data variable with this code block.

commentlist.push({ CommentID: commentguid, UserName: username, Comment: comment, MainCommentID: topcommentid });
data.append("Comments", commentlist);

And this is the list in my model from controller side.

public List<CommentModalClass> Comments { get; set; }

In summary I want to send commentlist to controllerside in data but I couldn’t make it.

How to parse date from data after page loading

after page loading, the html rendered is like that

    <h3>Lorem ipsum dolor sit</h3>
    <p>Meeting scheduled for 7/19/26, You should receive the email confirmation shortly.</p>
    <h4>Lorem ipsum dolor sit</h4>
<p>lorem ipsum dolor sit</p>

Now I want to change the date format like this July 19th via jquery or javascript so that para should be like that

Meeting scheduled for July 19th, You should receive the email confirmation shortly.

I need assistance in setting user account rights [closed]

I am creating a personal stock portfolio website and I need some help. I have created the personal website and I have been able to connect it to xampp mysql database and it is able to read and store data in the database. I would like assistance on how to achieve the following;

  1. A user account to create a stock portfolio that will only be accessible to his or her account
  2. A way to link different rows of a table to each other

I need the assista

SVG Icons don’t show after compiling / bundling with Webpack

This is my first time building a web-application, and I’m in my final steps. I’m trying to bundle the whole project with webpack, and everything seems to work, except for my SVG-Icons.

I think the problem is how webpack references the svg’s in the compiled index.html.

The original index.html references the svg’s like this:

<svg role="img">
   <use href="images/icons.svg#settings-icon"></use>
</svg>

The compiled index.html references the svg’s like this:

<svg role="img" style="margin-bottom:-3px">
   <use href="aaf2f945f2b181c45647.svg#settings-icon"></use>
</svg>

This is my dist/ folder after compiling:

dist/
├── images/
│   └── icons.svg
├── aaf2f945f2b181c45647.svg
├── bundle.js
└── index.html

aaf2f945f2b181c45647.svg contains this:
export default "images/icons.svg";

icons.svg contains all my svg’s as it should.

When I replace all “aaf2f945f2b181c45647.svg” with “images/icons.svg” in the compiled index.html, everything works fine.

The problem is that webpack seems to be trying to navigate to icons.svg via aaf2f945f2b181c45647.svg. Why does it do that? Can I somehow tell it to directly write “images/icons.svg” into the html file?

This is my webpack.config.cjs:

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');

module.exports = {
    entry: './frontend/src/scripts/index.ts', // Entry point of your application
    output: {
        filename: 'bundle.js', // Output bundle file name
        path: path.resolve(__dirname, 'frontend/dist'), // Output directory
        clean: true,
    },
    module: {
        rules: [
            {
                test: /.ts$/,
                use: 'ts-loader',
                exclude: /node_modules/,
            },
            {
                test: /.css$/,
                use: ['style-loader', 'css-loader'],
            },
            {
                test: /.svg$/,
                use: {
                    loader: 'file-loader',
                    options: {
                        name: '[name].[ext]',
                        outputPath: 'images/',
                        publicPath: 'images/',
                    },
                },
            },
            {
                test: /.html$/,
                use: 'html-loader',
            },
        ],
    },
    resolve: {
        extensions: ['.ts', '.js'],
    },
    plugins: [
        new CleanWebpackPlugin(),
        new HtmlWebpackPlugin({
            template: './frontend/public/index.html', // Template HTML file
            filename: 'index.html', // Output HTML file name
        }),
    ],
};

This is my complete folder structure:

dist/
├── images/
│   └── icons.svg
├── aaf2f945f2b181c45647.svg
├── bundle.js
└── index.html

public/
├── images/
│   └── icons.svg
└── index.html

src/
├── scripts/
│   └── ...
└── styles/
    └── ...

I already tried using url-loader, svg-url-loader and svg-sprite-loader instead. None of them was able to display my svg’s.

JS of my special page extension in mediawiki not loading only on smartphone

On my wiki I made a special page that display recent changes in a pinterest style. Fort the image, it fetchs them using mediawikiParserOutput as a thumb 100px and then with js, I fetch the big images and put them where it should go. On desktop the js is loaded properly but on smartphone (and mozilla firefox smartphone simulation), it doesn’t load.

It doesn’t even matter what is in the js, if the js is only composed of a console.log(“loaded”), there will be nothing in the console.

Here’s my extension.json :

{
  "manifest_version": 1,
  "name": "ArchiRecentChanges",
  "version": "1.1",
  "license-name": "GPL-3.0",
  "author": "Aymeric Feltz",
  "description": "Custom pages for archi-wiki.org that display a pinterest style list of recent changes",
  "type": "specialpage",
  "SpecialPages": {
    "ArchiRecentChanges": "ArchiRecentChanges\SpecialArchiRecentChanges"
  },
  "AutoloadClasses": {
    "ArchiRecentChanges\SpecialArchiRecentChanges": "SpecialArchiRecentChanges.php"
  },
  "MessagesDirs": {
    "ArchiRecentChanges": [
      "i18n"
    ]
  },
  "ResourceModules": {
    "ext.archirecentchanges": {
      "scripts": [
        "js/archirecentchanges.js"
      ],
      "messages":[
        "readthis"
      ]
    }
  },
  "ResourceFileModulePaths": {
    "localBasePath": "",
    "remoteExtPath": "ArchiRecentChanges"
  },
  "ExtensionMessagesFiles": {
    "ArchiRecentChangesAlias": "ArchiRecentChanges.i18n.alias.php"
  }
}

Here’s the page in question :

ArchiRecentChanges

Here’s all the code :

archi-mediawiki/extensions/ArchiRecentChanges/
(commit 58bfb64de078fc436b60993f0f726f5cc15e4fd5, 19/07/24)

MediaWiki : 1.39.7

PHP : 7.4.33 (fpm-fcgi)

MariaDB : 10.11.6-MariaDB-0+deb12u1-log

ICU : 72.1

elasticsearch : 6.8.23

We also have some js in our hack.js in our skin folder (that we deploy with npm), and this js works perfectly fine. It’s only with the js of the extension that I have problems with

How to access ckeditor5 features DropdownButtonView, createDropdown, addListToDropdown,DropdownView,ButtonView etc while using ckeditor5 from CDN?

While using ckeditor5 as node-modules features can be imported for example:

import {addListToDropdown, createDropdown} from '@ckeditor/ckeditor5-ui/src/dropdown/utils';

But how to access these features when we are using ckeditor5 from CDN. Following is a sample code suggestion from one place but that is not working:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CKEditor 5 Customization</title>
    <script src="https://cdn.ckeditor.com/ckeditor5/35.0.1/classic/ckeditor.js"></script>
</head>
<body>
    <div id="editor">
        <p>This is the editor content.</p>
    </div>

    <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/ckeditor5/35.0.1/ckeditor.js"></script> -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/ckeditor5/35.0.1/ckeditor5-basic-styles/ckeditor.js"></script>
    <!-- Add other necessary plugins CDN links here -->

    <script>
        ClassicEditor
            .create(document.querySelector('#editor'), {
                toolbar: {
                    items: [
                        'heading',
                        '|',
                        'bold',
                        'italic',
                        '|',
                        'link',
                        'bulletedList',
                        'numberedList',
                        'blockQuote',
                        'insertTable',
                        '|',
                        'undo',
                        'redo'
                    ]
                },
                language: 'en'
            })
            .then(editor => {
                console.log('Editor was initialized', editor);

                // Access necessary modules from the editor instance
                const dropdownButtonView = editor.ui.componentFactory.create('DropdownButtonView');
                const createDropdown = editor.ui.componentFactory.create('createDropdown');
                const addListToDropdown = editor.ui.componentFactory.create('addListToDropdown');

                console.log(dropdownButtonView, createDropdown, addListToDropdown);
            })
            .catch(error => {
                console.error(error);
            });
    </script>
</body>
</html>

Also saw one suggestion somewhere like:

const view = new editor.ui.button.ButtonView(locale);
const dropDownView= new editor.ui.dropdown.DropdownView(locale);

this also doesn’t seem to work and throws error “editor.ui.dropdown” is undefined. Can anyone please suggest some thing?

DataTransfer returns empty in chrome

In my HTML I have a drop zone where user can drag files from their computer and drop them inside that zone. Inside the event listener when I print the files/items It returns empty.

I have tested it in firefox and works as expected.

const dropZone = document.getElementById("dropZone");
dropZone.addEventListener("drop", (event) => {
  // Prevent default behavior (Prevent file from being opened)
  event.preventDefault();

  const items = event.dataTransfer.items;
  const files = event.dataTransfer.files;

  console.log(items);
  console.log(files);
});

What could be happening?

Azure tts api about getting voice lists for azure text to speech

i have a question that is anything their like api end point on azure tts which porovide voices data with sample voice url apart from this voices/list endpoint this giv list of voices but i want like azure portal which that i play audio sample which i want to here and than used to go with perticular voice after hearing . i tried by using tts endpoint by provideing sample text but it uses credit which i dont want

app.get(‘/api/voicegallery’, async (req, res) => {
try {
const response = await axios.get(https://eastus.tts.speech.microsoft.com/cognitiveservices/voices/list, {
headers: {
‘Ocp-Apim-Subscription-Key’: subscriptionKey
}
});

    if (response.status === 200) {
        const voices = response.data;
        // Example of transforming the response data if needed
        const voicesWithSamples = voices.voices.map(voice => ({
            name: voice.name,
            locale: voice.locale,
            gender: voice.gender,
            style: voice.style,
            sampleUrl: `https://your-cdn-or-service/${voice.name}/sample.mp3` // Modify as needed
        }));

        res.json(voicesWithSamples);
    } else {
        console.log('Azure API Response Status:', response.status);
        res.status(response.status).send('Error fetching voices.');
    }
} catch (error) {
    console.error('Error fetching voices:', error.response ? error.response.data : error.message);
    res.status(500).send('Error fetching voices.');
}

});