<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to make the previewHTML same as the text symbol show on map? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-make-the-previewhtml-same-as-the-text/m-p/1290884#M81210</link>
    <description>&lt;P&gt;Yes. It solved problem. Thank you!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LeoDeng_0-1684452823208.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/71123i80C321D901A94184/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LeoDeng_0-1684452823208.png" alt="LeoDeng_0-1684452823208.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 May 2023 23:34:00 GMT</pubDate>
    <dc:creator>LeoDeng</dc:creator>
    <dc:date>2023-05-18T23:34:00Z</dc:date>
    <item>
      <title>How to make the previewHTML same as the text symbol show on map?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-make-the-previewhtml-same-as-the-text/m-p/1282644#M80959</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I'm going to set the preview HTML as same as the text symbol show on the map. I notice that there is a method&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-support-symbolUtils.html#renderPreviewHTML" target="_self"&gt;renderPreviewHTML&lt;/A&gt;. However, the result is under expectation. Here is the code and result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;meta charset="utf-8" /&amp;gt;
    &amp;lt;meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no" /&amp;gt;
    &amp;lt;title&amp;gt;Test Page&amp;lt;/title&amp;gt;

    &amp;lt;style&amp;gt;
      html,
      body,
      #viewDiv {
        padding: 0;
        margin: 0;
        height: 100%;
        width: 100%;
      }
      #symbol-preview {
        position: absolute;
        right: 100px;
        top: 100px;
        width: 150px;
        height: 50px;
        border: 1px solid black;
        background-color: white;
      }
    &amp;lt;/style&amp;gt;

    &amp;lt;link rel="stylesheet" href="https://js.arcgis.com/4.26/esri/themes/light/main.css"&amp;gt;
    &amp;lt;script src="https://js.arcgis.com/4.26/"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script&amp;gt;
        require([
            "esri/Map",
            "esri/views/MapView",
            "esri/Graphic",
            "esri/symbols/TextSymbol",
            "esri/symbols/support/symbolUtils"],
            function(Map, MapView, Graphic, TextSymbol, symbolUtils) {

        const map = new Map({
          basemap: "streets"
        });

        const view = new MapView({
          map: map,
          center: [-117.1947900, 34.0572650], // Longitude, latitude
          zoom: 13, // Zoom level
          container: "viewDiv" // Div element
        });

        const markerSymbol = {
            type: "simple-marker",
            color: "blue",
            size: "8px",
        };

        const graphic = new Graphic({
            attributes: {
              "Sequence": 5
            },
            geometry: {
                type: "point",
                longitude: -117.1947900,
                latitude: 34.0572650
            },
            symbol: {
                type: "simple-marker",
                color: "blue",
                size: "8px",
            }
        });
        view.graphics.add(graphic);


        // preview symbol
        const textSymbol = new TextSymbol({
          color: [255, 165, 0],
          haloColor: [0, 0, 0],
          haloColor: [255, 255, 255],
          haloSize: "2px",
          text: "Esri",
          backgroundColor: [0, 165, 165],
          borderLineSize: "1px",
          borderLineColor: [0, 0, 0],
          font: {
            size: 20,
            family: "Josefin Slab",
            weight: "bold"
          }
        });

        symbolUtils.renderPreviewHTML(textSymbol, {
          node: document.getElementById("symbol-preview"),
          size: 20
        });

        const textGraphic = new Graphic({
            geometry: {
                type: "point",
                longitude: -117.1947900,
                latitude: 34.0572650,
            },
            symbol: textSymbol
        });
        view.graphics.add(textGraphic);

      });
    &amp;lt;/script&amp;gt;

  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;div id="viewDiv"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;div id="symbol-preview"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LeoDeng_1-1682475048296.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/69103iBAC3569DB861A30A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LeoDeng_1-1682475048296.png" alt="LeoDeng_1-1682475048296.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;My question is: Is this a bug on&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-support-symbolUtils.html#renderPreviewHTML" target="_self"&gt;renderPreviewHTML&lt;/A&gt;&amp;nbsp;or how to make the text symbol show on map same as in preview?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Leo&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2023 02:15:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-make-the-previewhtml-same-as-the-text/m-p/1282644#M80959</guid>
      <dc:creator>LeoDeng</dc:creator>
      <dc:date>2023-04-26T02:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to make the previewHTML same as the text symbol show on map?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-make-the-previewhtml-same-as-the-text/m-p/1282651#M80960</link>
      <description>&lt;P&gt;It would be helpful if you could provide more context and code related to your question so I can better understand the issue you are facing. Without more information, it's hard to provide an accurate answer. However, I'll provide some general advice that may help.&lt;/P&gt;&lt;P&gt;If you're trying to render HTML that matches the text symbol on the map, you'll need to make sure you're using the correct CSS styles and classes. One way to do this is to inspect the text symbol on the map using your browser's developer tools to see what styles and classes are being used. You can then use those styles and classes in your own HTML to ensure that it looks the same.&lt;/P&gt;&lt;P&gt;Here's an example of how you might use the renderPreviewHTML method to create HTML that matches the text symbol on the map:&lt;/P&gt;&lt;P&gt;const textSymbol = new esri.symbol.TextSymbol({&lt;BR /&gt;text: "Hello world!",&lt;BR /&gt;font: {&lt;BR /&gt;size: 14,&lt;BR /&gt;family: "Arial",&lt;BR /&gt;weight: "bold"&lt;BR /&gt;},&lt;BR /&gt;color: "#ffffff",&lt;BR /&gt;backgroundColor: "#000000"&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;const previewHtml = textSymbol.renderPreviewHTML();&lt;/P&gt;&lt;P&gt;const previewElement = document.createElement("div");&lt;BR /&gt;previewElement.innerHTML = previewHtml;&lt;/P&gt;&lt;P&gt;// Add the preview element to the DOM&lt;BR /&gt;document.body.appendChild(previewElement);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In this example, we create a &lt;/SPAN&gt;TextSymbol&lt;SPAN&gt; with the text "Hello world!" and some font and color settings. We then call the &lt;/SPAN&gt;renderPreviewHTML&lt;SPAN&gt; method to generate the HTML that corresponds to the symbol. Finally, we create a new &lt;/SPAN&gt;div&lt;SPAN&gt; element, set its &lt;/SPAN&gt;innerHTML&lt;SPAN&gt; to the preview HTML, and add it to the document.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://airportsdetail.com/" target="_self"&gt;&lt;SPAN&gt;Airports details&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2023 02:39:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-make-the-previewhtml-same-as-the-text/m-p/1282651#M80960</guid>
      <dc:creator>GharVisit</dc:creator>
      <dc:date>2023-04-26T02:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to make the previewHTML same as the text symbol show on map?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-make-the-previewhtml-same-as-the-text/m-p/1282656#M80961</link>
      <description>&lt;P&gt;Hi GharVisit,&lt;BR /&gt;I'm not sure if there is a method called "renderPreviewHTML" in &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-TextSymbol.html#methods-summary" target="_self"&gt;TextSymbol&lt;/A&gt;. Is there any document for reference?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LeoDeng_0-1682478039368.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/69110i8051EB7CB677488E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LeoDeng_0-1682478039368.png" alt="LeoDeng_0-1682478039368.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Bests,&lt;BR /&gt;Leo&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2023 03:02:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-make-the-previewhtml-same-as-the-text/m-p/1282656#M80961</guid>
      <dc:creator>LeoDeng</dc:creator>
      <dc:date>2023-04-26T03:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to make the previewHTML same as the text symbol show on map?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-make-the-previewhtml-same-as-the-text/m-p/1282869#M80965</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/267470"&gt;@LeoDeng&lt;/a&gt;&amp;nbsp;- Thanks for providing the code snippet and for reporting this issue! This is a bug in the API - we'll work on a fix for an upcoming release.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2023 15:46:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-make-the-previewhtml-same-as-the-text/m-p/1282869#M80965</guid>
      <dc:creator>AnneFitz</dc:creator>
      <dc:date>2023-04-26T15:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to make the previewHTML same as the text symbol show on map?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-make-the-previewhtml-same-as-the-text/m-p/1282931#M80972</link>
      <description>&lt;P&gt;See also &lt;A href="https://github.com/Esri/feedback-js-api-next/issues/43" target="_self"&gt;here&lt;/A&gt; for further reference.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2023 17:11:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-make-the-previewhtml-same-as-the-text/m-p/1282931#M80972</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2023-04-26T17:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to make the previewHTML same as the text symbol show on map?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-make-the-previewhtml-same-as-the-text/m-p/1289389#M81163</link>
      <description>&lt;P&gt;We've installed a fix for the upcoming 4.27 release (expected to go out in June). You can test out this fix in the &lt;A href="https://github.com/Esri/feedback-js-api-next" target="_self"&gt;development version of the API&lt;/A&gt;&amp;nbsp;at&amp;nbsp;&lt;STRONG&gt;&lt;A href="https://js.arcgis.com/next" rel="nofollow" target="_blank"&gt;https://js.arcgis.com/next&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;Let us know if you are still running into any issues &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/267470"&gt;@LeoDeng&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 22:38:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-make-the-previewhtml-same-as-the-text/m-p/1289389#M81163</guid>
      <dc:creator>AnneFitz</dc:creator>
      <dc:date>2023-05-15T22:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to make the previewHTML same as the text symbol show on map?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-make-the-previewhtml-same-as-the-text/m-p/1290884#M81210</link>
      <description>&lt;P&gt;Yes. It solved problem. Thank you!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LeoDeng_0-1684452823208.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/71123i80C321D901A94184/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LeoDeng_0-1684452823208.png" alt="LeoDeng_0-1684452823208.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2023 23:34:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-make-the-previewhtml-same-as-the-text/m-p/1290884#M81210</guid>
      <dc:creator>LeoDeng</dc:creator>
      <dc:date>2023-05-18T23:34:00Z</dc:date>
    </item>
  </channel>
</rss>

