JSFiddle - React, Tailwind, and code Playground

by CostaConquesta

HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
    <script src="http://api-maps.yandex.ru/2.0/?load=package.full&lang=ru-RU" type="text/javascript"></script>
    <div id="map" style="width:400px; height:300px"></div>
    <input type="button" id="destroyButton" value="Редактировать линию"/>

</html>

JavaScript

var myMap;

ymaps.ready(init);

function init () {
    myMap = new ymaps.Map('map', {
        center:[55.76, 37.64], 
        zoom:10
    });
    		myPolyline = [];
            myPolyline[1] =  new ymaps.Polyline([
            [55.80, 37.50],
            [55.80, 37.40],
            [55.70, 37.50],
            [55.70, 37.40]
        ], {}, {
                strokeColor: "#0066ff",
                strokeWidth: 4,
                editorMaxPoints: 500,
                editorMenuManager: function (items) {
                    items.push({
                        title: "Удалить линию",
                        onClick: function () {
                            myMap.geoObjects.remove(myPolyline[1]);
                        }
                    });
                    return items;
                }
            });
            myMap.geoObjects.add(myPolyline[1]);
            console.log(myPolyline[1]);
                $("#destroyButton").click(
                function(){
                    myPolyline[1].editor.startEditing();
                    alert (myPolyline[1]);
                });
}