public IHtmlSmartTag TryCreateSmartTag(ITextView textView, ITextBuffer textBuffer, ElementNode element, AttributeNode attribute, int caretPosition, HtmlPositionType positionType)
        {
            if ((element.IsStyleBlock() || element.IsJavaScriptBlock()) && element.InnerRange.Length > 5)
            {
                return new ExtractToFileSmartTag(textView, textBuffer, element);
            }

            return null;
        }
Esempio n. 2
0
        public IHtmlSmartTag TryCreateSmartTag(ITextView textView, ITextBuffer textBuffer, ElementNode element, AttributeNode attribute, int caretPosition, HtmlPositionType positionType)
        {
            if ((element.IsStyleBlock() || element.IsJavaScriptBlock()) && element.InnerRange.Length > 5)
            {
                return(new ExtractToFileSmartTag(textView, textBuffer, element));
            }

            return(null);
        }
        public IHtmlSmartTag TryCreateSmartTag(ITextView textView, ITextBuffer textBuffer, ElementNode element, AttributeNode attribute, int caretPosition, HtmlPositionType positionType)
        {
            if (element.IsStyleBlock() || element.IsJavaScriptBlock())
            {
                return new HtmlMinifySmartTag(textView, textBuffer, element);
            }

            return null;
        }
Esempio n. 4
0
        public IHtmlSmartTag TryCreateSmartTag(ITextView textView, ITextBuffer textBuffer, ElementNode element, AttributeNode attribute, int caretPosition, HtmlPositionType positionType)
        {
            if (element.IsStyleBlock() || element.IsJavaScriptBlock())
            {
                return(new HtmlMinifySmartTag(textView, textBuffer, element));
            }

            return(null);
        }
Esempio n. 5
0
            private static string GetReference(ElementNode element, string fileName, string root)
            {
                string relative  = FileHelpers.RelativePath(root, fileName);
                string reference = "<script src=\"/{0}\"></script>";

                if (element.IsStyleBlock())
                {
                    reference = "<link rel=\"stylesheet\" href=\"/{0}\" />";
                }

                return(string.Format(CultureInfo.CurrentCulture, reference, HttpUtility.HtmlAttributeEncode(relative)));
            }
        public bool HasSuggestedActions(ITextView textView, ITextBuffer textBuffer, int caretPosition, ElementNode element, AttributeNode attribute, HtmlPositionType positionType)
        {
            if (!element.StartTag.Contains(caretPosition))
            {
                return(false);
            }

            if (element.InnerRange.Length < 5)
            {
                return(false);
            }

            return(element.IsStyleBlock() || element.IsJavaScriptBlock());
        }
            private static string GetReference(ElementNode element, string fileName, string root)
            {
                string relative = FileHelpers.RelativePath(root, fileName);
                string reference = "<script src=\"/{0}\"></script>";

                if (element.IsStyleBlock())
                    reference = "<link rel=\"stylesheet\" href=\"/{0}\" />";

                return string.Format(CultureInfo.CurrentCulture, reference, HttpUtility.HtmlAttributeEncode(relative));
            }
Esempio n. 8
0
 public HtmlMinifyLightBulbAction(ITextView textView, ITextBuffer textBuffer, ElementNode element)
     : base(textView, textBuffer, element, "Minify " + (element.IsStyleBlock() ? "CSS" : "JavaScript"))
 {
 }