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;
        }
Beispiel #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;
        }
Beispiel #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);
        }
Beispiel #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));
            }
Beispiel #8
0
 public HtmlMinifyLightBulbAction(ITextView textView, ITextBuffer textBuffer, ElementNode element)
     : base(textView, textBuffer, element, "Minify " + (element.IsStyleBlock() ? "CSS" : "JavaScript"))
 {
 }