NUXT3 NuxtImg : Image rotate 90° when I use NuxtImg

When I use NuxtImg, my images rotate at 90°. This problem appear with vertical mobile images, when I read it on supabase and display it. Before upload and on supabase, images are ok (portrait).

When I use img instead everthing is ok, images change and become portrait style…

My nuxt config :

       image: {
  inject: true,
  quality: 80,
   format: ['webp'],
      screens: {
      'xs': 120,
      'sm': 240,
      'md': 290,
      'lg': 384,
      'xl': 480,
      'xxl': 480,
      '2xl': 480
    }, 

    domains: ['images.unsplash.com', 'draxies.com', 'qzlburhygrqslzasuiak.supabase.co']

},  

My NuxtImg code :

      <div class="relative pb-64 z-0">
        <NuxtImg class="absolute w-full h-full rounded-lg object-cover border-b shadow-md"
          :src="offer.offer_image_url" :alt="offer.offer_title" placeholder />
      </div>

Quill mention : trigger an event when clicking on the list

I am running Quill Mention, and I want to get the user id when I click on the suggestion list.

The form:

<form>
    <div id="editor"></div>
    <input type="hidden" id="user_id_field">
</form>

The JS:

async function suggestPeople(searchTerm) {
   const allPeople = [
      { id: 1, value: "Fredrik Sundqvist" },
      { id: 2, value: "Patrik Sjölin" }
   ];
   return allPeople.filter(person => person.value.includes(searchTerm));
}

const quill = new Quill("#editor", {
    placeholder: "Enter @",
    modules: {
        mention: {
            allowedChars: /^[A-Za-zsÅÄÖåäö]*$/,
            mentionDenotationChars: ["@"],
            source: async function(searchTerm, renderList) {
                const matchedPeople = await suggestPeople(searchTerm);
                renderList(matchedPeople);
            }
        }
    }
});

window.addEventListener("mention-clicked", function(event) {
    const userId = event.detail.id;
    console.log(userId);
});

The event “mention-clicked” is triggered when I clik on a username inside the

<div id="editor">

But I would like it to be triggered when I click on the suggestion list.

I have tried that instead, with no luck:

document.addEventListener("DOMContentLoaded", function() {
   const editor = document.getElementById("editor");
   const suggestionsList = document.getElementById("quill-mention-list");

   if (suggestionsList) {
      editor.addEventListener("click", function(event) {
         const target = event.target;
         if (target === suggestionsList || suggestionsList.contains(target)) {
            console.log('click');
         }
      });
   }
});

My backend API for GETall documents log isn’t working as expected while testing it

While I thought about using GET request to retrieve the created documents from my trackinglogs collection and fetch the data into my frontend LogCard component which basically is responsible for keeping and showing the logs to the user. I created an endpoint for both backend and frotend after fetching the API through RTK query and defining it inside my component while logging the endpoint it is throwing undefined and I thought it might be wrong from backend side too, so while I tested the backend API on postman it isn’t retrieving the document. Apperently it only have one document it should retrieve right? But I couldn’t figure it out where I am doing wrong.

Frontend

detailAllTrackingLog: builder.query({
      query: () => {
        return {
          url: `/tracking/log`,
          method: "GET",
        };
      },
        providesTags: ["detailTrackingLog"]
    }),

Defining it on my component

import {useLazyDetailAllTrackingLogQuery} from "../../services/api/trackingLog";

 const formattedDate = dayjs(selectedDate).format("YYYY-MM-DD");
 const { data: logs, isLoading: logsLoading } = useLazyDetailAllTrackingLogQuery({ date: formattedDate });
  console.log(logs);

Backend function for Detail all logs with routes

service function

export const detailAllTrackingLogService = async ({
  find = {},
  sort = "",
  limit = "",
  skip = "",
  select = "",
}) =>
  TrackingLog.find(find)
    .sort(sort)
    .limit(limit)
    .skip(skip)
    .select(select)
    .populate("user")
    .populate("timeTracker");

# controller function
export const detailAllTrackingLog = tryCatchWrapper(async (req, res, next) => {
  let find = {};
  req.find = find;
  req.service = trackingLogService.detailAllTrackingLogService;

  next();
});

# Defining Route

const trackingLogRouter = Router();

trackingLogRouter
  .route("/")
  .post(trackingLogController.addTrackingLog)
  .get(trackingLogController.detailAllTrackingLog);

# Route Path

const apiRouter = Router();

const OurRoutes = [
 {
    path: `/tracking/log`,
    router: trackingLogRouter,
  },
];

OurRoutes.forEach((route) => {
  apiRouter.use(route.path, route.router);
});

reload component/page without refreshing the entire page in angular

After a user has selected a file to upload, the file is only visible after a reload the entire page. I am looking for a neater way for the reload to happen so that I can display the document.

 public onFileSelected(event): void {

  console.log(this.fileId)
   const file = event.target.files[0];
   if (file) {
     const formData = new FormData();

     formData.append("file", file, file.name);
     this.testService.postUrl(`${this.fileId}/upload-document`, formData)
     .subscribe((data) => {
       Swal.fire("Document", "The document has been uploaded.", "success");
     });
   }
   this.getDocuments();
   //this.router.routeReuseStrategy.shouldReuseRoute = () => false;
   const RedirectUrl ='/portal/docupload/' + this.fileId
   this.router.navigateByUrl('/portal/docupload/' + this.fileId, {skipLocationChange: true}).then(() => {
   this.router.navigate([RedirectUrl]);
   this.active = 4;
   // When skipLocationChange true, navigates without pushing a new state into history.
   });
 }

How to unload an overlay without clicking a close button after pin check

I have a page when opening an overlay is loading and asking for pin validation. pin check is via php on action=”<?php echo $_SERVER[‘PHP_SELF’]; ?>”
This works all fine, but I have no idea how to close the overlay automaticly after the pin is correct. I have no problems showing a close button to click, but I want it automaticaly…

the script is:

<script>
function on() {document.getElementById("overlay").style.display = "block";}

function off() {document.getElementById("overlay").style.display = "none";} 
</script>

I can close it in php with this BUT how can i do it automaticaly?

<?
$pin = $_POST["pin"];
$ergebnis = $dbconnection->query("select usr, pin from user where usr like '$user' limit 1")
                        or die($dbconnection->error);
while($row = $ergebnis->fetch_object()){
    
    $pinD=$row->pin;
}
    if ($pin == $pinD) {
echo "<p> Code is good! Please close the Overlay to continue </p>";
echo "<button type='button' onclick='off()' class='btn btn-primary btn-lg' name='erledigt'>CLOSE and continue</button>  ";

    }
    
    else {
        echo "<p> You must entr the correct code</p>";
    }
?>

Unload the overlay automatical in the php if syntax.
I can only use onclick=”off” but how can I run the “off” without clicking?

javascript fetch-api doesnt proceed with .then(), but backend responds with correct JSON-Object

JS-Version: 18.13.0
Vue-Version: 5.0.8

I am currently developing a webapp with JS and Vue in the Frontend and Spring Boot and a temporary H2-Database in the backend.
When I test my webapp I run my frontend and backend at the same time on different ports.
I am currently stuck on a simple fetch request to the backend which doesnt proceed to the following .then().

The Frontend Code:

const userData = {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json'
        },
        body: JSON.stringify(user)
      }

      const emailRequestOptions = {
        method: 'GET',
        redirect: 'follow'
      }

      fetch('http://localhost:8080/register', userData)
        .then(response => response.json())
        .then(data => {

          console.log("test1")

          if (data.ok) {

            console.log("test2")
            
            fetch('http://localhost:8080/userEmail/' + this.email, emailRequestOptions)
              .then(response2 => response2.json())
              .then(data2 => this.navigateToRegistrationQuestions(data2))
              .catch(error => {
                console.error('error:', error)
              })

          } else {

            console.log('User could not be created, try again')
          }
        })
        .catch(error => {
          console.error('error:', error)
        })

The Backend Endpoints:

    @PostMapping("/register")
    public ResponseEntity<AuthenticationResponse> register(@RequestBody RegisterRequest request){

        return ResponseEntity.ok(service.register(request));
    }


    @GetMapping("/userEmail/{email}")
    public ResponseEntity<Map<String, Long>> getUserIdByEmail(@PathVariable String email) { 
        return ResponseEntity.ok(uService.getUserIdByEmail(email));
    }

My Backend returns this response when I test the request with Postman:
{ “token”: “eyJhbGciOiJIUzI1NiJo” }
which is what I expect, so that works fine.

I already tried to debug it a bit, with the console.log(“test”), (“test2”) but I dont get any of theses outputs and also no errors in my console browser.
Therefore I assume it is stuck on the .then(data => {….}), but I dont know why.
Is it maybe, because the response takes too long?

Problems with sending push notifications

Good afternoon
There is an iOS application that receives push notifications; for this purpose, a server part was created in node.js with Firebase cloud functions. There is a standard synchronous function for sending notifications, but it works with great loss, so we are trying to make it asynchronous, but we are faced with a problem.

Below is the code, testing on silent notifications

var allMesseges = []
const sendAllMessages = async () => {
const sendMessege = allMesseges.map(async (message) => {
let response = await admin.messaging().send(message);
});
await Promise.all(sendMessege);
};

exports.allSilentPushTrigerAsync =      functions.database.ref('/development/allSilentPushTrigerAsync/').onWrite(async event=> {
let snap = await db.ref("users").once("value")
let users = snap.val()
for (const [key, user] of Object.entries(users)) {
if (user.details.pushToken) {
const message = {
apns: {
headers: {
"apns-push-type": "background",
"apns-priority": "5",
},
payload: {
"aps" : {
"content-available" : 1
},
},
},
token: user.details.pushToken,
};
allMesseges.push(message)
}
}
await sendAllMessages()
})

We get an error in the logs

allSilentPushTrigerAsync
pzhv27hvepg4
Error: Requested entity was not found.
at Function.fromServerError (/workspace/node_modules/firebase-    admin/lib/utils/error.js:254:16)
at createFirebaseError (/workspace/node_modules/firebase-admin/lib/messaging/messaging-errors-internal.js:35:47)
at /workspace/node_modules/firebase-admin/lib/messaging/messaging-api-request-internal.js:79:75
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async /workspace/index.js:180:28
at async Promise.all (index 4)
at async sendAllMessages (/workspace/index.js:182:9)
at async /workspace/index.js:207:10

at async /workspace/index.js:180:28 refers to the line of code:
let response = await admin.messaging().send(message);

at async /workspace/index.js:207:10 refers to the line of code:
await sendAllMessages()

Please tell me what the problem is.

Smooth transition with filter Mapbox (setPaintProperty)

I’m trying to understand how the filters (expressions) in the setPaintProperty, setLayoutProperty and even setFilter methods work, as I’m noticing some peculiar behavior with transitions.

It seems that transitions are not applied when a filter is used in these methods. Here’s an example (https://codepen.io/cladjidane/pen/MWzLPeE), showing that only saintPaintProperty without a filter applies a smooth transition. But as soon as you add a filter, it doesn’t work anymore.

map.setPaintProperty("state-fills", "fill-opacity", 0); // Smooth transition
// ...
map.setPaintProperty("state-fills", "fill-opacity", ["case", ["==", ["get", "STATE_NAME"],  "Florida"], 1, 0]); // No smooth transition

I did read somewhere that “it’s technically impossible”, but I’d like to know more about it and possibly an alternative way of handling the appearance/disappearance of layers with a soft effect (if possible, a high-performance one).

React js Image Upload

xport default function AccountVerification(props) {
  const { user } = useSelector((state) => state.AuthReducer);
  const [loading, setLoading] = React.useState(true);
  const [countryData, setCountry] = React.useState([]);
  const [activeTab, setActiveTab] = useState(0);
  const [isverified, setIsverified] = useState(0)
  const [usercountry, setUserCountry] = useState('india');
  const [id_no, setIdNo] = useState('');
  const [first_name, setFirstName] = useState('');
  const [last_name, setLastName] = useState('');
  const [type, setType] = useState('');
  const [personalTab, setPersonalTab] = useState(0);
  const [isSubmitPersonalData, setSubmitPersonalData] = useState(0);
  const [id_verification, setIdVerifocation] = useState(0)
  const [filedata, setFileData] = useState();
  useEffect(() => {
    N_checkKYCStatus(user?.params ? user.params.token: user.token)
    .then((d)=>{
      if (d.status === 200) {
        if(d?.params.status == 2) {
          setPersonalTab(1);
        } 
        else if(d?.params.status == 4) {
          setPersonalTab(4)
        }else if(d?.params.status == -1) {
          setIsverified(2)
        } else if(d?.params.status == 1) {
          setIsverified(1)
        }
        if(d?.params.status == 0 || d?.params.status == 3) {
          N_getCountry(user?.params ? user.params.token : user.token)
          .then((d) => {
            if (d.status === 200) {
              setCountry(d?.params.country_data);
            }
           
          })
        }
      }
      setLoading(false);
    })
   
  }, []);


  const updatePersonal = (e) =>{
    e.preventDefault();
    N_profileData(user?.params ? user.params.token: user.token, type, id_no, first_name, last_name, usercountry)
    .then((res)=>{
      console.log(res);
      if(res.status == 200) {
        setSubmitPersonalData(2);
      }
    })
  }

  function readURL(input) {
    const file = input.target.files[0];
    var reader = new FileReader();
    if (file) {
      reader.readAsDataURL(file);
      setFileData(file);
      setIdVerifocation(3)
      reader.onload = function (e) {
        $("#check_photo").attr("src", e.target.result);
      };
    }
  }


  <div className={id_verification==3?'':'d-none'} id="preview_photo">
                  <div class="steps_div">
                    <div class="d-flex align-items-center">
                      <div class="circle_no">1</div>
                      <span class="text-lgray">Personal Information</span>
                    </div>

                    <div class="adjacent_line"></div>
                    <div class="d-flex align-items-center">
                      <div class="circle_no active">2</div>
                      <span class="text-lgray">
                        ID Verification & Face Verification
                      </span>
                    </div>
                  </div>

                  <div className="row mt-3">
                    <div className="col-lg-9 m-auto col-12 mb-3">
                      <div className="jambotron border-dashed">
                        <div className="photo-preview">
                          {" "}
                          <img
                            src="/img/placeholder-id-front.svg"
                            className="img-fluid"
                            id="check_photo"
                            alt="placeholder-id-front"
                          />
                        </div>
                        <h4 class="big_heading text-center">
                          Check Photo
                        </h4>

                        <ul className="my-3">
                          <li>Have you checked if your ID is supported? </li>
                          <li>Can you read the details?</li>
                          <li>Can you see the whole ID?</li>
                        </ul>
                     
                        <div className="text-center">
                          <button className="btn btn-secondary my-2 me-2"
                          onClick={(e)=>{
                            setIdVerifocation(2)
                          }}
                          >
                            Try again
                          </button>
                          <button className="btn btn-primary my-2"
                           onClick={(e) => {
                            N_uploadID(
                              e,
                              filedata,
                              "docf",
                              user?.params ? user.params.token : user.token
                            );
                            setIdVerifocation(2)
                            setPersonalTab(4)
                          }}>
                            Confirm
                          </button>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                </>
                :null}
                {personalTab == 4?
                <>
                {/* Start Verification */}
                <div className={id_verification==0?'':'d-none'} id="start_verification">
                  <div class="steps_div">
                    <div class="d-flex align-items-center">
                      <div class="circle_no">1</div>
                      <span class="text-lgray">Personal Information</span>
                    </div>

                    <div class="adjacent_line"></div>
                    <div class="d-flex align-items-center">
                      <div class="circle_no active">2</div>
                      <span class="text-lgray">
                        ID Verification & Face Verification
                      </span>
                    </div>
                  </div>

                  <h4 class="big_heading text-center">
                    <BiSolidCheckShield className="me-1 text-green" /> Start
                    Verfication
                  </h4>
                  <div className="row mt-3">
                    <div className="col-lg-9 m-auto col-12 mb-3">
                      <div className="jambotron">
                        <p>
                          {" "}
                          This process is designed to verify your identity and
                          protect you from identity theft.
                        </p>

                        <p>Please have your ID ready and click 'Start'. </p>
                      </div>

                      <div className="d-flex align-items-center gap-1 my-3">
                        <div>
                          {" "}
                          <BiError className="text-warning fs-4" />{" "}
                        </div>
                        <div>
                          This page will expire in a few minutes if you do not
                          start.
                        </div>
                      </div>

                      <div className="d-grid mb-2">
                        <button className="btn btn-primary btn-lg"
                        onClick={(e)=>{
                          setIdVerifocation(1)
                        }}>
                          Start
                        </button>
                      </div>
                      <p className="small text-muted">
                        By clicking “Start” you consent to Jumio collecting and
                        disclosing your biometric data pursuant to its{" "}
                        <a href="#" className="text-info">
                          Privacy Policy
                        </a>
                        .
                      </p>
                    </div>
                  </div>
                </div>

                {/* choose method to upload Documents */}
                <div className={id_verification == 1?"":"d-none"} id="choose_method">
                  <div class="steps_div">
                    <div class="d-flex align-items-center">
                      <div class="circle_no">1</div>
                      <span class="text-lgray">Personal Information</span>
                    </div>

                    <div class="adjacent_line"></div>
                    <div class="d-flex align-items-center">
                      <div class="circle_no active">2</div>
                      <span class="text-lgray">
                        ID Verification & Face Verification
                      </span>
                    </div>
                  </div>

                  <h4 class="big_heading text-center">
                    Choose an Upload Method
                  </h4>
                  <div className="row mt-3">
                    <div className="col-lg-9 m-auto col-12 mb-3">
                      {/* <div className=" mb-2">
                        <a href="#" className="upload_btn active">
                          <BiMobileAlt className="me-1 fs-4" /> Continue On
                          mobile
                        </a>
                      </div>
                      <div className=" mb-2">
                        <a href="#" className="upload_btn">
                          <AiOutlineCamera className="me-1 fs-4" /> Take photo
                          using webcam
                        </a>
                      </div> */}
                      <div className=" mb-2">
                        <button className="upload_btn"
                        onClick={(e)=>{
                          setIdVerifocation(2)
                        }}>
                          <AiOutlineCloudUpload className="me-1 fs-4" /> Upload
                          file from this device
                        </button>
                      </div>
                    </div>
                  </div>
                </div>

                {/* Upload front of ID Card */}
                <div className={id_verification==2?'':'d-none'}  id="upload_doc">
                  <div class="steps_div">
                    <div class="d-flex align-items-center">
                      <div class="circle_no">1</div>
                      <span class="text-lgray">Personal Information</span>
                    </div>

                    <div class="adjacent_line"></div>
                    <div class="d-flex align-items-center">
                      <div class="circle_no active">2</div>
                      <span class="text-lgray">
                        ID Verification & Face Verification
                      </span>
                    </div>
                  </div>

                  <div className="row mt-3">
                    <div className="col-lg-9 m-auto col-12 mb-3">
                      <div className="jambotron border-dashed text-center">
                        <div className="dummy-card-photo">
                          {" "}
                          <img
                            src="/img/placeholder-id-front.svg"
                            className="img-fluid"
                            alt="placeholder-id-front"
                          />
                        </div>
                        <h4 class="big_heading text-center">
                          Upload Back of identity card
                        </h4>

                        <div className="badge bg-dark fs-12 my-2">
                          Step 2 of 2
                        </div>
                        <p>
                          Upload a color image of the entire document.
                          Screenshots are not allowed. JPG, JPEG or PNG format
                          only.
                        </p>
                        <div className="d-grid">
                        <input
                            id="upload_front_adhar"
                            type="file"
                            onChange={(e) => {
                              readURL(e);
                            }}
                            className="form-control kyc_image--"
                          />
                        </div>
                      </div>
                    </div>
                  </div>
                </div>


                 {/* Preview of photo */}
                 <div className={id_verification==3?'':'d-none'} id="preview_photo">
                  <div class="steps_div">
                    <div class="d-flex align-items-center">
                      <div class="circle_no">1</div>
                      <span class="text-lgray">Personal Information</span>
                    </div>

                    <div class="adjacent_line"></div>
                    <div class="d-flex align-items-center">
                      <div class="circle_no active">2</div>
                      <span class="text-lgray">
                        ID Verification & Face Verification
                      </span>
                    </div>
                  </div>

                  <div className="row mt-3">
                    <div className="col-lg-9 m-auto col-12 mb-3">
                      <div className="jambotron border-dashed">
                        <div className="photo-preview">
                          {" "}
                          <img
                            src="/img/placeholder-id-front.svg"
                            className="img-fluid"
                            id="check_photo"
                            alt="placeholder-id-front"
                          />
                        </div>
                        <h4 class="big_heading text-center">
                          Check Photo
                        </h4>

                        <ul className="my-3">
                          <li>Have you checked if your ID is supported? </li>
                          <li>Can you read the details?</li>
                          <li>Can you see the whole ID?</li>
                        </ul>
                     
                        <div className="text-center">
                          <button className="btn btn-secondary my-2 me-2"
                          onClick={(e)=>{
                            setIdVerifocation(2)
                          }}
                          >
                            Try again
                          </button>
                          <button className="btn btn-primary my-2"
                           onClick={(e) => {
                            N_uploadID(
                              e,
                              filedata,
                              "docb",
                              user?.params ? user.params.token : user.token
                            );
                          }}>
                            Confirm
                          </button>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                </>
                :null}

              </div>

when i upload image show error 400 but send 2nd image upload selection in the screen when 1st image error image not upload the through 2nd image and when i upload second image sucesfully upload but 1st image has not upload when only 2nd iamge are sucesfully upload 1st image are not upload and not show any error to upload first image

How do I get select2 to work for two classes? It just initialize the second class

I tried to use Select2 with two different classes. The both classes are used for different forms. One of them is for the desktop and the other is for the mobile form. The problem is that just the second class is working as expected. What i want is to use select2 for two select fields.

Jquery Version: jQuery v3.6.4
Select2 Version: Select2 4.1.0-rc.0

Javascript Code:

<script>
    // Initialisiere Select2
    $('.select2-icons-mobile, .select2-icons-desktop').select2({
        templateResult: formatOption,
        templateSelection: formatSelection,
        escapeMarkup: function(m) { return m; },
        minimumResultsForSearch: Infinity
    });

    function formatOption(option) {
        if (!option.id) {
            return option.text;
        }

        var icon = getIconForOption(option);

        var $option = $('<span><i class="bi ' + option.text + ' mx-2"></i>' + icon + '</span>');

        return $option;
    }

    function formatSelection(selection) {
        var icon = getIconForOption({ text: selection.text });

        var $selection = $('<span><i class="bi ' + selection.text + '"></i></span>');

        return $selection;
    }

    function getIconForOption(option) {
        if (!option.text) {
            return "";
        }

        // Prüfe den Text direkt für die mobile Auswahl
        if (option.text == "Produkt" || option.text == "bi-stack") {
            return "Produkt";
        } else if (option.text == "Generation" || option.text == "bi-x-diamond-fill") {
            return "Generation";
        } else if (option.text == "Set" || option.text == "bi-collection-fill") {
            return "Set";
        } else if (option.text == "Shop" || option.text == "bi-shop-window") {
            return "Shop";
        } else if (option.text == "Community" || option.text == "bi-people-fill") {
            return "Community";
        }

        return "";
    }
</script>

HTML Code:

    <!-- MOBILE FORM -->
    <form class="d-flex" method="post" action="{{ url_for('main.search_results') }}">
        {{ search_form.hidden_tag() }}
        
        {{ search_form.search_type(class="form-control select2-icons-mobile") }}

        {{ search_form.search_string.label }}
        <div class="w-100 form-group position-relative mb-0 d-flex">
            {{ search_form.search_string(class="form-control rounded-0", placeholder="Auf PokeCheck suchen") }}
        </div>
        
        {{ search_form.submit() | safe }}
    </form>
                <!-- DEKSTOP FORM -->
                <form class="d-flex" method="post" action="{{ url_for('main.search_results') }}">
                    {{ search_form.hidden_tag() }}

                    {{ search_form.search_type.label(class="form-control d-hide") }}
                    {{ search_form.search_type(class="form-control select2-icons-desktop") }}

                    {{ search_form.search_string.label }}
                    <div class="form-group position-relative mb-0">
                        {{ search_form.search_string(class="form-control desktop-form", placeholder="Auf PokeCheck suchen") }}
                    </div>
                    
                    {{ search_form.submit() | safe }}
                </form>

What I tried so far was splitting it into two sectors like:

$('.select2-icons-mobile').select2({
    templateResult: formatOption,
    templateSelection: formatSelection,
    escapeMarkup: function(m) { return m; },
    minimumResultsForSearch: Infinity
});

$('.select2-icons-desktop').select2({
    templateResult: formatOption,
    templateSelection: formatSelection,
    escapeMarkup: function(m) { return m; },
    minimumResultsForSearch: Infinity
});

but i got the same bug. Just the second sector is working and the first is not. At the frontend i see that Select2 completely ignores the first sector( .select2-icons-mobile ).

How do I get select2 to work for two classes?

Unable to do File Upload using sendkeys method as i cannot find input type=file in the html

I am trying to automate a webpage using Selenium Java that need to be run in headless mode. In the webpage there is a table in which there are two buttons “Choose File”, “Upload”. I cannot find the input tag of type=file, to be able to sendkeys the file path to upload. How do I make the upload work?

Here is the HTML:

<div class="row">
<div id="DocumentTableWrapper" style="display: block;">
<table id="DocumentTable">
    <thead>
        <tr>
        <th>Document Category</th>
        <th>Document Name</th>
        <th>Upload</th>
        </tr>
    </thead>
    <tbody>
        <tr id="row0">
            <td>Proof of Income</td>
            <td>
                <select class="documentSelectBox" id="selectDocument-0">
                    <option value="1061-Pension" selected="">Pension</option>
                    <option value="1138-Divorce Decree">Divorce Decree</option>
                    <option value="1025-IRP5 Certificate">IRP5 Certificate</option>
                    <option value="1028-Pay slip">Pay slip</option>
                    <option value="1029-Bank Statement">Bank Statement</option>
                    <option value="1031-Confirmation from Employer">Confirmation from Employer</option>
                    <option value="1051-Reference Letter from Employer">Reference Letter from Employer</option>
                    <option value="1030-Affidavit">Affidavit</option>
                </select>
            </td>
            <td>
                <span class="uploadInput" id="chosenfile-0">
                </span>
                <span class="buttonWrapper">
                    <button id="browseDoc-0" class="browseButton" onclick="browseDocument(0)">Choose File</button>
                    <button id="upload-0" class="uploadButton" onclick="uploadDocument(0)">Upload</button>
                </span>
            </td>
        </tr>

Below is how it looks on UI:
enter image description here

I have tried AutoIt, Robot class, all these work but i need to be able to run headless hence these options won’t work.

Is it possible to resize a canvas after transferControlToOffscreen() in wasm?

I am cross compiling to wasm a multi-threaded rendering engine.
Upon spawning render thread we call emscripten_pthread_attr_settransferredcanvases which is same as calling transferControlToOffscreen() in JS.
In runtime a hosting JS code is required to resize the canvas to match a window size requested by the user.

For example,calling this:

   var canvas = document.getElementById('canvas');
   canvas.width = 640;
   canvas.height = 360;

Throws:

Uncaught DOMException: Failed to set the 'width' property on 'HTMLCanvasElement': Cannot resize canvas after call to transferControlToOffscreen().

I know we are not allowed to call DOM on a secondary thread (worker) in wasm.I wonder if there is still a way to perform canvas resizing in runtime when rendering in worker and using offscreen framebuffer in C++ or in JavaScript?

Use vue-18n in constants folder in Nuxt

I have a problem when using vue-i18n in Nuxt. This is my setup:

~/plugins/i18n.js

import en from '@/services/locales/en.json'
import ja from '@/services/locales/ja.json'
import vn from '@/services/locales/vn.json'
import Vue, { inject } from 'vue'
import VueI18n from 'vue-i18n'

Vue.use(VueI18n)

const messages = {
  vn,
  en,
  ja,
}
export default ({ app, store }, inject) => {
  app.i18n = new VueI18n({
    locale: store.state.locale,
    fallbackLocale: 'vn',
    messages,
    silentTranslationWarn: true,
  })
}

nuxt.config.js

export default {
   plugins: ['~/plugins/i18n.js']
}

My setup is used in .vue find and success to translate. However, i have a trouble when using it in .js file. specifically, in ~/constantsselectOptions.js, this file is to save all the options of all selectboxes, but I do not know to import i18n from anywhere

~/constantsselectOptions.js

export const GENDER_OPTIONS = [
  {
    label: i18n.t("label.male"),
    value: "MALE",
  },
  {
    label: i18n.t("label.female"),
    value: "FEMALE",
  },
  {
    label: i18n.t("label.bothGender"),
    value: "ALL",
  },
];

So, how can I use vue-i18n in .js file?
Notice that, I use vue-i18n not @nuxtjs/i18n